public final class Arrow extends Object implements IArrow, ICloneable, Cloneable
Constructor and Description |
---|
Arrow()
Creates a new arrow with default values for
Pen and brush. |
Arrow(ArrowType arrowType)
Creates a new arrow with the given arrow type and default values for the other properties.
|
Arrow(ArrowType arrowType,
Color color)
Creates a new arrow with the given color to use for pen and brush, the given arrow type
and default values for the other properties.
|
Arrow(ArrowType arrowType,
Color color,
double cropLength,
double scale)
Creates a new arrow with the given color to use for pen and brush, the given arrow type
and the given values for the crop length and scale.
|
Arrow(ArrowType arrowType,
Pen pen,
Paint paint)
Creates a new arrow with the given pen and brush, the given arrow type
and default values for the other properties.
|
Arrow(ArrowType arrowType,
Pen pen,
Paint paint,
double cropLength,
double scale)
Creates a new arrow with the given color to use for pen and brush, the given arrow type
and the given values for the croplength and scale.
|
Arrow(Color color)
Creates a new arrow with the given color to use for
Pen and brush. |
Modifier and Type | Method and Description |
---|---|
Arrow |
clone()
Creates a copy of this object and returns it.
|
boolean |
equals(Arrow other)
Determines whether this arrow is equal to the other arrow.
|
boolean |
equals(Object other) |
IArrow |
getAsFrozen()
Returns an immutable
IArrow instance that uses the current properties. |
IBoundsProvider |
getBoundsProvider(IEdge edge,
boolean atSource,
PointD anchor,
PointD directionVector)
Gets an
IBoundsProvider implementation that can yield this arrow's bounds if painted at the given location using
the given direction for the given edge. |
double |
getCropLength()
Gets the cropping length associated with this instance.
|
double |
getLength()
Returns the length of the arrow (the distance from the arrow's tip to the position where the visual representation of
the edge's path should begin).
|
Paint |
getPaint()
Gets the
Paint of the fill of this arrow. |
Pen |
getPen()
Gets the
Pen of the outline of this arrow. |
double |
getScale()
Gets the scale factor of this arrow.
|
ArrowType |
getType()
Gets the type of this arrow.
|
IVisualCreator |
getVisualCreator(IEdge edge,
boolean atSource,
PointD anchor,
PointD direction)
Gets an
IVisualCreator implementation that will paint this arrow at the given location using the given direction
for the given edge. |
int |
hashCode() |
void |
setCropLength(double value)
Sets the cropping length associated with this instance.
|
void |
setPaint(Paint value)
Sets the
Paint of the fill of this arrow. |
void |
setPen(Pen value)
Sets the
Pen of the outline of this arrow. |
void |
setScale(double value)
Sets the scale factor of this arrow.
|
void |
setType(ArrowType value)
Sets the type of this arrow.
|
String |
toString() |
public Arrow()
Pen
and brush.public Arrow(ArrowType arrowType)
arrowType
- The ArrowType
of the arrow.public Arrow(ArrowType arrowType, Color color)
arrowType
- The ArrowType
of the arrow.color
- The color to use for pen and brush.public Arrow(ArrowType arrowType, Color color, double cropLength, double scale)
arrowType
- The ArrowType
of the arrow.color
- The color to use for pen and brush.cropLength
- The cropping length associated with this instance.scale
- The scale factor of this arrow.public Arrow(ArrowType arrowType, Pen pen, Paint paint)
arrowType
- The ArrowType
of the arrow.pen
- The pen of the outline of this arrow.paint
- The paint of the fill of this arrow.public Arrow(ArrowType arrowType, Pen pen, Paint paint, double cropLength, double scale)
arrowType
- The ArrowType
of the arrow.pen
- The pen of the outline of this arrow.paint
- The paint of the fill of this arrow.cropLength
- The cropping length associated with this instance.scale
- The scale factor of this arrow.public final Arrow clone()
ICloneable
clone
in interface ICloneable
clone
in class Object
Object.clone()
public final boolean equals(Arrow other)
other
- The other.public final IArrow getAsFrozen()
IArrow
instance that uses the current properties.public final IBoundsProvider getBoundsProvider(IEdge edge, boolean atSource, PointD anchor, PointD directionVector)
IArrow
IBoundsProvider
implementation that can yield this arrow's bounds if painted at the given location using
the given direction for the given edge.getBoundsProvider
in interface IArrow
edge
- the edge this arrow belongs toatSource
- whether this will be the source arrowanchor
- the anchor point for the tip of the arrowdirectionVector
- the direction the arrow is pointing inIBoundsProvider
interface that can subsequently be used to query the bounds. Clients
will always call this method before using the implementation and may not cache the instance returned. This allows for
applying the flyweight design pattern to implementations.public final double getCropLength()
This value is used by IEdgeStyle
implementations to let the edge appear to end
shortly before its actual target.
getCropLength
in interface IArrow
setCropLength(double)
public final double getLength()
IArrow
public final Paint getPaint()
Paint
of the fill of this arrow.setPaint(Paint)
public final Pen getPen()
Pen
of the outline of this arrow.Pen
of this arrow.setPen(Pen)
public final double getScale()
The arrow bounds are scaled with this factor.
setScale(double)
public final ArrowType getType()
setType(ArrowType)
public final IVisualCreator getVisualCreator(IEdge edge, boolean atSource, PointD anchor, PointD direction)
IArrow
IVisualCreator
implementation that will paint this arrow at the given location using the given direction
for the given edge.getVisualCreator
in interface IArrow
edge
- the edge this arrow belongs toatSource
- whether this will be the source arrowanchor
- the anchor point for the tip of the arrowdirection
- the direction the arrow is pointing inIVisualCreator
interface that can subsequently be used to perform the actual painting.
Clients will always call this method before using the implementation and may not cache the instance returned. This
allows for applying the flyweight design pattern to implementations.public final void setCropLength(double value)
This value is used by IEdgeStyle
implementations to let the edge appear to end
shortly before its actual target.
getCropLength()
public final void setPaint(Paint value)
Paint
of the fill of this arrow.value
- The brush.getPaint()
public final void setScale(double value)
The arrow bounds are scaled with this factor.
value
- The scale factor of this arrow.getScale()
public final void setType(ArrowType value)
value
- The type of this arrow.getType()