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;
134 getDefaultInstance();
156 Point* createPoint()
const;
171 Geometry* createEmptyGeometry()
const;
175 std::vector<Geometry *> *newGeoms)
const;
179 const std::vector<Geometry *> &newGeoms)
const;
186 std::vector<Geometry *> *newLines)
const;
190 const std::vector<Geometry *> &fromLines)
const;
196 MultiPolygon* createMultiPolygon(std::vector<Geometry *> *newPolys)
const;
200 const std::vector<Geometry *> &fromPolys)
const;
208 std::auto_ptr<Geometry> createLinearRing(
209 std::auto_ptr<CoordinateSequence> newCoords)
const;
219 MultiPoint* createMultiPoint(std::vector<Geometry *> *newPoints)
const;
223 const std::vector<Geometry *> &fromPoints)
const;
235 const std::vector<Coordinate> &fromCoords)
const;
238 Polygon* createPolygon()
const;
242 std::vector<Geometry *> *holes)
const;
246 const std::vector<Geometry *> &holes)
const;
252 std::auto_ptr<LineString> createLineString(
const LineString& ls)
const;
257 std::auto_ptr<Geometry> createLineString(
258 std::auto_ptr<CoordinateSequence> coordinates)
const;
295 Geometry* buildGeometry(std::vector<Geometry *> *geoms)
const;
308 bool isHeterogeneous =
false;
311 for (T i=from; i != toofar; ++i)
315 if ( geomClass < 0 ) {
316 geomClass = g->getClassSortIndex();
318 else if ( geomClass != g->getClassSortIndex() ) {
319 isHeterogeneous =
true;
325 return std::auto_ptr<Geometry>( createGeometryCollection() );
330 return std::auto_ptr<Geometry>( (*from)->clone() );
339 std::vector<Geometry*> fromGeoms;
340 for (T i=from; i != toofar; ++i) {
342 fromGeoms.push_back(const_cast<Geometry*>(g));
347 if ( isHeterogeneous ) {
348 return std::auto_ptr<Geometry>( createGeometryCollection(fromGeoms) );
352 if ( dynamic_cast<const Polygon*>(*from) ) {
353 return std::auto_ptr<Geometry>( createMultiPolygon(fromGeoms) );
354 }
else if ( dynamic_cast<const LineString*>(*from) ) {
355 return std::auto_ptr<Geometry>( createMultiLineString(fromGeoms) );
356 }
else if ( dynamic_cast<const Point*>(*from) ) {
357 return std::auto_ptr<Geometry>( createMultiPoint(fromGeoms) );
361 return std::auto_ptr<Geometry>();
371 Geometry* buildGeometry(
const std::vector<Geometry *> &geoms)
const;
384 void destroyGeometry(
Geometry *g)
const;
396 # include "geos/geom/GeometryFactory.inl"
399 #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
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
std::auto_ptr< Geometry > buildGeometry(T from, T toofar) const
See buildGeometry(std::vector<Geometry *>&) for semantics.
Definition: GeometryFactory.h:306
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:56
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