Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

DouglasPeuckerLineSimplifier.h

00001 /**********************************************************************
00002  * $Id: DouglasPeuckerLineSimplifier.h 2556 2009-06-06 22:22:28Z strk $
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 Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************
00015  *
00016  * Last port: simplify/DouglasPeuckerLineSimplifier.java rev. 1.4
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef _GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H_
00021 #define _GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H_ 
00022 
00023 #include <geos/export.h>
00024 #include <vector>
00025 #include <memory> // for auto_ptr
00026 
00027 // Forward declarations
00028 namespace geos {
00029         namespace geom {
00030                 class Coordinate;
00031         }
00032 }
00033 
00034 namespace geos {
00035 namespace simplify { // geos::simplify
00036 
00041 class GEOS_DLL DouglasPeuckerLineSimplifier {
00042 
00043 public:
00044 
00045         typedef std::vector<short int> BoolVect;
00046         typedef std::auto_ptr<BoolVect> BoolVectAutoPtr;
00047 
00048         typedef std::vector<geom::Coordinate> CoordsVect;
00049         typedef std::auto_ptr<CoordsVect> CoordsVectAutoPtr;
00050 
00051 
00056         static CoordsVectAutoPtr simplify(
00057                         const CoordsVect& nPts,
00058                         double distanceTolerance);
00059 
00060         DouglasPeuckerLineSimplifier(const CoordsVect& nPts);
00061 
00070         void setDistanceTolerance(double nDistanceTolerance);
00071 
00076         CoordsVectAutoPtr simplify();
00077 
00078 private:
00079 
00080         const CoordsVect& pts;
00081         BoolVectAutoPtr usePt;
00082         double distanceTolerance;
00083 
00084         void simplifySection(size_t i, size_t j);
00085 };
00086 
00087 } // namespace geos::simplify
00088 } // namespace geos
00089 
00090 #endif // _GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H_ 
00091 
00092 /**********************************************************************
00093  * $Log$
00094  * Revision 1.4  2006/07/10 10:16:06  strk
00095  * changed vector<bool> to vector<short int> (see bug#101)
00096  *
00097  * Revision 1.3  2006/06/12 11:29:23  strk
00098  * unsigned int => size_t
00099  *
00100  * Revision 1.2  2006/04/13 10:39:12  strk
00101  * Initial implementation of TaggedLinesSimplifier class
00102  *
00103  * Revision 1.1  2006/04/03 10:16:11  strk
00104  * DouglasPeuckerLineSimplifier class port
00105  *
00106  **********************************************************************/

Generated on Thu Jun 11 06:17:01 2009 for GEOS by  doxygen 1.4.4