GEOS  3.9.0dev
GeometryCombiner.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006-2011 Refractions Research Inc.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
12  *
13  **********************************************************************
14  *
15  * Last port: geom/util/GeometryCombiner.java r320 (JTS-1.12)
16  *
17  **********************************************************************/
18
19 #ifndef GEOS_GEOM_UTIL_GEOMETRYCOMBINER_H
20 #define GEOS_GEOM_UTIL_GEOMETRYCOMBINER_H
21
22 #include <memory>
23 #include <vector>
24
25 // Forward declarations
26 namespace geos {
27 namespace geom {
28 class Geometry;
29 class GeometryFactory;
30 }
31 }
32
33 namespace geos {
34 namespace geom { // geos.geom
35 namespace util { // geos.geom.util
36
50 public:
57  static std::unique_ptr<Geometry> combine(std::vector<const Geometry*> const& geoms);
58  static std::unique_ptr<Geometry> combine(std::vector<std::unique_ptr<Geometry>> const& geoms);
59
67  static std::unique_ptr<Geometry> combine(const Geometry* g0, const Geometry* g1);
68
77  static std::unique_ptr<Geometry> combine(const Geometry* g0, const Geometry* g1, const Geometry* g2);
78
79 private:
80  GeometryFactory const* geomFactory;
81  bool skipEmpty;
82  std::vector<const Geometry*> const& inputGeoms;
83
84 public:
90  GeometryCombiner(std::vector<const Geometry*> const& geoms);
91
98  static GeometryFactory const* extractFactory(std::vector<const Geometry*> const& geoms);
99
106  std::unique_ptr<Geometry> combine();
107
108 private:
109  void extractElements(const Geometry* geom, std::vector<const Geometry*>& elems);
110
111  // Declare type as noncopyable
112  GeometryCombiner(const GeometryCombiner& other) = delete;
113  GeometryCombiner& operator=(const GeometryCombiner& rhs) = delete;
114 };
115
116 } // namespace geos.geom.util
117 } // namespace geos.geom
118 } // namespace geos
119
120 #endif
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
std::unique_ptr< Geometry > combine()
Computes the combination of the input geometries to produce the most appropriate Geometry or Geometry...
Combines Geometrys to produce a GeometryCollection of the most appropriate type.
Definition: GeometryCombiner.h:49
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:68
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26
GeometryCombiner(std::vector< const Geometry * > const &geoms)
Creates a new combiner for a collection of geometries.
static GeometryFactory const * extractFactory(std::vector< const Geometry * > const &geoms)
Extracts the GeometryFactory used by the geometries in a collection.