GEOS 3.11.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#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;
44namespace util {
45//class GeometryEditorOperation;
46}
47}
48}
49
50
51namespace geos {
52namespace geom { // geos.geom
53namespace util { // geos.geom.util
54
88class GEOS_DLL GeometryTransformer {
89
90public:
91
93
94 virtual ~GeometryTransformer() = default;
95
96 std::unique_ptr<Geometry> transform(const Geometry* nInputGeom);
97
98 void setSkipTransformedInvalidInteriorRings(bool b);
99
100protected:
101
102 const GeometryFactory* factory;
103
113 CoordinateSequence::Ptr createCoordinateSequence(
114 std::unique_ptr< std::vector<Coordinate> > coords);
115
116 virtual CoordinateSequence::Ptr transformCoordinates(
117 const CoordinateSequence* coords,
118 const Geometry* parent);
119
120 virtual Geometry::Ptr transformPoint(
121 const Point* geom,
122 const Geometry* parent);
123
124 virtual Geometry::Ptr transformMultiPoint(
125 const MultiPoint* geom,
126 const Geometry* parent);
127
128 virtual Geometry::Ptr transformLinearRing(
129 const LinearRing* geom,
130 const Geometry* parent);
131
132 virtual Geometry::Ptr transformLineString(
133 const LineString* geom,
134 const Geometry* parent);
135
136 virtual Geometry::Ptr transformMultiLineString(
137 const MultiLineString* geom,
138 const Geometry* parent);
139
140 virtual Geometry::Ptr transformPolygon(
141 const Polygon* geom,
142 const Geometry* parent);
143
144 virtual Geometry::Ptr transformMultiPolygon(
145 const MultiPolygon* geom,
146 const Geometry* parent);
147
148 virtual Geometry::Ptr transformGeometryCollection(
149 const GeometryCollection* geom,
150 const Geometry* parent);
151
152private:
153
154 const Geometry* inputGeom;
155
156 // these could eventually be exposed to clients
160 bool pruneEmptyGeometry;
161
167 bool preserveGeometryCollectionType;
168
172 // bool preserveCollections;
173
177 bool preserveType;
178
182 bool skipTransformedInvalidInteriorRings;
183
184 // Declare type as noncopyable
185 GeometryTransformer(const GeometryTransformer& other) = delete;
186 GeometryTransformer& operator=(const GeometryTransformer& rhs) = delete;
187};
188
189
190} // namespace geos.geom.util
191} // namespace geos.geom
192} // namespace geos
193
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:52
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
std::unique_ptr< Geometry > Ptr
An unique_ptr of Geometry.
Definition: Geometry.h:199
Definition: LineString.h:66
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition: LinearRing.h:55
Models a collection of LineStrings.
Definition: MultiLineString.h:50
Definition: MultiPoint.h:51
Definition: MultiPolygon.h:59
Definition: Point.h:63
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:88
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: geos.h:39