Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Geometry


  }

  public void writeObject(Object object, GraphicsDocument document, boolean asChild) throws RenderException {
    try {
      InternalFeature feature = (InternalFeature) object;
      Geometry geom = feature.getGeometry();
      if (feature.isClipped()) {
        geom = feature.getClippedGeometry();
      }
      geom = transformer.transform(geom);
      if (isPointLike(feature)) {
        if (feature.getStyleInfo().getSymbol() != null) {
          SymbolInfo info = feature.getStyleInfo().getSymbol();
          for (Coordinate coordinate : geom.getCoordinates()) {
            if (info.getRect() != null) {
              writeRectangle(document, coordinate, feature, info.getRect());
            } else if (info.getCircle() != null) {
              RectInfo rectInfo = new RectInfo();
              rectInfo.setW(info.getCircle().getR() * 2);
 
View Full Code Here


      throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapCrs");
    }

    Map<VectorLayer, Filter> filters = new LinkedHashMap<VectorLayer, Filter>();
    Filter f;
    Geometry mapGeom = converter.toInternal(criterion.getGeometry());

    for (String serverLayerId : criterion.getServerLayerIds()) {
      VectorLayer vl = configurationService.getVectorLayer(serverLayerId);
      if (vl == null) {
        throw new GeomajasException(ExceptionCode.LAYER_NOT_FOUND, serverLayerId);
      }

      // Transform geometry to layer CRS:
      Geometry layerGeometry = geoService.transform(mapGeom, mapCrs, vectorLayerService.getCrs(vl));

      switch (criterion.getOperator()) {
        case SearchByLocationRequest.QUERY_INTERSECTS:
          f = filterService.createIntersectsFilter(layerGeometry, vl.getFeatureModel()
              .getGeometryAttributeName());
View Full Code Here

  @Autowired
  private GeoService geoService;

  @Test
  public void transformGeometryString() throws Exception {
    Geometry geometry = getLineString();
    geometry = geoService.transform(geometry, LONLAT, LAMBERT72);
    assertTransformedLineString(geometry);
  }
View Full Code Here

    assertTransformedLineString(geometry);
  }

  @Test
  public void transformGeometryCrs() throws Exception {
    Geometry geometry = getLineString();
    Crs source = geoService.getCrs2(LONLAT);
    Crs target = geoService.getCrs2(LAMBERT72);
    geometry = geoService.transform(geometry, source, target);
    assertTransformedLineString(geometry);
  }
View Full Code Here

    assertTransformedLineString(geometry);
  }

  @Test
  public void transformGeometryCrsTransform() throws Exception {
    Geometry geometry = getLineString();
    CrsTransform transform = geoService.getCrsTransform(LONLAT, LAMBERT72);
    geometry = geoService.transform(geometry, transform);
    assertTransformedLineString(geometry);
  }
View Full Code Here

    assertTransformedLineString(geometry);
  }

  @Test
  public void transformGeometryJtsCrs() throws Exception {
    Geometry geometry = getLineString();
    CoordinateReferenceSystem source = CRS.decode(LONLAT);
    CoordinateReferenceSystem target = CRS.decode(LAMBERT72);
    geometry = geoService.transform(geometry, source, target);
    assertTransformedLineString(geometry);
  }
View Full Code Here

  }

  @Test
  public void transformOutsideAreaTest() throws Exception {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    Geometry geometry = factory.createLineString(new Coordinate[] {
        new Coordinate(110, 50), new Coordinate(120, 60)});
    geometry = geoService.transform(geometry, LONLAT, LAMBERT72);
    Assert.assertTrue(geometry.isEmpty());
  }
View Full Code Here

   */
  public void clipTile(InternalTile tile, double scale, Coordinate panOrigin) throws GeomajasException {
    log.debug("clipTile before {}", tile);
    List<InternalFeature> orgFeatures = tile.getFeatures();
    tile.setFeatures(new ArrayList<InternalFeature>());
    Geometry maxScreenBbox = null; // The tile's maximum bounds in screen space. Used for clipping.
    for (InternalFeature feature : orgFeatures) {
      // clip feature if necessary
      if (exceedsScreenDimensions(feature, scale)) {
        log.debug("feature {} exceeds screen dimensions", feature);
        InternalFeatureImpl vectorFeature = (InternalFeatureImpl) feature.clone();
        tile.setClipped(true);
        vectorFeature.setClipped(true);
        if (null == maxScreenBbox) {
          maxScreenBbox = JTS.toGeometry(getMaxScreenEnvelope(tile, panOrigin));
        }
        Geometry clipped = maxScreenBbox.intersection(feature.getGeometry());
        vectorFeature.setClippedGeometry(clipped);
        tile.addFeature(vectorFeature);
      } else {
        tile.addFeature(feature);
      }
View Full Code Here

  }

  public void writeObject(Object object, GraphicsDocument document, boolean asChild) throws RenderException {
    try {
      InternalFeatureImpl feature = (InternalFeatureImpl) object;
      Geometry geom = feature.getGeometry();
      if (feature.isClipped()) {
        geom = feature.getClippedGeometry();
      }
      geom = transformer.transform(geom);

      if (geom instanceof Point || geom instanceof MultiPoint) {
        // write the enclosing group
        document.writeElement("g", asChild);
        document.writeAttribute("id", feature.getId());

        // write the points
        for (int i = 0; i < geom.getNumGeometries(); i++) {
          document.writeObject(geom.getGeometryN(i), true);
          document.writeAttribute("id", feature.getId());
          document.writeAttribute("xlink:href", "#" + feature.getStyleInfo().getStyleId());
          document.closeElement();
        }
      } else {
View Full Code Here

      log.debug("bean.getGeometry {}", geometry);
      return (Geometry) geometry;
    } else {
      try {
        WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(), srid));
        Geometry geom = reader.read((String) geometry);
        log.debug("bean.getGeometry {}", geom);
        return geom;
      } catch (Throwable t) {
        throw new LayerException(t, ExceptionCode.FEATURE_MODEL_PROBLEM, geometry);
      }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.Geometry

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.