Package diva.canvas.connector
Class Arrowhead
- java.lang.Object
-
- diva.canvas.connector.Arrowhead
-
- All Implemented Interfaces:
ConnectorEnd
public class Arrowhead extends java.lang.Object implements ConnectorEnd
An arrowhead that is drawn on the end of a connector. This is a low-level utility class, not a self-contained Figure.- Version:
- $Id$
- Author:
- John Reekie
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Rectangle2DgetBounds()Get the bounding box of the shape used to draw this connector end.voidgetConnection(java.awt.geom.Point2D p)Get the connection point into the given pointbooleangetFlipped()Get the flag saying to flip the arrowhead.doublegetLength()Get the length.voidgetOrigin(java.awt.geom.Point2D p)Get the origin into the given point.booleanisFilled()Test if the blob is filled or not.voidpaint(java.awt.Graphics2D g)Paint the arrow-head.voidreshape()Recalculate the shape of the decoration.voidsetFilled(boolean flag)Set the flag that determines whether to fill the arrowhead.voidsetFlipped(boolean flag)Set the flag that says the arrowhead is "flipped." This means that the arrowhead is drawn so that the apparent direction of the arrowhead is the same as its normal.voidsetLength(double l)Set the length of the arrowhead.voidsetNormal(double angle)Set the normal of the decoration.voidsetOrigin(double x, double y)Set the origin of the decoration.voidtranslate(double x, double y)Translate the origin by the given amount.
-
-
-
Method Detail
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
Get the bounding box of the shape used to draw this connector end.- Specified by:
getBoundsin interfaceConnectorEnd
-
getConnection
public void getConnection(java.awt.geom.Point2D p)
Get the connection point into the given point- Specified by:
getConnectionin interfaceConnectorEnd
-
getFlipped
public boolean getFlipped()
Get the flag saying to flip the arrowhead.
-
getOrigin
public void getOrigin(java.awt.geom.Point2D p)
Get the origin into the given point.- Specified by:
getOriginin interfaceConnectorEnd
-
getLength
public double getLength()
Get the length.
-
isFilled
public boolean isFilled()
Test if the blob is filled or not.
-
paint
public void paint(java.awt.Graphics2D g)
Paint the arrow-head. This method assumes that the graphics context is already set up with the correct paint and stroke.- Specified by:
paintin interfaceConnectorEnd
-
reshape
public void reshape()
Recalculate the shape of the decoration.
-
setNormal
public void setNormal(double angle)
Set the normal of the decoration. The argument is the angle in radians away from the origin. The arrowhead is drawn so that the body of the arrowhead is in the same direction as the normal -- that is, the arrowhead appears to be pointed in the opposite direction to its "normal."- Specified by:
setNormalin interfaceConnectorEnd
-
setFilled
public void setFilled(boolean flag)
Set the flag that determines whether to fill the arrowhead.
-
setFlipped
public void setFlipped(boolean flag)
Set the flag that says the arrowhead is "flipped." This means that the arrowhead is drawn so that the apparent direction of the arrowhead is the same as its normal.
-
setOrigin
public void setOrigin(double x, double y)Set the origin of the decoration.- Specified by:
setOriginin interfaceConnectorEnd
-
setLength
public void setLength(double l)
Set the length of the arrowhead.
-
translate
public void translate(double x, double y)Translate the origin by the given amount.- Specified by:
translatein interfaceConnectorEnd
-
-