GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

DouglasPeuckerLineSimplifier.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: simplify/DouglasPeuckerLineSimplifier.java rev. 1.4
16 *
17 **********************************************************************/
18
19 #ifndef GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
20 #define GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
21
22 #include <geos/export.h>
23 #include <vector>
24 #include <memory> // for auto_ptr
25
26 #ifdef _MSC_VER
27 #pragma warning(push)
28 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
29 #endif
30
31 // Forward declarations
32 namespace geos {
33 namespace geom {
34 class Coordinate;
35 }
36 }
37
38 namespace geos {
39 namespace simplify { // geos::simplify
40
45 class GEOS_DLL DouglasPeuckerLineSimplifier {
46
47 public:
48
49 typedef std::vector<short int> BoolVect;
50 typedef std::auto_ptr<BoolVect> BoolVectAutoPtr;
51
52 typedef std::vector<geom::Coordinate> CoordsVect;
53 typedef std::auto_ptr<CoordsVect> CoordsVectAutoPtr;
54
55
60 static CoordsVectAutoPtr simplify(
61 const CoordsVect& nPts,
62 double distanceTolerance);
63
64 DouglasPeuckerLineSimplifier(const CoordsVect& nPts);
65
74 void setDistanceTolerance(double nDistanceTolerance);
75
80 CoordsVectAutoPtr simplify();
81
82 private:
83
84 const CoordsVect& pts;
85 BoolVectAutoPtr usePt;
86 double distanceTolerance;
87
88 void simplifySection(std::size_t i, std::size_t j);
89
90 // Declare type as noncopyable
91 DouglasPeuckerLineSimplifier(const DouglasPeuckerLineSimplifier& other);
92 DouglasPeuckerLineSimplifier& operator=(const DouglasPeuckerLineSimplifier& rhs);
93 };
94
95 } // namespace geos::simplify
96 } // namespace geos
97
98 #ifdef _MSC_VER
99 #pragma warning(pop)
100 #endif
101
102 #endif // GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H