OverlayGraph.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/Coordinate.h>
#include <geos/operation/overlayng/OverlayEdge.h>
#include <geos/operation/overlayng/OverlayLabel.h>
#include <geos/geom/CoordinateSequence.h>
#include <unordered_map>
#include <vector>
#include <deque>
// Forward declarations
namespace geos {
namespace geom {
}
namespace operation {
namespace overlayng {
class Edge;
}
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace overlayng { // geos.operation.overlayng
class GEOS_DLL OverlayGraph {
using Coordinate = geos::geom::Coordinate;
using CoordinateSequence = geos::geom::CoordinateSequence;
private:
// Members
std::unordered_map<Coordinate, OverlayEdge*, geom::Coordinate::HashCode> nodeMap;
std::vector<OverlayEdge*> edges;
// Locally store the OverlayEdge and OverlayLabel
std::deque<OverlayEdge> ovEdgeQue;
std::deque<OverlayLabel> ovLabelQue;
std::vector<std::unique_ptr<const geom::CoordinateSequence>> csQue;
// Methods
OverlayEdge* createEdgePair(const CoordinateSequence* pts, OverlayLabel* lbl);
OverlayEdge* createOverlayEdge(const CoordinateSequence* pts, OverlayLabel* lbl, bool direction);
void insert(OverlayEdge* e);
public:
OverlayGraph();
OverlayGraph(const OverlayGraph& g) = delete;
OverlayGraph& operator=(const OverlayGraph& g) = delete;
OverlayEdge* addEdge(Edge* edge);
std::vector<OverlayEdge*>& getEdges();
std::vector<OverlayEdge*> getNodeEdges();
OverlayEdge* getNodeEdge(const Coordinate& nodePt) const;
std::vector<OverlayEdge*> getResultAreaEdges();
OverlayLabel* createOverlayLabel(const Edge* edge);
friend std::ostream& operator<<(std::ostream& os, const OverlayGraph& og);
};
} // namespace geos.operation.overlayng
} // namespace geos.operation
} // namespace geos
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::operation::overlayng::Edge
Definition operation/overlayng/Edge.h:55
geos::operation::overlayng::OverlayEdge
Definition OverlayEdge.h:47
geos::operation::overlayng::OverlayGraph::addEdge
OverlayEdge * addEdge(Edge *edge)
geos::operation::overlayng::OverlayGraph::getEdges
std::vector< OverlayEdge * > & getEdges()
geos::operation::overlayng::OverlayGraph::getResultAreaEdges
std::vector< OverlayEdge * > getResultAreaEdges()
geos::operation::overlayng::OverlayGraph::getNodeEdge
OverlayEdge * getNodeEdge(const Coordinate &nodePt) const
geos::operation::overlayng::OverlayGraph::createOverlayLabel
OverlayLabel * createOverlayLabel(const Edge *edge)
geos::operation::overlayng::OverlayGraph::getNodeEdges
std::vector< OverlayEdge * > getNodeEdges()
geos::operation::overlayng::OverlayGraph::OverlayGraph
OverlayGraph()
geos::operation::overlayng::OverlayLabel
Definition OverlayLabel.h:86
geos::geom
Definition Angle.h:26
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38