GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

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
96 GeometryTransformer();
97
98 virtual ~GeometryTransformer();
99
100 std::auto_ptr<Geometry> transform(const Geometry* nInputGeom);
101
102 protected:
103
104 const GeometryFactory* factory;
105
115 CoordinateSequence::AutoPtr createCoordinateSequence(
116 std::auto_ptr< std::vector<Coordinate> > coords);
117
118 virtual CoordinateSequence::AutoPtr transformCoordinates(
119 const CoordinateSequence* coords,
120 const Geometry* parent);
121
122 virtual Geometry::AutoPtr transformPoint(
123 const Point* geom,
124 const Geometry* parent);
125
126 virtual Geometry::AutoPtr transformMultiPoint(
127 const MultiPoint* geom,
128 const Geometry* parent);
129
130 virtual Geometry::AutoPtr transformLinearRing(
131 const LinearRing* geom,
132 const Geometry* parent);
133
134 virtual Geometry::AutoPtr transformLineString(
135 const LineString* geom,
136 const Geometry* parent);
137
138 virtual Geometry::AutoPtr transformMultiLineString(
139 const MultiLineString* geom,
140 const Geometry* parent);
141
142 virtual Geometry::AutoPtr transformPolygon(
143 const Polygon* geom,
144 const Geometry* parent);
145
146 virtual Geometry::AutoPtr transformMultiPolygon(
147 const MultiPolygon* geom,
148 const Geometry* parent);
149
150 virtual Geometry::AutoPtr transformGeometryCollection(
151 const GeometryCollection* geom,
152 const Geometry* parent);
153
154 private:
155
156 const Geometry* inputGeom;
157
158 // these could eventually be exposed to clients
162 bool pruneEmptyGeometry;
163
169 bool preserveGeometryCollectionType;
170
174 bool preserveCollections;
175
179 bool preserveType;
180
181 // Declare type as noncopyable
182 GeometryTransformer(const GeometryTransformer& other);
183 GeometryTransformer& operator=(const GeometryTransformer& rhs);
184 };
185
186
187 } // namespace geos.geom.util
188 } // namespace geos.geom
189 } // namespace geos
190
191 #endif // GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H