Class Factory
- All Implemented Interfaces:
Serializable
The factory of geometry objects backed by Java2D.
- Since:
- 0.7
- Version:
- 1.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FactoryThe singleton instance of this factory.private static final longFor 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 TypeMethodDescriptioncastOrWrap(Object geometry) Returns a wrapper for the given<G>orGeometryWrapper<G>geometry.createFromComponents(GeometryType type, Object components) Creates a geometry from components.createMultiPolygon(Object[] geometries) Creates a multi-polygon from an array of geometries.private static Path2DcreatePath(boolean isFloat, int length) Creates an initially empty Java2D path.createPoint(double x, double y) Creates a two-dimensional point from the given coordinate.createPoint(double x, double y, double z) Unsupported operation with Java2D.createPoint(float x, float y) Creates a two-dimensional point from the given coordinate.createPolyline(boolean polygon, int dimension, Vector... coordinates) Creates a path from the given coordinate values.protected GeometryWrapper<Shape>createWrapper(Shape geometry) Creates a wrapper for the given geometry instance.parseWKB(ByteBuffer data) Well Known Binary (WKB) reading not supported with Java2D.Well Known Text (WKT) parsing not supported with Java2D.protected ObjectInvoked at deserialization time for obtaining the unique instance of thisGeometriesclass.booleanNotifies that this library can create geometry objects backed by single-precision type.Methods inherited from class org.apache.sis.internal.feature.Geometries
createPoint, getGeometryClass, implementation, implementation, isKnownType, mergePolylines, 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 thisGeometriesclass.- Returns:
INSTANCE.- Throws:
ObjectStreamException- if the object state is invalid.
-
castOrWrap
Returns a wrapper for the given<G>orGeometryWrapper<G>geometry.- Specified by:
castOrWrapin classGeometries<Shape>- 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
Creates a wrapper for the given geometry instance.- Specified by:
createWrapperin classGeometries<Shape>- Parameters:
geometry- the geometry to wrap.- Returns:
- wrapper for the given geometry.
- See Also:
-
supportSinglePrecision
public boolean supportSinglePrecision()Notifies that this library can create geometry objects backed by single-precision type.- Overrides:
supportSinglePrecisionin classGeometries<Shape>- Returns:
- whether the library support single-precision values.
- See Also:
-
createPoint
Creates a two-dimensional point from the given coordinate.- Overrides:
createPointin classGeometries<Shape>- Parameters:
x- the first coordinate value.y- the second coordinate value.- Returns:
- the point for the given coordinate values.
- See Also:
-
createPoint
Creates a two-dimensional point from the given coordinate.- Specified by:
createPointin classGeometries<Shape>- Parameters:
x- the first coordinate value.y- the second coordinate value.- Returns:
- the point for the given coordinate values.
- See Also:
-
createPoint
Unsupported operation with Java2D.- Specified by:
createPointin classGeometries<Shape>- 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:
-
createPath
Creates an initially empty Java2D path.- Parameters:
isFloat-trueforfloattype,falsefordoubletype.length- initial capacity.- Returns:
- an initially empty path of the given type.
-
createPolyline
Creates a path from the given coordinate values. EachDouble.NaNcoordinate value starts a new path. The geometry may be backed byfloatordoubleprimitive type, depending on the type used by the given vectors.- Specified by:
createPolylinein classGeometries<Shape>- 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 Java2D geometries.- Specified by:
createMultiPolygonin classGeometries<Shape>- 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 a Java2D geometry.
-
createFromComponents
Creates a geometry from components. The expectedcomponentstype depend on the target geometry type:- Specified by:
createFromComponentsin classGeometries<Shape>- 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.
-
parseWKT
Well Known Text (WKT) parsing not supported with Java2D.- Specified by:
parseWKTin classGeometries<Shape>- Parameters:
wkt- the WKT to parse. Cannot be null.- Returns:
- the geometry object for the given WKT (never
null). - See Also:
-
parseWKB
Well Known Binary (WKB) reading not supported with Java2D.- Specified by:
parseWKBin classGeometries<Shape>- Parameters:
data- the binary data in WKB format. Cannot be null.- Returns:
- decoded geometry (never
null).
-