BufferSubgraph.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research 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/buffer/BufferSubgraph.java r378 (JTS-1.12)
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/operation/buffer/RightmostEdgeFinder.h> // for composition
#include <vector>
#include <set>
#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 Coordinate;
class Envelope;
}
namespace algorithm {
class CGAlgorithms;
}
namespace geomgraph {
class DirectedEdge;
class Node;
}
}
namespace geos {
namespace operation { // geos.operation
namespace buffer { // geos.operation.buffer
class GEOS_DLL BufferSubgraph {
private:
RightmostEdgeFinder finder;
std::vector<geomgraph::DirectedEdge*> dirEdgeList;
std::vector<geomgraph::Node*> nodes;
geom::Coordinate* rightMostCoord;
geom::Envelope* env;
void addReachable(geomgraph::Node* startNode);
void add(geomgraph::Node* node, std::vector<geomgraph::Node*>* nodeStack);
void clearVisitedEdges();
// <FIX> MD - use iteration & queue rather than recursion, for speed and robustness
void computeDepths(geomgraph::DirectedEdge* startEdge);
void computeNodeDepth(geomgraph::Node* n);
void copySymDepths(geomgraph::DirectedEdge* de);
bool contains(std::set<geomgraph::Node*>& nodes, geomgraph::Node* node);
public:
friend std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
BufferSubgraph();
~BufferSubgraph();
std::vector<geomgraph::DirectedEdge*>* getDirectedEdges();
std::vector<geomgraph::Node*>* getNodes();
geom::Coordinate* getRightmostCoordinate();
void create(geomgraph::Node* node);
void computeDepth(int outsideDepth);
void findResultEdges();
int compareTo(BufferSubgraph*);
geom::Envelope* getEnvelope();
};
std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
// INLINES
inline geom::Coordinate*
BufferSubgraph::getRightmostCoordinate()
{
return rightMostCoord;
}
inline std::vector<geomgraph::Node*>*
BufferSubgraph::getNodes()
{
return &nodes;
}
inline std::vector<geomgraph::DirectedEdge*>*
BufferSubgraph::getDirectedEdges()
{
return &dirEdgeList;
}
bool BufferSubgraphGT(BufferSubgraph* first, BufferSubgraph* second);
} // namespace geos::operation::buffer
} // namespace geos::operation
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geom::Envelope
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
geos::geomgraph::DirectedEdge
A directed EdgeEnd.
Definition geomgraph/DirectedEdge.h:42
geos::geomgraph::Node
The node component of a geometry graph.
Definition geomgraph/Node.h:59
geos::operation::buffer::BufferSubgraph
A connected subset of the graph of DirectedEdge and geomgraph::Node.
Definition BufferSubgraph.h:60
geos::operation::buffer::BufferSubgraph::getEnvelope
geom::Envelope * getEnvelope()
Computes the envelope of the edges in the subgraph. The envelope is cached after being computed.
geos::operation::buffer::BufferSubgraph::findResultEdges
void findResultEdges()
Find all edges whose depths indicates that they are in the result area(s).
geos::operation::buffer::BufferSubgraph::compareTo
int compareTo(BufferSubgraph *)
BufferSubgraphs are compared on the x-value of their rightmost Coordinate.
geos::operation::buffer::BufferSubgraph::create
void create(geomgraph::Node *node)
Creates the subgraph consisting of all edges reachable from this node.
geos::operation::buffer::BufferSubgraph::getRightmostCoordinate
geom::Coordinate * getRightmostCoordinate()
Gets the rightmost coordinate in the edges of the subgraph.
Definition BufferSubgraph.h:176
geos::operation::buffer::RightmostEdgeFinder
A RightmostEdgeFinder find the geomgraph::DirectedEdge in a list which has the highest coordinate,...
Definition RightmostEdgeFinder.h:46
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::geom
Definition Angle.h:26
geos::geomgraph
Contains classes that implement topology graphs.
Definition Depth.h:31
geos::operation::buffer
Provides classes for computing buffers of geometries.
Definition namespaces.h:182
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38