Overview | Package | Class | Tree | Deprecated | Index | Help
| JTS Topology Suite - v 1.12
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.vividsolutions.jts.geom
Class GeometryFactory

    java.lang.Object
      com.vividsolutions.jts.geom.GeometryFactory

All Implemented Interfaces:
  java.io.Serializable

    public class GeometryFactory

extends java.lang.Object
implements java.io.Serializable

Supplies a set of utility methods for building Geometry objects from lists of Coordinates.

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.

Version:
  1.7
See Also:
  Serialized Form

Constructor Summary
`GeometryFactory()` Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0.
`GeometryFactory(CoordinateSequenceFactory 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 precisionModel)` Constructs a GeometryFactory that generates Geometries having the given `PrecisionModel` and the default CoordinateSequence implementation.
`GeometryFactory(PrecisionModel precisionModel, int SRID)` Constructs a GeometryFactory that generates Geometries having the given `PrecisionModel` and spatial-reference ID, and the default CoordinateSequence implementation.
`GeometryFactory(PrecisionModel precisionModel, int SRID, CoordinateSequenceFactory coordinateSequenceFactory)` Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation.

Method Summary
`Geometry` | `buildGeometry(java.util.Collection geomList)` Build an appropriate `Geometry`, `MultiGeometry`, or `GeometryCollection` to contain the `Geometry`s in it.
`Geometry` | `createGeometry(Geometry g)`
`GeometryCollection` | `createGeometryCollection(Geometry[] geometries)` Creates a GeometryCollection using the given Geometries; a null or empty array will create an empty GeometryCollection.
`LinearRing` | `createLinearRing(Coordinate[] coordinates)` Creates a `LinearRing` using the given `Coordinate`s.
`LinearRing` | `createLinearRing(CoordinateSequence coordinates)` Creates a `LinearRing` using the given `CoordinateSequence`.
`LineString` | `createLineString(Coordinate[] coordinates)` Creates a LineString using the given Coordinates; a null or empty array will create an empty LineString.
`LineString` | `createLineString(CoordinateSequence coordinates)` Creates a LineString using the given CoordinateSequence; a null or empty CoordinateSequence will create an empty LineString.
`MultiLineString` | `createMultiLineString(LineString[] lineStrings)` Creates a MultiLineString using the given LineStrings; a null or empty array will create an empty MultiLineString.
`MultiPoint` | `createMultiPoint(Coordinate[] coordinates)` Creates a `MultiPoint` using the given `Coordinate`s.
`MultiPoint` | `createMultiPoint(CoordinateSequence coordinates)` Creates a MultiPoint using the given CoordinateSequence.
`MultiPoint` | `createMultiPoint(Point[] point)` Creates a `MultiPoint` using the given `Point`s.
`MultiPolygon` | `createMultiPolygon(Polygon[] polygons)` Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon.
`Point` | `createPoint(Coordinate coordinate)` Creates a Point using the given Coordinate; a null Coordinate will create an empty Geometry.
`Point` | `createPoint(CoordinateSequence coordinates)` Creates a Point using the given CoordinateSequence; a null or empty CoordinateSequence will create an empty Point.
`static Point` | `createPointFromInternalCoord(Coordinate coord, Geometry exemplar)`
`Polygon` | `createPolygon(LinearRing shell, LinearRing[] holes)` 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()`
`Geometry` | `toGeometry(Envelope envelope)` Creates a `Geometry` with the same extent as the given envelope.
`static Geometry[]` | `toGeometryArray(java.util.Collection geometries)` Converts the `List` to an array.
`static LinearRing[]` | `toLinearRingArray(java.util.Collection linearRings)` Converts the `List` to an array.
`static LineString[]` | `toLineStringArray(java.util.Collection lineStrings)` Converts the `List` to an array.
`static MultiLineString[]` | `toMultiLineStringArray(java.util.Collection multiLineStrings)` Converts the `List` to an array.
`static MultiPoint[]` | `toMultiPointArray(java.util.Collection multiPoints)` Converts the `List` to an array.
`static MultiPolygon[]` | `toMultiPolygonArray(java.util.Collection multiPolygons)` Converts the `List` to an array.
`static Point[]` | `toPointArray(java.util.Collection points)` Converts the `List` to an array.
`static Polygon[]` | `toPolygonArray(java.util.Collection polygons)` Converts the `List` to an array.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GeometryFactory

    public GeometryFactory(PrecisionModel precisionModel,
                           int SRID,
                           CoordinateSequenceFactory coordinateSequenceFactory)

  Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation.

### GeometryFactory

    public GeometryFactory(CoordinateSequenceFactory 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

    public GeometryFactory(PrecisionModel precisionModel)

  Constructs a GeometryFactory that generates Geometries having the given `PrecisionModel` and the default CoordinateSequence implementation.

  Parameters:
    `precisionModel` - the PrecisionModel to use

### GeometryFactory

    public GeometryFactory(PrecisionModel precisionModel,
                           int SRID)

  Constructs a GeometryFactory that generates Geometries having the given `PrecisionModel` and spatial-reference ID, and the default CoordinateSequence implementation.

  Parameters:
    `precisionModel` - the PrecisionModel to use
    `SRID` - the SRID to use

### GeometryFactory

    public GeometryFactory()

  Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0.

Method Detail

### createPointFromInternalCoord

    public static Point createPointFromInternalCoord(Coordinate coord,
                                                     Geometry exemplar)

### toPointArray

    public static Point[] toPointArray(java.util.Collection points)

  Converts the `List` to an array.

  Parameters:
    `points` - the `List` of Points to convert
  Returns:
    the `List` in array format

### toGeometryArray

    public static Geometry[] toGeometryArray(java.util.Collection geometries)

  Converts the `List` to an array.

  Parameters:
    `geometries` - the list of `Geometry's` to convert
  Returns:
    the `List` in array format

