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;
306 std::auto_ptr<Geometry> buildGeometry(T from, T toofar)
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