21 #ifndef GEOS_GEOM_GEOMETRYFACTORY_H
22 #define GEOS_GEOM_GEOMETRYFACTORY_H
24 #include <geos/geom/Geometry.h>
25 #include <geos/geom/GeometryCollection.h>
26 #include <geos/geom/MultiPoint.h>
27 #include <geos/geom/MultiLineString.h>
28 #include <geos/geom/MultiPolygon.h>
29 #include <geos/export.h>
30 #include <geos/inline.h>
38 class CoordinateSequenceFactory;
40 class CoordinateSequence;
43 class GeometryCollection;
46 class MultiLineString;
135 getDefaultInstance();
157 Point* createPoint()
const;
172 Geometry* createEmptyGeometry()
const;
176 std::vector<Geometry *> *newGeoms)
const;
180 const std::vector<Geometry *> &newGeoms)
const;
187 std::vector<Geometry *> *newLines)
const;
191 const std::vector<Geometry *> &fromLines)
const;
197 MultiPolygon* createMultiPolygon(std::vector<Geometry *> *newPolys)
const;
201 const std::vector<Geometry *> &fromPolys)
const;
209 std::auto_ptr<Geometry> createLinearRing(
210 std::auto_ptr<CoordinateSequence> newCoords)
const;
220 MultiPoint* createMultiPoint(std::vector<Geometry *> *newPoints)
const;
224 const std::vector<Geometry *> &fromPoints)
const;
236 const std::vector<Coordinate> &fromCoords)
const;
239 Polygon* createPolygon()
const;
243 std::vector<Geometry *> *holes)
const;
247 const std::vector<Geometry *> &holes)
const;
253 std::auto_ptr<LineString> createLineString(
const LineString& ls)
const;
258 std::auto_ptr<Geometry> createLineString(
259 std::auto_ptr<CoordinateSequence> coordinates)
const;
296 Geometry* buildGeometry(std::vector<Geometry *> *geoms)
const;
307 std::auto_ptr<Geometry> buildGeometry(T from, T toofar)
const
309 bool isHeterogeneous =
false;
312 for (T i=from; i != toofar; ++i)
316 if ( geomClass < 0 ) {
317 geomClass = g->getClassSortIndex();
319 else if ( geomClass != g->getClassSortIndex() ) {
320 isHeterogeneous =
true;
326 return std::auto_ptr<Geometry>( createGeometryCollection() );
331 return std::auto_ptr<Geometry>( (*from)->clone() );
340 std::vector<Geometry*> fromGeoms;
341 for (T i=from; i != toofar; ++i) {
343 fromGeoms.push_back(const_cast<Geometry*>(g));
348 if ( isHeterogeneous ) {
349 return std::auto_ptr<Geometry>( createGeometryCollection(fromGeoms) );
353 if ( dynamic_cast<const Polygon*>(*from) ) {
354 return std::auto_ptr<Geometry>( createMultiPolygon(fromGeoms) );
355 }
else if ( dynamic_cast<const LineString*>(*from) ) {
356 return std::auto_ptr<Geometry>( createMultiLineString(fromGeoms) );
357 }
else if ( dynamic_cast<const Point*>(*from) ) {
358 return std::auto_ptr<Geometry>( createMultiPoint(fromGeoms) );
362 return std::auto_ptr<Geometry>();
372 Geometry* buildGeometry(
const std::vector<Geometry *> &geoms)
const;
385 void destroyGeometry(
Geometry *g)
const;
397 # include "geos/geom/GeometryFactory.inl"
400 #endif // ndef GEOS_GEOM_GEOMETRYFACTORY_H