GEOS: geos::GeometryFactory Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# geos::GeometryFactory Class Reference

Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geometry objects. More...

`#include <geos.h>`

List of all members.

## Public Member Functions
| GeometryFactory ()
| Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0.
| GeometryFactory (const PrecisionModel *pm, int newSRID, CoordinateSequenceFactory *nCoordinateSequenceFactory)
| Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation.
| GeometryFactory (CoordinateSequenceFactory *nCoordinateSequenceFactory)
| Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementation, a double-precision floating PrecisionModel and a spatial-reference ID of 0.
| GeometryFactory (const PrecisionModel *pm)
| Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and the default CoordinateSequence implementation.
| GeometryFactory (const PrecisionModel *pm, int newSRID)
| Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and spatial-reference ID, and the default CoordinateSequence implementation.
| GeometryFactory (const GeometryFactory &gf)
| Copy constructor.
virtual | ~GeometryFactory ()
| Destructor.
Geometry * | toGeometry (const Envelope *envelope) const
| Envelope to Geometry converter.
const PrecisionModel * | getPrecisionModel () const
| Returns the PrecisionModel that Geometries created by this factory will be associated with.
Point * | createPoint () const
| Creates an EMPTY Point.
Point * | createPoint (const Coordinate &coordinate) const
| Creates a Point using the given Coordinate.
Point * | createPoint (CoordinateSequence *coordinates) const
| Creates a Point taking ownership of the given CoordinateSequence.
Point * | createPoint (const CoordinateSequence &coordinates) const
| Creates a Point with a deep-copy of the given CoordinateSequence.
GeometryCollection * | createGeometryCollection () const
| Construct an EMPTY GeometryCollection.
GeometryCollection * | createGeometryCollection (vector< Geometry * > *newGeoms) const
| Construct a GeometryCollection taking ownership of given arguments.
GeometryCollection * | createGeometryCollection (const vector< Geometry * > &newGeoms) const
| Constructs a GeometryCollection with a deep-copy of args.
MultiLineString * | createMultiLineString () const
| Construct an EMPTY MultiLineString.
MultiLineString * | createMultiLineString (vector< Geometry * > *newLines) const
| Construct a MultiLineString taking ownership of given arguments.
MultiLineString * | createMultiLineString (const vector< Geometry * > &fromLines) const
| Construct a MultiLineString with a deep-copy of given arguments.
MultiPolygon * | createMultiPolygon () const
| Construct an EMPTY MultiPolygon.
MultiPolygon * | createMultiPolygon (vector< Geometry * > *newPolys) const
| Construct a MultiPolygon taking ownership of given arguments.
MultiPolygon * | createMultiPolygon (const vector< Geometry * > &fromPolys) const
| Construct a MultiPolygon with a deep-copy of given arguments.
LinearRing * | createLinearRing () const
| Construct an EMPTY LinearRing.
LinearRing * | createLinearRing (CoordinateSequence *newCoords) const
| Construct a LinearRing taking ownership of given arguments.
LinearRing * | createLinearRing (const CoordinateSequence &coordinates) const
| Construct a LinearRing with a deep-copy of given arguments.
MultiPoint * | createMultiPoint () const
| Constructs an EMPTY `MultiPoint`.
MultiPoint * | createMultiPoint (vector< Geometry * > *newPoints) const
| Construct a MultiPoint taking ownership of given arguments.
MultiPoint * | createMultiPoint (const vector< Geometry * > &fromPoints) const
| Construct a MultiPoint with a deep-copy of given arguments.
MultiPoint * | createMultiPoint (const CoordinateSequence &fromCoords) const
| Construct a MultiPoint containing a Point geometry for each Coordinate in the given list.
Polygon * | createPolygon () const
| Construct an EMPTY Polygon.
Polygon * | createPolygon (LinearRing *shell, vector< Geometry * > *holes) const
| Construct a Polygon taking ownership of given arguments.
Polygon * | createPolygon (const LinearRing &shell, const vector< Geometry * > &holes) const
| Construct a Polygon with a deep-copy of given arguments.
LineString * | createLineString () const
| Construct an EMPTY LineString.
LineString * | createLineString (CoordinateSequence *coordinates) const
| Construct a LineString taking ownership of given argument.
LineString * | createLineString (const CoordinateSequence &coordinates) const
| Construct a LineString with a deep-copy of given argument.
Geometry * | buildGeometry (vector< Geometry * > *geoms) const
| Construct the most suitable Geometry using the given Geometries; will take ownership of arguments.
Geometry * | buildGeometry (const vector< Geometry * > &geoms) const
| Construct the most suitable Geometry using the given Geometries; will use a deep-copy of arguments.
Geometry * | createGeometry (const Geometry *g) const
| Returns a clone of given Geometry.
void | destroyGeometry (Geometry *g) const
| Destroy a Geometry, or release it.

