Package org.locationtech.jts.planargraph
Class Edge
java.lang.Object
org.locationtech.jts.planargraph.GraphComponent
org.locationtech.jts.planargraph.Edge
- Direct Known Subclasses:
LineMergeEdge
Represents an undirected edge of a
PlanarGraph
. An undirected edge
in fact simply acts as a central point of reference for two opposite
DirectedEdge
s.
Usually a client using a PlanarGraph
will subclass Edge
to add its own application-specific data and methods.
- Version:
- 1.7
-
Constructor Summary
ConstructorsConstructorDescriptionEdge()
Constructs an Edge whose DirectedEdges are not yet set.Edge
(DirectedEdge de0, DirectedEdge de1) Constructs an Edge initialized with the given DirectedEdges, and for each DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node. -
Method Summary
Modifier and TypeMethodDescriptiongetDirEdge
(int i) Returns one of the DirectedEdges associated with this Edge.getDirEdge
(Node fromNode) Returns theDirectedEdge
that starts from the given node, or null if the node is not one of the two nodes associated with this Edge.getOppositeNode
(Node node) Ifnode
is one of the two nodes associated with this Edge, returns the other node; otherwise returns null.boolean
Tests whether this edge has been removed from its containing graphvoid
setDirectedEdges
(DirectedEdge de0, DirectedEdge de1) Initializes this Edge's two DirectedEdges, and for each DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node.Methods inherited from class org.locationtech.jts.planargraph.GraphComponent
getComponentWithVisitedState, getContext, getData, isMarked, isVisited, setContext, setData, setMarked, setMarked, setVisited, setVisited
-
Constructor Details
-
Edge
public Edge()Constructs an Edge whose DirectedEdges are not yet set. Be sure to callsetDirectedEdges(DirectedEdge, DirectedEdge)
-
Edge
Constructs an Edge initialized with the given DirectedEdges, and for each DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node.
-
-
Method Details
-
setDirectedEdges
Initializes this Edge's two DirectedEdges, and for each DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node. -
getDirEdge
Returns one of the DirectedEdges associated with this Edge.- Parameters:
i
- 0 or 1. 0 returns the forward directed edge, 1 returns the reverse
-
getDirEdge
Returns theDirectedEdge
that starts from the given node, or null if the node is not one of the two nodes associated with this Edge. -
getOppositeNode
Ifnode
is one of the two nodes associated with this Edge, returns the other node; otherwise returns null. -
isRemoved
public boolean isRemoved()Tests whether this edge has been removed from its containing graph- Specified by:
isRemoved
in classGraphComponent
- Returns:
true
if this edge is removed
-