Geometry boundary = hole.getBoundary(); if (boundary instanceof LinearRing) { lrholelist.add((LinearRing) boundary);
/** * Safely add a vertex to this area. This creates edges to all other vertices unless those edges would cross one of the original edges. */ public void addVertex(IntersectionVertex newVertex, Graph graph) { GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory(); if (edges.size() == 0) { throw new RuntimeException("Can't add a vertex to an empty area"); } @SuppressWarnings("unchecked") HashSet<IntersectionVertex> verticesCopy = (HashSet<IntersectionVertex>) vertices.clone(); VERTEX: for (IntersectionVertex v : verticesCopy) { LineString newGeometry = geometryFactory.createLineString(new Coordinate[] { newVertex.getCoordinate(), v.getCoordinate() }); // ensure that new edge does not leave the bounds of the original area, or // fall into any holes if (!originalEdges.union(originalEdges.getBoundary()).contains(newGeometry)) { continue VERTEX; } // check to see if this splits multiple NamedAreas. This code is rather similar to // code in OSMGBI, but the data structures are different createSegments(newVertex, v, areas, graph); } vertices.add(newVertex); }
/** * Computes the boundary of this geometry * * @return a lineal geometry (which may be empty) * @see Geometry#getBoundary */ public Geometry getBoundary() { if (isEmpty()) { return getFactory().createMultiLineString(null); } ArrayList allRings = new ArrayList(); for (int i = 0; i < geometries.length; i++) { Polygon polygon = (Polygon) geometries[i]; Geometry rings = polygon.getBoundary(); for (int j = 0; j < rings.getNumGeometries(); j++) { allRings.add(rings.getGeometryN(j)); } } LineString[] allRingsArray = new LineString[allRings.size()]; return getFactory().createMultiLineString((LineString[]) allRings.toArray(allRingsArray)); }
public Geometry getBoundary() { return polygon.getBoundary(); }
if (!bigMBRPoly.contains(p)) { if (p instanceof Polygon) { p = p.intersection(bigMBRPoly).getBoundary().difference(bigMBRPoly.getBoundary()); } else { p = p.intersection(bigMBRPoly);
/** * Computes the boundary of this geometry * * @return a lineal geometry (which may be empty) * @see Geometry#getBoundary */ public Geometry getBoundary() { if (isEmpty()) { return getFactory().createMultiLineString(null); } ArrayList allRings = new ArrayList(); for (int i = 0; i < geometries.length; i++) { Polygon polygon = (Polygon) geometries[i]; Geometry rings = polygon.getBoundary(); for (int j = 0; j < rings.getNumGeometries(); j++) { allRings.add(rings.getGeometryN(j)); } } LineString[] allRingsArray = new LineString[allRings.size()]; return getFactory().createMultiLineString((LineString[]) allRings.toArray(allRingsArray)); }
final Geometry clipped = target.intersection(polygon.getBoundary()); final String containedCountryCode = getGeometryProperty(polygon, ISOCountryTag.KEY);
GeometryFactory f = new GeometryFactory(); Geometry nodedLinework = polygon.getBoundary().union(line); Polygonizer polygonizer = new Polygonizer(); polygonizer.add(LineStringExtracter.getLines(nodedLinework));