GEOS 3.11.1
OverlayLabeller.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/export.h>
18#include <geos/geom/Location.h>
19#include <geos/operation/overlayng/OverlayGraph.h>
20
21#include <vector>
22#include <deque>
23
24// Forward declarations
25namespace geos {
26namespace geom {
27class Coordinate;
28}
29namespace operation {
30namespace overlayng {
31class OverlayLabel;
32class OverlayGraph;
33class OverlayEdge;
34class InputGeometry;
35}
36}
37}
38
39namespace geos { // geos.
40namespace operation { // geos.operation
41namespace overlayng { // geos.operation.overlayng
42
43
44class GEOS_DLL OverlayLabeller {
45
46private:
47
48 // Members
49 OverlayGraph* graph;
50 InputGeometry* inputGeometry;
51 std::vector<OverlayEdge*>& edges;
52
56 static OverlayEdge* findPropagationStartEdge(OverlayEdge* nodeEdge, uint8_t geomIndex);
57
83 void labelCollapsedEdges();
84 static void labelCollapsedEdge(OverlayEdge* edge, uint8_t geomIndex);
85
91 void labelConnectedLinearEdges();
92 void propagateLinearLocations(uint8_t geomIndex);
93 static void propagateLinearLocationAtNode(OverlayEdge* eNode, uint8_t geomIndex, bool isInputLine, std::deque<OverlayEdge*>& edgeStack);
94
100 static std::vector<OverlayEdge*> findLinearEdgesWithLocation(const std::vector<OverlayEdge *> &edges, uint8_t geomIndex);
101
116 void labelDisconnectedEdges();
117
126 void labelDisconnectedEdge(OverlayEdge* edge, uint8_t geomIndex);
127
137 geom::Location locateEdge(uint8_t geomIndex, OverlayEdge* edge);
138
150 geom::Location locateEdgeBothEnds(uint8_t geomIndex, OverlayEdge* edge);
151
157 void labelAreaNodeEdges(std::vector<OverlayEdge*>& nodes);
158
159
160
161public:
162
163 OverlayLabeller(OverlayGraph* p_graph, InputGeometry* p_inputGeometry)
164 : graph(p_graph)
165 , inputGeometry(p_inputGeometry)
166 , edges(p_graph->getEdges())
167 {}
168
172 void computeLabelling();
173
179 void propagateAreaLocations(OverlayEdge* nodeEdge, uint8_t geomIndex);
180
181 void markResultAreaEdges(int overlayOpCode);
182
190 static void markInResultArea(OverlayEdge* e, int overlayOpCode);
191
198 void unmarkDuplicateEdgesFromResultArea();
199
200
201};
202
203
204} // namespace geos.operation.overlayng
205} // namespace geos.operation
206} // namespace geos
207
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:32
Basic namespace for all GEOS functionalities.
Definition: geos.h:39