GEOS  3.8.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.
11  * See the COPYING file for more information.
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<Geometry*> const& geoms);
58 
66  static std::unique_ptr<Geometry> combine(const Geometry* g0, const Geometry* g1);
67 
76  static std::unique_ptr<Geometry> combine(const Geometry* g0, const Geometry* g1, const Geometry* g2);
77 
78 private:
79  GeometryFactory const* geomFactory;
80  bool skipEmpty;
81  std::vector<Geometry*> const& inputGeoms;
82 
83 public:
89  GeometryCombiner(std::vector<Geometry*> const& geoms);
90 
97  static GeometryFactory const* extractFactory(std::vector<Geometry*> const& geoms);
98 
105  std::unique_ptr<Geometry> combine();
106 
107 private:
108  void extractElements(Geometry* geom, std::vector<Geometry*>& elems);
109 
110  // Declare type as noncopyable
111  GeometryCombiner(const GeometryCombiner& other) = delete;
112  GeometryCombiner& operator=(const GeometryCombiner& rhs) = delete;
113 };
114 
115 } // namespace geos.geom.util
116 } // namespace geos.geom
117 } // namespace geos
118 
119 #endif
static GeometryFactory const * extractFactory(std::vector< Geometry * > const &geoms)
Extracts the GeometryFactory used by the geometries in a collection.
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:66
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
GeometryCombiner(std::vector< Geometry * > const &geoms)
Creates a new combiner for a collection of geometries.