• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

DouglasPeuckerLineSimplifier.h

00001 /**********************************************************************
00002  * $Id: DouglasPeuckerLineSimplifier.h 2785 2009-12-03 19:55:11Z 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 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     // Declare type as noncopyable
00087     DouglasPeuckerLineSimplifier(const DouglasPeuckerLineSimplifier& other);
00088     DouglasPeuckerLineSimplifier& operator=(const DouglasPeuckerLineSimplifier& rhs);
00089 };
00090 
00091 } // namespace geos::simplify
00092 } // namespace geos
00093 
00094 #endif // GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
00095 
00096 /**********************************************************************
00097  * $Log$
00098  * Revision 1.4  2006/07/10 10:16:06  strk
00099  * changed vector<bool> to vector<short int> (see bug#101)
00100  *
00101  * Revision 1.3  2006/06/12 11:29:23  strk
00102  * unsigned int => size_t
00103  *
00104  * Revision 1.2  2006/04/13 10:39:12  strk
00105  * Initial implementation of TaggedLinesSimplifier class
00106  *
00107  * Revision 1.1  2006/04/03 10:16:11  strk
00108  * DouglasPeuckerLineSimplifier class port
00109  *
00110  **********************************************************************/

Generated on Thu Jul 22 2010 for GEOS by  doxygen 1.7.1