20#ifndef GEOS_GEOM_GEOMETRYFACTORY_H
21#define GEOS_GEOM_GEOMETRYFACTORY_H
23#include <geos/geom/Geometry.h>
24#include <geos/geom/GeometryCollection.h>
25#include <geos/geom/MultiPoint.h>
26#include <geos/geom/MultiLineString.h>
27#include <geos/geom/MultiPolygon.h>
28#include <geos/export.h>
29#include <geos/inline.h>
75 unique_ptr(
const unique_ptr& o): _f(o.release()) {};
79 unique_ptr& operator=(
const unique_ptr& o) {
86 unique_ptr(): _f(0) {}
88 ~unique_ptr() { reset(0); }
96 static GeometryFactory::unique_ptr
create();
161 const Geometry *exemplar)
const;
194 std::vector<Geometry *> *newGeoms)
const;
198 const std::vector<Geometry *> &newGeoms)
const;
205 std::vector<Geometry *> *newLines)
const;
209 const std::vector<Geometry *> &fromLines)
const;
219 const std::vector<Geometry *> &fromPolys)
const;
228 std::auto_ptr<CoordinateSequence> newCoords)
const;
242 const std::vector<Geometry *> &fromPoints)
const;
254 const std::vector<Coordinate> &fromCoords)
const;
261 std::vector<Geometry *> *holes)
const;
265 const std::vector<Geometry *> &holes)
const;
277 std::auto_ptr<CoordinateSequence> coordinates)
const;
327 bool isHeterogeneous =
false;
330 for (T i=from; i != toofar; ++i)
333 const Geometry* g = *i;
334 if ( geomClass < 0 ) {
335 geomClass = g->getClassSortIndex();
337 else if ( geomClass != g->getClassSortIndex() ) {
338 isHeterogeneous =
true;
349 return std::auto_ptr<Geometry>( (*from)->clone() );
358 std::vector<Geometry*> fromGeoms;
359 for (T i=from; i != toofar; ++i) {
360 const Geometry* g = *i;
361 fromGeoms.push_back(
const_cast<Geometry*
>(g));
366 if ( isHeterogeneous ) {
371 if (
dynamic_cast<const Polygon*
>(*from) ) {
373 }
else if (
dynamic_cast<const LineString*
>(*from) ) {
375 }
else if (
dynamic_cast<const Point*
>(*from) ) {
380 return std::auto_ptr<Geometry>();
482 mutable int _refCount;
485friend class Geometry;
488 void dropRef()
const;
496# include "geos/geom/GeometryFactory.inl"
A factory to create concrete instances of CoordinateSequences.
Definition CoordinateSequenceFactory.h:47
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:53
Represents a collection of heterogeneous Geometry objects.
Definition GeometryCollection.h:56
MultiPoint * createMultiPoint(const std::vector< Geometry * > &fromPoints) const
Construct a MultiPoint with a deep-copy of given arguments.
static const GeometryFactory * getDefaultInstance()
Return a pointer to the default GeometryFactory. This is a global shared object instantiated using de...
Polygon * createPolygon(LinearRing *shell, std::vector< Geometry * > *holes) const
Construct a Polygon taking ownership of given arguments.
MultiPoint * createMultiPoint() const
Constructs an EMPTY MultiPoint.
Point * createPoint() const
Creates an EMPTY Point.
GeometryFactory(const PrecisionModel *pm)
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and the defaul...
Geometry * buildGeometry(std::vector< Geometry * > *geoms) const
GeometryCollection * createGeometryCollection() const
Construct an EMPTY GeometryCollection.
MultiPoint * createMultiPoint(std::vector< Geometry * > *newPoints) const
Construct a MultiPoint taking ownership of given arguments.
std::auto_ptr< Geometry > buildGeometry(T from, T toofar) const
See buildGeometry(std::vector<Geometry *>&) for semantics.
Definition GeometryFactory.h:325
std::auto_ptr< LineString > createLineString(const LineString &ls) const
Copy a LineString.
LineString * createLineString(const CoordinateSequence &coordinates) const
Construct a LineString with a deep-copy of given argument.
static GeometryFactory::unique_ptr create(const GeometryFactory &gf)
Copy constructor.
LineString * createLineString(CoordinateSequence *coordinates) const
Construct a LineString taking ownership of given argument.
Point * createPoint(const CoordinateSequence &coordinates) const
Creates a Point with a deep-copy of the given CoordinateSequence.
const PrecisionModel * getPrecisionModel() const
Returns the PrecisionModel that Geometries created by this factory will be associated with.
LinearRing * createLinearRing(const CoordinateSequence &coordinates) const
Construct a LinearRing with a deep-copy of given arguments.
MultiPoint * createMultiPoint(const std::vector< Coordinate > &fromCoords) const
Construct a MultiPoint containing a Point geometry for each Coordinate in the given vector.
static GeometryFactory::unique_ptr create(CoordinateSequenceFactory *nCoordinateSequenceFactory)
Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementa...
static GeometryFactory::unique_ptr create(const PrecisionModel *pm)
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and the defaul...
GeometryFactory(CoordinateSequenceFactory *nCoordinateSequenceFactory)
Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementa...
static GeometryFactory::unique_ptr create(const PrecisionModel *pm, int newSRID)
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and spatial-re...
LineString * createLineString() const
Construct an EMPTY LineString.
Point * createPoint(const Coordinate &coordinate) const
Creates a Point using the given Coordinate.
void destroyGeometry(Geometry *g) const
Destroy a Geometry, or release it.
Geometry * createEmptyGeometry() const
Construct the EMPTY Geometry.
GeometryCollection * createGeometryCollection(const std::vector< Geometry * > &newGeoms) const
Constructs a GeometryCollection with a deep-copy of args.
MultiPolygon * createMultiPolygon(std::vector< Geometry * > *newPolys) const
Construct a MultiPolygon taking ownership of given arguments.
static GeometryFactory::unique_ptr create(const PrecisionModel *pm, int newSRID, CoordinateSequenceFactory *nCoordinateSequenceFactory)
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel,...
GeometryFactory(const PrecisionModel *pm, int newSRID, CoordinateSequenceFactory *nCoordinateSequenceFactory)
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel,...
Point * createPoint(CoordinateSequence *coordinates) const
Creates a Point taking ownership of the given CoordinateSequence.
GeometryCollection * createGeometryCollection(std::vector< Geometry * > *newGeoms) const
Construct a GeometryCollection taking ownership of given arguments.
MultiPoint * createMultiPoint(const CoordinateSequence &fromCoords) const
Construct a MultiPoint containing a Point geometry for each Coordinate in the given list.
GeometryFactory(const PrecisionModel *pm, int newSRID)
Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and spatial-re...
virtual ~GeometryFactory()
Destructor.
Geometry * buildGeometry(const std::vector< Geometry * > &geoms) const
This function does the same thing of the omonimouse function taking vector pointer instead of referen...
static GeometryFactory::unique_ptr create()
Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial...
Geometry * createGeometry(const Geometry *g) const
Returns a clone of given Geometry.
MultiPolygon * createMultiPolygon(const std::vector< Geometry * > &fromPolys) const
Construct a MultiPolygon with a deep-copy of given arguments.
Polygon * createPolygon() const
Construct an EMPTY Polygon.
MultiLineString * createMultiLineString(std::vector< Geometry * > *newLines) const
Construct a MultiLineString taking ownership of given arguments.
LinearRing * createLinearRing() const
Construct an EMPTY LinearRing.
MultiPolygon * createMultiPolygon() const
Construct an EMPTY MultiPolygon.
MultiLineString * createMultiLineString() const
Construct an EMPTY MultiLineString.
const CoordinateSequenceFactory * getCoordinateSequenceFactory() const
Returns the CoordinateSequenceFactory associated with this GeometryFactory.
GeometryFactory(const GeometryFactory &gf)
Copy constructor.
GeometryFactory()
Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial...
Polygon * createPolygon(const LinearRing &shell, const std::vector< Geometry * > &holes) const
Construct a Polygon with a deep-copy of given arguments.
void destroy()
Request that the instance is deleted.
MultiLineString * createMultiLineString(const std::vector< Geometry * > &fromLines) const
Construct a MultiLineString with a deep-copy of given arguments.
LinearRing * createLinearRing(CoordinateSequence *newCoords) const
Construct a LinearRing taking ownership of given arguments.
Geometry * toGeometry(const Envelope *envelope) const
Converts an Envelope to a Geometry.
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Definition LineString.h:70
Models an OGC SFS LinearRing.
Definition LinearRing.h:57
Models a collection of (}s.
Definition MultiLineString.h:51
Definition MultiPoint.h:56
Models a collection of Polygons.
Definition MultiPolygon.h:61
Represents a linear polygon, which may include holes.
Definition Polygon.h:67
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25