GEOS 3.9.1
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#ifndef GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H
21#define GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H
22
23
24#include <geos/export.h>
25#include <geos/geom/Coordinate.h> // destructor visibility for vector
26#include <geos/geom/Geometry.h> // destructor visibility for unique_ptr
27#include <geos/geom/CoordinateSequence.h> // destructor visibility for unique_ptr
28
29#include <memory> // for unique_ptr
30#include <vector>
31
32// Forward declarations
33namespace geos {
34namespace geom {
35class Geometry;
36class GeometryFactory;
37class Point;
38class LinearRing;
39class LineString;
40class Polygon;
41class MultiPoint;
42class MultiPolygon;
43class MultiLineString;
44class GeometryCollection;
45namespace util {
46//class GeometryEditorOperation;
47}
48}
49}
50
51
52namespace geos {
53namespace geom { // geos.geom
54namespace util { // geos.geom.util
55
89class GEOS_DLL GeometryTransformer {
90
91public:
92
94
95 virtual ~GeometryTransformer() = default;
96
97 std::unique_ptr<Geometry> transform(const Geometry* nInputGeom);
98
99 void setSkipTransformedInvalidInteriorRings(bool b);
100
101protected:
102
103 const GeometryFactory* factory;
104
114 CoordinateSequence::Ptr createCoordinateSequence(
115 std::unique_ptr< std::vector<Coordinate> > coords);
116
117 virtual CoordinateSequence::Ptr transformCoordinates(
118 const CoordinateSequence* coords,
119 const Geometry* parent);
120
121 virtual Geometry::Ptr transformPoint(
122 const Point* geom,
123 const Geometry* parent);
124
125 virtual Geometry::Ptr transformMultiPoint(
126 const MultiPoint* geom,
127 const Geometry* parent);
128
129 virtual Geometry::Ptr transformLinearRing(
130 const LinearRing* geom,
131 const Geometry* parent);
132
133 virtual Geometry::Ptr transformLineString(
134 const LineString* 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 transformMultiPolygon(
146 const MultiPolygon* geom,
147 const Geometry* parent);
148
149 virtual Geometry::Ptr transformGeometryCollection(
150 const GeometryCollection* geom,
151 const Geometry* parent);
152
153private:
154
155 const Geometry* inputGeom;
156
157 // these could eventually be exposed to clients
161 bool pruneEmptyGeometry;
162
168 bool preserveGeometryCollectionType;
169
173 // bool preserveCollections;
174
178 bool preserveType;
179
183 bool skipTransformedInvalidInteriorRings;
184
185 // Declare type as noncopyable
186 GeometryTransformer(const GeometryTransformer& other) = delete;
187 GeometryTransformer& operator=(const GeometryTransformer& rhs) = delete;
188};
189
190
191} // namespace geos.geom.util
192} // namespace geos.geom
193} // namespace geos
194
195#endif // GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:55
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:68
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
std::unique_ptr< Geometry > Ptr
An unique_ptr of Geometry.
Definition: Geometry.h:201
Definition: LineString.h:68
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:51
Definition: MultiPoint.h:54
Definition: MultiPolygon.h:59
Definition: Point.h:66
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
A framework for processes which transform an input Geometry into an output Geometry,...
Definition: GeometryTransformer.h:89
CoordinateSequence::Ptr createCoordinateSequence(std::unique_ptr< std::vector< Coordinate > > coords)
Convenience method which provides standard way of creating a CoordinateSequence.
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26