GEOS  3.4.2
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 #include <cstddef>
26 
27 #ifdef _MSC_VER
28 #pragma warning(push)
29 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
30 #endif
31 
32 // Forward declarations
33 namespace geos {
34  namespace geom {
35  class Coordinate;
36  }
37 }
38 
39 namespace geos {
40 namespace simplify { // geos::simplify
41 
42 using namespace std;
43 
49 
50 public:
51 
52  typedef std::vector<short int> BoolVect;
53  typedef std::auto_ptr<BoolVect> BoolVectAutoPtr;
54 
55  typedef std::vector<geom::Coordinate> CoordsVect;
56  typedef std::auto_ptr<CoordsVect> CoordsVectAutoPtr;
57 
58 
63  static CoordsVectAutoPtr simplify(
64  const CoordsVect& nPts,
65  double distanceTolerance);
66 
67  DouglasPeuckerLineSimplifier(const CoordsVect& nPts);
68 
77  void setDistanceTolerance(double nDistanceTolerance);
78 
83  CoordsVectAutoPtr simplify();
84 
85 private:
86 
87  const CoordsVect& pts;
88  BoolVectAutoPtr usePt;
89  double distanceTolerance;
90 
91  void simplifySection(std::size_t i, std::size_t j);
92 
93  // Declare type as noncopyable
96 };
97 
98 } // namespace geos::simplify
99 } // namespace geos
100 
101 #ifdef _MSC_VER
102 #pragma warning(pop)
103 #endif
104 
105 #endif // GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
Simplifies a linestring (sequence of points) using the standard Douglas-Peucker algorithm.
Definition: DouglasPeuckerLineSimplifier.h:48
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25