Class Factory
java.lang.Object
org.apache.sis.internal.feature.Geometries<com.esri.core.geometry.Geometry>
org.apache.sis.internal.feature.esri.Factory
- All Implemented Interfaces:
Serializable
The factory of geometry objects backed by ESRI.
- Since:
- 0.7
- Version:
- 1.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Factory
The singleton instance of this factory.private static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.internal.feature.Geometries
BIDIMENSIONAL, library, pointClass, polygonClass, polylineClass, rootClass, TRIDIMENSIONAL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGeometryWrapper<com.esri.core.geometry.Geometry>
castOrWrap
(Object geometry) Returns a wrapper for the given<G>
orGeometryWrapper<G>
geometry.GeometryWrapper<com.esri.core.geometry.Geometry>
createFromComponents
(GeometryType type, Object components) Creates a geometry from components.GeometryWrapper<com.esri.core.geometry.Geometry>
createMultiPolygon
(Object[] geometries) Creates a multi-polygon from an array of geometries.createPoint
(double x, double y) Creates a two-dimensional point from the given coordinates.createPoint
(double x, double y, double z) Creates a three-dimensional point from the given coordinates.com.esri.core.geometry.Geometry
createPolyline
(boolean polygon, int dimension, Vector... coordinates) Creates a polyline from the given coordinate values.protected GeometryWrapper<com.esri.core.geometry.Geometry>
createWrapper
(com.esri.core.geometry.Geometry geometry) Creates a wrapper for the given geometry instance.GeometryWrapper<com.esri.core.geometry.Geometry>
parseWKB
(ByteBuffer data) Reads the given Well Known Binary (WKB).GeometryWrapper<com.esri.core.geometry.Geometry>
Parses the given Well Known Text (WKT).protected Object
Invoked at deserialization time for obtaining the unique instance of thisGeometries
class.Methods inherited from class org.apache.sis.internal.feature.Geometries
createPoint, createPoint, getGeometryClass, implementation, implementation, isKnownType, mergePolylines, supportSinglePrecision, toGeometry2D, unsupported, unsupported, unwrap, wrap
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
INSTANCE
The singleton instance of this factory.
-
-
Constructor Details
-
Factory
private Factory()Creates the singleton instance.
-
-
Method Details
-
readResolve
Invoked at deserialization time for obtaining the unique instance of thisGeometries
class.- Returns:
INSTANCE
.- Throws:
ObjectStreamException
- if the object state is invalid.
-
castOrWrap
Returns a wrapper for the given<G>
orGeometryWrapper<G>
geometry.- Specified by:
castOrWrap
in classGeometries<com.esri.core.geometry.Geometry>
- Parameters:
geometry
- the geometry instance to wrap (can benull
).- Returns:
- a wrapper for the given geometry implementation, or
null
. - Throws:
ClassCastException
- if the given geometry is not an instance of valid type.- See Also:
-
createWrapper
protected GeometryWrapper<com.esri.core.geometry.Geometry> createWrapper(com.esri.core.geometry.Geometry geometry) Creates a wrapper for the given geometry instance.- Specified by:
createWrapper
in classGeometries<com.esri.core.geometry.Geometry>
- Parameters:
geometry
- the geometry to wrap.- Returns:
- wrapper for the given geometry.
- See Also:
-
createPoint
Creates a two-dimensional point from the given coordinates.- Specified by:
createPoint
in classGeometries<com.esri.core.geometry.Geometry>
- Parameters:
x
- the first coordinate value.y
- the second coordinate value.- Returns:
- the point for the given coordinate values.
- See Also:
-
createPoint
Creates a three-dimensional point from the given coordinates.- Specified by:
createPoint
in classGeometries<com.esri.core.geometry.Geometry>
- Parameters:
x
- the first coordinate value.y
- the second coordinate value.z
- the third coordinate value.- Returns:
- the point for the given coordinate values.
- See Also:
-
createPolyline
public com.esri.core.geometry.Geometry createPolyline(boolean polygon, int dimension, Vector... coordinates) Creates a polyline from the given coordinate values. EachDouble.NaN
coordinate value starts a new path.- Specified by:
createPolyline
in classGeometries<com.esri.core.geometry.Geometry>
- Parameters:
polygon
- whether to return the path as a polygon instead of polyline.dimension
- the number of dimensions (2 or 3).coordinates
- sequence of (x,y) or (x,y,z) tuples.- Returns:
- the geometric object for the given points.
- Throws:
UnsupportedOperationException
- if this operation is not implemented for the given number of dimensions.
-
createMultiPolygon
Creates a multi-polygon from an array of geometries. Callers must ensure that the given objects are ESRI geometries.- Specified by:
createMultiPolygon
in classGeometries<com.esri.core.geometry.Geometry>
- Parameters:
geometries
- the polygons or linear rings to put in a multi-polygons.- Returns:
- the multi-polygon.
- Throws:
ClassCastException
- if an element in the array is not an ESRI geometry.
-
createFromComponents
public GeometryWrapper<com.esri.core.geometry.Geometry> createFromComponents(GeometryType type, Object components) Creates a geometry from components. The expectedcomponents
type depend on the target geometry type:- If
type
is a multi-geometry, then the components shall be an array ofPoint
,Geometry
,Polyline
orPolygon
elements, depending on the desired target type. - Otherwise the components shall be an array or collection of
Point
instances.
- Specified by:
createFromComponents
in classGeometries<com.esri.core.geometry.Geometry>
- Parameters:
type
- type of geometry to create.components
- the components. Valid classes depend on the type of geometry to create.- Returns:
- geometry built from the given components.
- Throws:
ClassCastException
- if the given object is not an array or a collection of supported geometry components.
- If
-
parseWKT
Parses the given Well Known Text (WKT).- Specified by:
parseWKT
in classGeometries<com.esri.core.geometry.Geometry>
- Parameters:
wkt
- the Well Known Text to parse.- Returns:
- the geometry object for the given WKT.
- See Also:
-
parseWKB
Reads the given Well Known Binary (WKB).- Specified by:
parseWKB
in classGeometries<com.esri.core.geometry.Geometry>
- Parameters:
data
- the sequence of bytes to parse.- Returns:
- the geometry object for the given WKB.
-