Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryFactory.createLinearRing()


      Polygon originalArea = (Polygon)mapArea;
      // NB: the buffer method always returns a polygonal result.
      Polygon expandedArea = (Polygon)mapArea.buffer( getOffTheMapDistance(), DEFAULT_CAP_EDGES, DEFAULT_BUFFER_CAP_TYPE );
     
      GeometryFactory geometryFactory = mapArea.getFactory();
      LinearRing expandedAreaBoundary = geometryFactory.createLinearRing( expandedArea.getExteriorRing().getCoordinates() );
      LinearRing originalAreaBoundary = geometryFactory.createLinearRing( originalArea.getExteriorRing().getCoordinates() );
     
      this.justOffTheMapArea = geometryFactory.createPolygon( expandedAreaBoundary, new LinearRing[]{ originalAreaBoundary } );
    }
    else if (mapArea instanceof MultiPolygon)
View Full Code Here


      // NB: the buffer method always returns a polygonal result.
      Polygon expandedArea = (Polygon)mapArea.buffer( getOffTheMapDistance(), DEFAULT_CAP_EDGES, DEFAULT_BUFFER_CAP_TYPE );
     
      GeometryFactory geometryFactory = mapArea.getFactory();
      LinearRing expandedAreaBoundary = geometryFactory.createLinearRing( expandedArea.getExteriorRing().getCoordinates() );
      LinearRing originalAreaBoundary = geometryFactory.createLinearRing( originalArea.getExteriorRing().getCoordinates() );
     
      this.justOffTheMapArea = geometryFactory.createPolygon( expandedAreaBoundary, new LinearRing[]{ originalAreaBoundary } );
    }
    else if (mapArea instanceof MultiPolygon)
    {
View Full Code Here

   */
  protected Shape parsePolygonShape(WktShapeParser.State state) throws ParseException {
    Geometry geometry;
    if (state.nextIfEmptyAndSkipZM()) {
      GeometryFactory geometryFactory = ctx.getGeometryFactory();
      geometry = geometryFactory.createPolygon(geometryFactory.createLinearRing(
          new Coordinate[]{}), null);
    } else {
      geometry = polygon(state);
      if (geometry.isRectangle()) {
        //TODO although, might want to never convert if there's a semantic difference (e.g. geodetically)
View Full Code Here

  protected Polygon polygon(WktShapeParser.State state) throws ParseException {
    GeometryFactory geometryFactory = ctx.getGeometryFactory();

    List<Coordinate[]> coordinateSequenceList = coordinateSequenceList(state);

    LinearRing shell = geometryFactory.createLinearRing
        (coordinateSequenceList.get(0));

    LinearRing[] holes = null;
    if (coordinateSequenceList.size() > 1) {
      holes = new LinearRing[coordinateSequenceList.size() - 1];
View Full Code Here

    LinearRing[] holes = null;
    if (coordinateSequenceList.size() > 1) {
      holes = new LinearRing[coordinateSequenceList.size() - 1];
      for (int i = 1; i < coordinateSequenceList.size(); i++) {
        holes[i - 1] = geometryFactory.createLinearRing(coordinateSequenceList.get(i));
      }
    }
    return geometryFactory.createPolygon(shell, holes);
  }
View Full Code Here

  public static Geometry toPolygon(Vertex[] v) {
    Coordinate[] ringPts = new Coordinate[] { v[0].getCoordinate(),
        v[1].getCoordinate(), v[2].getCoordinate(), v[0].getCoordinate() };
    GeometryFactory fact = new GeometryFactory();
    LinearRing ring = fact.createLinearRing(ringPts);
    Polygon tri = fact.createPolygon(ring, null);
    return tri;
  }

  public static Geometry toPolygon(QuadEdge[] e) {
View Full Code Here

  public static Geometry toPolygon(QuadEdge[] e) {
    Coordinate[] ringPts = new Coordinate[] { e[0].orig().getCoordinate(),
        e[1].orig().getCoordinate(), e[2].orig().getCoordinate(),
        e[0].orig().getCoordinate() };
    GeometryFactory fact = new GeometryFactory();
    LinearRing ring = fact.createLinearRing(ringPts);
    Polygon tri = fact.createPolygon(ring, null);
    return tri;
  }

  /**
 
View Full Code Here

        .build();
    assertParses("POLYGON ((100 0, 101 0, 101 1, 100 1, 100 0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8, 100.2 0.2))", polygonWithHoles);

    GeometryFactory gf = ctx.getGeometryFactory();
    assertParses("POLYGON EMPTY", ctx.makeShape(
        gf.createPolygon(gf.createLinearRing(new Coordinate[]{}), null)
    ));
  }

  @Test
  public void testPolyToRect() throws ParseException {
View Full Code Here

                    break;
                }
            }
            // Close the polyline
            polyPoints.add(polyPoints.get(0));
            LinearRing ring = geomFactory.createLinearRing(polyPoints
                    .toArray(new Coordinate[polyPoints.size()]));
            rings.add(ring);
        }
        retval.addAll(punchHoles(geomFactory, rings));
View Full Code Here

        if (jtsPolygon != null) {
            return jtsPolygon;
        }
        GeometryFactory factory = GeometryUtils.getGeometryFactory();

        LinearRing shell = factory.createLinearRing(toCoordinates(geometry));

        // we need to merge connected holes here, because JTS does not believe in
        // holes that touch at multiple points (and, weirdly, does not have a method
        // to detect this other than this crazy DE-9IM stuff
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.