GEOS 3.10.1
OverlayEdge.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
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#pragma once
16
17#include <geos/edgegraph/HalfEdge.h>
18#include <geos/geom/Location.h>
19
20#include <geos/export.h>
21#include <geos/inline.h>
22
23#include <memory>
24
25// Forward declarations
26namespace geos {
27namespace geom {
28class Coordinate;
29class CoordinateSequence;
30class CoordinateArraySequence;
31}
32namespace operation {
33namespace overlayng {
34class OverlayEdgeRing;
35class MaximalEdgeRing;
36class OverlayLabel;
37}
38}
39}
40
41namespace geos { // geos.
42namespace operation { // geos.operation
43namespace overlayng { // geos.operation.overlayng
44
45using namespace geos::geom;
46
50class GEOS_DLL OverlayEdge : public edgegraph::HalfEdge {
51
52private:
53
54 // Members
55 const CoordinateSequence* pts;
61 bool direction;
62 Coordinate dirPt;
63 OverlayLabel* label;
64 bool m_isInResultArea;
65 bool m_isInResultLine;
66 bool m_isVisited;
67 OverlayEdge* nextResultEdge;
68 const OverlayEdgeRing* edgeRing;
69 const MaximalEdgeRing* maxEdgeRing;
70 OverlayEdge* nextResultMaxEdge;
71
72 void markVisited();
73
74
75public:
76
77 // takes ownershiph of CoordinateSequence
78 OverlayEdge(const Coordinate& p_orig, const Coordinate& p_dirPt,
79 bool p_direction, OverlayLabel* p_label,
80 const CoordinateSequence* p_pts)
81 : HalfEdge(p_orig)
82 , pts(p_pts)
83 , direction(p_direction)
84 , dirPt(p_dirPt)
85 , label(p_label)
86 , m_isInResultArea(false)
87 , m_isInResultLine(false)
88 , m_isVisited(false)
89 , nextResultEdge(nullptr)
90 , edgeRing(nullptr)
91 , maxEdgeRing(nullptr)
92 , nextResultMaxEdge(nullptr)
93 {}
94
95 bool isForward() const;
96
97 const Coordinate& directionPt() const override;
98 ~OverlayEdge() override {};
99
100 OverlayLabel* getLabel() const;
101
102 Location getLocation(uint8_t index, int position) const;
103
104 const Coordinate& getCoordinate() const;
105
106 const CoordinateSequence* getCoordinatesRO() const;
107
108 std::unique_ptr<CoordinateSequence> getCoordinates();
109
110 std::unique_ptr<CoordinateSequence> getCoordinatesOriented();
111
122
123 OverlayEdge* symOE() const;
124 OverlayEdge* oNextOE() const;
125
126 bool isInResultArea() const;
127
128 bool isInResultAreaBoth() const;
129
130 void unmarkFromResultAreaBoth();
131
132 void markInResultArea();
133
134 void markInResultAreaBoth();
135
136 bool isInResultLine() const;
137
138 void markInResultLine();
139
140 bool isInResult() const;
141
142 bool isInResultEither() const;
143
144 void setNextResult(OverlayEdge* e);
145
146 OverlayEdge* nextResult() const;
147
148 bool isResultLinked() const;
149
150 void setNextResultMax(OverlayEdge* e);
151
152 OverlayEdge* nextResultMax() const;
153
154 bool isResultMaxLinked() const;
155
156 bool isVisited() const;
157 void markVisitedBoth();
158
159 const OverlayEdgeRing* getEdgeRing() const;
160 void setEdgeRing(const OverlayEdgeRing* p_edgeRing);
161
162 const MaximalEdgeRing* getEdgeRingMax() const;
163 void setEdgeRingMax(const MaximalEdgeRing* maximalEdgeRing);
164
165 friend std::ostream& operator<<(std::ostream& os, const OverlayEdge& oe);
166 std::string resultSymbol() const;
167
168};
169
170
171} // namespace geos.operation.overlayng
172} // namespace geos.operation
173} // namespace geos
174
175#ifdef GEOS_INLINE
176#include "geos/operation/overlayng/OverlayEdge.inl"
177#endif
Definition: HalfEdge.h:63
The default implementation of CoordinateSequence.
Definition: CoordinateArraySequence.h:37
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Definition: OverlayEdge.h:50
const Coordinate & directionPt() const override
void addCoordinates(CoordinateArraySequence *coords) const
Definition: OverlayLabel.h:90
Definition: Angle.h:27
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:34
Basic namespace for all GEOS functionalities.
Definition: geos.h:40