|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vividsolutions.jts.planargraph.PlanarGraph
public abstract class PlanarGraph
Represents a directed graph which is embeddable in a planar surface.
This class and the other classes in this package serve as a framework for
building planar graphs for specific algorithms. This class must be
subclassed to expose appropriate methods to construct the graph. This allows
controlling the types of graph components (DirectedEdge
s,
Edge
s and Node
s) which can be added to the graph. An
application which uses the graph framework will almost always provide
subclasses for one or more graph components, which hold application-specific
data and graph algorithms.
Field Summary | |
---|---|
protected java.util.Set |
dirEdges
|
protected java.util.Set |
edges
|
protected NodeMap |
nodeMap
|
Constructor Summary | |
---|---|
PlanarGraph()
Constructs a empty graph. |
Method Summary | |
---|---|
protected void |
add(DirectedEdge dirEdge)
Adds the Edge to this PlanarGraph; only subclasses can add DirectedEdges, to ensure the edges added are of the right class. |
protected void |
add(Edge edge)
Adds the Edge and its DirectedEdges with this PlanarGraph. |
protected void |
add(Node node)
Adds a node to the map, replacing any that is already at that location. |
boolean |
contains(DirectedEdge de)
Tests whether this graph contains the given DirectedEdge |
boolean |
contains(Edge e)
Tests whether this graph contains the given Edge |
java.util.Iterator |
dirEdgeIterator()
Returns an Iterator over the DirectedEdges in this PlanarGraph, in the order in which they were added. |
java.util.Iterator |
edgeIterator()
Returns an Iterator over the Edges in this PlanarGraph, in the order in which they were added. |
Node |
findNode(Coordinate pt)
Returns the Node at the given location,
or null if no Node was there. |
java.util.List |
findNodesOfDegree(int degree)
Returns all Nodes with the given number of Edges around it. |
java.util.Collection |
getEdges()
Returns the Edges that have been added to this PlanarGraph |
java.util.Collection |
getNodes()
|
java.util.Iterator |
nodeIterator()
Returns an Iterator over the Nodes in this PlanarGraph. |
void |
remove(DirectedEdge de)
Removes a DirectedEdge from its from-Node and from this graph. |
void |
remove(Edge edge)
Removes an Edge and its associated DirectedEdge s
from their from-Nodes and from the graph. |
void |
remove(Node node)
Removes a node from the graph, along with any associated DirectedEdges and Edges. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Set edges
protected java.util.Set dirEdges
protected NodeMap nodeMap
Constructor Detail |
---|
public PlanarGraph()
Method Detail |
---|
public Node findNode(Coordinate pt)
Node
at the given location,
or null if no Node
was there.
pt
- the location to query
protected void add(Node node)
node
- the node to addprotected void add(Edge edge)
protected void add(DirectedEdge dirEdge)
public java.util.Iterator nodeIterator()
public boolean contains(Edge e)
Edge
e
- the edge to query
true
if the graph contains the edgepublic boolean contains(DirectedEdge de)
DirectedEdge
de
- the directed edge to query
true
if the graph contains the directed edgepublic java.util.Collection getNodes()
public java.util.Iterator dirEdgeIterator()
add(Edge)
,
add(DirectedEdge)
public java.util.Iterator edgeIterator()
add(Edge)
public java.util.Collection getEdges()
add(Edge)
public void remove(Edge edge)
Edge
and its associated DirectedEdge
s
from their from-Nodes and from the graph.
Note: This method does not remove the Node
s associated
with the Edge
, even if the removal of the Edge
reduces the degree of a Node
to zero.
public void remove(DirectedEdge de)
DirectedEdge
from its from-Node
and from this graph.
This method does not remove the Node
s associated with the DirectedEdge,
even if the removal of the DirectedEdge reduces the degree of a Node to zero.
public void remove(Node node)
public java.util.List findNodesOfDegree(int degree)
|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |