switch (geometryType) { case POINT: addPoint(envelope, (Point) geometry); break; case LINESTRING: addLineString(envelope, (LineString) geometry); break; case POLYGON: addPolygon(envelope, (Polygon) geometry); break; case MULTIPOINT: addMultiPoint(envelope, (MultiPoint) geometry); break; case MULTILINESTRING: addMultiLineString(envelope, (MultiLineString) geometry); break; case MULTIPOLYGON: addMultiPolygon(envelope, (MultiPolygon) geometry); break; case CIRCULARSTRING: addLineString(envelope, (CircularString) geometry); break; case COMPOUNDCURVE: addCompoundCurve(envelope, (CompoundCurve) geometry); break; case CURVEPOLYGON: @SuppressWarnings("unchecked") CurvePolygon<Curve> curvePolygon = (CurvePolygon<Curve>) geometry; addCurvePolygon(envelope, curvePolygon);
/** * Add CurvePolygon * * @param envelope * geometry envelope * @param curvePolygon * curve polygon */ private static void addCurvePolygon(GeometryEnvelope envelope, CurvePolygon<Curve> curvePolygon) { updateHasZandM(envelope, curvePolygon); List<Curve> rings = curvePolygon.getRings(); for (Curve ring : rings) { buildEnvelope(ring, envelope); } }
/** * Add Polygon * * @param envelope * geometry envelope * @param polygon * polygon */ private static void addPolygon(GeometryEnvelope envelope, Polygon polygon) { updateHasZandM(envelope, polygon); List<LineString> rings = polygon.getRings(); for (LineString ring : rings) { addLineString(envelope, ring); } }
/** * Get the minimum bounding box for this Geometry * * @return geometry envelope */ public GeometryEnvelope getEnvelope() { return GeometryEnvelopeBuilder.buildEnvelope(this); }
/** * Get the envelope if it exists or build it from the geometry if not null * * @return geometry envelope * @since 3.1.0 */ public GeometryEnvelope getOrBuildEnvelope() { GeometryEnvelope envelope = getEnvelope(); if (envelope == null) { Geometry geometry = getGeometry(); if (geometry != null) { envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry); } } return envelope; }
/** * Add CompoundCurve * * @param envelope * geometry envelope * @param compoundCurve * compound curve */ private static void addCompoundCurve(GeometryEnvelope envelope, CompoundCurve compoundCurve) { updateHasZandM(envelope, compoundCurve); List<LineString> lineStrings = compoundCurve.getLineStrings(); for (LineString lineString : lineStrings) { addLineString(envelope, lineString); } }
/** * Build Geometry Envelope * * @param geometry * geometry to build envelope from * @return geometry envelope */ public static GeometryEnvelope buildEnvelope(Geometry geometry) { GeometryEnvelope envelope = new GeometryEnvelope(); envelope.setMinX(Double.MAX_VALUE); envelope.setMaxX(-Double.MAX_VALUE); envelope.setMinY(Double.MAX_VALUE); envelope.setMaxY(-Double.MAX_VALUE); buildEnvelope(geometry, envelope); return envelope; }
/** * Add MultiLineString * * @param envelope * geometry envelope * @param multiLineString * multi line string */ private static void addMultiLineString(GeometryEnvelope envelope, MultiLineString multiLineString) { updateHasZandM(envelope, multiLineString); List<LineString> lineStrings = multiLineString.getLineStrings(); for (LineString lineString : lineStrings) { addLineString(envelope, lineString); } }
Geometry geometry = geomData.getGeometry(); if (geometry != null) { envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry);
for (Geometry geometry : geometries) { if (envelope == null) { envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry); } else { GeometryEnvelopeBuilder.buildEnvelope(geometry, envelope);
envelope = GeometryEnvelopeBuilder.buildEnvelope(point); resultCount = 0; featureFound = false;
envelope = GeometryEnvelopeBuilder.buildEnvelope(point); resultCount = 0; featureFound = false;