return serialize(outputs.get(0)); return serialize(new OGCConcreteGeometryCollection(outputs, null).flattenAndRemoveOverlaps().reduceFromMulti());
public OGCGeometry union(OGCGeometry another) { String thisType = geometryType(); String anotherType = another.geometryType(); if (thisType != anotherType || thisType == OGCConcreteGeometryCollection.TYPE) { //heterogeneous union. //We make a geometry collection, then process to union parts and remove overlaps. ArrayList<OGCGeometry> geoms = new ArrayList<OGCGeometry>(); geoms.add(this); geoms.add(another); OGCConcreteGeometryCollection geomCol = new OGCConcreteGeometryCollection(geoms, esriSR); return geomCol.flattenAndRemoveOverlaps().reduceFromMulti(); } OperatorUnion op = (OperatorUnion) OperatorFactoryLocal.getInstance() .getOperator(Operator.Type.Union); GeometryCursorAppend ap = new GeometryCursorAppend( getEsriGeometryCursor(), another.getEsriGeometryCursor()); com.esri.core.geometry.GeometryCursor cursor = op.execute(ap, getEsriSpatialReference(), null); return OGCGeometry.createFromEsriCursor(cursor, esriSR); }
public OGCGeometry union(OGCGeometry another) { String thisType = geometryType(); String anotherType = another.geometryType(); if (thisType != anotherType || thisType == OGCConcreteGeometryCollection.TYPE) { //heterogeneous union. //We make a geometry collection, then process to union parts and remove overlaps. ArrayList<OGCGeometry> geoms = new ArrayList<OGCGeometry>(); geoms.add(this); geoms.add(another); OGCConcreteGeometryCollection geomCol = new OGCConcreteGeometryCollection(geoms, esriSR); return geomCol.flattenAndRemoveOverlaps().reduceFromMulti(); } OperatorUnion op = (OperatorUnion) OperatorFactoryLocal.getInstance() .getOperator(Operator.Type.Union); GeometryCursorAppend ap = new GeometryCursorAppend( getEsriGeometryCursor(), another.getEsriGeometryCursor()); com.esri.core.geometry.GeometryCursor cursor = op.execute(ap, getEsriSpatialReference(), null); return OGCGeometry.createFromEsriCursor(cursor, esriSR); }
return serialize(outputs.get(0)); return serialize(new OGCConcreteGeometryCollection(outputs, null).flattenAndRemoveOverlaps().reduceFromMulti());
return serialize(outputs.get(0)); return serialize(new OGCConcreteGeometryCollection(outputs, null).flattenAndRemoveOverlaps().reduceFromMulti());
@Override public OGCGeometry intersection(OGCGeometry another) { if (isEmpty() || another.isEmpty()) { return new OGCConcreteGeometryCollection(esriSR); } List<Geometry> geometries = toList(prepare_for_ops_(toGeometryCollection(this))); List<Geometry> otherGeometries = toList(prepare_for_ops_(toGeometryCollection(another))); List<OGCGeometry> result = new ArrayList<OGCGeometry>(); for (Geometry geometry : geometries) { for (Geometry otherGeometry : otherGeometries) { GeometryCursor intersectionCursor = OperatorIntersection.local().execute(new SimpleGeometryCursor(geometry), new SimpleGeometryCursor(otherGeometry), esriSR, null, 7); OGCGeometry intersection = OGCGeometry.createFromEsriCursor(intersectionCursor, esriSR, true); if (!intersection.isEmpty()) { result.add(intersection); } } } if (result.size() == 1) { return result.get(0).reduceFromMulti(); } return new OGCConcreteGeometryCollection(result, esriSR).flattenAndRemoveOverlaps(); }
gc1 = gc1.flattenAndRemoveOverlaps(); gc2 = gc2.flattenAndRemoveOverlaps(); int n = gc1.numGeometries(); if (n != gc2.numGeometries()) {
@Override public OGCGeometry intersection(OGCGeometry another) { if (isEmpty() || another.isEmpty()) { return new OGCConcreteGeometryCollection(esriSR); } List<Geometry> geometries = toList(prepare_for_ops_(toGeometryCollection(this))); List<Geometry> otherGeometries = toList(prepare_for_ops_(toGeometryCollection(another))); List<OGCGeometry> result = new ArrayList<OGCGeometry>(); for (Geometry geometry : geometries) { for (Geometry otherGeometry : otherGeometries) { GeometryCursor intersectionCursor = OperatorIntersection.local().execute(new SimpleGeometryCursor(geometry), new SimpleGeometryCursor(otherGeometry), esriSR, null, 7); OGCGeometry intersection = OGCGeometry.createFromEsriCursor(intersectionCursor, esriSR, true); if (!intersection.isEmpty()) { result.add(intersection); } } } if (result.size() == 1) { return result.get(0).reduceFromMulti(); } return new OGCConcreteGeometryCollection(result, esriSR).flattenAndRemoveOverlaps(); }
gc1 = gc1.flattenAndRemoveOverlaps(); gc2 = gc2.flattenAndRemoveOverlaps(); int n = gc1.numGeometries(); if (n != gc2.numGeometries()) {
@Override public OGCGeometry difference(OGCGeometry another) { if (isEmpty() || another.isEmpty()) { return this; } List<Geometry> geometries = toList(prepare_for_ops_(toGeometryCollection(this))); List<Geometry> otherGeometries = toList(prepare_for_ops_(toGeometryCollection(another))); List<OGCGeometry> result = new ArrayList<OGCGeometry>(); for (Geometry geometry : geometries) { for (Geometry otherGeometry : otherGeometries) { if (geometry.getDimension() > otherGeometry.getDimension()) { continue; //subtracting lower dimension has no effect. } geometry = OperatorDifference.local().execute(geometry, otherGeometry, esriSR, null); if (geometry.isEmpty()) { break; } } if (!geometry.isEmpty()) { result.add(OGCGeometry.createFromEsriGeometry(geometry, esriSR)); } } if (result.size() == 1) { return result.get(0).reduceFromMulti(); } return new OGCConcreteGeometryCollection(result, esriSR).flattenAndRemoveOverlaps(); }
@Override public OGCGeometry difference(OGCGeometry another) { if (isEmpty() || another.isEmpty()) { return this; } List<Geometry> geometries = toList(prepare_for_ops_(toGeometryCollection(this))); List<Geometry> otherGeometries = toList(prepare_for_ops_(toGeometryCollection(another))); List<OGCGeometry> result = new ArrayList<OGCGeometry>(); for (Geometry geometry : geometries) { for (Geometry otherGeometry : otherGeometries) { if (geometry.getDimension() > otherGeometry.getDimension()) { continue; //subtracting lower dimension has no effect. } geometry = OperatorDifference.local().execute(geometry, otherGeometry, esriSR, null); if (geometry.isEmpty()) { break; } } if (!geometry.isEmpty()) { result.add(OGCGeometry.createFromEsriGeometry(geometry, esriSR)); } } if (result.size() == 1) { return result.get(0).reduceFromMulti(); } return new OGCConcreteGeometryCollection(result, esriSR).flattenAndRemoveOverlaps(); }