GEOS: BufferInputLineSimplifier.h Source File

GEOS 3.3.8

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

- File List

BufferInputLineSimplifier.h
1 /**********************************************************************
2 * $Id: BufferInputLineSimplifier.h 3246 2011-02-23 17:13:31Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: operation/buffer/BufferInputLineSimplifier.java r320 (JTS-1.12)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
21 #define GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
22
23 #include <geos/geom/CoordinateSequence.h> // complete type required
24 #include <geos/algorithm/CGAlgorithms.h> // for enum
25
26 #include <memory>
27 #include <vector> // for composition
28
29
30 // Forward declarations
31 namespace geos {
32 namespace geom {
33 class CoordinateSequence;
34 //class PrecisionModel;
35 }
36 }
37
38 namespace geos {
39 namespace operation { // geos.operation
40 namespace buffer { // geos.operation.buffer
41
74 class BufferInputLineSimplifier
75 {
76
77 public:
78
91 static std::auto_ptr<geom::CoordinateSequence> simplify(
92 const geom::CoordinateSequence& inputLine, double distanceTol);
93
94 BufferInputLineSimplifier(const geom::CoordinateSequence& input);
95
106 std::auto_ptr<geom::CoordinateSequence> simplify(double distanceTol);
107
108 private:
109
116 bool deleteShallowConcavities();
117
126 unsigned int findNextNonDeletedIndex(unsigned int index) const;
127
128 std::auto_ptr<geom::CoordinateSequence> collapseLine() const;
129
130 bool isDeletable(int i0, int i1, int i2, double distanceTol) const;
131
132 bool isShallowConcavity(const geom::Coordinate& p0,
133 const geom::Coordinate& p1,
134 const geom::Coordinate& p2,
135 double distanceTol) const;
136
150 bool isShallowSampled(const geom::Coordinate& p0,
151 const geom::Coordinate& p2,
152 int i0, int i2, double distanceTol) const;
153
154 bool isShallow(const geom::Coordinate& p0,
155 const geom::Coordinate& p1,
156 const geom::Coordinate& p2,
157 double distanceTol) const;
158
159 bool isConcave(const geom::Coordinate& p0,
160 const geom::Coordinate& p1,
161 const geom::Coordinate& p2) const;
162
163 static const int NUM_PTS_TO_CHECK = 10;
164
165 static const int INIT = 0;
166 static const int DELETE = 1;
167 static const int KEEP = 1;
168
169 const geom::CoordinateSequence& inputLine;
170 double distanceTol;
171 std::vector<int> isDeleted;
172
173 int angleOrientation;
174
175 // Declare type as noncopyable
176 BufferInputLineSimplifier(const BufferInputLineSimplifier& other);
177 BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs);
178 };
179
180
181 } // namespace geos.operation.buffer
182 } // namespace geos.operation
183 } // namespace geos
184
185
186 #endif // ndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
187
188 /**********************************************************************
189 * $Log$
190 **********************************************************************/
191