GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net> 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 r320 (JTS-1.12) 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 void setSkipTransformedInvalidInteriorRings(bool b); 00103 00104 protected: 00105 00106 const GeometryFactory* factory; 00107 00117 CoordinateSequence::AutoPtr createCoordinateSequence( 00118 std::auto_ptr< std::vector<Coordinate> > coords); 00119 00120 virtual CoordinateSequence::AutoPtr transformCoordinates( 00121 const CoordinateSequence* coords, 00122 const Geometry* parent); 00123 00124 virtual Geometry::AutoPtr transformPoint( 00125 const Point* geom, 00126 const Geometry* parent); 00127 00128 virtual Geometry::AutoPtr transformMultiPoint( 00129 const MultiPoint* geom, 00130 const Geometry* parent); 00131 00132 virtual Geometry::AutoPtr transformLinearRing( 00133 const LinearRing* geom, 00134 const Geometry* parent); 00135 00136 virtual Geometry::AutoPtr transformLineString( 00137 const LineString* geom, 00138 const Geometry* parent); 00139 00140 virtual Geometry::AutoPtr transformMultiLineString( 00141 const MultiLineString* geom, 00142 const Geometry* parent); 00143 00144 virtual Geometry::AutoPtr transformPolygon( 00145 const Polygon* geom, 00146 const Geometry* parent); 00147 00148 virtual Geometry::AutoPtr transformMultiPolygon( 00149 const MultiPolygon* geom, 00150 const Geometry* parent); 00151 00152 virtual Geometry::AutoPtr transformGeometryCollection( 00153 const GeometryCollection* geom, 00154 const Geometry* parent); 00155 00156 private: 00157 00158 const Geometry* inputGeom; 00159 00160 // these could eventually be exposed to clients 00164 bool pruneEmptyGeometry; 00165 00171 bool preserveGeometryCollectionType; 00172 00176 bool preserveCollections; 00177 00181 bool preserveType; 00182 00186 bool skipTransformedInvalidInteriorRings; 00187 00188 // Declare type as noncopyable 00189 GeometryTransformer(const GeometryTransformer& other); 00190 GeometryTransformer& operator=(const GeometryTransformer& rhs); 00191 }; 00192 00193 00194 } // namespace geos.geom.util 00195 } // namespace geos.geom 00196 } // namespace geos 00197 00198 #endif // GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H