GEOS  3.6.1
GeometryTransformer.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
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 auto_ptr
27 #include <geos/geom/CoordinateSequence.h> // destructor visibility for auto_ptr
28 
29 #include <memory> // for auto_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::auto_ptr<Geometry> transform(const Geometry* nInputGeom);
101 
102  void setSkipTransformedInvalidInteriorRings(bool b);
103 
104 protected:
105 
106  const GeometryFactory* factory;
107 
117  CoordinateSequence::AutoPtr createCoordinateSequence(
118  std::auto_ptr< std::vector<Coordinate> > coords);
119 
120  virtual CoordinateSequence::AutoPtr transformCoordinates(
121  const CoordinateSequence* coords,
122  const Geometry* parent);
123 
124  virtual Geometry::AutoPtr transformPoint(
125  const Point* geom,
126  const Geometry* parent);
127 
128  virtual Geometry::AutoPtr transformMultiPoint(
129  const MultiPoint* geom,
130  const Geometry* parent);
131 
132  virtual Geometry::AutoPtr transformLinearRing(
133  const LinearRing* geom,
134  const Geometry* parent);
135 
136  virtual Geometry::AutoPtr transformLineString(
137  const LineString* geom,
138  const Geometry* parent);
139 
140  virtual Geometry::AutoPtr transformMultiLineString(
141  const MultiLineString* geom,
142  const Geometry* parent);
143 
144  virtual Geometry::AutoPtr transformPolygon(
145  const Polygon* geom,
146  const Geometry* parent);
147 
148  virtual Geometry::AutoPtr transformMultiPolygon(
149  const MultiPolygon* geom,
150  const Geometry* parent);
151 
152  virtual Geometry::AutoPtr 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
190  GeometryTransformer& operator=(const GeometryTransformer& rhs);
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:60
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
Definition: LineString.h:70
Represents a linear polygon, which may include holes.
Definition: Polygon.h:66
std::auto_ptr< Geometry > AutoPtr
An auto_ptr of Geometry.
Definition: Geometry.h:180
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:56
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Definition: MultiPoint.h:55
Models an OGC SFS LinearRing.
Definition: LinearRing.h:57
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
Definition: Point.h:67
Models a collection of (}s.
Definition: MultiLineString.h:51