### toLinearRingArray

    public static LinearRing[] toLinearRingArray(java.util.Collection linearRings)

  Converts the `List` to an array.

  Parameters:
    `linearRings` - the `List` of LinearRings to convert
  Returns:
    the `List` in array format

### toLineStringArray

    public static LineString[] toLineStringArray(java.util.Collection lineStrings)

  Converts the `List` to an array.

  Parameters:
    `lineStrings` - the `List` of LineStrings to convert
  Returns:
    the `List` in array format

### toPolygonArray

    public static Polygon[] toPolygonArray(java.util.Collection polygons)

  Converts the `List` to an array.

  Parameters:
    `polygons` - the `List` of Polygons to convert
  Returns:
    the `List` in array format

### toMultiPolygonArray

    public static MultiPolygon[] toMultiPolygonArray(java.util.Collection multiPolygons)

  Converts the `List` to an array.

  Parameters:
    `multiPolygons` - the `List` of MultiPolygons to convert
  Returns:
    the `List` in array format

### toMultiLineStringArray

    public static MultiLineString[] toMultiLineStringArray(java.util.Collection multiLineStrings)

  Converts the `List` to an array.

  Parameters:
    `multiLineStrings` - the `List` of MultiLineStrings to convert
  Returns:
    the `List` in array format

### toMultiPointArray

    public static MultiPoint[] toMultiPointArray(java.util.Collection multiPoints)

  Converts the `List` to an array.

  Parameters:
    `multiPoints` - the `List` of MultiPoints to convert
  Returns:
    the `List` in array format

