GEOS  3.9.1dev
OverlayEdge.h
Go to the documentation of this file.
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 
18 #include <geos/geom/Location.h>
19 
20 #include <geos/export.h>
21 
22 #include <memory>
23 
24 // Forward declarations
25 namespace geos {
26 namespace geom {
27 class Coordinate;
28 class CoordinateSequence;
29 class CoordinateArraySequence;
30 }
31 namespace operation {
32 namespace overlayng {
33 class OverlayEdgeRing;
34 class MaximalEdgeRing;
35 class OverlayLabel;
36 }
37 }
38 }
39 
40 namespace geos { // geos.
41 namespace operation { // geos.operation
42 namespace overlayng { // geos.operation.overlayng
43 
44 using namespace geos::geom;
45 
50 
51 private:
52 
53  // Members
60  bool direction;
70 
71  void markVisited();
72 
73 
74 public:
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 
120  void addCoordinates(CoordinateArraySequence* coords);
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 
const OverlayEdgeRing * edgeRing
Definition: OverlayEdge.h:67
#define GEOS_DLL
Definition: export.h:28
The default implementation of CoordinateSequence.
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
const CoordinateSequence * pts
Definition: OverlayEdge.h:54
const MaximalEdgeRing * maxEdgeRing
Definition: OverlayEdge.h:68
OverlayEdge(const Coordinate &p_orig, const Coordinate &p_dirPt, bool p_direction, OverlayLabel *p_label, const CoordinateSequence *p_pts)
Definition: OverlayEdge.h:77
std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:34
Basic namespace for all GEOS functionalities.
The internal representation of a list of coordinates inside a Geometry.