GEOS 3.11.1
BufferInputLineSimplifier.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
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#pragma once
20
21#include <geos/geom/CoordinateSequence.h> // complete type required
22
23#include <memory>
24#include <vector> // for composition
25
26
27// Forward declarations
28namespace geos {
29namespace geom {
30class CoordinateSequence;
31//class PrecisionModel;
32}
33}
34
35namespace geos {
36namespace operation { // geos.operation
37namespace buffer { // geos.operation.buffer
38
72
73public:
74
87 static std::unique_ptr<geom::CoordinateSequence> simplify(
88 const geom::CoordinateSequence& inputLine, double distanceTol);
89
91
102 std::unique_ptr<geom::CoordinateSequence> simplify(double distanceTol);
103
104private:
105
112 bool deleteShallowConcavities();
113
122 std::size_t findNextNonDeletedIndex(std::size_t index) const;
123
124 std::unique_ptr<geom::CoordinateSequence> collapseLine() const;
125
126 bool isDeletable(std::size_t i0, std::size_t i1, std::size_t i2, double distanceTol) const;
127
128 bool isShallowConcavity(const geom::Coordinate& p0,
129 const geom::Coordinate& p1,
130 const geom::Coordinate& p2,
131 double distanceTol) const;
132
146 bool isShallowSampled(const geom::Coordinate& p0,
147 const geom::Coordinate& p2,
148 std::size_t i0, std::size_t i2, double distanceTol) const;
149
150 bool isShallow(const geom::Coordinate& p0,
151 const geom::Coordinate& p1,
152 const geom::Coordinate& p2,
153 double distanceTol) const;
154
155 bool isConcave(const geom::Coordinate& p0,
156 const geom::Coordinate& p1,
157 const geom::Coordinate& p2) const;
158
159 static const int NUM_PTS_TO_CHECK = 10;
160
161 static const int INIT = 0;
162 static const int DELETE = 1;
163 static const int KEEP = 1;
164
165 const geom::CoordinateSequence& inputLine;
166 double distanceTol;
167 std::vector<int> isDeleted;
168
169 int angleOrientation;
170
171 // Declare type as noncopyable
173 BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs) = delete;
174};
175
176
177} // namespace geos.operation.buffer
178} // namespace geos.operation
179} // namespace geos
180
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Simplifies a buffer input line to remove concavities with shallow depth.
Definition: BufferInputLineSimplifier.h:71
static std::unique_ptr< geom::CoordinateSequence > simplify(const geom::CoordinateSequence &inputLine, double distanceTol)
std::unique_ptr< geom::CoordinateSequence > simplify(double distanceTol)
Basic namespace for all GEOS functionalities.
Definition: geos.h:39