### toGeometry

    public Geometry toGeometry(Envelope envelope)

  Creates a `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:

  - null : returns an empty `Point`
  - a point : returns a non-empty `Point`
  - a line : returns a two-point `LineString`
  - a rectangle : returns a `Polygon`> whose points are (minx, miny), (minx, maxy), (maxx, maxy), (maxx, miny), (minx, miny).

  Parameters:
    `envelope` - the `Envelope` to convert
  Returns:
    an empty `Point` (for null `Envelope`s), a `Point` (when min x = max x and min y = max y) or a `Polygon` (in all other cases)

### getPrecisionModel

    public PrecisionModel getPrecisionModel()

  Returns the PrecisionModel that Geometries created by this factory will be associated with.

### createPoint

    public Point createPoint(Coordinate coordinate)

  Creates a Point using the given Coordinate; a null Coordinate will create an empty Geometry.

### createPoint

    public Point createPoint(CoordinateSequence coordinates)

  Creates a Point using the given CoordinateSequence; a null or empty CoordinateSequence will create an empty Point.

### createMultiLineString

    public MultiLineString createMultiLineString(LineString[] lineStrings)

  Creates a MultiLineString using the given LineStrings; a null or empty array will create an empty MultiLineString.

  Parameters:
    `lineStrings` - LineStrings, each of which may be empty but not null

### createGeometryCollection

    public GeometryCollection createGeometryCollection(Geometry[] geometries)

  Creates a GeometryCollection using the given Geometries; a null or empty array will create an empty GeometryCollection.

  Parameters:
    `geometries` - Geometries, each of which may be empty but not null

### createMultiPolygon

    public MultiPolygon createMultiPolygon(Polygon[] polygons)

  Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon. The polygons must conform to the assertions specified in the OpenGIS Simple Features Specification for SQL.

  Parameters:
    `polygons` - Polygons, each of which may be empty but not null

### createLinearRing

    public LinearRing createLinearRing(Coordinate[] coordinates)

  Creates a `LinearRing` using the given `Coordinate`s. A null or empty array will create an empty LinearRing. The points must form a closed and simple linestring. Consecutive points must not be equal.

  Parameters:
    `coordinates` - an array without null elements, or an empty array, or null

### createLinearRing

    public LinearRing createLinearRing(CoordinateSequence coordinates)

  Creates a `LinearRing` using the given `CoordinateSequence`. A null or empty CoordinateSequence will create an empty LinearRing. The points must form a closed and simple linestring. Consecutive points must not be equal.

  Parameters:
    `coordinates` - a CoordinateSequence possibly empty, or null
  Throws:
    `java.lang.IllegalArgumentException` - if the ring is not closed, or has too few points

### createMultiPoint

    public MultiPoint createMultiPoint(Point[] point)

  Creates a `MultiPoint` using the given `Point`s. A null or empty array will create an empty MultiPoint.

  Parameters:
    `point` - an array of Points (without null elements), or an empty array, or `null`
  Returns:
    a MultiPoint object

### createMultiPoint

    public MultiPoint createMultiPoint(Coordinate[] coordinates)

  Creates a `MultiPoint` using the given `Coordinate`s. A null or empty array will create an empty MultiPoint.

  Parameters:
    `coordinates` - an array (without null elements), or an empty array, or `null`
  Returns:
    a MultiPoint object

### createMultiPoint

    public MultiPoint createMultiPoint(CoordinateSequence coordinates)

  Creates a MultiPoint using the given CoordinateSequence. A a null or empty CoordinateSequence will create an empty MultiPoint.

  Parameters:
    `coordinates` - a CoordinateSequence (possibly empty), or `null`
  Returns:
    a MultiPoint object

### createPolygon

    public Polygon createPolygon(LinearRing shell,
                                 LinearRing[] holes)

  Constructs a `Polygon` with the given exterior boundary and interior boundaries.

  Parameters:
    `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.
  Throws:
    `java.lang.IllegalArgumentException` - if a ring is invalid

### buildGeometry

    public Geometry buildGeometry(java.util.Collection geomList)

  Build an appropriate `Geometry`, `MultiGeometry`, or `GeometryCollection` to contain the `Geometry`s in it. For example:
  - If `geomList` contains a single `Polygon`, the `Polygon` is returned.
  - If `geomList` contains several `Polygon`s, a `MultiPolygon` is returned.
  - If `geomList` contains some `Polygon`s and some `LineString`s, a `GeometryCollection` is returned.
  - If `geomList` is empty, an empty `GeometryCollection` is returned
  Note that this method does not "flatten" Geometries in the input, and hence if any MultiGeometries are contained in the input a GeometryCollection containing them will be returned.

  Parameters:
    `geomList` - the `Geometry`s to combine
  Returns:
    a `Geometry` of the "smallest", "most type-specific" class that can contain the elements of `geomList` .

### createLineString

    public LineString createLineString(Coordinate[] coordinates)

  Creates a LineString using the given Coordinates; a null or empty array will create an empty LineString. Consecutive points must not be equal.

  Parameters:
    `coordinates` - an array without null elements, or an empty array, or null

### createLineString

    public LineString createLineString(CoordinateSequence coordinates)

  Creates a LineString using the given CoordinateSequence; a null or empty CoordinateSequence will create an empty LineString. Consecutive points must not be equal.

  Parameters:
    `coordinates` - a CoordinateSequence possibly empty, or null

### createGeometry

    public Geometry createGeometry(Geometry g)

  Returns:
    a clone of g based on a CoordinateSequence created by this GeometryFactory's CoordinateSequenceFactory

### getSRID

    public int getSRID()

### getCoordinateSequenceFactory

    public CoordinateSequenceFactory getCoordinateSequenceFactory()

Overview | Package | Class | Tree | Deprecated | Index | Help
| JTS Topology Suite - v 1.12
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD