17#include <geos/geom/Coordinate.h>
18#include <geos/simplify/LinkedRing.h>
19#include <geos/index/VertexSequencePackedRtree.h>
59 RingHull(
const LinearRing* p_ring,
bool p_isOuter);
61 void setMinVertexNum(std::size_t minVertexNum);
63 void setMaxAreaDelta(
double maxAreaDelta);
67 std::unique_ptr<LinearRing> getHull(RingHullIndex& hullIndex);
69 static bool isConvex(
const LinkedRing& vertexRing, std::size_t index);
71 static double area(
const LinkedRing& vertexRing, std::size_t index);
73 void compute(RingHullIndex& hullIndex);
75 std::unique_ptr<Polygon> toGeometry()
const;
93 Corner(std::size_t p_idx, std::size_t p_prev, std::size_t p_next,
double p_area)
107 bool operator< (
const Corner& rhs)
const
109 return area > rhs.area;
112 bool operator> (
const Corner& rhs)
const
114 return area < rhs.area;
117 bool operator==(
const Corner& rhs)
const
119 return area == rhs.area;
122 bool isVertex(std::size_t p_index)
const;
123 std::size_t getIndex()
const;
124 double getArea()
const;
125 void envelope(
const LinkedRing& ring,
Envelope& env)
const;
126 bool intersects(
const Coordinate& v,
const LinkedRing& ring)
const;
127 bool isRemoved(
const LinkedRing& ring)
const;
128 std::unique_ptr<LineString> toLineString(
const LinkedRing& ring);
135 double targetVertexNum = -1.0;
136 double targetAreaDelta = -1.0;
143 std::vector<Coordinate> vertex;
144 std::unique_ptr<LinkedRing> vertexRing;
145 double areaDelta = 0;
152 std::unique_ptr<VertexSequencePackedRtree> vertexIndex;
154 std::priority_queue<Corner> cornerQueue;
157 void init(std::vector<Coordinate>& ring,
bool isOuter);
158 void addCorner(std::size_t i, std::priority_queue<Corner>& cornerQueue);
159 bool isAtTarget(
const Corner& corner);
170 void removeCorner(
const Corner& corner, std::priority_queue<Corner>& cornerQueue);
171 bool isRemovable(
const Corner& corner,
const RingHullIndex& hullIndex)
const;
182 bool hasIntersectingVertex(
183 const Corner& corner,
185 const RingHull* hull)
const;
187 const Coordinate& getCoordinate(std::size_t index)
const;
191 std::vector<std::size_t>& result)
const;
193 void queryHull(
const Envelope& queryEnv, std::vector<Coordinate>& pts);
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Definition: LineString.h:66
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition: LinearRing.h:55
Represents a linear polygon, which may include holes.
Definition: Polygon.h:61
Definition: VertexSequencePackedRtree.h:49
Basic namespace for all GEOS functionalities.
Definition: geos.h:39