17#include <geos/geom/Envelope.h>
18#include <geos/simplify/LinkedLine.h>
19#include <geos/export.h>
44 using LinkedLine = geos::simplify::LinkedLine;
48 Corner(
const LinkedLine* edge, std::size_t i);
50 bool isVertex(std::size_t index)
const;
52 inline std::size_t getIndex()
const {
56 inline double getArea()
const {
60 const Coordinate& prev()
const;
61 const Coordinate& next()
const;
63 Envelope envelope()
const;
65 bool isVertex(
const Coordinate& v)
const;
66 bool isBaseline(
const Coordinate& p0,
const Coordinate& p1)
const;
67 bool intersects(
const Coordinate& v)
const;
68 bool isRemoved()
const;
70 const Coordinate& getCoordinate() {
71 return m_edge->getCoordinate(m_index);
74 std::unique_ptr<LineString> toLineString()
const;
76 inline int compareTo(
const Corner& rhs)
const {
77 double area_lhs = getArea();
78 double area_rhs = rhs.getArea();
80 if (area_lhs == area_rhs) {
81 std::size_t index_lhs = getIndex();
82 std::size_t index_rhs = rhs.getIndex();
83 if (index_lhs == index_rhs)
return 0;
84 else return index_lhs < index_rhs ? -1 : 1;
87 return area_lhs < area_rhs ? -1 : 1;
90 bool operator< (
const Corner& rhs)
const {
91 return compareTo(rhs) < 0;
94 bool operator> (
const Corner& rhs)
const {
95 return compareTo(rhs) > 0;
98 bool operator==(
const Corner& rhs)
const {
99 return compareTo(rhs) == 0;
103 inline bool operator()(
const Corner & a,
const Corner & b)
const {
104 return a.compareTo(b) > 0;
111 using PriorityQueue = std::priority_queue<Corner, std::vector<Corner>, Corner::Greater>;
117 const LinkedLine* m_edge;
124 static double area(
const LinkedLine& edge, std::size_t index);
130GEOS_DLL std::ostream& operator<< (std::ostream& os,
const Corner& c);
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
Definition LineString.h:66
Basic namespace for all GEOS functionalities.
Definition geos.h:39