Package org.geomajas.geometry

Examples of org.geomajas.geometry.Crs


    if (null == mapBounds) {
      throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapBounds");
    }

    Coordinate coordinate = new Coordinate(requestLocation.getX(), requestLocation.getY());
    Crs crs = geoService.getCrs2(request.getCrs());
    boolean searchFirstLayerOnly;
    switch (request.getSearchType()) {
      case SearchByPointRequest.SEARCH_FIRST_LAYER:
        searchFirstLayerOnly = true;
        break;
      case SearchByPointRequest.SEARCH_ALL_LAYERS:
        searchFirstLayerOnly = false;
        break;
      default:
        throw new IllegalArgumentException("Invalid value for searchType");
    }

    log.debug("search by location {}", coordinate);

    if (layerIds.length > 0) {
      for (String layerId : layerIds) {
        if (securityContext.isLayerVisible(layerId)) {
          Layer<?> layer = configurationService.getLayer(layerId);
          if (layer instanceof LayerFeatureInfoSupport &&
              ((LayerFeatureInfoSupport) layer).isEnableFeatureInfoSupport()) {
            Crs layerCrs = layerService.getCrs(layer);
            double layerScale = calculateLayerScale(crs, layerCrs, mapBounds, request.getScale());
            Coordinate layerCoordinate = geoService.transform(coordinate, crs, layerCrs);
            List<Feature> features = ((LayerFeatureInfoSupport) layer).getFeaturesByLocation(
                layerCoordinate, layerScale, request.getPixelTolerance());
            if (features != null && features.size() > 0) {
View Full Code Here


          return;
        }
        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);
View Full Code Here

    // Calculate the labels
    ClientMapInfo map = configurationService.getMapInfo(getMap().getMapId(), getMap().getApplicationId());
    if (map != null) {
      log.debug("calculateSize getMap.getId({}), res {}", getMap().getId(), map);
      Crs crs;
      try {
        crs = geoService.getCrs2(map.getCrs());
        unit = crs.getCoordinateSystem().getAxis(0).getUnit().toString();
      } catch (Exception e) {
        log.error("could not calculate map unit", e);
      }
    }
//    font = new Font("Dialog", Font.PLAIN, (int) (0.8 * ticHeight));
 
View Full Code Here

    VectorLayer layer = getVectorLayer(layerId);
    PipelineContext context = pipelineService.createContext();
    context.put(PipelineCode.LAYER_ID_KEY, layerId);
    context.put(PipelineCode.LAYER_KEY, layer);
    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);
View Full Code Here

  private String getTransformKey(Crs source, Crs target) {
    return source.getId() + "->" + target.getId();
  }

  private CrsTransform getCrsTransform(String key, CrsTransformInfo crsTransformInfo) throws GeomajasException {
    Crs source = getCrs2(crsTransformInfo.getSource());
    Crs target = getCrs2(crsTransformInfo.getTarget());

    MathTransform mathTransform = getBaseMathTransform(source, target);

    return new CrsTransformImpl(key, source, target, mathTransform, crsTransformInfo.getTransformableArea());
  }
View Full Code Here

  }

  /** @{inheritDoc} */
  public Crs getCrs2(String crs) throws LayerException {
    try {
      Crs res = crsCache.get(crs);
      if (null == res) {
        res = CrsFactory.getCrs(crs, CRS.decode(crs));
        crsCache.put(crs, res);
      }
      return res;
View Full Code Here

  }

  /** @{inheritDoc} */
  public CrsTransform getCrsTransform(CoordinateReferenceSystem sourceCrs, CoordinateReferenceSystem targetCrs)
      throws GeomajasException {
    Crs source, target;
    if (sourceCrs instanceof Crs) {
      source = (Crs) sourceCrs;
    } else {
      source = getCrs2(getCodeFromCrs(sourceCrs));
    }
View Full Code Here

      CoordinateReferenceSystem targetCrs) throws GeomajasException {
    if (sourceCrs == targetCrs) { // NOPMD
      // only works when the caching of the CRSs works
      return geometry;
    }
    Crs source, target;
    if (sourceCrs instanceof Crs) {
      source = (Crs) sourceCrs;
    } else {
      source = getCrs2(getCodeFromCrs(sourceCrs));
    }
View Full Code Here

  private double getUnitLength(String mapCrsKey, Bbox mapBounds) throws LayerException {
    try {
      if (null == mapBounds) {
        throw new LayerException(ExceptionCode.MAP_MAX_EXTENT_MISSING);
      }
      Crs crs = geoService.getCrs2(mapCrsKey);
      GeodeticCalculator calculator = new GeodeticCalculator(crs);
      Coordinate center = new Coordinate(0.5 * (mapBounds.getX() + mapBounds.getMaxX()),
          0.5 * (mapBounds.getY() + mapBounds.getMaxY()));
      calculator.setStartingPosition(new DirectPosition2D(crs, center.getX(), center.getY()));
      calculator.setDestinationPosition(new DirectPosition2D(crs, center.getX() + 1, center.getY()));
View Full Code Here

      throws LayerException {
    if (mapCrsKey.equals(layerCrsKey)) {
      return serverBbox;
    }
    try {
      Crs mapCrs = geoService.getCrs2(mapCrsKey);
      Crs layerCrs = geoService.getCrs2(layerCrsKey);
      Envelope serverEnvelope = converterService.toInternal(serverBbox);
      CrsTransform transformer = geoService.getCrsTransform(layerCrs, mapCrs);
      Bbox res = converterService.toDto(geoService.transform(serverEnvelope, transformer));
      if (Double.isNaN(res.getX()) || Double.isNaN(res.getY()) || Double.isNaN(res.getWidth())
          || Double.isNaN(res.getHeight())) {
View Full Code Here

TOP

Related Classes of org.geomajas.geometry.Crs

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.