20 #ifndef GEOS_GEOM_GEOMETRYFACTORY_H 21 #define GEOS_GEOM_GEOMETRYFACTORY_H 40 class CoordinateSequenceFactory;
42 class CoordinateSequence;
45 class GeometryCollection;
48 class MultiLineString;
81 using Ptr = std::unique_ptr<GeometryFactory, GeometryFactoryDeleter>;
148 getDefaultInstance();
159 std::unique_ptr<Geometry> toGeometry(
const Envelope* envelope)
const;
167 std::unique_ptr<Point> createPoint(std::size_t coordinateDimension = 2)
const;
179 std::unique_ptr<GeometryCollection> createGeometryCollection()
const;
182 std::unique_ptr<Geometry> createEmptyGeometry()
const;
186 std::vector<Geometry*>* newGeoms)
const;
190 std::vector<std::unique_ptr<T>> && newGeoms)
const {
197 const std::vector<const Geometry*>& newGeoms)
const;
200 std::unique_ptr<MultiLineString> createMultiLineString()
const;
204 std::vector<Geometry*>* newLines)
const;
208 const std::vector<const Geometry*>& fromLines)
const;
210 std::unique_ptr<MultiLineString> createMultiLineString(
211 std::vector<std::unique_ptr<LineString>> && fromLines)
const;
213 std::unique_ptr<MultiLineString> createMultiLineString(
214 std::vector<std::unique_ptr<Geometry>> && fromLines)
const;
217 std::unique_ptr<MultiPolygon> createMultiPolygon()
const;
220 MultiPolygon* createMultiPolygon(std::vector<Geometry*>* newPolys)
const;
224 const std::vector<const Geometry*>& fromPolys)
const;
226 std::unique_ptr<MultiPolygon> createMultiPolygon(
227 std::vector<std::unique_ptr<Polygon>> && fromPolys)
const;
229 std::unique_ptr<MultiPolygon> createMultiPolygon(
230 std::vector<std::unique_ptr<Geometry>> && fromPolys)
const;
233 std::unique_ptr<LinearRing> createLinearRing()
const;
238 std::unique_ptr<LinearRing> createLinearRing(
239 std::unique_ptr<CoordinateSequence> && newCoords)
const;
246 std::unique_ptr<MultiPoint> createMultiPoint()
const;
249 MultiPoint* createMultiPoint(std::vector<Geometry*>* newPoints)
const;
251 std::unique_ptr<MultiPoint> createMultiPoint(std::vector<std::unique_ptr<Point>> && newPoints)
const;
253 std::unique_ptr<MultiPoint> createMultiPoint(std::vector<std::unique_ptr<Geometry>> && newPoints)
const;
257 const std::vector<const Geometry*>& fromPoints)
const;
269 const std::vector<Coordinate>& fromCoords)
const;
272 std::unique_ptr<Polygon> createPolygon(std::size_t coordinateDimension = 2)
const;
276 std::vector<LinearRing*>* holes)
const;
278 std::unique_ptr<Polygon> createPolygon(std::unique_ptr<LinearRing> && shell)
const;
280 std::unique_ptr<Polygon> createPolygon(std::unique_ptr<LinearRing> && shell,
281 std::vector<std::unique_ptr<LinearRing>> && holes)
const;
285 const std::vector<LinearRing*>& holes)
const;
288 std::unique_ptr<LineString> createLineString(std::size_t coordinateDimension = 2)
const;
291 std::unique_ptr<LineString> createLineString(
const LineString& ls)
const;
296 std::unique_ptr<LineString> createLineString(
297 std::unique_ptr<CoordinateSequence> && coordinates)
const;
310 std::unique_ptr<Geometry> createEmpty(
int dimension)
const;
342 Geometry* buildGeometry(std::vector<Geometry*>* geoms)
const;
344 std::unique_ptr<Geometry> buildGeometry(std::vector<std::unique_ptr<Geometry>> && geoms)
const;
346 std::unique_ptr<Geometry> buildGeometry(std::vector<std::unique_ptr<Point>> && geoms)
const;
348 std::unique_ptr<Geometry> buildGeometry(std::vector<std::unique_ptr<LineString>> && geoms)
const;
350 std::unique_ptr<Geometry> buildGeometry(std::vector<std::unique_ptr<Polygon>> && geoms)
const;
361 std::unique_ptr<Geometry>
364 bool isHeterogeneous =
false;
367 for(T i = from; i != toofar; ++i) {
374 isHeterogeneous =
true;
380 return std::unique_ptr<Geometry>(createGeometryCollection());
385 return (*from)->clone();
394 std::vector<std::unique_ptr<Geometry>> fromGeoms;
395 for(T i = from; i != toofar; ++i) {
396 fromGeoms.push_back((*i)->clone());
400 if(isHeterogeneous) {
401 return createGeometryCollection(std::move(fromGeoms));
405 switch((*from)->getDimension()) {
406 case Dimension::A:
return createMultiPolygon(std::move(fromGeoms));
407 case Dimension::L:
return createMultiLineString(std::move(fromGeoms));
408 case Dimension::P:
return createMultiPoint(std::move(fromGeoms));
421 Geometry* buildGeometry(
const std::vector<const Geometry*>& geoms)
const;
434 void destroyGeometry(
Geometry* g)
const;
519 void dropRef()
const;
527 # include "geos/geom/GeometryFactory.inl" 530 #endif // ndef GEOS_GEOM_GEOMETRYFACTORY_H std::unique_ptr< GeometryFactory, GeometryFactoryDeleter > Ptr
PrecisionModel precisionModel
virtual int getSortIndex() const =0
An Envelope defines a rectangulare region of the 2D coordinate plane.
Coordinate is the lightweight class used to store coordinates.
std::unique_ptr< GeometryCollection > createGeometryCollection(std::vector< std::unique_ptr< T >> &&newGeoms) const
Specifies the precision model of the Coordinate in a Geometry.
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
static std::vector< std::unique_ptr< Geometry > > toGeometryArray(std::vector< std::unique_ptr< T >> &&v)
Indicates one or more illegal arguments.
Represents a linear polygon, which may include holes.
Dimension value of a curve (1).
Dimension value of a surface (2).
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Represents a collection of heterogeneous Geometry objects.
Basic namespace for all GEOS functionalities.
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple...
std::unique_ptr< Geometry > buildGeometry(T from, T toofar) const
See buildGeometry(std::vector<Geometry *>&) for semantics.
const CoordinateSequenceFactory * coordinateListFactory
Dimension value of a point (0).
A factory to create concrete instances of CoordinateSequences.
The internal representation of a list of coordinates inside a Geometry.
void operator()(GeometryFactory *p) const
Models a collection of LineStrings.