## Detailed Description

Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geometry objects.

## Constructor & Destructor Documentation

geos::GeometryFactory::GeometryFactory | ( |  | ) |

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

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

geos::GeometryFactory::GeometryFactory | ( | const PrecisionModel * | pm,
|  | int | newSRID,
|  | CoordinateSequenceFactory * | nCoordinateSequenceFactory |
| ) |  |  |

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

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

geos::GeometryFactory::GeometryFactory | ( | CoordinateSequenceFactory * | nCoordinateSequenceFactory | ) |

Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementation, a double-precision floating PrecisionModel and a spatial-reference ID of 0.

Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementation, a double-precision floating PrecisionModel and a spatial-reference ID of 0.

geos::GeometryFactory::GeometryFactory | ( | const PrecisionModel * | pm | ) |

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

Parameters:

  | pm | the PrecisionModel to use

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

Parameters:

  | precisionModel | the PrecisionModel to use

geos::GeometryFactory::GeometryFactory | ( | const PrecisionModel * | pm,
|  | int | newSRID |
| ) |  |  |

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

Parameters:

  | pm | the PrecisionModel to use
  | newSRID | the SRID to use

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

geos::GeometryFactory::GeometryFactory | ( | const GeometryFactory & | gf | ) |

Copy constructor.

Parameters:

  | gf | the GeometryFactory to clone from

## Member Function Documentation

Geometry * geos::GeometryFactory::toGeometry | ( | const Envelope * | envelope | ) | const

Envelope to Geometry converter.

Converts an Envelope to a Geometry. Returned Geometry can be a Point, a Polygon or an EMPTY geom.

const PrecisionModel * geos::GeometryFactory::getPrecisionModel | ( |  | ) | const

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

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

Point * geos::GeometryFactory::createPoint | ( |  | ) | const

Creates an EMPTY Point.

Creates the EMPTY Point

Point * geos::GeometryFactory::createPoint | ( | const Coordinate & | coordinate | ) | const

Creates a Point using the given Coordinate.

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

Point * geos::GeometryFactory::createPoint | ( | CoordinateSequence * | newCoords | ) | const

Creates a Point taking ownership of the given CoordinateSequence.

Creates a Point using the given CoordinateSequence (must have 1 element)

Parameters:

  | newCoords | contains the single coordinate on which to base this `Point` or `null` to create the empty geometry.

If not null the created Point will take ownership of newCoords.

Point * geos::GeometryFactory::createPoint | ( | const CoordinateSequence & | fromCoords | ) | const

Creates a Point with a deep-copy of the given CoordinateSequence.

Creates a Point using the given CoordinateSequence (must have 1 element)

Parameters:

  | fromCoords | contains the single coordinate on which to base this `Point`.

GeometryCollection * geos::GeometryFactory::createGeometryCollection | ( |  | ) | const

Construct an EMPTY GeometryCollection.

Constructs an EMPTY `GeometryCollection`.

