Package org.locationtech.spatial4j.shape
Interface ShapeFactory
-
- All Known Implementing Classes:
JtsShapeFactory
,ShapeFactoryImpl
public interface ShapeFactory
A factory forShape
s. Stateless and thread-safe, except for any returned builders.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ShapeFactory.LineStringBuilder
static interface
ShapeFactory.MultiLineStringBuilder
static interface
ShapeFactory.MultiPointBuilder
static interface
ShapeFactory.MultiPolygonBuilder
static interface
ShapeFactory.MultiShapeBuilder<T extends Shape>
static interface
ShapeFactory.PointsBuilder<T>
Builds a point and returns the generic specified type (usually whatever "this" is).static interface
ShapeFactory.PolygonBuilder
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description Circle
circle(double x, double y, double distance)
Construct a circle.Circle
circle(Point point, double distance)
Construct a circle.SpatialContext
getSpatialContext()
boolean
isNormWrapLongitude()
If true thennormX(double)
will wrap longitudes outside of the standard geodetic boundary into it.ShapeFactory.LineStringBuilder
lineString()
(Builder) Constructs a line string, with a possible buffer.Shape
lineString(java.util.List<Point> points, double buf)
Deprecated.ShapeFactory.MultiLineStringBuilder
multiLineString()
(Builder) Constructs a MultiLineString, or possibly the result of that buffered.ShapeFactory.MultiPointBuilder
multiPoint()
(Builder) Constructs a MultiPoint.ShapeFactory.MultiPolygonBuilder
multiPolygon()
(Builder) Constructs a MultiPolygon.<T extends Shape>
ShapeFactory.MultiShapeBuilder<T>multiShape(java.lang.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(java.util.List<S> coll)
Deprecated.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)default Point
pointLatLon(double latitude, double longitude)
Construct a point of latitude, longitude coordinatesPoint
pointXY(double x, double y)
Construct a point.Point
pointXYZ(double x, double y, double z)
Construct a point of 3 dimensions.ShapeFactory.PolygonBuilder
polygon()
(Builder) Constructs a polygon.Rectangle
rect(double minX, double maxX, double minY, double maxY)
Construct a rectangle.Rectangle
rect(Point lowerLeft, Point upperRight)
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)
-
-
-
Method Detail
-
getSpatialContext
SpatialContext getSpatialContext()
-
isNormWrapLongitude
boolean isNormWrapLongitude()
If true thennormX(double)
will wrap longitudes outside of the standard geodetic boundary into it. Example: 181 will become -179.
-
normX
double normX(double x)
Normalize the 'x' dimension. Might reduce precision or wrap it to be within the bounds. This is called byShapeReader
s before creating a shape.
-
normY
double normY(double y)
- See Also:
normX(double)
-
normZ
double normZ(double z)
(disclaimer: the Z dimension isn't fully supported)- See Also:
normX(double)
-
normDist
double normDist(double d)
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.
-
verifyX
void verifyX(double x)
Ensure fits in the world bounds. It's called by any shape factory method that gets an 'x' dimension.
-
verifyY
void verifyY(double y)
- See Also:
verifyX(double)
-
verifyZ
void verifyZ(double z)
(disclaimer: the Z dimension isn't fully supported)- See Also:
verifyX(double)
-
pointXY
Point pointXY(double x, double y)
Construct a point.
-
pointLatLon
default Point pointLatLon(double latitude, double longitude)
Construct a point of latitude, longitude coordinates
-
pointXYZ
Point pointXYZ(double x, double y, double z)
Construct a point of 3 dimensions. The implementation might ignore unsupported dimensions like 'z' or throw an error.
-
rect
Rectangle rect(double minX, double maxX, double minY, double maxY)
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).
-
circle
Circle circle(double x, double y, double distance)
Construct a circle. The units of "distance" should be the same as x & y.
-
circle
Circle circle(Point point, double distance)
Construct a circle. The units of "distance" should be the same as x & y.
-
lineString
@Deprecated Shape lineString(java.util.List<Point> points, double buf)
Deprecated.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.
-
multiShape
@Deprecated <S extends Shape> ShapeCollection<S> multiShape(java.util.List<S> coll)
Deprecated.Construct a ShapeCollection, analogous to an OGC GeometryCollection.
-
lineString
ShapeFactory.LineStringBuilder lineString()
(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.
-
polygon
ShapeFactory.PolygonBuilder polygon()
(Builder) Constructs a polygon. There is no official shape/interface for it yet so we just return Shape.
-
multiShape
<T extends Shape> ShapeFactory.MultiShapeBuilder<T> multiShape(java.lang.Class<T> shapeClass)
(Builder) Constructs a Shape aggregate in which each component/member is an instance of the specified class.
-
multiPoint
ShapeFactory.MultiPointBuilder multiPoint()
(Builder) Constructs a MultiPoint.
-
multiLineString
ShapeFactory.MultiLineStringBuilder multiLineString()
(Builder) Constructs a MultiLineString, or possibly the result of that buffered.
-
multiPolygon
ShapeFactory.MultiPolygonBuilder multiPolygon()
(Builder) Constructs a MultiPolygon.
-
-