GEOS 3.11.1
OverlayGraph.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/Coordinate.h>
19#include <geos/operation/overlayng/OverlayEdge.h>
20#include <geos/operation/overlayng/OverlayLabel.h>
21#include <geos/geom/CoordinateSequence.h>
22
23#include <unordered_map>
24#include <vector>
25#include <deque>
26
27// Forward declarations
28namespace geos {
29namespace geom {
30}
31namespace operation {
32namespace overlayng {
33class Edge;
34}
35}
36}
37
38namespace geos { // geos.
39namespace operation { // geos.operation
40namespace overlayng { // geos.operation.overlayng
41
42using namespace geos::geom;
43
54class GEOS_DLL OverlayGraph {
55
56private:
57
58 // Members
59 std::unordered_map<Coordinate, OverlayEdge*, geom::Coordinate::HashCode> nodeMap;
60 std::vector<OverlayEdge*> edges;
61
62 // Locally store the OverlayEdge and OverlayLabel
63 std::deque<OverlayEdge> ovEdgeQue;
64 std::deque<OverlayLabel> ovLabelQue;
65
66 std::vector<std::unique_ptr<const geom::CoordinateSequence>> csQue;
67
68 // Methods
69
74 OverlayEdge* createEdgePair(const CoordinateSequence* pts, OverlayLabel* lbl);
75
80 OverlayEdge* createOverlayEdge(const CoordinateSequence* pts, OverlayLabel* lbl, bool direction);
81
82 void insert(OverlayEdge* e);
83
84
85
86public:
87
92
93 OverlayGraph(const OverlayGraph& g) = delete;
94 OverlayGraph& operator=(const OverlayGraph& g) = delete;
95
103
109 std::vector<OverlayEdge*>& getEdges();
110
117 std::vector<OverlayEdge*> getNodeEdges();
118
122 OverlayEdge* getNodeEdge(const Coordinate& nodePt) const;
123
127 std::vector<OverlayEdge*> getResultAreaEdges();
128
134
135 friend std::ostream& operator<<(std::ostream& os, const OverlayGraph& og);
136
137};
138
139
140} // namespace geos.operation.overlayng
141} // namespace geos.operation
142} // namespace geos
143
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Definition: operation/overlayng/Edge.h:55
Definition: OverlayEdge.h:52
Definition: OverlayGraph.h:54
OverlayEdge * addEdge(Edge *edge)
std::vector< OverlayEdge * > & getEdges()
std::vector< OverlayEdge * > getResultAreaEdges()
OverlayEdge * getNodeEdge(const Coordinate &nodePt) const
OverlayLabel * createOverlayLabel(const Edge *edge)
std::vector< OverlayEdge * > getNodeEdges()
Definition: OverlayLabel.h:87
Definition: Angle.h:26
Basic namespace for all GEOS functionalities.
Definition: geos.h:39