GEOS 3.2.2
|
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 #include <cstddef> 00027 00028 // Forward declarations 00029 namespace geos { 00030 namespace geom { 00031 class Coordinate; 00032 } 00033 } 00034 00035 namespace geos { 00036 namespace simplify { // geos::simplify 00037 00038 using namespace std; 00039 00044 class GEOS_DLL DouglasPeuckerLineSimplifier { 00045 00046 public: 00047 00048 typedef std::vector<short int> BoolVect; 00049 typedef std::auto_ptr<BoolVect> BoolVectAutoPtr; 00050 00051 typedef std::vector<geom::Coordinate> CoordsVect; 00052 typedef std::auto_ptr<CoordsVect> CoordsVectAutoPtr; 00053 00054 00059 static CoordsVectAutoPtr simplify( 00060 const CoordsVect& nPts, 00061 double distanceTolerance); 00062 00063 DouglasPeuckerLineSimplifier(const CoordsVect& nPts); 00064 00073 void setDistanceTolerance(double nDistanceTolerance); 00074 00079 CoordsVectAutoPtr simplify(); 00080 00081 private: 00082 00083 const CoordsVect& pts; 00084 BoolVectAutoPtr usePt; 00085 double distanceTolerance; 00086 00087 void simplifySection(size_t i, size_t j); 00088 00089 // Declare type as noncopyable 00090 DouglasPeuckerLineSimplifier(const DouglasPeuckerLineSimplifier& other); 00091 DouglasPeuckerLineSimplifier& operator=(const DouglasPeuckerLineSimplifier& rhs); 00092 }; 00093 00094 } // namespace geos::simplify 00095 } // namespace geos 00096 00097 #endif // GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H 00098 00099 /********************************************************************** 00100 * $Log$ 00101 * Revision 1.4 2006/07/10 10:16:06 strk 00102 * changed vector<bool> to vector<short int> (see bug#101) 00103 * 00104 * Revision 1.3 2006/06/12 11:29:23 strk 00105 * unsigned int => size_t 00106 * 00107 * Revision 1.2 2006/04/13 10:39:12 strk 00108 * Initial implementation of TaggedLinesSimplifier class 00109 * 00110 * Revision 1.1 2006/04/03 10:16:11 strk 00111 * DouglasPeuckerLineSimplifier class port 00112 * 00113 **********************************************************************/