public class GeometryFactory extends Objectimplements Serializable
Note that the factory constructor methods do not change the input coordinates in any way. In particular, they are not rounded to the supplied PrecisionModel. It is assumed that input Coordinates meet the given precision.
| Constructor and Description |
|---|
GeometryFactory()
Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0.
|
GeometryFactory(CoordinateSequenceFactory
Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementation, a double-precision floating PrecisionModel and a spatial-reference ID of 0.
|
GeometryFactory(PrecisionModel
Constructs a GeometryFactory that generates Geometries having the given
PrecisionModel and the default CoordinateSequence implementation.
|
GeometryFactory(PrecisionModel
Constructs a GeometryFactory that generates Geometries having the given
PrecisionModel and spatial-reference ID, and the default CoordinateSequence implementation.
|
GeometryFactory(PrecisionModel
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation.
|
| Modifier and Type | Method and Description |
|---|---|
Geometry |
buildGeometry(Collection
Build an appropriate
Geometry,
MultiGeometry, or
GeometryCollection to contain the
Geometrys in it.
|
Geometry |
createGeometry(Geometry
Creates a deep copy of the input
Geometry.
|
GeometryCollection |
createGeometryCollection(Geometry
Creates a GeometryCollection using the given Geometries; a null or empty array will create an empty GeometryCollection.
|
LinearRing |
createLinearRing(Coordinate
Creates a
LinearRing using the given
Coordinates.
|
LinearRing |
createLinearRing(CoordinateSequence
Creates a
LinearRing using the given
CoordinateSequence.
|
LineString |
createLineString(Coordinate
Creates a LineString using the given Coordinates.
|
LineString |
createLineString(CoordinateSequence
Creates a LineString using the given CoordinateSequence.
|
MultiLineString |
createMultiLineString(LineString
Creates a MultiLineString using the given LineStrings; a null or empty array will create an empty MultiLineString.
|
MultiPoint |
createMultiPoint(Coordinate
Creates a
MultiPoint using the given
Coordinates.
|
MultiPoint |
createMultiPoint(CoordinateSequence
Creates a
MultiPoint using the points in the given
CoordinateSequence.
|
MultiPoint |
createMultiPoint(Point
Creates a
MultiPoint using the given
Points.
|
MultiPolygon |
createMultiPolygon(Polygon
Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon.
|
Point |
createPoint(Coordinate
Creates a Point using the given Coordinate.
|
Point |
createPoint(CoordinateSequence
Creates a Point using the given CoordinateSequence; a null or empty CoordinateSequence will create an empty Point.
|
static Point |
createPointFromInternalCoord(Coordinate
|
Polygon |
createPolygon(Coordinate
Constructs a
Polygon with the given exterior boundary.
|
Polygon |
createPolygon(CoordinateSequence
Constructs a
Polygon with the given exterior boundary.
|
Polygon |
createPolygon(LinearRing
Constructs a
Polygon with the given exterior boundary.
|
Polygon |
createPolygon(LinearRing
Constructs a
Polygon with the given exterior boundary and interior boundaries.
|
CoordinateSequenceFactory |
getCoordinateSequenceFactory()
|
PrecisionModel |
getPrecisionModel()
Returns the PrecisionModel that Geometries created by this factory will be associated with.
|
int |
getSRID()
Gets the SRID value defined for this factory.
|
Geometry |
toGeometry(Envelope
Creates a
Geometry with the same extent as the given envelope.
|
static Geometry |
toGeometryArray(Collection
Converts the
List to an array.
|
static LinearRing |
toLinearRingArray(Collection
Converts the
List to an array.
|
static LineString |
toLineStringArray(Collection
Converts the
List to an array.
|
static MultiLineString |
toMultiLineStringArray(Collection
Converts the
List to an array.
|
static MultiPoint |
toMultiPointArray(Collection
Converts the
List to an array.
|
static MultiPolygon |
toMultiPolygonArray(Collection
Converts the
List to an array.
|
static Point |
toPointArray(Collection
Converts the
List to an array.
|
static Polygon |
toPolygonArray(Collection
Converts the
List to an array.
|
public GeometryFactory(PrecisionModelprecisionModel, int SRID, CoordinateSequenceFactory coordinateSequenceFactory)
public GeometryFactory(CoordinateSequenceFactorycoordinateSequenceFactory)
public GeometryFactory(PrecisionModelprecisionModel)
PrecisionModel and the default CoordinateSequence implementation.
precisionModel - the PrecisionModel to use
public GeometryFactory(PrecisionModelprecisionModel, int SRID)
PrecisionModel and spatial-reference ID, and the default CoordinateSequence implementation.
precisionModel - the PrecisionModel to use
SRID - the SRID to use
public GeometryFactory()
public static PointcreatePointFromInternalCoord(Coordinate coord, Geometry exemplar)
public static Point[] toPointArray(Collection points)
List to an array.
points - the
List of Points to convert
List in array format
public static Geometry[] toGeometryArray(Collection geometries)
List to an array.
geometries - the list of
Geometry's to convert
List in array format
public static LinearRing[] toLinearRingArray(Collection linearRings)
List to an array.
linearRings - the
List of LinearRings to convert
List in array format
public static LineString[] toLineStringArray(Collection lineStrings)
List to an array.
lineStrings - the
List of LineStrings to convert
List in array format
public static Polygon[] toPolygonArray(Collection polygons)
List to an array.
polygons - the
List of Polygons to convert
List in array format
public static MultiPolygon[] toMultiPolygonArray(Collection multiPolygons)
List to an array.
multiPolygons - the
List of MultiPolygons to convert
List in array format
public static MultiLineString[] toMultiLineStringArray(Collection multiLineStrings)
List to an array.
multiLineStrings - the
List of MultiLineStrings to convert
List in array format
public static MultiPoint[] toMultiPointArray(Collection multiPoints)
List to an array.
multiPoints - the
List of MultiPoints to convert
List in array format
public GeometrytoGeometry(Envelope envelope)
Geometry with the same extent as the given envelope. The Geometry returned is guaranteed to be valid. To provide this behaviour, the following cases occur:
If the Envelope is:
Point Point LineString Polygon> whose points are (minx, miny), (minx, maxy), (maxx, maxy), (maxx, miny), (minx, miny). envelope - the
Envelope to convert
Point (for null
Envelopes), a
Point (when min x = max x and min y = max y) or a
Polygon (in all other cases)
public PrecisionModelgetPrecisionModel()
public PointcreatePoint(Coordinate coordinate)
coordinate - a Coordinate, or null
public PointcreatePoint(CoordinateSequence coordinates)
coordinates - a CoordinateSequence (possibly empty), or null
public MultiLineStringcreateMultiLineString(LineString [] lineStrings)
lineStrings - LineStrings, each of which may be empty but not null
public GeometryCollectioncreateGeometryCollection(Geometry [] geometries)
geometries - an array of Geometries, each of which may be empty but not null, or null
public MultiPolygoncreateMultiPolygon(Polygon [] polygons)
polygons - Polygons, each of which may be empty but not null
public LinearRingcreateLinearRing(Coordinate [] coordinates)
LinearRing using the given
Coordinates. A null or empty array creates an empty LinearRing. The points must form a closed and simple linestring.
coordinates - an array without null elements, or an empty array, or null
IllegalArgumentException - if the ring is not closed, or has too few points
public LinearRingcreateLinearRing(CoordinateSequence coordinates)
LinearRing using the given
CoordinateSequence. A null or empty array creates an empty LinearRing. The points must form a closed and simple linestring.
coordinates - a CoordinateSequence (possibly empty), or null
IllegalArgumentException - if the ring is not closed, or has too few points
public MultiPointcreateMultiPoint(Point [] point)
MultiPoint using the given
Points. A null or empty array will create an empty MultiPoint.
point - an array of Points (without null elements), or an empty array, or
null
public MultiPointcreateMultiPoint(Coordinate [] coordinates)
MultiPoint using the given
Coordinates. A null or empty array will create an empty MultiPoint.
coordinates - an array (without null elements), or an empty array, or
null
public MultiPointcreateMultiPoint(CoordinateSequence coordinates)
MultiPoint using the points in the given
CoordinateSequence. A
null or empty CoordinateSequence creates an empty MultiPoint.
coordinates - a CoordinateSequence (possibly empty), or
null
public PolygoncreatePolygon(LinearRing shell, LinearRing [] holes)
Polygon with the given exterior boundary and interior boundaries.
shell - the outer boundary of the new
Polygon, or
null or an empty
LinearRing if the empty geometry is to be created.
holes - the inner boundaries of the new
Polygon, or
null or empty
LinearRing s if the empty geometry is to be created.
IllegalArgumentException - if a ring is invalid
public PolygoncreatePolygon(CoordinateSequence coordinates)
Polygon with the given exterior boundary.
shell - the outer boundary of the new
Polygon, or
null or an empty
LinearRing if the empty geometry is to be created.
IllegalArgumentException - if the boundary ring is invalid
public PolygoncreatePolygon(Coordinate [] coordinates)
Polygon with the given exterior boundary.
shell - the outer boundary of the new
Polygon, or
null or an empty
LinearRing if the empty geometry is to be created.
IllegalArgumentException - if the boundary ring is invalid
public PolygoncreatePolygon(LinearRing shell)
Polygon with the given exterior boundary.
shell - the outer boundary of the new
Polygon, or
null or an empty
LinearRing if the empty geometry is to be created.
IllegalArgumentException - if the boundary ring is invalid
public GeometrybuildGeometry(Collection geomList)
Geometry,
MultiGeometry, or
GeometryCollection to contain the
Geometrys in it. For example:
geomList contains a single Polygon, the Polygon is returned. geomList contains several Polygons, a MultiPolygon is returned. geomList contains some Polygons and some LineStrings, a GeometryCollection is returned. geomList is empty, an empty GeometryCollection is returned geomList - the
Geometrys to combine
Geometry of the "smallest", "most type-specific" class that can contain the elements of
geomList .
public LineStringcreateLineString(Coordinate [] coordinates)
coordinates - an array without null elements, or an empty array, or null
public LineStringcreateLineString(CoordinateSequence coordinates)
coordinates - a CoordinateSequence (possibly empty), or null
public GeometrycreateGeometry(Geometry g)
Geometry. The
CoordinateSequenceFactory defined for this factory is used to copy the
CoordinateSequences of the input geometry.
This is a convenient way to change the CoordinateSequence used to represent a geometry, or to change the factory used for a geometry.
Geometry can also be used to make a deep copy, but it does not allow changing the CoordinateSequence type.
Geometry.clone()
public int getSRID()
public CoordinateSequenceFactorygetCoordinateSequenceFactory()