GeometryCollection * geos::GeometryFactory::createGeometryCollection | ( | vector< Geometry * > * | newGeoms | ) | const

Construct a GeometryCollection taking ownership of given arguments.

Constructs a GeometryCollection.

Parameters:

  | newGeoms | The `Geometry`s for this `GeometryCollection`, or `null` or an empty array to create the empty geometry. Elements may be empty `Geometry`s, but not `null`s.

If construction succeed the created object will take ownership of newGeoms vector and elements.

If construction fails "IllegalArgumentException *" is thrown and it is your responsibility to delete newGeoms vector and content.

GeometryCollection * geos::GeometryFactory::createGeometryCollection | ( | const vector< Geometry * > & | fromGeoms | ) | const

Constructs a GeometryCollection with a deep-copy of args.

Parameters:

  | fromGeoms | the `Geometry`s for this `GeometryCollection`, Elements may be empty `Geometry`s, but not `null`s.

fromGeoms vector and elements will be copied.

MultiLineString * geos::GeometryFactory::createMultiLineString | ( |  | ) | const

Construct an EMPTY MultiLineString.

Construct an EMPTY MultiLineString

MultiLineString * geos::GeometryFactory::createMultiLineString | ( | vector< Geometry * > * | newLines | ) | const

Construct a MultiLineString taking ownership of given arguments.

Constructs a `MultiLineString`.

Parameters:

  | newLines | the `LineStrings`s for this `MultiLineString`, or `null` or an empty array to create the empty geometry. Elements may be empty `LineString`s, but not `null`s.

Constructed object will take ownership of the vector and its elements.

MultiLineString * geos::GeometryFactory::createMultiLineString | ( | const vector< Geometry * > & | fromLines | ) | const

Construct a MultiLineString with a deep-copy of given arguments.

Constructs a `MultiLineString`.

Parameters:

  | fromLines | the `LineStrings`s for this `MultiLineString`, or an empty array to create the empty geometry. Elements may be empty `LineString`s, but not `null`s.

Constructed object will copy the vector and its elements.

MultiPolygon * geos::GeometryFactory::createMultiPolygon | ( | vector< Geometry * > * | newPolys | ) | const

Construct a MultiPolygon taking ownership of given arguments.

Parameters:

  | newPolys | the `Polygon`s for this `MultiPolygon`, or `null` or an empty array to create the empty geometry. Elements may be empty `Polygon`s, but not `null`s. The polygons must conform to the assertions specified in the OpenGIS Simple Features Specification for SQL .

Constructed object will take ownership of the vector and its elements.

MultiPolygon * geos::GeometryFactory::createMultiPolygon | ( | const vector< Geometry * > & | fromPolys | ) | const

Construct a MultiPolygon with a deep-copy of given arguments.

Parameters:

  | fromPolys | the `Polygon`s for this `MultiPolygon`, or an empty array to create the empty geometry. Elements may be empty `Polygon`s, but not `null`s. The polygons must conform to the assertions specified in the OpenGIS Simple Features Specification for SQL .

Constructed object will copy the vector and its elements.

LinearRing * geos::GeometryFactory::createLinearRing | ( |  | ) | const

Construct an EMPTY LinearRing.

Creates an EMPTY LinearRing

LinearRing * geos::GeometryFactory::createLinearRing | ( | CoordinateSequence * | newCoords | ) | const

Construct a LinearRing taking ownership of given arguments.

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:

  | newCoords | a CoordinateSequence possibly empty, or null.

LinearRing will take ownership of coordinates.

MultiPoint * geos::GeometryFactory::createMultiPoint | ( |  | ) | const

Constructs an EMPTY `MultiPoint`.

Creates an EMPTY MultiPoint

MultiPoint * geos::GeometryFactory::createMultiPoint | ( | vector< Geometry * > * | newPoints | ) | const

Construct a MultiPoint taking ownership of given arguments.

