GEOS  3.14.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
32 namespace geos {
33 namespace geom {
34 class Geometry;
35 class GeometryFactory;
36 class Point;
37 class LinearRing;
38 class LineString;
39 class Polygon;
40 class MultiPoint;
41 class MultiPolygon;
42 class MultiLineString;
43 class GeometryCollection;
44 namespace util {
45 //class GeometryEditorOperation;
46 }
47 }
48 }
49 
50 
51 namespace geos {
52 namespace geom { // geos.geom
53 namespace util { // geos.geom.util
54 
88 class GEOS_DLL GeometryTransformer {
89 
90 public:
91 
93 
94  virtual ~GeometryTransformer() = default;
95 
96  std::unique_ptr<Geometry> transform(const Geometry* nInputGeom);
97 
98  void setSkipTransformedInvalidInteriorRings(bool b);
99 
100 protected:
101 
102  const GeometryFactory* factory;
103 
104  virtual CoordinateSequence::Ptr transformCoordinates(
105  const CoordinateSequence* coords,
106  const Geometry* parent);
107 
108  virtual Geometry::Ptr transformPoint(
109  const Point* geom,
110  const Geometry* parent);
111 
112  virtual Geometry::Ptr transformMultiPoint(
113  const MultiPoint* geom,
114  const Geometry* parent);
115 
116  virtual Geometry::Ptr transformLinearRing(
117  const LinearRing* geom,
118  const Geometry* parent);
119 
120  virtual Geometry::Ptr transformLineString(
121  const LineString* geom,
122  const Geometry* parent);
123 
124  virtual Geometry::Ptr transformMultiLineString(
125  const MultiLineString* geom,
126  const Geometry* parent);
127 
128  virtual Geometry::Ptr transformPolygon(
129  const Polygon* geom,
130  const Geometry* parent);
131 
132  virtual Geometry::Ptr transformMultiPolygon(
133  const MultiPolygon* geom,
134  const Geometry* parent);
135 
136  virtual Geometry::Ptr transformGeometryCollection(
137  const GeometryCollection* geom,
138  const Geometry* parent);
139 
140 private:
141 
142  const Geometry* inputGeom;
143 
144  // these could eventually be exposed to clients
148  bool pruneEmptyGeometry;
149 
155  bool preserveGeometryCollectionType;
156 
160  // bool preserveCollections;
161 
165  bool preserveType;
166 
170  bool skipTransformedInvalidInteriorRings;
171 
172  // Declare type as noncopyable
173  GeometryTransformer(const GeometryTransformer& other) = delete;
174  GeometryTransformer& operator=(const GeometryTransformer& rhs) = delete;
175 };
176 
177 
178 } // namespace geos.geom.util
179 } // namespace geos.geom
180 } // namespace geos
181 
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:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:197
std::unique_ptr< Geometry > Ptr
An unique_ptr of Geometry.
Definition: Geometry.h:210
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:88
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25