private static OGCConcreteGeometryCollection readGeometryCollection(BasicSliceInput input, Slice inputSlice) { // GeometryCollection: geometryType|len-of-shape1|bytes-of-shape1|len-of-shape2|bytes-of-shape2... List<OGCGeometry> geometries = new ArrayList<>(); while (input.available() > 0) { int length = input.readInt() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); geometries.add(readGeometry(input, inputSlice, type, length)); } return new OGCConcreteGeometryCollection(geometries, null); }
return serialize(outputs.get(0)); return serialize(new OGCConcreteGeometryCollection(outputs, null).flattenAndRemoveOverlaps().reduceFromMulti());
private static OGCConcreteGeometryCollection toGeometryCollection(OGCGeometry geometry) { if (geometry.geometryType() != OGCConcreteGeometryCollection.TYPE) { return new OGCConcreteGeometryCollection(geometry, geometry.getEsriSpatialReference()); } return (OGCConcreteGeometryCollection) geometry; }
private static OGCConcreteGeometryCollection toGeometryCollection(OGCGeometry geometry) { if (geometry.geometryType() != OGCConcreteGeometryCollection.TYPE) { return new OGCConcreteGeometryCollection(geometry, geometry.getEsriSpatialReference()); } return (OGCConcreteGeometryCollection) geometry; }
public static OGCGeometry createFromEsriCursor(GeometryCursor gc, SpatialReference sr, boolean skipEmpty) { ArrayList<OGCGeometry> geoms = new ArrayList<OGCGeometry>(10); Geometry emptyGeom = null; for (Geometry g = gc.next(); g != null; g = gc.next()) { emptyGeom = g; if (!skipEmpty || !g.isEmpty()) geoms.add(createFromEsriGeometry(g, sr)); } if (geoms.size() == 1) { return geoms.get(0); } else if (geoms.size() == 0) return createFromEsriGeometry(emptyGeom, sr); else return new OGCConcreteGeometryCollection(geoms, sr); }
public static OGCGeometry createFromEsriCursor(GeometryCursor gc, SpatialReference sr, boolean skipEmpty) { ArrayList<OGCGeometry> geoms = new ArrayList<OGCGeometry>(10); Geometry emptyGeom = null; for (Geometry g = gc.next(); g != null; g = gc.next()) { emptyGeom = g; if (!skipEmpty || !g.isEmpty()) geoms.add(createFromEsriGeometry(g, sr)); } if (geoms.size() == 1) { return geoms.get(0); } else if (geoms.size() == 0) return createFromEsriGeometry(emptyGeom, sr); else return new OGCConcreteGeometryCollection(geoms, sr); }
private static OGCConcreteGeometryCollection readGeometryCollection(BasicSliceInput input, Slice inputSlice) { // GeometryCollection: geometryType|len-of-shape1|bytes-of-shape1|len-of-shape2|bytes-of-shape2... List<OGCGeometry> geometries = new ArrayList<>(); while (input.available() > 0) { int length = input.readInt() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); geometries.add(readGeometry(input, inputSlice, type, length)); } return new OGCConcreteGeometryCollection(geometries, null); }
static protected OGCGeometry union(Tuple input) throws ExecException { DataBag values = (DataBag)input.get(0); if (values.size() == 0) return null; ArrayList<OGCGeometry> all_geoms = new ArrayList<OGCGeometry>(); for (Tuple one_geom : values) { OGCGeometry parsedGeom = geometryParser.parseGeom(one_geom.get(0)); all_geoms.add(parsedGeom); } // Do a union of all_geometries in the recommended way (using buffer(0)) OGCGeometryCollection geom_collection = new OGCConcreteGeometryCollection( all_geoms, all_geoms.get(0).getEsriSpatialReference()); return geom_collection.union(all_geoms.get(0)); }
private static OGCConcreteGeometryCollection readGeometryCollection(BasicSliceInput input, Slice inputSlice) { // GeometryCollection: geometryType|len-of-shape1|bytes-of-shape1|len-of-shape2|bytes-of-shape2... List<OGCGeometry> geometries = new ArrayList<>(); while (input.available() > 0) { int length = input.readInt() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); geometries.add(readGeometry(input, inputSlice, type, length)); } return new OGCConcreteGeometryCollection(geometries, null); }
private static OGCConcreteGeometryCollection readGeometryCollection(BasicSliceInput input, Slice inputSlice) { // GeometryCollection: geometryType|len-of-shape1|bytes-of-shape1|len-of-shape2|bytes-of-shape2... List<OGCGeometry> geometries = new ArrayList<>(); while (input.available() > 0) { int length = input.readInt() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); geometries.add(readGeometry(input, inputSlice, type, length)); } return new OGCConcreteGeometryCollection(geometries, null); }
static protected OGCGeometry extent(Tuple input) throws ExecException { DataBag values = (DataBag)input.get(0); if (values.size() == 0) return null; ArrayList<OGCGeometry> all_geoms = new ArrayList<OGCGeometry>(); for (Tuple one_geom : values) { OGCGeometry parsedGeom = geometryParser.parseGeom(one_geom.get(0)); all_geoms.add(parsedGeom); } // Do a union of all_geometries in the recommended way (using buffer(0)) OGCGeometryCollection geom_collection = new OGCConcreteGeometryCollection( all_geoms, all_geoms.get(0).getEsriSpatialReference()); return geom_collection.envelope(); }
static protected OGCGeometry convexHull(Tuple input) throws ExecException { DataBag values = (DataBag)input.get(0); if (values.size() == 0) return null; ArrayList<OGCGeometry> all_geoms = new ArrayList<OGCGeometry>(); for (Tuple one_geom : values) { OGCGeometry parsedGeom = geometryParser.parseGeom(one_geom.get(0)); all_geoms.add(parsedGeom); } // Do a convex null of all_geometries OGCGeometryCollection geom_collection = new OGCConcreteGeometryCollection( all_geoms, all_geoms.get(0).getEsriSpatialReference()); return geom_collection.convexHull(); }
/** * Fixes topological overlaps in the GeometryCollecion. * This is equivalent to union of the geometry collection elements. * * TODO "flattened" collection is supposed to contain only mutli-geometries, but this method may return single geometries * e.g. for GEOMETRYCOLLECTION (LINESTRING (...)) it returns GEOMETRYCOLLECTION (LINESTRING (...)) * and not GEOMETRYCOLLECTION (MULTILINESTRING (...)) * @return A geometry collection that is flattened and has no overlapping elements. */ public OGCConcreteGeometryCollection flattenAndRemoveOverlaps() { //flatten and crack/cluster GeometryCursor cursor = OGCStructureInternal.prepare_for_ops_(flatten().getEsriGeometryCursor(), esriSR); //make sure geometries don't overlap return new OGCConcreteGeometryCollection(removeOverlapsHelper_(toList(cursor)), esriSR); }
/** * Fixes topological overlaps in the GeometryCollecion. * This is equivalent to union of the geometry collection elements. * * TODO "flattened" collection is supposed to contain only mutli-geometries, but this method may return single geometries * e.g. for GEOMETRYCOLLECTION (LINESTRING (...)) it returns GEOMETRYCOLLECTION (LINESTRING (...)) * and not GEOMETRYCOLLECTION (MULTILINESTRING (...)) * @return A geometry collection that is flattened and has no overlapping elements. */ public OGCConcreteGeometryCollection flattenAndRemoveOverlaps() { //flatten and crack/cluster GeometryCursor cursor = OGCStructureInternal.prepare_for_ops_(flatten().getEsriGeometryCursor(), esriSR); //make sure geometries don't overlap return new OGCConcreteGeometryCollection(removeOverlapsHelper_(toList(cursor)), esriSR); }
public boolean contains(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return new OGCConcreteGeometryCollection(this, esriSR).contains(another); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.contains(geom1, geom2, getEsriSpatialReference()); }
public boolean contains(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return new OGCConcreteGeometryCollection(this, esriSR).contains(another); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.contains(geom1, geom2, getEsriSpatialReference()); }
public OGCGeometry difference(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return (new OGCConcreteGeometryCollection(this, esriSR)).difference(another); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return createFromEsriGeometry( com.esri.core.geometry.GeometryEngine.difference(geom1, geom2, getEsriSpatialReference()), esriSR); }
public OGCGeometry difference(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return (new OGCConcreteGeometryCollection(this, esriSR)).difference(another); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return createFromEsriGeometry( com.esri.core.geometry.GeometryEngine.difference(geom1, geom2, getEsriSpatialReference()), esriSR); }
public OGCGeometry intersection(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return (new OGCConcreteGeometryCollection(this, esriSR)).intersection(another); } com.esri.core.geometry.OperatorIntersection op = (OperatorIntersection) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.Intersection); com.esri.core.geometry.GeometryCursor cursor = op.execute( getEsriGeometryCursor(), another.getEsriGeometryCursor(), getEsriSpatialReference(), null, 7); return OGCGeometry.createFromEsriCursor(cursor, esriSR, true); }
public OGCGeometry intersection(OGCGeometry another) { if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return (new OGCConcreteGeometryCollection(this, esriSR)).intersection(another); } com.esri.core.geometry.OperatorIntersection op = (OperatorIntersection) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.Intersection); com.esri.core.geometry.GeometryCursor cursor = op.execute( getEsriGeometryCursor(), another.getEsriGeometryCursor(), getEsriSpatialReference(), null, 7); return OGCGeometry.createFromEsriCursor(cursor, esriSR, true); }