/** * Transform into GeometryCollection. * * @param geom * input geometry * @return * a geometry collection */ private static GeometryCollection transformIntoPointGeometryCollection(Geometry geom) { UniqueCoordinateArrayFilter filter = new UniqueCoordinateArrayFilter(); geom.apply(filter); Coordinate[] coord = filter.getCoordinates(); Geometry[] geometries = new Geometry[coord.length]; for (int i = 0 ; i < coord.length ; i++) { Coordinate[] c = new Coordinate[] { coord[i] }; CoordinateArraySequence cs = new CoordinateArraySequence(c); geometries[i] = new Point(cs, geom.getFactory()); } return new GeometryCollection(geometries, geom.getFactory()); }
/** * Notifies this geometry that its coordinates have been changed by an external * party (for example, via a {@link CoordinateFilter}). * When this method is called the geometry will flush * and/or update any derived information it has cached (such as its {@link Envelope} ). * The operation is applied to all component Geometries. */ public void geometryChanged() { apply(geometryChangedFilter); }
/** * Add a {@link Geometry} to the edges to be polygonized. * May be called multiple times. * Any dimension of Geometry may be added; * the constituent linework will be extracted and used * * @param g a {@link Geometry} with linework to be polygonized */ public void add(Geometry g) { g.apply(lineStringAdder); }
public void apply(CoordinateFilter filter) { for (int i = 0; i < geometries.length; i++) { geometries[i].apply(filter); } }
nextTransformGeom.apply(RoundingFilter.INSTANCE);
private void compute() { if (minClearancePts != null) return; minClearancePts = new Coordinate[2]; minClearance = Double.MAX_VALUE; inputGeom.apply(new VertexCoordinateFilter()); }
public void apply(GeometryFilter filter) { filter.filter(this); for (int i = 0; i < geometries.length; i++) { geometries[i].apply(filter); } }
/** * Returns a list containing a point from each Polygon, LineString, and Point * found inside the specified geometry. Thus, if the specified geometry is * not a GeometryCollection, an empty list will be returned. The elements of the list * are {@link com.vividsolutions.jts.operation.distance.GeometryLocation}s. */ public static List getLocations(Geometry geom) { List locations = new ArrayList(); geom.apply(new ConnectedElementLocationFilter(locations)); return locations; }
private List extractLines(Collection geoms) { List lines = new ArrayList(); LinearComponentExtracter lce = new LinearComponentExtracter(lines); for (Iterator it = geoms.iterator(); it.hasNext(); ) { Geometry geom = (Geometry) it.next(); geom.apply(lce); } return lines; }
public void apply(GeometryComponentFilter filter) { filter.filter(this); for (int i = 0; i < geometries.length; i++) { geometries[i].apply(filter); } }
/** * Returns a list containing a Coordinate from each Polygon, LineString, and Point * found inside the specified geometry. Thus, if the specified geometry is * not a GeometryCollection, an empty list will be returned. */ public static List getCoordinates(Geometry geom) { List pts = new ArrayList(); geom.apply(new ConnectedElementPointFilter(pts)); return pts; }
/** * Adds the common coordinate bits back into a Geometry. * The coordinates of the Geometry are changed. * * @param geom the Geometry to which to add the common coordinate bits */ public void addCommonBits(Geometry geom) { Translater trans = new Translater(commonCoord); geom.apply(trans); geom.geometryChanged(); }
private static Coordinate[] extractCoordinates(Geometry geom) { UniqueCoordinateArrayFilter filter = new UniqueCoordinateArrayFilter(); geom.apply(filter); return filter.getCoordinates(); }
public static boolean hasSegment(Geometry geom, Coordinate p0, Coordinate p1) { SegmentFindingFilter filter = new SegmentFindingFilter(p0, p1); geom.apply(filter); return filter.hasSegment(); }
protected Geometry rotate(Geometry geom) { if (rotationAngle != 0.0) { AffineTransformation trans = AffineTransformation.rotationInstance(rotationAngle, dim.getCentre().x, dim.getCentre().y); geom.apply(trans); } return geom; }
public void apply(CoordinateSequenceFilter filter) { if (geometries.length == 0) return; for (int i = 0; i < geometries.length; i++) { geometries[i].apply(filter); if (filter.isDone()) { break; } } if (filter.isGeometryChanged()) geometryChanged(); }
private void computeMaxVertexDistance(Geometry curve) { MaxPointDistanceFilter distFilter = new MaxPointDistanceFilter(inputGeom); curve.apply(distFilter); maxPtDist.setMaximum(distFilter.getMaxPointDistance()); }
private void computeMaxMidpointDistance(Geometry curve) { MaxMidpointDistanceFilter distFilter = new MaxMidpointDistanceFilter(inputGeom); curve.apply(distFilter); maxPtDist.setMaximum(distFilter.getMaxPointDistance()); }
private void computeOrientedDistance(Geometry discreteGeom, Geometry geom, PointPairDistance ptDist) { MaxPointDistanceFilter distFilter = new MaxPointDistanceFilter(geom); discreteGeom.apply(distFilter); ptDist.setMaximum(distFilter.getMaxPointDistance()); if (densifyFrac > 0) { MaxDensifiedByFractionDistanceFilter fracFilter = new MaxDensifiedByFractionDistanceFilter(geom, densifyFrac); discreteGeom.apply(fracFilter); ptDist.setMaximum(fracFilter.getMaxPointDistance()); } }
public Geometry getResultGeometry() { // empty input produces an empty result if (inputGeom.isEmpty()) return (Geometry) inputGeom.clone(); linestringMap = new HashMap(); inputGeom.apply(new LineStringMapBuilderFilter()); lineSimplifier.simplify(linestringMap.values()); Geometry result = (new LineStringTransformer()).transform(inputGeom); return result; }