00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
00020 #define GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
00021
00022 #include <geos/export.h>
00023 #include <vector>
00024 #include <memory>
00025
00026 #ifdef _MSC_VER
00027 #pragma warning(push)
00028 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00029 #endif
00030
00031
00032 namespace geos {
00033 namespace geom {
00034 class Coordinate;
00035 }
00036 }
00037
00038 namespace geos {
00039 namespace simplify {
00040
00045 class GEOS_DLL DouglasPeuckerLineSimplifier {
00046
00047 public:
00048
00049 typedef std::vector<short int> BoolVect;
00050 typedef std::auto_ptr<BoolVect> BoolVectAutoPtr;
00051
00052 typedef std::vector<geom::Coordinate> CoordsVect;
00053 typedef std::auto_ptr<CoordsVect> CoordsVectAutoPtr;
00054
00055
00060 static CoordsVectAutoPtr simplify(
00061 const CoordsVect& nPts,
00062 double distanceTolerance);
00063
00064 DouglasPeuckerLineSimplifier(const CoordsVect& nPts);
00065
00074 void setDistanceTolerance(double nDistanceTolerance);
00075
00080 CoordsVectAutoPtr simplify();
00081
00082 private:
00083
00084 const CoordsVect& pts;
00085 BoolVectAutoPtr usePt;
00086 double distanceTolerance;
00087
00088 void simplifySection(std::size_t i, std::size_t j);
00089
00090
00091 DouglasPeuckerLineSimplifier(const DouglasPeuckerLineSimplifier& other);
00092 DouglasPeuckerLineSimplifier& operator=(const DouglasPeuckerLineSimplifier& rhs);
00093 };
00094
00095 }
00096 }
00097
00098 #ifdef _MSC_VER
00099 #pragma warning(pop)
00100 #endif
00101
00102 #endif // GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H