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> 37 class CoordinateSequenceFactory;
39 class CoordinateSequence;
42 class GeometryCollection;
45 class MultiLineString;
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();
110 static GeometryFactory::unique_ptr create(
const PrecisionModel *pm,
int newSRID,
129 static GeometryFactory::unique_ptr create(
const PrecisionModel *pm);
140 static GeometryFactory::unique_ptr create(
const PrecisionModel* pm,
int newSRID);
156 getDefaultInstance();
175 Point* createPoint()
const;
190 Geometry* createEmptyGeometry()
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;
215 MultiPolygon* createMultiPolygon(std::vector<Geometry *> *newPolys)
const;
219 const std::vector<Geometry *> &fromPolys)
const;
227 std::auto_ptr<Geometry> createLinearRing(
228 std::auto_ptr<CoordinateSequence> newCoords)
const;
238 MultiPoint* createMultiPoint(std::vector<Geometry *> *newPoints)
const;
242 const std::vector<Geometry *> &fromPoints)
const;
254 const std::vector<Coordinate> &fromCoords)
const;
257 Polygon* createPolygon()
const;
261 std::vector<Geometry *> *holes)
const;
265 const std::vector<Geometry *> &holes)
const;
271 std::auto_ptr<LineString> createLineString(
const LineString& ls)
const;
276 std::auto_ptr<Geometry> createLineString(
277 std::auto_ptr<CoordinateSequence> coordinates)
const;
314 Geometry* buildGeometry(std::vector<Geometry *> *geoms)
const;
327 bool isHeterogeneous =
false;
330 for (T i=from; i != toofar; ++i)
334 if ( geomClass < 0 ) {
335 geomClass = g->getClassSortIndex();
337 else if ( geomClass != g->getClassSortIndex() ) {
338 isHeterogeneous =
true;
344 return std::auto_ptr<Geometry>( createGeometryCollection() );
349 return std::auto_ptr<Geometry>( (*from)->clone() );
358 std::vector<Geometry*> fromGeoms;
359 for (T i=from; i != toofar; ++i) {
361 fromGeoms.push_back(const_cast<Geometry*>(g));
366 if ( isHeterogeneous ) {
367 return std::auto_ptr<Geometry>( createGeometryCollection(fromGeoms) );
371 if ( dynamic_cast<const Polygon*>(*from) ) {
372 return std::auto_ptr<Geometry>( createMultiPolygon(fromGeoms) );
373 }
else if ( dynamic_cast<const LineString*>(*from) ) {
374 return std::auto_ptr<Geometry>( createMultiLineString(fromGeoms) );
375 }
else if ( dynamic_cast<const Point*>(*from) ) {
376 return std::auto_ptr<Geometry>( createMultiPoint(fromGeoms) );
380 return std::auto_ptr<Geometry>();
390 Geometry* buildGeometry(
const std::vector<Geometry *> &geoms)
const;
403 void destroyGeometry(
Geometry *g)
const;
482 mutable int _refCount;
488 void dropRef()
const;
496 # include "geos/geom/GeometryFactory.inl" 499 #endif // ndef GEOS_GEOM_GEOMETRYFACTORY_H An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:53
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Models a collection of Polygons.
Definition: MultiPolygon.h:60
std::auto_ptr< Geometry > buildGeometry(T from, T toofar) const
See buildGeometry(std::vector<Geometry *>&) for semantics.
Definition: GeometryFactory.h:325
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
Definition: LineString.h:70
Represents a linear polygon, which may include holes.
Definition: Polygon.h:66
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:56
void destroy()
Request that the instance is deleted.
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Definition: MultiPoint.h:55
Models an OGC SFS LinearRing.
Definition: LinearRing.h:57
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
Models a collection of (}s.
Definition: MultiLineString.h:51