GEOS  3.3.3
GeometryTransformer.h
1 /**********************************************************************
2  * $Id: GeometryTransformer.h 3179 2011-02-03 19:59:23Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
8  * Copyright (C) 2006 Refractions Research Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: geom/util/GeometryTransformer.java r320 (JTS-1.12)
18  *
19  **********************************************************************/
20 
21 #ifndef GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H
22 #define GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H
23 
24 
25 #include <geos/export.h>
26 #include <geos/geom/Coordinate.h> // destructor visibility for vector
27 #include <geos/geom/Geometry.h> // destructor visibility for auto_ptr
28 #include <geos/geom/CoordinateSequence.h> // destructor visibility for auto_ptr
29 
30 #include <memory> // for auto_ptr
31 #include <vector>
32 
33 // Forward declarations
34 namespace geos {
35  namespace geom {
36  class Geometry;
37  class GeometryFactory;
38  class Point;
39  class LinearRing;
40  class LineString;
41  class Polygon;
42  class MultiPoint;
43  class MultiPolygon;
44  class MultiLineString;
45  class GeometryCollection;
46  namespace util {
47  //class GeometryEditorOperation;
48  }
49  }
50 }
51 
52 
53 namespace geos {
54 namespace geom { // geos.geom
55 namespace util { // geos.geom.util
56 
93 class GEOS_DLL GeometryTransformer {
94 
95 public:
96 
98 
99  virtual ~GeometryTransformer();
100 
101  std::auto_ptr<Geometry> transform(const Geometry* nInputGeom);
102 
103 protected:
104 
105  const GeometryFactory* factory;
106 
116  CoordinateSequence::AutoPtr createCoordinateSequence(
117  std::auto_ptr< std::vector<Coordinate> > coords);
118 
119  virtual CoordinateSequence::AutoPtr transformCoordinates(
120  const CoordinateSequence* coords,
121  const Geometry* parent);
122 
123  virtual Geometry::AutoPtr transformPoint(
124  const Point* geom,
125  const Geometry* parent);
126 
127  virtual Geometry::AutoPtr transformMultiPoint(
128  const MultiPoint* geom,
129  const Geometry* parent);
130 
131  virtual Geometry::AutoPtr transformLinearRing(
132  const LinearRing* geom,
133  const Geometry* parent);
134 
135  virtual Geometry::AutoPtr transformLineString(
136  const LineString* geom,
137  const Geometry* parent);
138 
139  virtual Geometry::AutoPtr transformMultiLineString(
140  const MultiLineString* geom,
141  const Geometry* parent);
142 
143  virtual Geometry::AutoPtr transformPolygon(
144  const Polygon* geom,
145  const Geometry* parent);
146 
147  virtual Geometry::AutoPtr transformMultiPolygon(
148  const MultiPolygon* geom,
149  const Geometry* parent);
150 
151  virtual Geometry::AutoPtr transformGeometryCollection(
152  const GeometryCollection* geom,
153  const Geometry* parent);
154 
155 private:
156 
157  const Geometry* inputGeom;
158 
159  // these could eventually be exposed to clients
163  bool pruneEmptyGeometry;
164 
170  bool preserveGeometryCollectionType;
171 
175  bool preserveCollections;
176 
180  bool preserveType;
181 
182  // Declare type as noncopyable
184  GeometryTransformer& operator=(const GeometryTransformer& rhs);
185 };
186 
187 
188 } // namespace geos.geom.util
189 } // namespace geos.geom
190 } // namespace geos
191 
192 //#ifdef GEOS_INLINE
193 //# include "geos/geom/util/GeometryTransformer.inl"
194 //#endif
195 
196 #endif // GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H
197 
198 /**********************************************************************
199  * $Log$
200  * Revision 1.4 2006/06/19 21:20:22 strk
201  * updated port info
202  *
203  * Revision 1.3 2006/04/13 14:25:17 strk
204  * TopologyPreservingSimplifier initial port
205  *
206  * Revision 1.2 2006/04/11 12:56:06 strk
207  * used typedef for auto_ptr<CoordinateSequence>
208  *
209  * Revision 1.1 2006/04/11 12:21:49 strk
210  * GeometryTransformer class ported
211  *
212  **********************************************************************/