Package org.geomajas.geometry

Examples of org.geomajas.geometry.CrsTransform


   */
  public List<RasterTile> paint(CoordinateReferenceSystem targetCrs, Envelope bounds, double scale)
      throws GeomajasException {
    Envelope layerBounds = bounds;
    double layerScale = scale;
    CrsTransform layerToMap = null;
    boolean needTransform = !crs.equals(targetCrs);

    try {
      // We don't necessarily need to split into same CRS and different CRS cases, the latter implementation uses
      // identity transform if crs's are equal for map and layer but might introduce bugs in rounding and/or
      // conversions.
      if (needTransform) {
        layerToMap = geoService.getCrsTransform(crs, targetCrs);
        CrsTransform mapToLayer = geoService.getCrsTransform(targetCrs, crs);

        // Translate the map coordinates to layer coordinates, assumes equal x-y orientation
        layerBounds = geoService.transform(bounds, mapToLayer);
        layerScale = bounds.getWidth() * scale / layerBounds.getWidth();
      }
View Full Code Here


  }

  public void execute(PipelineContext context, Object response) throws GeomajasException {
    InternalFeature feature = context.get(PipelineCode.FEATURE_KEY, InternalFeature.class);
    if (null != feature.getGeometry()) {
      CrsTransform mapToLayer = context.get(PipelineCode.CRS_TRANSFORM_KEY, CrsTransform.class);
      feature.setGeometry(geoService.transform(feature.getGeometry(), mapToLayer));
    }
  }
View Full Code Here

  }

  public void execute(PipelineContext context, Object response) throws GeomajasException {
    InternalFeature feature = context.get(PipelineCode.FEATURE_KEY, InternalFeature.class);
    if (null != feature.getGeometry()) {
      CrsTransform layerToMap = context.get(PipelineCode.CRS_BACK_TRANSFORM_KEY, CrsTransform.class);
      feature.setGeometry(geoService.transform(feature.getGeometry(), layerToMap));
    }
  }
View Full Code Here

  }

  public void execute(PipelineContext context, GetTileContainer response) throws GeomajasException {
    // Determine transformation to apply
    InternalTile tile = response.getTile();
    CrsTransform transform = context.get(PipelineCode.CRS_TRANSFORM_KEY, CrsTransform.class);

    // convert feature geometries to layer, need to copy to assure cache is not affected
    List<InternalFeature> features = new ArrayList<InternalFeature>();
    for (InternalFeature feature : tile.getFeatures()) {
      if (null != feature.getGeometry()) {
View Full Code Here

      Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);
      int offset = context.get(PipelineCode.OFFSET_KEY, Integer.class);
      int maxResultSize = context.get(PipelineCode.MAX_RESULT_SIZE_KEY, Integer.class);
      int featureIncludes = context.get(PipelineCode.FEATURE_INCLUDES_KEY, Integer.class);
      NamedStyleInfo style = context.get(PipelineCode.STYLE_KEY, NamedStyleInfo.class);
      CrsTransform transformation = context.getOptional(PipelineCode.CRS_TRANSFORM_KEY, CrsTransform.class);
      List<StyleFilter> styleFilters = context.getOptional(GetFeaturesStyleStep.STYLE_FILTERS_KEY, List.class);

      if (log.isDebugEnabled()) {
        log.debug("getElements " + filter + ", offset = " + offset + ", maxResultSize= " + maxResultSize);
      }
View Full Code Here

   */
  @Api
  public List<RasterTile> paint(TiledRasterLayerServiceState tileServiceState, CoordinateReferenceSystem boundsCrs,
      Envelope bounds, double scale) throws GeomajasException {
    try {
      CrsTransform layerToMap = geoService.getCrsTransform(tileServiceState.getCrs(), boundsCrs);
      CrsTransform mapToLayer = geoService.getCrsTransform(boundsCrs, tileServiceState.getCrs());

      bounds = clipBounds(tileServiceState, bounds);
      if (bounds.isNull()) {
        return new ArrayList<RasterTile>();
      }
View Full Code Here

  public void execute(PipelineContext context, GetBoundsContainer response)
      throws GeomajasException {
    if (null == response.getEnvelope()) {
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      CrsTransform crsTransform = context.get(PipelineCode.CRS_TRANSFORM_KEY, CrsTransform.class);
      Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);
      Envelope bounds = layer.getBounds(filter);
      bounds = geoService.transform(bounds, crsTransform);
      response.setEnvelope(bounds);
    }
View Full Code Here

        recorder.record(CacheCategory.REBUILD, "Got rebuild info from cache");
        TileMetadata tileMetadata = rebuildCacheContainer.getMetadata();
        context.put(PipelineCode.TILE_METADATA_KEY, tileMetadata);
        Crs crs = geoService.getCrs2(tileMetadata.getCrs());
        context.put(PipelineCode.CRS_KEY, crs);
        CrsTransform layerToMap = geoService.getCrsTransform(layer.getCrs(), crs);
        context.put(PipelineCode.CRS_TRANSFORM_KEY, layerToMap);
        Envelope layerExtent = dtoConverterService.toInternal(layer.getLayerInfo().getMaxExtent());
        Envelope tileExtent = geoService.transform(layerExtent, layerToMap);
        context.put(PipelineCode.TILE_MAX_EXTENT_KEY, tileExtent);
        // can't stop here, we have only prepared the context, not built the tile !
View Full Code Here

  public void saveOrUpdate(String layerId, CoordinateReferenceSystem crs, List<InternalFeature> oldFeatures,
      List<InternalFeature> newFeatures) throws GeomajasException {
    log.debug("saveOrUpdate start on layer {}", layerId);
    long ts = System.currentTimeMillis();
    VectorLayer layer = getVectorLayer(layerId);
    CrsTransform mapToLayer = geoService.getCrsTransform(crs, layer.getCrs());
    CrsTransform layerToMap = geoService.getCrsTransform(layer.getCrs(), crs);
    PipelineContext context = pipelineService.createContext();
    context.put(PipelineCode.LAYER_ID_KEY, layerId);
    context.put(PipelineCode.LAYER_KEY, layer);
    context.put(PipelineCode.CRS_TRANSFORM_KEY, mapToLayer);
    context.put(PipelineCode.CRS_BACK_TRANSFORM_KEY, layerToMap);
View Full Code Here

  public List<InternalFeature> getFeatures(String layerId, CoordinateReferenceSystem crs, Filter queryFilter,
      NamedStyleInfo style, int featureIncludes, int offset, int maxResultSize) throws GeomajasException {
    log.debug("getFeatures start on layer {}", layerId);
    long ts = System.currentTimeMillis();
    VectorLayer layer = getVectorLayer(layerId);
    CrsTransform transformation = null;
    if ((featureIncludes & FEATURE_INCLUDE_GEOMETRY) != 0 && crs != null && !crs.equals(layer.getCrs())) {
      transformation = geoService.getCrsTransform(layer.getCrs(), crs);
    }
    GetFeaturesContainer container = new GetFeaturesContainer();
    PipelineContext context = pipelineService.createContext();
View Full Code Here

TOP

Related Classes of org.geomajas.geometry.CrsTransform

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.