public class GraphicEdge extends GraphicElement implements Edge
The graphic edge defines its source and target node as well as a direction, a string label and a style from the style sheet.
GraphicGraph| Modifier and Type | Class and Description |
|---|---|
class |
GraphicEdge.EdgeGroup
An edge group contains the set of edges between two given nodes.
|
GraphicElement.SwingElementRendererAbstractElement.AttributeChangeEvent| Modifier and Type | Field and Description |
|---|---|
double[] |
ctrl
Control points for curved edges or polylines.
|
boolean |
directed
Is the edge directed ?.
|
GraphicNode |
from
The first node.
|
GraphicEdge.EdgeGroup |
group
If non null, this gives the number of edges between the two same nodes.
|
int |
multi
In case of a multi-graph this is the index of the edge between to and
from.
|
GraphicNode |
to
The second node.
|
component, hidden, label, style| Constructor and Description |
|---|
GraphicEdge(String id,
GraphicNode from,
GraphicNode to,
boolean dir,
HashMap<String,Object> attributes)
New graphic edge.
|
| Modifier and Type | Method and Description |
|---|---|
double[] |
getControlPoints()
Control points for curved edges or polylines.
|
GraphicEdge.EdgeGroup |
getGroup()
If there are several edges between two nodes, this edge pertains to a
group.
|
int |
getMultiIndex()
This edge is the i-th between the two same nodes.
|
<T extends Node> |
getNode0()
First node of the edge.
|
<T extends Node> |
getNode1()
Second node of the edge.
|
<T extends Node> |
getOpposite(Node node)
When knowing one node and one edge of this node, this method return the
node at the other end of the edge.
|
Selector.Type |
getSelectorType()
Type of selector for the graphic element (Node, Edge, Sprite ?).
|
<T extends Node> |
getSourceNode()
Start node.
|
<T extends Node> |
getTargetNode()
End node.
|
double |
getX()
Abscissa of the element, always in GU (graph units).
|
double |
getY()
Ordinate of the element, always in GU (graph units).
|
double |
getZ()
Depth of the element, always in GU (graph units).
|
boolean |
isCurve()
True if the the edge defines control points to draw a curve or polyline.
|
boolean |
isDirected()
Is the edge directed ?.
|
boolean |
isLoop()
Does the source and target of this edge identify the same node ?.
|
void |
move(double x,
double y,
double z)
Try to force the element to move at the give location in graph units
(GU).
|
GraphicNode |
otherNode(GraphicNode n)
Obtain the node that is not "n" attached to this edge.
|
void |
removed()
The graphic element was removed from the graphic graph, clean up.
|
void |
setControlPoints(double[] points)
Change the control points array for this edge.
|
void |
setDirected(boolean on) |
void |
switchDirection() |
addAttribute, getComponent, getLabel, getStyle, myGraph, setComponentaddAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttributepublic GraphicNode from
public GraphicNode to
public boolean directed
public int multi
public GraphicEdge.EdgeGroup group
public double[] ctrl
public GraphicEdge(String id, GraphicNode from, GraphicNode to, boolean dir, HashMap<String,Object> attributes)
id - The edge unique identifier.from - The source node.to - The target node.dir - True if the edge is directed in the direction from-to.attributes - A set of initial attributes.public Selector.Type getSelectorType()
GraphicElementgetSelectorType in class GraphicElementpublic GraphicNode otherNode(GraphicNode n)
n - One of the node of this edge.public double getX()
GraphicElementgetX in class GraphicElementpublic double getY()
GraphicElementgetY in class GraphicElementpublic double getZ()
GraphicElementgetZ in class GraphicElementpublic double[] getControlPoints()
public boolean isCurve()
public void setControlPoints(double[] points)
points - The new set of points. See the getControlPoints()
method for an explanation on the organisation of this array.getControlPoints()public int getMultiIndex()
public void move(double x,
double y,
double z)
GraphicElementmove in class GraphicElementx - The new X.y - The new Y.z - the new Z.public void removed()
GraphicElementpublic <T extends Node> T getNode0()
Edge
This is equivalent to the Edge.getSourceNode() method, but may be
clearer in the source code if the graph you are using is not directed.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = edge.getNode0();the method will return an ExtendedNode. If no left part exists, method will just return a Node.
getNode0 in interface EdgeEdge.getNode1(),
Edge.getSourceNode()public <T extends Node> T getNode1()
Edge
This is equivalent to the Edge.getTargetNode() method, but may be
clearer in the source code if the graph you are using is not directed.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = edge.getNode1();the method will return an ExtendedNode. If no left part exists, method will just return a Node.
getNode1 in interface EdgeEdge.getNode0(),
Edge.getTargetNode()public GraphicEdge.EdgeGroup getGroup()
public <T extends Node> T getOpposite(Node node)
EdgeReturn null if the given node is not at any end of the edge.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = edge.getOppositeNode((ExtendedNode) m);the method will return an ExtendedNode. If no left part exists, method will just return a Node.
getOpposite in interface Edgenode - The node we search the opposite of.public <T extends Node> T getSourceNode()
Edge
When the edge is directed this is the source node, in this case you can
get the opposite node using Edge.getTargetNode(). This is equivalent
to the Edge.getNode0() method but may be clearer in the source code
if the graph you are using is directed.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = edge.getSourceNode();the method will return an ExtendedNode. If no left part exists, method will just return a Node.
getSourceNode in interface EdgeEdge.getNode0(),
Edge.getTargetNode()public <T extends Node> T getTargetNode()
Edge
When the edge is directed this is the target node, in this case you can
get the opposite node using Edge.getSourceNode(). This is equivalent
to the Edge.getNode1() method but may be clearer in the source code
if the graph you are using is directed.
This method is implicitly generic and return something which extends Node. The return type is the one of the left part of the assignment. For example, in the following call :
ExtendedNode n = edge.getTargetNode();the method will return an ExtendedNode. If no left part exists, method will just return a Node.
getTargetNode in interface EdgeEdge.getNode1(),
Edge.getSourceNode()public boolean isDirected()
EdgeisDirected in interface Edgepublic boolean isLoop()
Edgepublic void setDirected(boolean on)
public void switchDirection()
Copyright © 2015. All rights reserved.