PolygonizeGraph.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* 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.
*
**********************************************************************
*
* Last port: operation/polygonize/PolygonizeGraph.java rev. 974
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/planargraph/PlanarGraph.h> // for inheritance
#include <vector>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
#endif
// Forward declarations
namespace geos {
namespace geom {
class LineString;
class GeometryFactory;
class Coordinate;
class CoordinateSequence;
}
namespace planargraph {
class Node;
class Edge;
class DirectedEdge;
}
namespace operation {
namespace polygonize {
class EdgeRing;
class PolygonizeDirectedEdge;
}
}
}
namespace geos {
namespace operation { // geos::operation
namespace polygonize { // geos::operation::polygonize
class GEOS_DLL PolygonizeGraph: public planargraph::PlanarGraph {
public:
static void deleteAllEdges(planargraph::Node* node);
explicit PolygonizeGraph(const geom::GeometryFactory* newFactory);
~PolygonizeGraph() override;
void addEdge(const geom::LineString* line);
void getEdgeRings(std::vector<EdgeRing*>& edgeRingList);
void deleteCutEdges(std::vector<const geom::LineString*>& cutLines);
void deleteDangles(std::vector<const geom::LineString*>& dangleLines);
private:
static int getDegreeNonDeleted(planargraph::Node* node);
static int getDegree(planargraph::Node* node, long label);
const geom::GeometryFactory* factory;
planargraph::Node* getNode(const geom::Coordinate& pt);
void computeNextCWEdges();
void convertMaximalToMinimalEdgeRings(
std::vector<PolygonizeDirectedEdge*>& ringEdges);
static void findIntersectionNodes(PolygonizeDirectedEdge* startDE,
long label, std::vector<planargraph::Node*>& intNodes
);
static void findLabeledEdgeRings(
std::vector<planargraph::DirectedEdge*>& dirEdgesIn,
std::vector<PolygonizeDirectedEdge*>& dirEdgesOut);
static void label(std::vector<PolygonizeDirectedEdge*>& dirEdges, long label);
static void label(std::vector<planargraph::DirectedEdge*>& dirEdges, long label);
static void computeNextCWEdges(planargraph::Node* node);
static void computeNextCCWEdges(planargraph::Node* node, long label);
EdgeRing* findEdgeRing(PolygonizeDirectedEdge* startDE);
/* These are for memory management */
std::vector<planargraph::Edge*> newEdges;
std::vector<planargraph::DirectedEdge*> newDirEdges;
std::vector<planargraph::Node*> newNodes;
std::vector<EdgeRing*> newEdgeRings;
std::vector<geom::CoordinateSequence*> newCoords;
};
} // namespace geos::operation::polygonize
} // namespace geos::operation
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
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::geom::GeometryFactory
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
geos::geom::LineString
Definition LineString.h:66
geos::operation::polygonize::EdgeRing
Represents a ring of PolygonizeDirectedEdge which form a ring of a polygon. The ring may be either an...
Definition operation/polygonize/EdgeRing.h:59
geos::operation::polygonize::PolygonizeDirectedEdge
A DirectedEdge of a PolygonizeGraph, which represents an edge of a polygon formed by the graph.
Definition PolygonizeDirectedEdge.h:52
geos::operation::polygonize::PolygonizeGraph::getEdgeRings
void getEdgeRings(std::vector< EdgeRing * > &edgeRingList)
Computes the EdgeRings formed by the edges in this graph.
geos::operation::polygonize::PolygonizeGraph::deleteAllEdges
static void deleteAllEdges(planargraph::Node *node)
Deletes all edges at a node.
geos::operation::polygonize::PolygonizeGraph::deleteCutEdges
void deleteCutEdges(std::vector< const geom::LineString * > &cutLines)
Finds and removes all cut edges from the graph.
geos::operation::polygonize::PolygonizeGraph::addEdge
void addEdge(const geom::LineString *line)
Add a LineString forming an edge of the polygon graph.
geos::operation::polygonize::PolygonizeGraph::~PolygonizeGraph
~PolygonizeGraph() override
Destroy a polygonization graph.
geos::operation::polygonize::PolygonizeGraph::PolygonizeGraph
PolygonizeGraph(const geom::GeometryFactory *newFactory)
Create a new polygonization graph.
geos::operation::polygonize::PolygonizeGraph::deleteDangles
void deleteDangles(std::vector< const geom::LineString * > &dangleLines)
Marks all edges from the graph which are "dangles".
geos::planargraph::DirectedEdge
Represents a directed edge in a PlanarGraph.
Definition planargraph/DirectedEdge.h:45
geos::planargraph::Edge
Represents an undirected edge of a PlanarGraph.
Definition planargraph/Edge.h:54
geos::planargraph::Node
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition planargraph/Node.h:44
geos::planargraph::PlanarGraph
Represents a directed graph which is embeddable in a planar surface.
Definition planargraph/PlanarGraph.h:59
geos::geom
Definition Angle.h:26
geos::operation::polygonize
An API for polygonizing sets of lines.
Definition namespaces.h:232
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos::planargraph
Contains classes to implement a planar graph data structure.
Definition namespaces.h:293
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38