|
Graphics2D Actor API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectg2d.glyph.Identifiable
g2d.glyph.Attributable
g2d.glyph.Glyphish
g2d.graph.GraphItem
g2d.graph.IOPEdge
public class IOPEdge
An edge object for IOPGraph.
Edges are defined by their source and sink given as IOPNodes.
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.
| Field Summary | |
|---|---|
static String |
BOLD
Style of a bold line (twice current stroke width) for this edge. |
static String |
DASHED
Style of a dashed line for this edge. |
static String |
DOTTED
Style of a dotted line for this edge. |
static String |
INVIS
Style of a invisible line for this edge. |
static String |
SOLID
Style of a solid line for this edge. |
| Fields inherited from class g2d.graph.GraphItem |
|---|
antiAliased, HIGHLIGHT, HIGHLIGHT_OFFSET |
| Fields inherited from class g2d.glyph.Glyphish |
|---|
DEBUG |
| Fields inherited from class g2d.glyph.Identifiable |
|---|
uid |
| Constructor Summary | |
|---|---|
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,
Color c)
Constructs a bare edge (no arrow heads) between two given nodes with the given color. |
|
| Method Summary | |
|---|---|
void |
dehighlight()
Revert highlighting to previous state (if any). |
double |
distanceTo(Point2D p)
Calculate distance from this edge to given point. |
boolean |
equals(Object o)
Two edges are equal if their source and sink nodes are equal. |
Color |
getColor()
Obtain current color of edge. |
IOPNode |
getSink()
Obtain sink node of this edge. |
IOPNode |
getSource()
Obtain source node of this edge. |
float |
getStrokeWidth()
Obtain current stroke width. |
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 GraphItem.HIGHLIGHT color. |
boolean |
isDoubleEnded()
Query current setting of being double ended (i.e., having two arrow heads, one at each end). |
void |
setColor(Color c)
Set color of edge to given value. |
void |
setDoubleEnded(boolean value)
Set whether this edge has arrow heads on both ends or not. |
void |
setStrokeWidth(float width)
Set current stroke width to the given value. |
void |
setStyle(String style)
Set current style to one described by given String. |
String |
toString()
The String representation conforming to DOT format of edges, for example: "20 -> 4". |
void |
updatePoints(List points,
Point2D arrowTipSource,
Point2D arrowTipSink)
Update the curve of this edge using given list of points. |
| Methods inherited from class g2d.graph.GraphItem |
|---|
getBounds, inside, intersects, paint, transform |
| Methods inherited from class g2d.glyph.Glyphish |
|---|
keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, paint, rotate, rotate, scale, setKeyAction, setMouseAction, shear, translate |
| Methods inherited from class g2d.glyph.Attributable |
|---|
getAttribute, getAttributeAsBoolean, getAttributeAsByte, getAttributeAsChar, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsShort, getAttributeAsString, getKeys, getStaticAttribute, getStaticKeys, isAttribute, isStaticAttribute, setAttribute, setStaticAttribute |
| Methods inherited from class g2d.glyph.Identifiable |
|---|
getObject, getUID, setUID |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SOLID
setStyle(java.lang.String),
Constant Field Valuespublic static final String DASHED
setStyle(java.lang.String),
Constant Field Valuespublic static final String DOTTED
setStyle(java.lang.String),
Constant Field Valuespublic static final String BOLD
setStyle(java.lang.String),
Constant Field Valuespublic static final String INVIS
setStyle(java.lang.String),
Constant Field Values| Constructor Detail |
|---|
public IOPEdge(IOPNode source,
IOPNode sink)
updatePoints(java.util.List, 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 edge
public IOPEdge(IOPNode source,
IOPNode sink,
Color c)
updatePoints(java.util.List, 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 edge
public 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 edge| Method Detail |
|---|
public IOPNode getSource()
public IOPNode getSink()
public void updatePoints(List points,
Point2D arrowTipSource,
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 Color getColor()
setColor(java.awt.Color)public void setColor(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) 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 String getStyle()
setStyle(java.lang.String),
SOLID,
DASHED,
DOTTED,
BOLD,
INVISpublic void setStyle(String style)
Note, to have change take effect visually need to issue repainting of container.
style - String describing stylegetStyle(),
SOLID,
DASHED,
DOTTED,
BOLD,
INVISpublic 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 double distanceTo(Point2D p)
distanceTo in class GraphItemp - Point to compute distance to
public void highlight()
GraphItem.HIGHLIGHT color.
highlight in class GraphItempublic void dehighlight()
dehighlight in class GraphItempublic String toString()
toString in class Objectpublic int hashCode()
equals(Object).
hashCode in class Objectpublic boolean equals(Object o)
equals in class Objecto - Object to test equality with this IOPEdge
true if this IOPEdge is equal to
given Object, false otherwiseObject.equals(java.lang.Object)
|
Graphics2D Actor API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||