Class ShapeFactoryImpl
java.lang.Object
org.locationtech.spatial4j.shape.impl.ShapeFactoryImpl
- All Implemented Interfaces:
ShapeFactory
- Direct Known Subclasses:
JtsShapeFactory
The default
ShapeFactory
. It does not support polygon shapes.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
Nested classes/interfaces inherited from interface org.locationtech.spatial4j.shape.ShapeFactory
ShapeFactory.LineStringBuilder, ShapeFactory.MultiLineStringBuilder, ShapeFactory.MultiPointBuilder, ShapeFactory.MultiPolygonBuilder, ShapeFactory.MultiShapeBuilder<T extends Shape>, ShapeFactory.PointsBuilder<T>, ShapeFactory.PolygonBuilder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncircle
(double x, double y, double distance) Construct a circle.Construct a circle.boolean
If true thenShapeFactory.normX(double)
will wrap longitudes outside of the standard geodetic boundary into it.(Builder) Constructs a line string, with a possible buffer.lineString
(List<Point> points, double buf) Constructs a line string with a possible buffer.(Builder) Constructs a MultiLineString, or possibly the result of that buffered.(Builder) Constructs a MultiPoint.(Builder) Constructs a MultiPolygon.<T extends Shape>
ShapeFactory.MultiShapeBuilder<T> multiShape
(Class<T> shapeClass) (Builder) Constructs a Shape aggregate in which each component/member is an instance of the specified class.<S extends Shape>
ShapeCollection<S> multiShape
(List<S> coll) Construct a ShapeCollection, analogous to an OGC GeometryCollection.double
normDist
(double d) Called to normalize a value that isn't X or Y or Z.double
normX
(double x) Normalize the 'x' dimension.double
normY
(double y) double
normZ
(double z) (disclaimer: the Z dimension isn't fully supported)pointXY
(double x, double y) Construct a point.pointXYZ
(double x, double y, double z) Construct a point of 3 dimensions.polygon()
(Builder) Constructs a polygon.rect
(double minX, double maxX, double minY, double maxY) Construct a rectangle.Construct a rectangle.void
verifyX
(double x) Ensure fits in the world bounds.void
verifyY
(double y) void
verifyZ
(double z) (disclaimer: the Z dimension isn't fully supported)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.locationtech.spatial4j.shape.ShapeFactory
pointLatLon
-
Field Details
-
ctx
-
normWrapLongitude
private final boolean normWrapLongitude
-
-
Constructor Details
-
ShapeFactoryImpl
-
-
Method Details
-
getSpatialContext
- Specified by:
getSpatialContext
in interfaceShapeFactory
-
isNormWrapLongitude
public boolean isNormWrapLongitude()Description copied from interface:ShapeFactory
If true thenShapeFactory.normX(double)
will wrap longitudes outside of the standard geodetic boundary into it. Example: 181 will become -179.- Specified by:
isNormWrapLongitude
in interfaceShapeFactory
-
normX
public double normX(double x) Description copied from interface:ShapeFactory
Normalize the 'x' dimension. Might reduce precision or wrap it to be within the bounds. This is called byShapeReader
s before creating a shape.- Specified by:
normX
in interfaceShapeFactory
-
normY
public double normY(double y) - Specified by:
normY
in interfaceShapeFactory
- See Also:
-
normZ
public double normZ(double z) Description copied from interface:ShapeFactory
(disclaimer: the Z dimension isn't fully supported)- Specified by:
normZ
in interfaceShapeFactory
- See Also:
-
normDist
public double normDist(double d) Description copied from interface:ShapeFactory
Called to normalize a value that isn't X or Y or Z. X & Y & Z are normalized viaSpatialContext.normX(double)
& normY & normZ. This is called by aShapeReader
before creating a shape.- Specified by:
normDist
in interfaceShapeFactory
-
verifyX
public void verifyX(double x) Description copied from interface:ShapeFactory
Ensure fits in the world bounds. It's called by any shape factory method that gets an 'x' dimension.- Specified by:
verifyX
in interfaceShapeFactory
-
verifyY
public void verifyY(double y) - Specified by:
verifyY
in interfaceShapeFactory
- See Also:
-
verifyZ
public void verifyZ(double z) Description copied from interface:ShapeFactory
(disclaimer: the Z dimension isn't fully supported)- Specified by:
verifyZ
in interfaceShapeFactory
- See Also:
-
pointXY
Description copied from interface:ShapeFactory
Construct a point.- Specified by:
pointXY
in interfaceShapeFactory
-
pointXYZ
Description copied from interface:ShapeFactory
Construct a point of 3 dimensions. The implementation might ignore unsupported dimensions like 'z' or throw an error.- Specified by:
pointXYZ
in interfaceShapeFactory
-
rect
Description copied from interface:ShapeFactory
Construct a rectangle.- Specified by:
rect
in interfaceShapeFactory
-
rect
Description copied from interface:ShapeFactory
Construct a rectangle. If just one longitude is on the dateline (+/- 180) and ifSpatialContext.isGeo()
then potentially adjust its sign to ensure the rectangle does not cross the dateline (aka anti-meridian).- Specified by:
rect
in interfaceShapeFactory
-
circle
Description copied from interface:ShapeFactory
Construct a circle. The units of "distance" should be the same as x & y.- Specified by:
circle
in interfaceShapeFactory
-
circle
Description copied from interface:ShapeFactory
Construct a circle. The units of "distance" should be the same as x & y.- Specified by:
circle
in interfaceShapeFactory
-
lineString
Description copied from interface:ShapeFactory
Constructs a line string with a possible buffer. It's an ordered sequence of connected vertexes, with a buffer distance along the line in all directions. There is no official shape/interface for it so we just return Shape.- Specified by:
lineString
in interfaceShapeFactory
-
lineString
Description copied from interface:ShapeFactory
(Builder) Constructs a line string, with a possible buffer. It's an ordered sequence of connected vertexes. There is no official shape/interface for it yet so we just return Shape.- Specified by:
lineString
in interfaceShapeFactory
-
multiShape
Description copied from interface:ShapeFactory
Construct a ShapeCollection, analogous to an OGC GeometryCollection.- Specified by:
multiShape
in interfaceShapeFactory
-
multiShape
Description copied from interface:ShapeFactory
(Builder) Constructs a Shape aggregate in which each component/member is an instance of the specified class.- Specified by:
multiShape
in interfaceShapeFactory
-
multiPoint
Description copied from interface:ShapeFactory
(Builder) Constructs a MultiPoint.- Specified by:
multiPoint
in interfaceShapeFactory
-
multiLineString
Description copied from interface:ShapeFactory
(Builder) Constructs a MultiLineString, or possibly the result of that buffered.- Specified by:
multiLineString
in interfaceShapeFactory
-
multiPolygon
Description copied from interface:ShapeFactory
(Builder) Constructs a MultiPolygon.- Specified by:
multiPolygon
in interfaceShapeFactory
-
polygon
Description copied from interface:ShapeFactory
(Builder) Constructs a polygon. There is no official shape/interface for it yet so we just return Shape.- Specified by:
polygon
in interfaceShapeFactory
-