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 classNested classes/interfaces inherited from interface ShapeFactory
ShapeFactory.LineStringBuilder, ShapeFactory.MultiLineStringBuilder, ShapeFactory.MultiPointBuilder, ShapeFactory.MultiPolygonBuilder, ShapeFactory.MultiShapeBuilder<T>, 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.booleanIf 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.doublenormDist(double d) Called to normalize a value that isn't X or Y or Z.doublenormX(double x) Normalize the 'x' dimension.doublenormY(double y) doublenormZ(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.voidverifyX(double x) Ensure fits in the world bounds.voidverifyY(double y) voidverifyZ(double z) (disclaimer: the Z dimension isn't fully supported)Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ShapeFactory
pointLatLon
-
Field Details
-
ctx
-
normWrapLongitude
private final boolean normWrapLongitude
-
-
Constructor Details
-
ShapeFactoryImpl
-
-
Method Details
-
getSpatialContext
- Specified by:
getSpatialContextin interfaceShapeFactory
-
isNormWrapLongitude
public boolean isNormWrapLongitude()Description copied from interface:ShapeFactoryIf true thenShapeFactory.normX(double)will wrap longitudes outside of the standard geodetic boundary into it. Example: 181 will become -179.- Specified by:
isNormWrapLongitudein interfaceShapeFactory
-
normX
public double normX(double x) Description copied from interface:ShapeFactoryNormalize the 'x' dimension. Might reduce precision or wrap it to be within the bounds. This is called byShapeReaders before creating a shape.- Specified by:
normXin interfaceShapeFactory
-
normY
public double normY(double y) - Specified by:
normYin interfaceShapeFactory- See Also:
-
normZ
public double normZ(double z) Description copied from interface:ShapeFactory(disclaimer: the Z dimension isn't fully supported)- Specified by:
normZin interfaceShapeFactory- See Also:
-
normDist
public double normDist(double d) Description copied from interface:ShapeFactoryCalled 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 aShapeReaderbefore creating a shape.- Specified by:
normDistin interfaceShapeFactory
-
verifyX
public void verifyX(double x) Description copied from interface:ShapeFactoryEnsure fits in the world bounds. It's called by any shape factory method that gets an 'x' dimension.- Specified by:
verifyXin interfaceShapeFactory
-
verifyY
public void verifyY(double y) - Specified by:
verifyYin interfaceShapeFactory- See Also:
-
verifyZ
public void verifyZ(double z) Description copied from interface:ShapeFactory(disclaimer: the Z dimension isn't fully supported)- Specified by:
verifyZin interfaceShapeFactory- See Also:
-
pointXY
Description copied from interface:ShapeFactoryConstruct a point.- Specified by:
pointXYin interfaceShapeFactory
-
pointXYZ
Description copied from interface:ShapeFactoryConstruct a point of 3 dimensions. The implementation might ignore unsupported dimensions like 'z' or throw an error.- Specified by:
pointXYZin interfaceShapeFactory
-
rect
Description copied from interface:ShapeFactoryConstruct a rectangle.- Specified by:
rectin interfaceShapeFactory
-
rect
Description copied from interface:ShapeFactoryConstruct 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:
rectin interfaceShapeFactory
-
circle
Description copied from interface:ShapeFactoryConstruct a circle. The units of "distance" should be the same as x & y.- Specified by:
circlein interfaceShapeFactory
-
circle
Description copied from interface:ShapeFactoryConstruct a circle. The units of "distance" should be the same as x & y.- Specified by:
circlein interfaceShapeFactory
-
lineString
Description copied from interface:ShapeFactoryConstructs 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:
lineStringin 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:
lineStringin interfaceShapeFactory
-
multiShape
Description copied from interface:ShapeFactoryConstruct a ShapeCollection, analogous to an OGC GeometryCollection.- Specified by:
multiShapein 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:
multiShapein interfaceShapeFactory
-
multiPoint
Description copied from interface:ShapeFactory(Builder) Constructs a MultiPoint.- Specified by:
multiPointin interfaceShapeFactory
-
multiLineString
Description copied from interface:ShapeFactory(Builder) Constructs a MultiLineString, or possibly the result of that buffered.- Specified by:
multiLineStringin interfaceShapeFactory
-
multiPolygon
Description copied from interface:ShapeFactory(Builder) Constructs a MultiPolygon.- Specified by:
multiPolygonin 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:
polygonin interfaceShapeFactory
-