GEOS  3.8.0dev
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 #ifndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
20 #define GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
21 
22 #include <geos/geom/CoordinateSequence.h> // complete type required
23 
24 #include <memory>
25 #include <vector> // for composition
26 
27 
28 // Forward declarations
29 namespace geos {
30 namespace geom {
31 class CoordinateSequence;
32 //class PrecisionModel;
33 }
34 }
35 
36 namespace geos {
37 namespace operation { // geos.operation
38 namespace buffer { // geos.operation.buffer
39 
73 
74 public:
75 
88  static std::unique_ptr<geom::CoordinateSequence> simplify(
89  const geom::CoordinateSequence& inputLine, double distanceTol);
90 
92 
103  std::unique_ptr<geom::CoordinateSequence> simplify(double distanceTol);
104 
105 private:
106 
113  bool deleteShallowConcavities();
114 
123  size_t findNextNonDeletedIndex(size_t index) const;
124 
125  std::unique_ptr<geom::CoordinateSequence> collapseLine() const;
126 
127  bool isDeletable(size_t i0, size_t i1, size_t i2, double distanceTol) const;
128 
129  bool isShallowConcavity(const geom::Coordinate& p0,
130  const geom::Coordinate& p1,
131  const geom::Coordinate& p2,
132  double distanceTol) const;
133 
147  bool isShallowSampled(const geom::Coordinate& p0,
148  const geom::Coordinate& p2,
149  size_t i0, size_t i2, double distanceTol) const;
150 
151  bool isShallow(const geom::Coordinate& p0,
152  const geom::Coordinate& p1,
153  const geom::Coordinate& p2,
154  double distanceTol) const;
155 
156  bool isConcave(const geom::Coordinate& p0,
157  const geom::Coordinate& p1,
158  const geom::Coordinate& p2) const;
159 
160  static const int NUM_PTS_TO_CHECK = 10;
161 
162  static const int INIT = 0;
163  static const int DELETE = 1;
164  static const int KEEP = 1;
165 
166  const geom::CoordinateSequence& inputLine;
167  double distanceTol;
168  std::vector<int> isDeleted;
169 
170  int angleOrientation;
171 
172  // Declare type as noncopyable
174  BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs) = delete;
175 };
176 
177 
178 } // namespace geos.operation.buffer
179 } // namespace geos.operation
180 } // namespace geos
181 
182 
183 #endif // ndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
184 
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
static std::unique_ptr< geom::CoordinateSequence > simplify(const geom::CoordinateSequence &inputLine, double distanceTol)
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Simplifies a buffer input line to remove concavities with shallow depth.
Definition: BufferInputLineSimplifier.h:72