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 
89 class GEOS_DLL GeometryTransformer {
90 
91 public:
92 
94 
95  virtual ~GeometryTransformer();
96 
97  std::unique_ptr<Geometry> transform(const Geometry* nInputGeom);
98 
99  void setSkipTransformedInvalidInteriorRings(bool b);
100 
101 protected:
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 
153 private:
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
A framework for processes which transform an input Geometry into an output Geometry, possibly changing its structure and type(s).
Definition: GeometryTransformer.h:89
Models a collection of Polygons.
Definition: MultiPolygon.h:59
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Definition: LineString.h:68
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:55
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Definition: MultiPoint.h:53
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple...
Definition: LinearRing.h:54
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:201
Definition: Point.h:65
Models a collection of LineStrings.
Definition: MultiLineString.h:51