Package org.locationtech.jts.planargraph
Class Node
- java.lang.Object
-
- org.locationtech.jts.planargraph.GraphComponent
-
- org.locationtech.jts.planargraph.Node
-
public class Node extends GraphComponent
A node in aPlanarGraph
is a location where 0 or moreEdge
s meet. A node is connected to each of its incident Edges via an outgoing DirectedEdge. Some clients using aPlanarGraph
may want to subclassNode
to add their own application-specific data and methods.- Version:
- 1.7
-
-
Constructor Summary
Constructors Constructor Description Node(Coordinate pt)
Constructs a Node with the given location.Node(Coordinate pt, DirectedEdgeStar deStar)
Constructs a Node with the given location and collection of outgoing DirectedEdges.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOutEdge(DirectedEdge de)
Adds an outgoing DirectedEdge to this Node.Coordinate
getCoordinate()
Returns the location of this Node.int
getDegree()
Returns the number of edges around this Node.static java.util.Collection
getEdgesBetween(Node node0, Node node1)
Returns all Edges that connect the two nodes (which are assumed to be different).int
getIndex(Edge edge)
Returns the zero-based index of the given Edge, after sorting in ascending order by angle with the positive x-axis.DirectedEdgeStar
getOutEdges()
Returns the collection of DirectedEdges that leave this Node.boolean
isRemoved()
Tests whether this node has been removed from its containing graphvoid
remove(DirectedEdge de)
Removes aDirectedEdge
incident on this node.-
Methods inherited from class org.locationtech.jts.planargraph.GraphComponent
getComponentWithVisitedState, getContext, getData, isMarked, isVisited, setContext, setData, setMarked, setMarked, setVisited, setVisited
-
-
-
-
Constructor Detail
-
Node
public Node(Coordinate pt)
Constructs a Node with the given location.
-
Node
public Node(Coordinate pt, DirectedEdgeStar deStar)
Constructs a Node with the given location and collection of outgoing DirectedEdges.
-
-
Method Detail
-
getEdgesBetween
public static java.util.Collection getEdgesBetween(Node node0, Node node1)
Returns all Edges that connect the two nodes (which are assumed to be different).
-
getCoordinate
public Coordinate getCoordinate()
Returns the location of this Node.
-
addOutEdge
public void addOutEdge(DirectedEdge de)
Adds an outgoing DirectedEdge to this Node.
-
getOutEdges
public DirectedEdgeStar getOutEdges()
Returns the collection of DirectedEdges that leave this Node.
-
getDegree
public int getDegree()
Returns the number of edges around this Node.
-
getIndex
public int getIndex(Edge edge)
Returns the zero-based index of the given Edge, after sorting in ascending order by angle with the positive x-axis.
-
remove
public void remove(DirectedEdge de)
Removes aDirectedEdge
incident on this node. Does not change the state of the directed edge.
-
isRemoved
public boolean isRemoved()
Tests whether this node has been removed from its containing graph- Specified by:
isRemoved
in classGraphComponent
- Returns:
true
if this node is removed
-
-