GEOS 3.15.0dev
GeometryTransformer.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: geom/util/GeometryTransformer.java r320 (JTS-1.12)
17 *
18 **********************************************************************/
19
20#pragma once
21
22
23#include <geos/export.h>
24#include <geos/geom/Coordinate.h> // destructor visibility for vector
25#include <geos/geom/Geometry.h> // destructor visibility for unique_ptr
26#include <geos/geom/CoordinateSequence.h> // destructor visibility for unique_ptr
27
28#include <memory> // for unique_ptr
29#include <vector>
30
31// Forward declarations
32namespace geos {
33namespace geom {
34class Geometry;
35class GeometryFactory;
36class Point;
37class LinearRing;
38class LineString;
39class Polygon;
40class MultiPoint;
41class MultiPolygon;
42class MultiLineString;
43class GeometryCollection;
44class CircularString;
45class CompoundCurve;
46class CurvePolygon;
47class MultiCurve;
48class MultiSurface;
49namespace util {
50//class GeometryEditorOperation;
51}
52}
53}
54
55
56namespace geos {
57namespace geom { // geos.geom
58namespace util { // geos.geom.util
59
93class GEOS_DLL GeometryTransformer {
94
95public:
96
98
99 virtual ~GeometryTransformer() = default;
100
101 std::unique_ptr<Geometry> transform(const Geometry* nInputGeom);
102
103 void setSkipTransformedInvalidInteriorRings(bool b);
104
105protected:
106
107 const GeometryFactory* factory;
108
109 virtual CoordinateSequence::Ptr transformCoordinates(
110 const CoordinateSequence* coords,
111 const Geometry* parent);
112
113 virtual Geometry::Ptr transformPoint(
114 const Point* geom,
115 const Geometry* parent);
116
117 virtual Geometry::Ptr transformMultiPoint(
118 const MultiPoint* geom,
119 const Geometry* parent);
120
121 virtual Geometry::Ptr transformLinearRing(
122 const LinearRing* geom,
123 const Geometry* parent);
124
125 virtual Geometry::Ptr transformLineString(
126 const LineString* geom,
127 const Geometry* parent);
128
129 virtual Geometry::Ptr transformCircularString(
130 const CircularString* geom,
131 const Geometry* parent);
132
133 virtual Geometry::Ptr transformCompoundCurve(
134 const CompoundCurve* geom,
135 const Geometry* parent);
136
137 virtual Geometry::Ptr transformMultiLineString(
138 const MultiLineString* geom,
139 const Geometry* parent);
140
141 virtual Geometry::Ptr transformPolygon(
142 const Polygon* geom,
143 const Geometry* parent);
144
145 virtual Geometry::Ptr transformCurvePolygon(
146 const CurvePolygon* geom,
147 const Geometry* parent);
148
149 virtual Geometry::Ptr transformMultiPolygon(
150 const MultiPolygon* geom,
151 const Geometry* parent);
152
153 virtual Geometry::Ptr transformMultiCurve(
154 const MultiCurve* geom,
155 const Geometry* parent);
156
157 virtual Geometry::Ptr transformMultiSurface(
158 const MultiSurface* geom,
159 const Geometry* parent);
160
161 virtual Geometry::Ptr transformGeometryCollection(
162 const GeometryCollection* geom,
163 const Geometry* parent);
164
165private:
166
167 const Geometry* inputGeom;
168
169 // these could eventually be exposed to clients
173 bool pruneEmptyGeometry;
174
180 bool preserveGeometryCollectionType;
181
185 // bool preserveCollections;
186
190 bool preserveType;
191
195 bool skipTransformedInvalidInteriorRings;
196
197 // Declare type as noncopyable
198 GeometryTransformer(const GeometryTransformer& other) = delete;
199 GeometryTransformer& operator=(const GeometryTransformer& rhs) = delete;
200};
201
202
203} // namespace geos.geom.util
204} // namespace geos.geom
205} // namespace geos
206
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Represents a collection of heterogeneous Geometry objects.
Definition GeometryCollection.h:51
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:71
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
std::unique_ptr< Geometry > Ptr
An unique_ptr of Geometry.
Definition Geometry.h:209
Definition LineString.h:66
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
Models a collection of LineStrings.
Definition MultiLineString.h:49
Definition MultiPoint.h:50
Definition MultiPolygon.h:58
Definition Point.h:61
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
A framework for processes which transform an input Geometry into an output Geometry,...
Definition GeometryTransformer.h:93
Basic namespace for all GEOS functionalities.
Definition geos.h:38