GeometryTransformer.h

00001 /**********************************************************************
00002  * $Id: GeometryTransformer.h 1820 2006-09-06 16:54:23Z 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 #include <geos/geom/Coordinate.h> // destructor visibility for vector
00024 #include <geos/geom/Geometry.h> // destructor visibility for auto_ptr
00025 #include <geos/geom/CoordinateSequence.h> // destructor visibility for auto_ptr
00026 
00027 #include <memory> // for auto_ptr
00028 #include <vector>
00029 
00030 // Forward declarations
00031 namespace geos {
00032         namespace geom {
00033                 class Geometry;
00034                 class GeometryFactory;
00035                 class Point;
00036                 class LinearRing;
00037                 class LineString;
00038                 class Polygon;
00039                 class MultiPoint;
00040                 class MultiPolygon;
00041                 class MultiLineString;
00042                 class GeometryCollection;
00043                 namespace util {
00044                         //class GeometryEditorOperation;
00045                 }
00046         }
00047 }
00048 
00049 
00050 namespace geos {
00051 namespace geom { // geos.geom
00052 namespace util { // geos.geom.util
00053 
00090 class GeometryTransformer {
00091 
00092 public:
00093 
00094         GeometryTransformer();
00095 
00096         virtual ~GeometryTransformer();
00097 
00098         std::auto_ptr<Geometry> transform(const Geometry* nInputGeom);
00099 
00100 protected:
00101 
00102         const GeometryFactory* factory;
00103 
00113         CoordinateSequence::AutoPtr createCoordinateSequence(
00114                         std::auto_ptr< std::vector<Coordinate> > coords);
00115 
00116         virtual CoordinateSequence::AutoPtr transformCoordinates(
00117                         const CoordinateSequence* coords,
00118                         const Geometry* parent);
00119 
00120         virtual Geometry::AutoPtr transformPoint(
00121                         const Point* geom,
00122                         const Geometry* parent);
00123 
00124         virtual Geometry::AutoPtr transformMultiPoint(
00125                         const MultiPoint* geom,
00126                         const Geometry* parent);
00127 
00128         virtual Geometry::AutoPtr transformLinearRing(
00129                         const LinearRing* geom,
00130                         const Geometry* parent);
00131 
00132         virtual Geometry::AutoPtr transformLineString(
00133                         const LineString* geom,
00134                         const Geometry* parent);
00135 
00136         virtual Geometry::AutoPtr transformMultiLineString(
00137                         const MultiLineString* geom,
00138                         const Geometry* parent);
00139 
00140         virtual Geometry::AutoPtr transformPolygon(
00141                         const Polygon* geom,
00142                         const Geometry* parent);
00143 
00144         virtual Geometry::AutoPtr transformMultiPolygon(
00145                         const MultiPolygon* geom,
00146                         const Geometry* parent);
00147 
00148         virtual Geometry::AutoPtr transformGeometryCollection(
00149                         const GeometryCollection* geom,
00150                         const Geometry* parent);
00151 
00152 private:
00153 
00154         const Geometry* inputGeom;
00155 
00156         // these could eventually be exposed to clients
00160         bool pruneEmptyGeometry;
00161 
00167         bool preserveGeometryCollectionType;
00168 
00172         bool preserveCollections;
00173 
00177         bool preserveType;
00178 
00179 
00180 };
00181 
00182 
00183 } // namespace geos.geom.util
00184 } // namespace geos.geom
00185 } // namespace geos
00186 
00187 //#ifdef GEOS_INLINE
00188 //# include "geos/geom/util/GeometryTransformer.inl"
00189 //#endif
00190 
00191 #endif // GEOS_GEOM_UTIL_GEOMETRYTRANSFORMER_H
00192 
00193 /**********************************************************************
00194  * $Log$
00195  * Revision 1.4  2006/06/19 21:20:22  strk
00196  * updated port info
00197  *
00198  * Revision 1.3  2006/04/13 14:25:17  strk
00199  * TopologyPreservingSimplifier initial port
00200  *
00201  * Revision 1.2  2006/04/11 12:56:06  strk
00202  * used typedef for auto_ptr<CoordinateSequence>
00203  *
00204  * Revision 1.1  2006/04/11 12:21:49  strk
00205  * GeometryTransformer class ported
00206  *
00207  **********************************************************************/

Generated on Fri Mar 27 04:52:45 2009 for GEOS by  doxygen 1.5.4