GEOS
3.9.1dev
|
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geometry objects. More...
#include <GeometryFactory.h>
Classes | |
struct | GeometryFactoryDeleter |
Public Types | |
using | Ptr = std::unique_ptr< GeometryFactory, GeometryFactoryDeleter > |
Public Member Functions | |
Point * | createPointFromInternalCoord (const Coordinate *coord, const Geometry *exemplar) const |
std::unique_ptr< Geometry > | toGeometry (const Envelope *envelope) const |
const PrecisionModel * | getPrecisionModel () const |
Returns the PrecisionModel that Geometries created by this factory will be associated with. More... | |
std::unique_ptr< Point > | createPoint (std::size_t coordinateDimension=2) const |
Creates an EMPTY Point. More... | |
Point * | createPoint (const Coordinate &coordinate) const |
Creates a Point using the given Coordinate. More... | |
Point * | createPoint (CoordinateSequence *coordinates) const |
Creates a Point taking ownership of the given CoordinateSequence. More... | |
Point * | createPoint (const CoordinateSequence &coordinates) const |
Creates a Point with a deep-copy of the given CoordinateSequence. More... | |
std::unique_ptr< GeometryCollection > | createGeometryCollection () const |
Construct an EMPTY GeometryCollection. More... | |
std::unique_ptr< Geometry > | createEmptyGeometry () const |
Construct the EMPTY Geometry. More... | |
GeometryCollection * | createGeometryCollection (std::vector< Geometry * > *newGeoms) const |
Construct a GeometryCollection taking ownership of given arguments. More... | |
template<typename T > | |
std::unique_ptr< GeometryCollection > | createGeometryCollection (std::vector< std::unique_ptr< T >> &&newGeoms) const |
GeometryCollection * | createGeometryCollection (const std::vector< const Geometry * > &newGeoms) const |
Constructs a GeometryCollection with a deep-copy of args. More... | |
std::unique_ptr< MultiLineString > | createMultiLineString () const |
Construct an EMPTY MultiLineString. More... | |
MultiLineString * | createMultiLineString (std::vector< Geometry * > *newLines) const |
Construct a MultiLineString taking ownership of given arguments. More... | |
MultiLineString * | createMultiLineString (const std::vector< const Geometry * > &fromLines) const |
Construct a MultiLineString with a deep-copy of given arguments. More... | |
std::unique_ptr< MultiLineString > | createMultiLineString (std::vector< std::unique_ptr< LineString >> &&fromLines) const |
std::unique_ptr< MultiLineString > | createMultiLineString (std::vector< std::unique_ptr< Geometry >> &&fromLines) const |
std::unique_ptr< MultiPolygon > | createMultiPolygon () const |
Construct an EMPTY MultiPolygon. More... | |
MultiPolygon * | createMultiPolygon (std::vector< Geometry * > *newPolys) const |
Construct a MultiPolygon taking ownership of given arguments. More... | |
MultiPolygon * | createMultiPolygon (const std::vector< const Geometry * > &fromPolys) const |
Construct a MultiPolygon with a deep-copy of given arguments. More... | |
std::unique_ptr< MultiPolygon > | createMultiPolygon (std::vector< std::unique_ptr< Polygon >> &&fromPolys) const |
std::unique_ptr< MultiPolygon > | createMultiPolygon (std::vector< std::unique_ptr< Geometry >> &&fromPolys) const |
std::unique_ptr< LinearRing > | createLinearRing () const |
Construct an EMPTY LinearRing. More... | |
LinearRing * | createLinearRing (CoordinateSequence *newCoords) const |
Construct a LinearRing taking ownership of given arguments. More... | |
std::unique_ptr< LinearRing > | createLinearRing (std::unique_ptr< CoordinateSequence > &&newCoords) const |
LinearRing * | createLinearRing (const CoordinateSequence &coordinates) const |
Construct a LinearRing with a deep-copy of given arguments. More... | |
std::unique_ptr< MultiPoint > | createMultiPoint () const |
Constructs an EMPTY MultiPoint . More... | |
MultiPoint * | createMultiPoint (std::vector< Geometry * > *newPoints) const |
Construct a MultiPoint taking ownership of given arguments. More... | |
std::unique_ptr< MultiPoint > | createMultiPoint (std::vector< std::unique_ptr< Point >> &&newPoints) const |
std::unique_ptr< MultiPoint > | createMultiPoint (std::vector< std::unique_ptr< Geometry >> &&newPoints) const |
MultiPoint * | createMultiPoint (const std::vector< const Geometry * > &fromPoints) const |
Construct a MultiPoint with a deep-copy of given arguments. More... | |
MultiPoint * | createMultiPoint (const CoordinateSequence &fromCoords) const |
Construct a MultiPoint containing a Point geometry for each Coordinate in the given list. More... | |
MultiPoint * | createMultiPoint (const std::vector< Coordinate > &fromCoords) const |
Construct a MultiPoint containing a Point geometry for each Coordinate in the given vector. More... | |
std::unique_ptr< Polygon > | createPolygon (std::size_t coordinateDimension=2) const |
Construct an EMPTY Polygon. More... | |
Polygon * | createPolygon (LinearRing *shell, std::vector< LinearRing * > *holes) const |
Construct a Polygon taking ownership of given arguments. More... | |
std::unique_ptr< Polygon > | createPolygon (std::unique_ptr< LinearRing > &&shell) const |
std::unique_ptr< Polygon > | createPolygon (std::unique_ptr< LinearRing > &&shell, std::vector< std::unique_ptr< LinearRing >> &&holes) const |
Polygon * | createPolygon (const LinearRing &shell, const std::vector< LinearRing * > &holes) const |
Construct a Polygon with a deep-copy of given arguments. More... | |
std::unique_ptr< LineString > | createLineString (std::size_t coordinateDimension=2) const |
Construct an EMPTY LineString. More... | |
std::unique_ptr< LineString > | createLineString (const LineString &ls) const |
Copy a LineString. More... | |
LineString * | createLineString (CoordinateSequence *coordinates) const |
Construct a LineString taking ownership of given argument. More... | |
std::unique_ptr< LineString > | createLineString (std::unique_ptr< CoordinateSequence > &&coordinates) const |
LineString * | createLineString (const CoordinateSequence &coordinates) const |
Construct a LineString with a deep-copy of given argument. More... | |
std::unique_ptr< Geometry > | createEmpty (int dimension) const |
Geometry * | buildGeometry (std::vector< Geometry * > *geoms) const |
std::unique_ptr< Geometry > | buildGeometry (std::vector< std::unique_ptr< Geometry >> &&geoms) const |
std::unique_ptr< Geometry > | buildGeometry (std::vector< std::unique_ptr< Point >> &&geoms) const |
std::unique_ptr< Geometry > | buildGeometry (std::vector< std::unique_ptr< LineString >> &&geoms) const |
std::unique_ptr< Geometry > | buildGeometry (std::vector< std::unique_ptr< Polygon >> &&geoms) const |
template<class T > | |
std::unique_ptr< Geometry > | buildGeometry (T from, T toofar) const |
See buildGeometry(std::vector<Geometry *>&) for semantics. More... | |
Geometry * | buildGeometry (const std::vector< const Geometry * > &geoms) const |
This function does the same thing of the omonimouse function taking vector pointer instead of reference. More... | |
int | getSRID () const |
const CoordinateSequenceFactory * | getCoordinateSequenceFactory () const |
Returns the CoordinateSequenceFactory associated with this GeometryFactory. More... | |
Geometry * | createGeometry (const Geometry *g) const |
Returns a clone of given Geometry. More... | |
void | destroyGeometry (Geometry *g) const |
Destroy a Geometry, or release it. More... | |
void | destroy () |
Static Public Member Functions | |
static GeometryFactory::Ptr | create () |
Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0. More... | |
static GeometryFactory::Ptr | create (const PrecisionModel *pm, int newSRID, CoordinateSequenceFactory *nCoordinateSequenceFactory) |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation. More... | |
static GeometryFactory::Ptr | create (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. More... | |
static GeometryFactory::Ptr | create (const PrecisionModel *pm) |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and the default CoordinateSequence implementation. More... | |
static GeometryFactory::Ptr | create (const PrecisionModel *pm, int newSRID) |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and spatial-reference ID, and the default CoordinateSequence implementation. More... | |
static GeometryFactory::Ptr | create (const GeometryFactory &gf) |
Copy constructor. More... | |
static const GeometryFactory * | getDefaultInstance () |
Return a pointer to the default GeometryFactory. This is a global shared object instantiated using default constructor. More... | |
Protected Member Functions | |
GeometryFactory () | |
Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0. More... | |
GeometryFactory (const PrecisionModel *pm, int newSRID, CoordinateSequenceFactory *nCoordinateSequenceFactory) | |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation. More... | |
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. More... | |
GeometryFactory (const PrecisionModel *pm) | |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and the default CoordinateSequence implementation. More... | |
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. More... | |
GeometryFactory (const GeometryFactory &gf) | |
Copy constructor. More... | |
virtual | ~GeometryFactory () |
Destructor. More... | |
Private Member Functions | |
void | addRef () const |
void | dropRef () const |
Private Attributes | |
PrecisionModel | precisionModel |
int | SRID |
const CoordinateSequenceFactory * | coordinateListFactory |
int | _refCount |
bool | _autoDestroy |
Friends | |
class | Geometry |
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geometry objects.
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.
Definition at line 68 of file GeometryFactory.h.
using geos::geom::GeometryFactory::Ptr = std::unique_ptr<GeometryFactory, GeometryFactoryDeleter> |
Definition at line 81 of file GeometryFactory.h.
|
protected |
Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0.
|
protected |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation.
NOTES: (1) the given PrecisionModel is COPIED (2) the CoordinateSequenceFactory is NOT COPIED and must be available for the whole lifetime of the GeometryFactory
|
protected |
Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementation, a double-precision floating PrecisionModel and a spatial-reference ID of 0.
|
protected |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and the default CoordinateSequence implementation.
pm | the PrecisionModel to use |
|
protected |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and spatial-reference ID, and the default CoordinateSequence implementation.
pm | the PrecisionModel to use, will be copied internally |
newSRID | the SRID to use |
|
protected |
Copy constructor.
gf | the GeometryFactory to clone from |
|
protectedvirtual |
Destructor.
|
private |
Build an appropriate Geometry
, MultiGeometry
, or GeometryCollection
to contain the Geometry
s in it.
For example:
geomList
contains a single Polygon
, the Polygon
is returned.geomList
contains several Polygon
s, a MultiPolygon
is returned.geomList
contains some Polygon
s and some LineString
s, a GeometryCollection
is returned.geomList
is empty, an empty GeometryCollection
is returnedNote 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.
geoms | the Geometry s to combine |
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
std::unique_ptr<Geometry> geos::geom::GeometryFactory::buildGeometry | ( | std::vector< std::unique_ptr< Geometry >> && | geoms | ) | const |
std::unique_ptr<Geometry> geos::geom::GeometryFactory::buildGeometry | ( | std::vector< std::unique_ptr< Point >> && | geoms | ) | const |
std::unique_ptr<Geometry> geos::geom::GeometryFactory::buildGeometry | ( | std::vector< std::unique_ptr< LineString >> && | geoms | ) | const |
std::unique_ptr<Geometry> geos::geom::GeometryFactory::buildGeometry | ( | std::vector< std::unique_ptr< Polygon >> && | geoms | ) | const |
|
inline |
See buildGeometry(std::vector<Geometry *>&) for semantics.
Will clone the geometries accessible trough the iterator.
T | an iterator yelding something which casts to const Geometry* |
from | start iterator |
toofar | end iterator |
Definition at line 362 of file GeometryFactory.h.
References geos::geom::Dimension::A, geos::geom::Geometry::getSortIndex(), geos::geom::Dimension::L, and geos::geom::Dimension::P.
Geometry* geos::geom::GeometryFactory::buildGeometry | ( | const std::vector< const Geometry * > & | geoms | ) | const |
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.
|
static |
Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0.
|
static |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation.
NOTES: (1) the given PrecisionModel is COPIED (2) the CoordinateSequenceFactory is NOT COPIED and must be available for the whole lifetime of the GeometryFactory
|
static |
Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementation, a double-precision floating PrecisionModel and a spatial-reference ID of 0.
|
static |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and the default CoordinateSequence implementation.
pm | the PrecisionModel to use |
|
static |
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and spatial-reference ID, and the default CoordinateSequence implementation.
pm | the PrecisionModel to use, will be copied internally |
newSRID | the SRID to use |
|
static |
Copy constructor.
gf | the GeometryFactory to clone from |
std::unique_ptr<Geometry> geos::geom::GeometryFactory::createEmpty | ( | int | dimension | ) | const |
Creates an empty atomic geometry of the given dimension. If passed a dimension of -1 will create an empty GeometryCollection.
dimension | the required dimension (-1, 0, 1 or 2) |
std::unique_ptr<Geometry> geos::geom::GeometryFactory::createEmptyGeometry | ( | ) | const |
Construct the EMPTY Geometry.
Returns a clone of given Geometry.
std::unique_ptr<GeometryCollection> geos::geom::GeometryFactory::createGeometryCollection | ( | ) | const |
Construct an EMPTY GeometryCollection.
GeometryCollection* geos::geom::GeometryFactory::createGeometryCollection | ( | std::vector< Geometry * > * | newGeoms | ) | const |
Construct a GeometryCollection taking ownership of given arguments.
|
inline |
Definition at line 189 of file GeometryFactory.h.
References geos::geom::Geometry::toGeometryArray().
GeometryCollection* geos::geom::GeometryFactory::createGeometryCollection | ( | const std::vector< const Geometry * > & | newGeoms | ) | const |
Constructs a GeometryCollection with a deep-copy of args.
std::unique_ptr<LinearRing> geos::geom::GeometryFactory::createLinearRing | ( | ) | const |
Construct an EMPTY LinearRing.
LinearRing* geos::geom::GeometryFactory::createLinearRing | ( | CoordinateSequence * | newCoords | ) | const |
Construct a LinearRing taking ownership of given arguments.
std::unique_ptr<LinearRing> geos::geom::GeometryFactory::createLinearRing | ( | std::unique_ptr< CoordinateSequence > && | newCoords | ) | const |
LinearRing* geos::geom::GeometryFactory::createLinearRing | ( | const CoordinateSequence & | coordinates | ) | const |
Construct a LinearRing with a deep-copy of given arguments.
std::unique_ptr<LineString> geos::geom::GeometryFactory::createLineString | ( | std::size_t | coordinateDimension = 2 | ) | const |
Construct an EMPTY LineString.
std::unique_ptr<LineString> geos::geom::GeometryFactory::createLineString | ( | const LineString & | ls | ) | const |
Copy a LineString.
LineString* geos::geom::GeometryFactory::createLineString | ( | CoordinateSequence * | coordinates | ) | const |
Construct a LineString taking ownership of given argument.
std::unique_ptr<LineString> geos::geom::GeometryFactory::createLineString | ( | std::unique_ptr< CoordinateSequence > && | coordinates | ) | const |
LineString* geos::geom::GeometryFactory::createLineString | ( | const CoordinateSequence & | coordinates | ) | const |
Construct a LineString with a deep-copy of given argument.
std::unique_ptr<MultiLineString> geos::geom::GeometryFactory::createMultiLineString | ( | ) | const |
Construct an EMPTY MultiLineString.
MultiLineString* geos::geom::GeometryFactory::createMultiLineString | ( | std::vector< Geometry * > * | newLines | ) | const |
Construct a MultiLineString taking ownership of given arguments.
MultiLineString* geos::geom::GeometryFactory::createMultiLineString | ( | const std::vector< const Geometry * > & | fromLines | ) | const |
Construct a MultiLineString with a deep-copy of given arguments.
std::unique_ptr<MultiLineString> geos::geom::GeometryFactory::createMultiLineString | ( | std::vector< std::unique_ptr< LineString >> && | fromLines | ) | const |
std::unique_ptr<MultiLineString> geos::geom::GeometryFactory::createMultiLineString | ( | std::vector< std::unique_ptr< Geometry >> && | fromLines | ) | const |
std::unique_ptr<MultiPoint> geos::geom::GeometryFactory::createMultiPoint | ( | ) | const |
Constructs an EMPTY MultiPoint
.
MultiPoint* geos::geom::GeometryFactory::createMultiPoint | ( | std::vector< Geometry * > * | newPoints | ) | const |
Construct a MultiPoint taking ownership of given arguments.
std::unique_ptr<MultiPoint> geos::geom::GeometryFactory::createMultiPoint | ( | std::vector< std::unique_ptr< Point >> && | newPoints | ) | const |
std::unique_ptr<MultiPoint> geos::geom::GeometryFactory::createMultiPoint | ( | std::vector< std::unique_ptr< Geometry >> && | newPoints | ) | const |
MultiPoint* geos::geom::GeometryFactory::createMultiPoint | ( | const std::vector< const Geometry * > & | fromPoints | ) | const |
Construct a MultiPoint with a deep-copy of given arguments.
MultiPoint* geos::geom::GeometryFactory::createMultiPoint | ( | const CoordinateSequence & | fromCoords | ) | const |
Construct a MultiPoint containing a Point geometry for each Coordinate in the given list.
MultiPoint* geos::geom::GeometryFactory::createMultiPoint | ( | const std::vector< Coordinate > & | fromCoords | ) | const |
Construct a MultiPoint containing a Point geometry for each Coordinate in the given vector.
std::unique_ptr<MultiPolygon> geos::geom::GeometryFactory::createMultiPolygon | ( | ) | const |
Construct an EMPTY MultiPolygon.
MultiPolygon* geos::geom::GeometryFactory::createMultiPolygon | ( | std::vector< Geometry * > * | newPolys | ) | const |
Construct a MultiPolygon taking ownership of given arguments.
MultiPolygon* geos::geom::GeometryFactory::createMultiPolygon | ( | const std::vector< const Geometry * > & | fromPolys | ) | const |
Construct a MultiPolygon with a deep-copy of given arguments.
std::unique_ptr<MultiPolygon> geos::geom::GeometryFactory::createMultiPolygon | ( | std::vector< std::unique_ptr< Polygon >> && | fromPolys | ) | const |
std::unique_ptr<MultiPolygon> geos::geom::GeometryFactory::createMultiPolygon | ( | std::vector< std::unique_ptr< Geometry >> && | fromPolys | ) | const |
std::unique_ptr<Point> geos::geom::GeometryFactory::createPoint | ( | std::size_t | coordinateDimension = 2 | ) | const |
Creates an EMPTY Point.
Point* geos::geom::GeometryFactory::createPoint | ( | const Coordinate & | coordinate | ) | const |
Creates a Point using the given Coordinate.
Point* geos::geom::GeometryFactory::createPoint | ( | CoordinateSequence * | coordinates | ) | const |
Creates a Point taking ownership of the given CoordinateSequence.
Point* geos::geom::GeometryFactory::createPoint | ( | const CoordinateSequence & | coordinates | ) | const |
Creates a Point with a deep-copy of the given CoordinateSequence.
Point* geos::geom::GeometryFactory::createPointFromInternalCoord | ( | const Coordinate * | coord, |
const Geometry * | exemplar | ||
) | const |
std::unique_ptr<Polygon> geos::geom::GeometryFactory::createPolygon | ( | std::size_t | coordinateDimension = 2 | ) | const |
Construct an EMPTY Polygon.
Polygon* geos::geom::GeometryFactory::createPolygon | ( | LinearRing * | shell, |
std::vector< LinearRing * > * | holes | ||
) | const |
Construct a Polygon taking ownership of given arguments.
std::unique_ptr<Polygon> geos::geom::GeometryFactory::createPolygon | ( | std::unique_ptr< LinearRing > && | shell | ) | const |
std::unique_ptr<Polygon> geos::geom::GeometryFactory::createPolygon | ( | std::unique_ptr< LinearRing > && | shell, |
std::vector< std::unique_ptr< LinearRing >> && | holes | ||
) | const |
Polygon* geos::geom::GeometryFactory::createPolygon | ( | const LinearRing & | shell, |
const std::vector< LinearRing * > & | holes | ||
) | const |
Construct a Polygon with a deep-copy of given arguments.
void geos::geom::GeometryFactory::destroy | ( | ) |
Request that the instance is deleted.
It will really be deleted only after last child Geometry is deleted. Do not use the instance anymore after calling this function (unless you're a live child!).
Referenced by geos::geom::GeometryFactory::GeometryFactoryDeleter::operator()().
void geos::geom::GeometryFactory::destroyGeometry | ( | Geometry * | g | ) | const |
Destroy a Geometry, or release it.
|
private |
const CoordinateSequenceFactory* geos::geom::GeometryFactory::getCoordinateSequenceFactory | ( | ) | const |
Returns the CoordinateSequenceFactory associated with this GeometryFactory.
|
static |
Return a pointer to the default GeometryFactory. This is a global shared object instantiated using default constructor.
const PrecisionModel* geos::geom::GeometryFactory::getPrecisionModel | ( | ) | const |
Returns the PrecisionModel that Geometries created by this factory will be associated with.
int geos::geom::GeometryFactory::getSRID | ( | ) | const |
|
friend |
Definition at line 516 of file GeometryFactory.h.
|
private |
Definition at line 514 of file GeometryFactory.h.
|
mutableprivate |
Definition at line 513 of file GeometryFactory.h.
|
private |
Definition at line 511 of file GeometryFactory.h.
|
private |
Definition at line 509 of file GeometryFactory.h.
|
private |
Definition at line 510 of file GeometryFactory.h.