public class IOPEdge extends GraphItem
IOPGraph
.
Edges are defined by their source and sink given as IOPNode
s.
These two nodes are given at object construction time and must be
non-null.
An edge manifests itself as a spline and two arrow heads. Similar to the implementation of IOPNode, these glyphish things are instantiated at construction time and remain non-null. The interface of this class allows then to change the appearance of the edge, which will propagate into changing the sub-glyphs accordingly.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BOLD
Style of a bold line (twice current stroke width) for this edge.
|
protected java.awt.Color |
color |
static java.lang.String |
DASHED
Style of a dashed line for this edge.
|
protected g2d.graph.xdotparser.visitor.xDotEdge |
dotRendering |
static java.lang.String |
DOTTED
Style of a dotted line for this edge.
|
static java.lang.String |
INVIS
Style of a invisible line for this edge.
|
static java.lang.String |
LHEAD |
static java.lang.String |
LTAIL |
protected IOPNode |
sink |
static java.lang.String |
SOLID
Style of a solid line for this edge.
|
protected IOPNode |
source |
static java.lang.String |
SPECIFIC
Style of a width-specified line line for this edge.
|
protected Spline |
spline |
antiAliased, COMPARATOR, gid, glyphList, HIGHLIGHT, HIGHLIGHT_OFFSET, highlighted
Constructor and Description |
---|
IOPEdge(IOPEdge clone,
IOPNode newSource,
IOPNode newSink)
Constructs a new edge cloning the given edge with the
new endpoints of given nodes.
|
IOPEdge(IOPNode source,
IOPNode sink)
Constructs a bare edge (no arrow heads) between two given nodes.
|
IOPEdge(IOPNode source,
IOPNode sink,
java.awt.Color c)
Constructs a bare edge (no arrow heads) between two given nodes with
the given color.
|
Modifier and Type | Method and Description |
---|---|
boolean |
__intersects(java.awt.geom.Rectangle2D rect) |
static java.awt.BasicStroke |
createStroke(java.lang.String style,
float strokeWidth) |
void |
dehighlight()
Revert highlighting to previous state (if any).
|
double |
distanceTo(java.awt.geom.Point2D p)
Calculate distance from this edge to given point.
|
boolean |
equals(java.lang.Object o)
Two edges are equal if their source and sink nodes
are equal.
|
java.awt.Color |
getColor()
Obtain current color of edge.
|
java.util.List<java.awt.geom.Point2D> |
getPoints()
Get the list of points that define end points and spline.
|
IOPNode |
getSink()
Obtain sink node of this edge.
|
IOPNode |
getSource()
Obtain source node of this edge.
|
float |
getStrokeWidth()
Obtain current stroke width.
|
java.lang.String |
getStyle()
Obtain String describing current style.
|
int |
hashCode()
Overriding method to comply with
equals(Object) . |
void |
highlight()
Highlight this edge by drawing it in
HIGHLIGHT color
defined in GraphItem . |
boolean |
isDoubleEnded()
Query current setting of being double ended (i.e., having two
arrow heads, one at each end).
|
protected void |
resetRendering(g2d.graph.xdotparser.visitor.xDotEdge info) |
void |
setColor(java.awt.Color c)
Set color of edge to given value.
|
void |
setDotLayout(java.lang.String _draw_,
java.lang.String _ldraw_,
java.lang.String _hdraw_,
java.lang.String _tdraw_,
java.lang.String _hldraw_,
java.lang.String _tldraw_,
double graphHeight) |
void |
setDoubleEnded(boolean value)
Set whether this edge has arrow heads on both ends or not.
|
protected void |
setRendering(g2d.graph.xdotparser.visitor.xDotEdge info) |
void |
setStrokeWidth(float width)
Set current stroke width to the given value.
|
void |
setStyle(java.lang.String style)
Set current style to one described by given String.
|
java.lang.String |
toDotString() |
java.lang.String |
toString()
The String representation conforming to DOT format
of edges, for example: "20 -> 4".
|
void |
updatePoints(java.util.List<java.awt.geom.Point2D> points,
java.awt.geom.Point2D arrowTipSource,
java.awt.geom.Point2D arrowTipSink)
Update the curve of this edge using given list of points.
|
getBounds, gid, inside, intersects, isHighlighted, isSelected, paint, setSelected, transform
keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, rotate, rotate, scale, setKeyAction, setMouseAction, shear, translate, unsetMouseAction
_getAttribute, _setAttribute, getAttribute, getAttributeAsBoolean, getAttributeAsByte, getAttributeAsChar, getAttributeAsClosure, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsShort, getAttributeAsString, getKeys, getStaticAttribute, getStaticKeys, isAttribute, isStaticAttribute, removeAllAttributes, removeAllStaticAttributes, removeAttribute, removeStaticAttribute, setAttribute, setStaticAttribute, showAttributes, showAttributes
protected g2d.graph.xdotparser.visitor.xDotEdge dotRendering
protected IOPNode source
protected IOPNode sink
protected Spline spline
protected java.awt.Color color
public static final java.lang.String SOLID
setStyle(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String DASHED
setStyle(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String DOTTED
setStyle(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String BOLD
setStyle(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String INVIS
setStyle(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String SPECIFIC
setStyle(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String LTAIL
public static final java.lang.String LHEAD
public IOPEdge(IOPNode source, IOPNode sink)
updatePoints(java.util.List<java.awt.geom.Point2D>, java.awt.geom.Point2D, java.awt.geom.Point2D)
,
this will be a straight line between the center points of the two
nodes.source
- IOPNode that is source (or start/tail) of this edgesink
- IOPNode that is sink (or end/head) of this edgepublic IOPEdge(IOPNode source, IOPNode sink, java.awt.Color c)
updatePoints(java.util.List<java.awt.geom.Point2D>, java.awt.geom.Point2D, java.awt.geom.Point2D)
,
this will be a straight line between the center points of the two
nodes.source
- IOPNode that is source (or start/tail) of this edgesink
- IOPNode that is sink (or end/head) of this edgec
- Color of this edgepublic IOPEdge(IOPEdge clone, IOPNode newSource, IOPNode newSink)
clone
- IOPEdge to be clonednewSource
- IOPNode used as the new source node of this edgenewSink
- IOPNode used as the new sink of this edgepublic boolean __intersects(java.awt.geom.Rectangle2D rect)
public IOPNode getSource()
public IOPNode getSink()
protected void setRendering(g2d.graph.xdotparser.visitor.xDotEdge info)
protected void resetRendering(g2d.graph.xdotparser.visitor.xDotEdge info)
public void setDotLayout(java.lang.String _draw_, java.lang.String _ldraw_, java.lang.String _hdraw_, java.lang.String _tdraw_, java.lang.String _hldraw_, java.lang.String _tldraw_, double graphHeight)
public void updatePoints(java.util.List<java.awt.geom.Point2D> points, java.awt.geom.Point2D arrowTipSource, java.awt.geom.Point2D arrowTipSink)
null
or the list is less
than 2 points long.
The two points given denote the arrow tips of arrows at
start and end of edge, respectively. If any of these
is null
then no arrow at that part of edge
is drawn.
points
- Ordered list of 3n+1 points to be used to
define the cubic curve segments of the edgearrowTipSource
- Point2D of arrow tip at start of edge (if any)arrowTipSink
- Point2D of arrow tip at end of edge (if any)public java.util.List<java.awt.geom.Point2D> getPoints()
null
. The rest of the list are the points of the spline, if they
exist.null
public java.awt.Color getColor()
setColor(java.awt.Color)
public void setColor(java.awt.Color c)
Note, to have change take effect visually need to issue repainting of container.
c
- Color used for edgegetColor()
public void setDoubleEnded(boolean value)
updatePoints(java.util.List<java.awt.geom.Point2D>, java.awt.geom.Point2D, java.awt.geom.Point2D)
method.
In case of overriding the setting with true
, the
angle of the arrow head at the source is estimated by the
first line segment of the edge.value
- Boolean denoting whether this edge has two arrow heads
or notpublic boolean isDoubleEnded()
true
if this edge shows two arrow heads and
false
otherwise.public java.lang.String getStyle()
public void setStyle(java.lang.String style)
Note, to have change take effect visually need to issue repainting of container.
public float getStrokeWidth()
setStrokeWidth(float)
public void setStrokeWidth(float width)
Note, to have change take effect visually need to issue repainting of container.
width
- Value of stroke widthgetStrokeWidth()
public static java.awt.BasicStroke createStroke(java.lang.String style, float strokeWidth)
public double distanceTo(java.awt.geom.Point2D p)
distanceTo
in class GraphItem
p
- Point to compute distance topublic void highlight()
HIGHLIGHT
color
defined in GraphItem
.public void dehighlight()
dehighlight
in class GraphItem
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
equals(Object)
.hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object to test equality with this IOPEdgetrue
if this IOPEdge is equal to
given Object, false
otherwiseObject.equals(java.lang.Object)
public java.lang.String toDotString()