GEOS 3.2.2
|
00001 /********************************************************************** 00002 * $Id: GeometryTransformer.h 2772 2009-12-03 19:30:54Z mloskot $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2006 Refractions Research Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 ********************************************************************** 00015 * 00016 * Last port: geom/util/GeometryTransformer.java rev. 1.6 (JTS-1.7.1+) 00017 * 00018 **********************************************************************/ 00019 00020 #ifndef GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H 00021 #define GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H 00022 00023 00024 #include <geos/export.h> 00025 #include <geos/geom/Coordinate.h> // destructor visibility for vector 00026 #include <geos/geom/Geometry.h> // destructor visibility for auto_ptr 00027 #include <geos/geom/CoordinateSequence.h> // destructor visibility for auto_ptr 00028 00029 #include <memory> // for auto_ptr 00030 #include <vector> 00031 00032 // Forward declarations 00033 namespace geos { 00034 namespace geom { 00035 class Geometry; 00036 class GeometryFactory; 00037 class Point; 00038 class LinearRing; 00039 class LineString; 00040 class Polygon; 00041 class MultiPoint; 00042 class MultiPolygon; 00043 class MultiLineString; 00044 class GeometryCollection; 00045 namespace util { 00046 //class GeometryEditorOperation; 00047 } 00048 } 00049 } 00050 00051 00052 namespace geos { 00053 namespace geom { // geos.geom 00054 namespace util { // geos.geom.util 00055 00092 class GEOS_DLL GeometryTransformer { 00093 00094 public: 00095 00096 GeometryTransformer(); 00097 00098 virtual ~GeometryTransformer(); 00099 00100 std::auto_ptr<Geometry> transform(const Geometry* nInputGeom); 00101 00102 protected: 00103 00104 const GeometryFactory* factory; 00105 00115 CoordinateSequence::AutoPtr createCoordinateSequence( 00116 std::auto_ptr< std::vector<Coordinate> > coords); 00117 00118 virtual CoordinateSequence::AutoPtr transformCoordinates( 00119 const CoordinateSequence* coords, 00120 const Geometry* parent); 00121 00122 virtual Geometry::AutoPtr transformPoint( 00123 const Point* geom, 00124 const Geometry* parent); 00125 00126 virtual Geometry::AutoPtr transformMultiPoint( 00127 const MultiPoint* geom, 00128 const Geometry* parent); 00129 00130 virtual Geometry::AutoPtr transformLinearRing( 00131 const LinearRing* geom, 00132 const Geometry* parent); 00133 00134 virtual Geometry::AutoPtr transformLineString( 00135 const LineString* geom, 00136 const Geometry* parent); 00137 00138 virtual Geometry::AutoPtr transformMultiLineString( 00139 const MultiLineString* geom, 00140 const Geometry* parent); 00141 00142 virtual Geometry::AutoPtr transformPolygon( 00143 const Polygon* geom, 00144 const Geometry* parent); 00145 00146 virtual Geometry::AutoPtr transformMultiPolygon( 00147 const MultiPolygon* geom, 00148 const Geometry* parent); 00149 00150 virtual Geometry::AutoPtr transformGeometryCollection( 00151 const GeometryCollection* geom, 00152 const Geometry* parent); 00153 00154 private: 00155 00156 const Geometry* inputGeom; 00157 00158 // these could eventually be exposed to clients 00162 bool pruneEmptyGeometry; 00163 00169 bool preserveGeometryCollectionType; 00170 00174 bool preserveCollections; 00175 00179 bool preserveType; 00180 00181 // Declare type as noncopyable 00182 GeometryTransformer(const GeometryTransformer& other); 00183 GeometryTransformer& operator=(const GeometryTransformer& rhs); 00184 }; 00185 00186 00187 } // namespace geos.geom.util 00188 } // namespace geos.geom 00189 } // namespace geos 00190 00191 //#ifdef GEOS_INLINE 00192 //# include "geos/geom/util/GeometryTransformer.inl" 00193 //#endif 00194 00195 #endif // GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H 00196 00197 /********************************************************************** 00198 * $Log$ 00199 * Revision 1.4 2006/06/19 21:20:22 strk 00200 * updated port info 00201 * 00202 * Revision 1.3 2006/04/13 14:25:17 strk 00203 * TopologyPreservingSimplifier initial port 00204 * 00205 * Revision 1.2 2006/04/11 12:56:06 strk 00206 * used typedef for auto_ptr<CoordinateSequence> 00207 * 00208 * Revision 1.1 2006/04/11 12:21:49 strk 00209 * GeometryTransformer class ported 00210 * 00211 **********************************************************************/