com.vividsolutions.jts.planargraph

Class Node


public class Node
extends GraphComponent

A node in a PlanarGraphis a location where 0 or more Edges meet. A node is connected to each of its incident Edges via an outgoing DirectedEdge. Some clients using a PlanarGraph may want to subclass Node to add their own application-specific data and methods.
Version:
1.6

Field Summary

protected DirectedEdgeStar
deStar
The collection of DirectedEdges that leave this Node
protected Coordinate
pt
The location of this Node

Fields inherited from class com.vividsolutions.jts.planargraph.GraphComponent

isMarked, isVisited

Constructor Summary

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

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 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.

Methods inherited from class com.vividsolutions.jts.planargraph.GraphComponent

isMarked, isVisited, setMarked, setVisited

Field Details

deStar

protected DirectedEdgeStar deStar
The collection of DirectedEdges that leave this Node

pt

protected Coordinate pt
The location of this Node

Constructor Details

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 Details

addOutEdge

public void addOutEdge(DirectedEdge de)
Adds an outgoing DirectedEdge to this Node.

getCoordinate

public Coordinate getCoordinate()
Returns the location of this Node.

getDegree

public int getDegree()
Returns the number of edges around this Node.

getEdgesBetween

public static Collection getEdgesBetween(Node node0,
                                         Node node1)
Returns all Edges that connect the two nodes (which are assumed to be different).

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.

getOutEdges

public DirectedEdgeStar getOutEdges()
Returns the collection of DirectedEdges that leave this Node.