Constructs a `MultiPoint`.

Parameters:

  | newPoints | the `Point`s for this `MultiPoint`, or `null` or an empty array to create the empty geometry. Elements may be empty `Point`s, but not `null`s.

Constructed object will take ownership of the vector and its elements.

MultiPoint * geos::GeometryFactory::createMultiPoint | ( | const vector< Geometry * > & | fromPoints | ) | const

Construct a MultiPoint with a deep-copy of given arguments.

Constructs a `MultiPoint`.

Parameters:

  | fromPoints | the `Point`s for this `MultiPoint`, or an empty array to create the empty geometry. Elements may be empty `Point`s, but not `null`s.

Constructed object will copy the vector and its elements.

MultiPoint * geos::GeometryFactory::createMultiPoint | ( | const CoordinateSequence & | fromCoords | ) | const

Construct a MultiPoint containing a Point geometry for each Coordinate in the given list.

Creates a MultiPoint using the given CoordinateSequence.

Parameters:

  | fromCoords | a CoordinateSequence used for Points construction.

Polygon * geos::GeometryFactory::createPolygon | ( |  | ) | const

Construct an EMPTY Polygon.

Constructs an EMPTY Polygon

Polygon * geos::GeometryFactory::createPolygon | ( | LinearRing * | shell,
|  | vector< Geometry * > * | holes |
| ) |  |  | const

Construct a Polygon taking ownership of given arguments.

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.

Polygon * geos::GeometryFactory::createPolygon | ( | const LinearRing & | shell,
|  | const vector< Geometry * > & | holes |
| ) |  |  | const

Construct a Polygon with a deep-copy of given arguments.

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

Parameters:

  | shell | the outer boundary of the new `Polygon`
  | holes | the inner boundaries of the new `Polygon` Note that these must be LinearRings

LineString * geos::GeometryFactory::createLineString | ( |  | ) | const

Construct an EMPTY LineString.

Constructs an EMPTY LineString

LineString * geos::GeometryFactory::createLineString | ( | CoordinateSequence * | newCoords | ) | const

Construct a LineString taking ownership of given argument.

Constructs a `LineString` taking ownership of the given CoordinateSequence.

Parameters:

  | newCoords | the list of coordinates making up the linestring, or `null` to create the empty geometry. Consecutive points may not be equal. Created object will take ownership of CoordinateSequence.

LineString * geos::GeometryFactory::createLineString | ( | const CoordinateSequence & | fromCoords | ) | const

Construct a LineString with a deep-copy of given argument.

Constructs a `LineString` copying the given CoordinateSequence.

Parameters:

  | fromCoords | the list of coordinates making up the linestring. Consecutive points may not be equal.

Geometry * geos::GeometryFactory::buildGeometry | ( | vector< Geometry * > * | newGeoms | ) | const

Construct the most suitable Geometry using the given Geometries; will take ownership of arguments.

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:

  | newGeoms | the `Geometry`s to combine

Returns:
  A `Geometry` of the "smallest", "most type-specific" class that can contain the elements of `geomList`.

NOTE: the returned Geometry will take ownership of the given vector AND its elements

Geometry * geos::GeometryFactory::buildGeometry | ( | const vector< Geometry * > & | fromGeoms | ) | const

Construct the most suitable Geometry using the given Geometries; will use a deep-copy of arguments.

This function does the same thing of the omonimouse function taking vector pointer instead of reference. The difference is that this version will copy needed data leaving ownership to the caller.

Geometry * geos::GeometryFactory::createGeometry | ( | const Geometry * | g | ) | const

Returns a clone of given Geometry.

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

void geos::GeometryFactory::destroyGeometry | ( | Geometry * | g | ) | const

Destroy a Geometry, or release it.

Destroy a Geometry, or release it.

The documentation for this class was generated from the following files:

- geom.h
- GeometryFactory.cpp