GEOS 3.6.2
BufferInputLineSimplifier.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: operation/buffer/BufferInputLineSimplifier.java r320 (JTS-1.12)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
20#define GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
21
22#include <geos/geom/CoordinateSequence.h> // complete type required
23#include <geos/algorithm/CGAlgorithms.h> // for enum
24
25#include <memory>
26#include <vector> // for composition
27
28
29// Forward declarations
30namespace geos {
31 namespace geom {
33 //class PrecisionModel;
34 }
35}
36
37namespace geos {
38namespace operation { // geos.operation
39namespace buffer { // geos.operation.buffer
40
73class BufferInputLineSimplifier
74{
75
76public:
77
90 static std::auto_ptr<geom::CoordinateSequence> simplify(
91 const geom::CoordinateSequence& inputLine, double distanceTol);
92
93 BufferInputLineSimplifier(const geom::CoordinateSequence& input);
94
105 std::auto_ptr<geom::CoordinateSequence> simplify(double distanceTol);
106
107private:
108
115 bool deleteShallowConcavities();
116
125 unsigned int findNextNonDeletedIndex(unsigned int index) const;
126
127 std::auto_ptr<geom::CoordinateSequence> collapseLine() const;
128
129 bool isDeletable(int i0, int i1, int i2, double distanceTol) const;
130
131 bool isShallowConcavity(const geom::Coordinate& p0,
132 const geom::Coordinate& p1,
133 const geom::Coordinate& p2,
134 double distanceTol) const;
135
149 bool isShallowSampled(const geom::Coordinate& p0,
150 const geom::Coordinate& p2,
151 int i0, int i2, double distanceTol) const;
152
153 bool isShallow(const geom::Coordinate& p0,
154 const geom::Coordinate& p1,
155 const geom::Coordinate& p2,
156 double distanceTol) const;
157
158 bool isConcave(const geom::Coordinate& p0,
159 const geom::Coordinate& p1,
160 const geom::Coordinate& p2) const;
161
162 static const int NUM_PTS_TO_CHECK = 10;
163
164 static const int INIT = 0;
165 static const int DELETE = 1;
166 static const int KEEP = 1;
167
168 const geom::CoordinateSequence& inputLine;
169 double distanceTol;
170 std::vector<int> isDeleted;
171
172 int angleOrientation;
173
174 // Declare type as noncopyable
175 BufferInputLineSimplifier(const BufferInputLineSimplifier& other);
176 BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs);
177};
178
179
180} // namespace geos.operation.buffer
181} // namespace geos.operation
182} // namespace geos
183
184
185#endif // ndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
186
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
std::auto_ptr< geom::CoordinateSequence > simplify(double distanceTol)
static std::auto_ptr< geom::CoordinateSequence > simplify(const geom::CoordinateSequence &inputLine, double distanceTol)
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Provides classes for various kinds of spatial indexes.
Definition IndexedNestedRingTester.h:31
Provides classes for computing buffers of geometries.
Definition opBuffer.h:23
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25