GEOS  3.8.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 #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
33 namespace geos {
34 namespace geom {
35 class Geometry;
36 class GeometryFactory;
37 class Point;
38 class LinearRing;
39 class LineString;
40 class Polygon;
41 class MultiPoint;
42 class MultiPolygon;
43 class MultiLineString;
44 class GeometryCollection;
45 namespace util {
46 //class GeometryEditorOperation;
47 }
48 }
49 }
50 
51 
52 namespace geos {
53 namespace geom { // geos.geom
54 namespace util { // geos.geom.util
55 
92 class GEOS_DLL GeometryTransformer {
93 
94 public:
95 
97 
98  virtual ~GeometryTransformer();
99 
100  std::unique_ptr<Geometry> transform(const Geometry* nInputGeom);
101 
102  void setSkipTransformedInvalidInteriorRings(bool b);
103 
104 protected:
105 
106  const GeometryFactory* factory;
107 
117  CoordinateSequence::Ptr createCoordinateSequence(
118  std::unique_ptr< std::vector<Coordinate> > coords);
119 
120  virtual CoordinateSequence::Ptr transformCoordinates(
121  const CoordinateSequence* coords,
122  const Geometry* parent);
123 
124  virtual Geometry::Ptr transformPoint(
125  const Point* geom,
126  const Geometry* parent);
127 
128  virtual Geometry::Ptr transformMultiPoint(
129  const MultiPoint* geom,
130  const Geometry* parent);
131 
132  virtual Geometry::Ptr transformLinearRing(
133  const LinearRing* geom,
134  const Geometry* parent);
135 
136  virtual Geometry::Ptr transformLineString(
137  const LineString* geom,
138  const Geometry* parent);
139 
140  virtual Geometry::Ptr transformMultiLineString(
141  const MultiLineString* geom,
142  const Geometry* parent);
143 
144  virtual Geometry::Ptr transformPolygon(
145  const Polygon* geom,
146  const Geometry* parent);
147 
148  virtual Geometry::Ptr transformMultiPolygon(
149  const MultiPolygon* geom,
150  const Geometry* parent);
151 
152  virtual Geometry::Ptr transformGeometryCollection(
153  const GeometryCollection* geom,
154  const Geometry* parent);
155 
156 private:
157 
158  const Geometry* inputGeom;
159 
160  // these could eventually be exposed to clients
164  bool pruneEmptyGeometry;
165 
171  bool preserveGeometryCollectionType;
172 
176  // bool preserveCollections;
177 
181  bool preserveType;
182 
186  bool skipTransformedInvalidInteriorRings;
187 
188  // Declare type as noncopyable
189  GeometryTransformer(const GeometryTransformer& other) = delete;
190  GeometryTransformer& operator=(const GeometryTransformer& rhs) = delete;
191 };
192 
193 
194 } // namespace geos.geom.util
195 } // namespace geos.geom
196 } // namespace geos
197 
198 #endif // GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H
A framework for processes which transform an input Geometry into an output Geometry, possibly changing its structure and type(s).
Definition: GeometryTransformer.h:92
Models a collection of Polygons.
Definition: MultiPolygon.h:59
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:187
Definition: LineString.h:69
Represents a linear polygon, which may include holes.
Definition: Polygon.h:65
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:55
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Definition: MultiPoint.h:54
Models an OGC SFS LinearRing.
Definition: LinearRing.h:56
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
std::unique_ptr< Geometry > Ptr
An unique_ptr of Geometry.
Definition: Geometry.h:200
Definition: Point.h:66
Models a collection of (}s.
Definition: MultiLineString.h:51