17 #include <geos/geom/Envelope.h>
18 #include <geos/simplify/LinkedLine.h>
19 #include <geos/export.h>
39 using geos::simplify::LinkedLine;
51 Corner(
const LinkedLine* edge, std::size_t i);
53 bool isVertex(std::size_t index)
const;
55 inline std::size_t getIndex()
const {
59 inline double getArea()
const {
71 bool isRemoved()
const;
74 return m_edge->getCoordinate(m_index);
77 std::unique_ptr<LineString> toLineString()
const;
79 inline int compareTo(
const Corner& rhs)
const {
80 double area_lhs = getArea();
81 double area_rhs = rhs.getArea();
83 if (area_lhs == area_rhs) {
84 std::size_t index_lhs = getIndex();
85 std::size_t index_rhs = rhs.getIndex();
86 if (index_lhs == index_rhs)
return 0;
87 else return index_lhs < index_rhs ? -1 : 1;
90 return area_lhs < area_rhs ? -1 : 1;
93 bool operator< (
const Corner& rhs)
const {
94 return compareTo(rhs) < 0;
97 bool operator> (
const Corner& rhs)
const {
98 return compareTo(rhs) > 0;
101 bool operator==(
const Corner& rhs)
const {
102 return compareTo(rhs) == 0;
106 inline bool operator()(
const Corner & a,
const Corner & b)
const {
107 return a.compareTo(b) > 0;
114 using PriorityQueue = std::priority_queue<Corner, std::vector<Corner>, Corner::Greater>;
120 const LinkedLine* m_edge;
127 static double area(
const LinkedLine& edge, std::size_t index);
133 GEOS_DLL std::ostream& operator<< (std::ostream& os,
const Corner& c);
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Definition: LineString.h:65
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25