GEOS 3.9.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
22#include <memory>
23
24// Forward declarations
25namespace geos {
26namespace geom {
27class Coordinate;
28class CoordinateSequence;
29class CoordinateArraySequence;
30}
31namespace operation {
32namespace overlayng {
33class OverlayEdgeRing;
34class MaximalEdgeRing;
35class OverlayLabel;
36}
37}
38}
39
40namespace geos { // geos.
41namespace operation { // geos.operation
42namespace overlayng { // geos.operation.overlayng
43
44using namespace geos::geom;
45
49class GEOS_DLL OverlayEdge : public edgegraph::HalfEdge {
50
51private:
52
53 // Members
54 const CoordinateSequence* pts;
60 bool direction;
61 Coordinate dirPt;
62 OverlayLabel* label;
63 bool m_isInResultArea;
64 bool m_isInResultLine;
65 bool m_isVisited;
66 OverlayEdge* nextResultEdge;
67 const OverlayEdgeRing* edgeRing;
68 const MaximalEdgeRing* maxEdgeRing;
69 OverlayEdge* nextResultMaxEdge;
70
71 void markVisited();
72
73
74public:
75
76 // takes ownershiph of CoordinateSequence
77 OverlayEdge(const Coordinate& p_orig, const Coordinate& p_dirPt,
78 bool p_direction, OverlayLabel* p_label,
79 const CoordinateSequence* p_pts)
80 : HalfEdge(p_orig)
81 , pts(p_pts)
82 , direction(p_direction)
83 , dirPt(p_dirPt)
84 , label(p_label)
85 , m_isInResultArea(false)
86 , m_isInResultLine(false)
87 , m_isVisited(false)
88 , nextResultEdge(nullptr)
89 , edgeRing(nullptr)
90 , maxEdgeRing(nullptr)
91 , nextResultMaxEdge(nullptr)
92 {}
93
94 bool isForward() const;
95
96 const Coordinate& directionPt() const override;
97 ~OverlayEdge() override {};
98
99 OverlayLabel* getLabel() const;
100
101 Location getLocation(int index, int position) const;
102
103 const Coordinate& getCoordinate() const;
104
105 const CoordinateSequence* getCoordinatesRO() const;
106
107 std::unique_ptr<CoordinateSequence> getCoordinates();
108
109 std::unique_ptr<CoordinateSequence> getCoordinatesOriented();
110
121
122 OverlayEdge* symOE() const;
123 OverlayEdge* oNextOE() const;
124
125 bool isInResultArea() const;
126
127 bool isInResultAreaBoth() const;
128
129 void unmarkFromResultAreaBoth();
130
131 void markInResultArea();
132
133 void markInResultAreaBoth();
134
135 bool isInResultLine() const;
136
137 void markInResultLine();
138
139 bool isInResult() const;
140
141 bool isInResultEither() const;
142
143 void setNextResult(OverlayEdge* e);
144
145 OverlayEdge* nextResult() const;
146
147 bool isResultLinked() const;
148
149 void setNextResultMax(OverlayEdge* e);
150
151 OverlayEdge* nextResultMax() const;
152
153 bool isResultMaxLinked() const;
154
155 bool isVisited() const;
156 void markVisitedBoth();
157
158 const OverlayEdgeRing* getEdgeRing() const;
159 void setEdgeRing(const OverlayEdgeRing* p_edgeRing);
160
161 const MaximalEdgeRing* getEdgeRingMax() const;
162 void setEdgeRingMax(const MaximalEdgeRing* maximalEdgeRing);
163
164 friend std::ostream& operator<<(std::ostream& os, const OverlayEdge& oe);
165 std::string resultSymbol() const;
166
167};
168
169
170} // namespace geos.operation.overlayng
171} // namespace geos.operation
172} // namespace geos
173
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:49
void addCoordinates(CoordinateArraySequence *coords)
const Coordinate & directionPt() const override
Definition: OverlayLabel.h:90
Definition: IndexedNestedRingTester.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: IndexedNestedRingTester.h:26