GEOS 3.15.0dev
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
52class 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 // Methods
67
72 OverlayEdge* createEdgePair(const std::shared_ptr<const CoordinateSequence> &pts, OverlayLabel *lbl);
73
78 OverlayEdge* createOverlayEdge(const std::shared_ptr<const CoordinateSequence> &pts, OverlayLabel *lbl, bool direction);
79
80 void insert(OverlayEdge* e);
81
82
83
84public:
85
90
91 OverlayGraph(const OverlayGraph& g) = delete;
92 OverlayGraph& operator=(const OverlayGraph& g) = delete;
93
101
107 std::vector<OverlayEdge*>& getEdges();
108
115 std::vector<OverlayEdge*> getNodeEdges();
116
120 OverlayEdge* getNodeEdge(const Coordinate& nodePt) const;
121
125 std::vector<OverlayEdge*> getResultAreaEdges();
126
132
133 friend std::ostream& operator<<(std::ostream& os, const OverlayGraph& og);
134
135};
136
137
138} // namespace geos.operation.overlayng
139} // namespace geos.operation
140} // namespace geos
141
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
Definition operation/overlayng/Edge.h:55
Definition OverlayEdge.h:47
Definition OverlayGraph.h:52
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:86
Basic namespace for all GEOS functionalities.
Definition geos.h:38