GEOS  3.9.1dev
OverlayGraph.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 
17 #include <geos/export.h>
21 
22 #include <map>
23 #include <vector>
24 #include <deque>
25 
26 // Forward declarations
27 namespace geos {
28 namespace geom {
29 class Coordinate;
30 }
31 namespace operation {
32 namespace overlayng {
33 class Edge;
34 }
35 }
36 }
37 
38 namespace geos { // geos.
39 namespace operation { // geos.operation
40 namespace overlayng { // geos.operation.overlayng
41 
42 using namespace geos::geom;
43 
55 
56 private:
57 
58  // Members
59  std::map<Coordinate, OverlayEdge*> 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 
86 public:
87 
91  OverlayGraph();
92 
93  OverlayGraph(const OverlayGraph& g) = delete;
94  OverlayGraph& operator=(const OverlayGraph& g) = delete;
95 
102  OverlayEdge* addEdge(Edge* edge);
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 
133  OverlayLabel* createOverlayLabel(const Edge* edge);
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 
std::vector< OverlayEdge * > edges
Definition: OverlayGraph.h:60
std::map< Coordinate, OverlayEdge * > nodeMap
Definition: OverlayGraph.h:59
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
std::deque< OverlayLabel > ovLabelQue
Definition: OverlayGraph.h:64
std::deque< OverlayEdge > ovEdgeQue
Definition: OverlayGraph.h:63
std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
Basic namespace for all GEOS functionalities.
std::vector< std::unique_ptr< const geom::CoordinateSequence > > csQue
Definition: OverlayGraph.h:66
The internal representation of a list of coordinates inside a Geometry.