Class Wrapper
java.lang.Object
- All Implemented Interfaces:
org.opengis.geometry.Geometry
The wrapper of Java2D geometries.
- Since:
- 1.1
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final Shape
The wrapped implementation.private static final BiPredicate<Wrapper,
Object>[] All predicates recognized bypredicateSameCRS(SpatialOperatorName, GeometryWrapper)
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Area
area()
Returns the geometry as anArea
object, creating it on the fly if necessary.private boolean
Estimates whether the wrapped geometry intersects the geometry of the given wrapper, testing only the bounding box of thewrapper
argument.private boolean
Estimates whether the wrapped geometry contains the geometry of the given wrapper.private boolean
Estimates whether the wrapped geometry is equal to the geometry of the given wrapper.factory()
Returns the implementation-dependent factory of geometric object.formatWKT
(double flatness) Builds a WKT representation of the wrapped shape.double[]
Returns all coordinate tuples in the wrapped geometry.org.opengis.geometry.DirectPosition
Returns the centroid of the wrapped geometry as a direct position.Returns the Java2D envelope as an Apache SIS implementation.double[]
Returnsnull
sinceShape
are never points in Java2D API.Returns the geometry specified at construction time.private boolean
Estimates whether the wrapped geometry intersects the geometry of the given wrapper.(package private) static Shape
mergePolylines
(Object next, Iterator<?> polylines) Implementation ofmergePolylines(Iterator)
also shared byPointWrapper
.protected Shape
mergePolylines
(Iterator<?> polylines) Merges a sequence of points or paths after this geometry.protected Object
operationSameCRS
(SQLMM operation, GeometryWrapper<Shape> other, Object argument) Applies a SQLMM operation on this geometry.protected boolean
predicateSameCRS
(SpatialOperatorName type, GeometryWrapper<Shape> other) Applies a filter predicate between this geometry and another geometry.private boolean
Estimates whether the wrapped geometry is contained by the geometry of the given wrapper.Methods inherited from class org.apache.sis.internal.feature.GeometryWithCRS
createEnvelope, getCoordinateReferenceSystem, isSameCRS, setCoordinateReferenceSystem
Methods inherited from class org.apache.sis.internal.feature.GeometryWrapper
equals, getSRID, hashCode, operation, operation, operationWithArgument, operationWithArgument, predicate, predicate, predicateSameCRS, toGeometryType, toString, transform, transform
-
Field Details
-
geometry
The wrapped implementation. -
PREDICATES
All predicates recognized bypredicateSameCRS(SpatialOperatorName, GeometryWrapper)
. Array indices areEnum.ordinal()
values.
-
-
Constructor Details
-
Wrapper
Wrapper(Shape geometry) Creates a new wrapper around the given geometry.
-
-
Method Details
-
factory
Returns the implementation-dependent factory of geometric object.- Specified by:
factory
in classGeometryWrapper<Shape>
- Returns:
- the factory of implementation-dependent geometric objects (never
null
).
-
implementation
Returns the geometry specified at construction time.- Specified by:
implementation
in classGeometryWrapper<Shape>
- Returns:
- the geometry implementation wrapped by this instance (never
null
).
-
area
-
getEnvelope
Returns the Java2D envelope as an Apache SIS implementation.- Specified by:
getEnvelope
in classGeometryWrapper<Shape>
- Returns:
- the envelope of the geometry.
-
getCentroid
public org.opengis.geometry.DirectPosition getCentroid()Returns the centroid of the wrapped geometry as a direct position.- Specified by:
getCentroid
in classGeometryWrapper<Shape>
- Returns:
- the centroid of the wrapped geometry.
-
getPointCoordinates
public double[] getPointCoordinates()Returnsnull
sinceShape
are never points in Java2D API.- Specified by:
getPointCoordinates
in classGeometryWrapper<Shape>
- Returns:
- the coordinate of the point as an array of length 2 or 3,
or
null
if the geometry is not a point. - See Also:
-
getAllCoordinates
Returns all coordinate tuples in the wrapped geometry. This method is currently used for testing purpose only.- Specified by:
getAllCoordinates
in classGeometryWrapper<Shape>
- Returns:
- the sequence of all coordinate values in the wrapped geometry,
or
null
if they cannot be obtained.
-
mergePolylines
Merges a sequence of points or paths after this geometry.- Specified by:
mergePolylines
in classGeometryWrapper<Shape>
- Parameters:
polylines
- the points or polylines to merge in a single polyline instance.- Returns:
- the merged polyline (may be the wrapper geometry but never
null
). - Throws:
ClassCastException
- if an element in the iterator is not aShape
or aPoint2D
.
-
mergePolylines
Implementation ofmergePolylines(Iterator)
also shared byPointWrapper
. -
predicateSameCRS
Applies a filter predicate between this geometry and another geometry. This method assumes that the two geometries are in the same CRS (this is not verified).- Overrides:
predicateSameCRS
in classGeometryWrapper<Shape>
- Parameters:
type
- the predicate operation to apply.other
- the other geometry to test with this geometry.- Returns:
- result of applying the specified predicate.
-
operationSameCRS
Applies a SQLMM operation on this geometry.- Overrides:
operationSameCRS
in classGeometryWrapper<Shape>
- Parameters:
operation
- the SQLMM operation to apply.other
- the other geometry, ornull
if the operation requires only one geometry.argument
- an operation-specific argument, ornull
if not applicable.- Returns:
- result of the specified operation.
-
equal
Estimates whether the wrapped geometry is equal to the geometry of the given wrapper.- Parameters:
wrapper
- instance ofWrapper
.
-
within
Estimates whether the wrapped geometry is contained by the geometry of the given wrapper. This method may conservatively returnsfalse
if an accurate computation would be too expansive.- Parameters:
wrapper
- instance ofWrapper
.
-
contain
Estimates whether the wrapped geometry contains the geometry of the given wrapper. This method may conservatively returnsfalse
if an accurate computation would be too expansive.- Parameters:
wrapper
- instance ofWrapper
orPointWrapper
.- Throws:
ClassCastException
- if the given object is not a recognized wrapper.
-
intersect
Estimates whether the wrapped geometry intersects the geometry of the given wrapper. This method may conservatively returnstrue
if an accurate computation would be too expansive.- Parameters:
wrapper
- instance ofWrapper
orPointWrapper
.- Throws:
ClassCastException
- if the given object is not a recognized wrapper.
-
bbox
Estimates whether the wrapped geometry intersects the geometry of the given wrapper, testing only the bounding box of thewrapper
argument. This method may be more accurate than required by OGC Filter Encoding specification in that this geometry is not simplified to a bounding box. But Java2D implementations sometimes use bounding box approximation, so the result may be the same.- Parameters:
wrapper
- instance ofWrapper
orPointWrapper
.- Throws:
ClassCastException
- if the given object is not a recognized wrapper.
-
formatWKT
Builds a WKT representation of the wrapped shape. Current implementation assumes that all closed shapes are polygons and that polygons have no hole (i.e. if a polygon is followed by more data, this method assumes that the additional data is a disjoint polygon).- Specified by:
formatWKT
in classGeometryWrapper<Shape>
- Parameters:
flatness
- maximal distance between the approximated WKT and any point on the curve.- Returns:
- the Well Known Text for the wrapped geometry (never
null
). - See Also:
-