GEOS 3.14.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#pragma once
20
21#include <memory>
22#include <vector>
23
24#include <geos/export.h>
25
26// Forward declarations
27namespace geos {
28namespace geom {
29class Geometry;
30class GeometryFactory;
31}
32}
33
34namespace geos {
35namespace geom { // geos.geom
36namespace util { // geos.geom.util
37
50class GEOS_DLL GeometryCombiner {
51public:
58 static std::unique_ptr<Geometry> combine(std::vector<const Geometry*> const& geoms);
59
66 static std::unique_ptr<Geometry> combine(std::vector<std::unique_ptr<Geometry>> && geoms);
67
75 static std::unique_ptr<Geometry> combine(const Geometry* g0, const Geometry* g1);
76
84 static std::unique_ptr<Geometry> combine(std::unique_ptr<Geometry> && g0,
85 std::unique_ptr<Geometry> && g1);
86
95 static std::unique_ptr<Geometry> combine(const Geometry* g0, const Geometry* g1, const Geometry* g2);
96
105 static std::unique_ptr<Geometry> combine(std::unique_ptr<Geometry> && g0,
106 std::unique_ptr<Geometry> && g1,
107 std::unique_ptr<Geometry> && g2);
108
109private:
110 std::vector<std::unique_ptr<Geometry>> inputGeoms;
111 bool skipEmpty;
112
113public:
119 explicit GeometryCombiner(std::vector<const Geometry*> const& geoms);
120
121 explicit GeometryCombiner(std::vector<std::unique_ptr<Geometry>> && geoms);
122
129
136 std::unique_ptr<Geometry> combine();
137
141 void setSkipEmpty(bool);
142
143 // Declare type as noncopyable
144 GeometryCombiner(const GeometryCombiner& other) = delete;
145 GeometryCombiner& operator=(const GeometryCombiner& rhs) = delete;
146};
147
148} // namespace geos.geom.util
149} // namespace geos.geom
150} // namespace geos
151
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Combines Geometrys to produce a GeometryCollection of the most appropriate type.
Definition GeometryCombiner.h:50
static std::unique_ptr< Geometry > combine(const Geometry *g0, const Geometry *g1)
Copies two geometries and combines the result.
static std::unique_ptr< Geometry > combine(std::unique_ptr< Geometry > &&g0, std::unique_ptr< Geometry > &&g1, std::unique_ptr< Geometry > &&g2)
Combines three geometries.
GeometryFactory const * extractFactory() const
Extracts the GeometryFactory used by the geometries in a collection.
static std::unique_ptr< Geometry > combine(std::unique_ptr< Geometry > &&g0, std::unique_ptr< Geometry > &&g1)
Combines two geometries.
static std::unique_ptr< Geometry > combine(std::vector< std::unique_ptr< Geometry > > &&geoms)
Combines a collection of geometries.
static std::unique_ptr< Geometry > combine(std::vector< const Geometry * > const &geoms)
Copies a collection of geometries and combines the result.
std::unique_ptr< Geometry > combine()
Computes the combination of the input geometries to produce the most appropriate Geometry or Geometry...
static std::unique_ptr< Geometry > combine(const Geometry *g0, const Geometry *g1, const Geometry *g2)
Copies three geometries and combines the result.
void setSkipEmpty(bool)
Set a flag indicating that empty geometries should be omitted from the result.
GeometryCombiner(std::vector< const Geometry * > const &geoms)
Creates a new combiner for a collection of geometries.
Basic namespace for all GEOS functionalities.
Definition geos.h:39