GEOS 3.3.8

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

- File List

DouglasPeuckerLineSimplifier.h
1 /**********************************************************************
2 * $Id: DouglasPeuckerLineSimplifier.h 3255 2011-03-01 17:56:10Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: simplify/DouglasPeuckerLineSimplifier.java rev. 1.4
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
21 #define GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
22
23 #include <geos/export.h>
24 #include <vector>
25 #include <memory> // for auto_ptr
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
46 class GEOS_DLL DouglasPeuckerLineSimplifier {
47
48 public:
49
50 typedef std::vector<short int> BoolVect;
51 typedef std::auto_ptr<BoolVect> BoolVectAutoPtr;
52
53 typedef std::vector<geom::Coordinate> CoordsVect;
54 typedef std::auto_ptr<CoordsVect> CoordsVectAutoPtr;
55
56
61 static CoordsVectAutoPtr simplify(
62 const CoordsVect& nPts,
63 double distanceTolerance);
64
65 DouglasPeuckerLineSimplifier(const CoordsVect& nPts);
66
75 void setDistanceTolerance(double nDistanceTolerance);
76
81 CoordsVectAutoPtr simplify();
82
83 private:
84
85 const CoordsVect& pts;
86 BoolVectAutoPtr usePt;
87 double distanceTolerance;
88
89 void simplifySection(std::size_t i, std::size_t j);
90
91 // Declare type as noncopyable
92 DouglasPeuckerLineSimplifier(const DouglasPeuckerLineSimplifier& other);
93 DouglasPeuckerLineSimplifier& operator=(const DouglasPeuckerLineSimplifier& rhs);
94 };
95
96 } // namespace geos::simplify
97 } // namespace geos
98
99 #ifdef _MSC_VER
100 #pragma warning(pop)
101 #endif
102
103 #endif // GEOS_SIMPLIFY_DOUBGLASPEUCKERLINESIMPLIFIER_H
104
105 /**********************************************************************
106 * $Log$
107 * Revision 1.4 2006/07/10 10:16:06 strk
108 * changed vector<bool> to vector<short int> (see bug#101)
109 *
110 * Revision 1.3 2006/06/12 11:29:23 strk
111 * unsigned int => size_t
112 *
113 * Revision 1.2 2006/04/13 10:39:12 strk
114 * Initial implementation of TaggedLinesSimplifier class
115 *
116 * Revision 1.1 2006/04/03 10:16:11 strk
117 * DouglasPeuckerLineSimplifier class port
118 *
119 **********************************************************************/