/** * Creates and returns a full copy of this {@link GeometryCollection} object. * (including all coordinates contained by it). * * @return a clone of this instance */ public Object clone() { GeometryCollection gc = (GeometryCollection) super.clone(); gc.geometries = new Geometry[geometries.length]; for (int i = 0; i < geometries.length; i++) { gc.geometries[i] = (Geometry) geometries[i].clone(); } return gc;// return the clone }
/** * Computes the union of two geometries, * either or both of which may be null. * * @param g0 a Geometry * @param g1 a Geometry * @return the union of the input(s) * or null if both inputs are null */ private Geometry unionSafe(Geometry g0, Geometry g1) { if (g0 == null && g1 == null) return null; if (g0 == null) return (Geometry) g1.clone(); if (g1 == null) return (Geometry) g0.clone(); return unionOptimized(g0, g1); }
private Geometry repeatedUnion(List geoms) { Geometry union = null; for (Iterator i = geoms.iterator(); i.hasNext(); ) { Geometry g = (Geometry) i.next(); if (union == null) union = (Geometry) g.clone(); else union = union.union(g); } return union; }
/** * Creates and returns a full copy of this {@link Point} object. * (including all coordinates contained by it). * * @return a clone of this instance */ public Object clone() { Point p = (Point) super.clone(); p.coordinates = (CoordinateSequence) coordinates.clone(); return p;// return the clone }
/** * Creates and returns a full copy of this {@link LineString} object. * (including all coordinates contained by it). * * @return a clone of this instance */ public Object clone() { LineString ls = (LineString) super.clone(); ls.points = (CoordinateSequence) points.clone(); return ls; }
/** * Cretaes a new @link Geometry which is the result * of this transformation applied to the input Geometry. * *@param seq a <code>Geometry</code> *@return a transformed Geometry */ public Geometry transform(Geometry g) { Geometry g2 = (Geometry) g.clone(); g2.apply(this); return g2; }
/** * Creates a new Geometry which is a normalized * copy of this Geometry. * * @return a normalized copy of this geometry. * @see #normalize() */ public Geometry norm() { Geometry copy = (Geometry) clone(); copy.normalize(); return copy; }
/** * Creates and returns a full copy of this {@link Polygon} object. * (including all coordinates contained by it). * * @return a clone of this instance */ public Object clone() { Polygon poly = (Polygon) super.clone(); poly.shell = (LinearRing) shell.clone(); poly.holes = new LinearRing[holes.length]; for (int i = 0; i < holes.length; i++) { poly.holes[i] = (LinearRing) holes[i].clone(); } return poly;// return the clone }
private Geometry[] removeCommonBits(Geometry[] geom) { cbr = new CommonBitsRemover(); cbr.add(geom[0]); cbr.add(geom[1]); Geometry remGeom[] = new Geometry[2]; remGeom[0] = cbr.removeCommonBits((Geometry) geom[0].clone()); remGeom[1] = cbr.removeCommonBits((Geometry) geom[1].clone()); return remGeom; }
public Geometry getResultGeometry() { // empty input produces an empty result if (inputGeom.isEmpty()) return (Geometry) inputGeom.clone(); return (new DPTransformer(isEnsureValidTopology)).transform(inputGeom); }
/** * Computes a copy of the input {@link Geometry} with the calculated common bits * removed from each coordinate. * @param geom0 the Geometry to remove common bits from * @return a copy of the input Geometry with common bits removed */ private Geometry removeCommonBits(Geometry geom0) { cbr = new CommonBitsRemover(); cbr.add(geom0); Geometry geom = cbr.removeCommonBits((Geometry) geom0.clone()); return geom; }
/** * Computes a copy of each input {@link Geometry}s with the calculated common bits * removed from each coordinate. * @param geom0 a Geometry to remove common bits from * @param geom1 a Geometry to remove common bits from * @return an array containing copies * of the input Geometry's with common bits removed */ private Geometry[] removeCommonBits(Geometry geom0, Geometry geom1) { cbr = new CommonBitsRemover(); cbr.add(geom0); cbr.add(geom1); Geometry geom[] = new Geometry[2]; geom[0] = cbr.removeCommonBits((Geometry) geom0.clone()); geom[1] = cbr.removeCommonBits((Geometry) geom1.clone()); return geom; } }
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; }
public Geometry reverse() { Polygon poly = (Polygon) super.clone(); poly.shell = (LinearRing) ((LinearRing) shell.clone()).reverse(); poly.holes = new LinearRing[holes.length]; for (int i = 0; i < holes.length; i++) { poly.holes[i] = (LinearRing) ((LinearRing) holes[i].clone()).reverse(); } return poly;// return the clone } }
/** * Computes a <code>Geometry</code> representing the closure of the point-set * of the points contained in this <code>Geometry</code> that are not contained in * the <code>other</code> Geometry. * <p> * If the result is empty, it is an atomic geometry * with the dimension of the left-hand input. * <p> * Non-empty {@link GeometryCollection} arguments are not supported. * *@param other the <code>Geometry</code> with which to compute the * difference *@return a Geometry representing the point-set difference of this <code>Geometry</code> with * <code>other</code> * @throws TopologyException if a robustness error occurs * @throws IllegalArgumentException if either input is a non-empty GeometryCollection */ public Geometry difference(Geometry other) { // special case: if A.isEmpty ==> empty; if B.isEmpty ==> A if (this.isEmpty()) return OverlayOp.createEmptyResult(OverlayOp.DIFFERENCE, this, other, factory); if (other.isEmpty()) return (Geometry) clone(); checkNotGeometryCollection(this); checkNotGeometryCollection(other); return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.DIFFERENCE); }
/** * Sets the geometry contained in this lite shape. Convenient to reuse this * object instead of creating it again and again during rendering * * @param g */ public void setGeometry(Geometry g) { this.geometry = (Geometry) g.clone(); }
/** * Creates and returns a full copy of this {@link LineString} object. * (including all coordinates contained by it). * * @return a clone of this instance */ public Object clone() { LineString ls = (LineString) super.clone(); ls.points = (CoordinateSequence) points.clone(); return ls; }
private Geometry repeatedUnion(List geoms) { Geometry union = null; for (Iterator i = geoms.iterator(); i.hasNext(); ) { Geometry g = (Geometry) i.next(); if (union == null) union = (Geometry) g.clone(); else union = union.union(g); } return union; }