Packagecom.yworks.graph.drawing
Classpublic class ArrowPaintable
InheritanceArrowPaintable Inheritance Object
Implements IDisplayObjectCreator, IBoundsProvider

An IDisplayObjectCreator implementation returning a DisplayObject that renders arrowheads and provides bounds for the drawing engine.



Public Properties
 PropertyDefined By
  anchor : IPoint
[read-only] The point the arrow is anchored to by reference.
ArrowPaintable
  arrowType : uint
[read-only] Returns the type of the arrow as defined in ArrowType.
ArrowPaintable
  direction : IPoint
[read-only] An IPoint which determines the direction of the arrow.
ArrowPaintable
  fill : IFill
The IFill the arrow is filled with.
ArrowPaintable
  length : Number
[read-only] The length of the arrow.
ArrowPaintable
  scale : Number
Defines the scale, the arrow is painted with.
ArrowPaintable
  stroke : IStroke
The IStroke the arrow's outline is drawn with.
ArrowPaintable
Public Methods
 MethodDefined By
  
ArrowPaintable(anchor:IPoint, direction:IPoint, length:Number)
Don't call the constructor directly - use the create factory method.
ArrowPaintable
  
Returns a tight rectangular area where the whole rendering would fit into.
ArrowPaintable
  
create(type:uint, anchor:IPoint, direction:IPoint, stroke:IStroke, fill:IFill):ArrowPaintable
[static] Factory method which will create an arrow of the given type and dimensions.
ArrowPaintable
  
Creates a new DisplayObject which represents the styled model item.
ArrowPaintable
  
Transforms the given YGraphics matrix so that the arrow is pointing right and the arrow tip is at (0, 0).
ArrowPaintable
  
updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
Updates the given DisplayObject.
ArrowPaintable
Protected Methods
 MethodDefined By
  
Paints the arrow in the given YGraphics object, assuming that the arrow is pointing to the right and the arrow tip is at (0, 0).
ArrowPaintable
Property Detail
anchorproperty
anchor:IPoint  [read-only]

The point the arrow is anchored to by reference.


Implementation
    public function get anchor():IPoint
arrowTypeproperty 
arrowType:uint  [read-only]

Returns the type of the arrow as defined in ArrowType.

Has to be overridden by subclass implementations.


Implementation
    public function get arrowType():uint

See also

directionproperty 
direction:IPoint  [read-only]

An IPoint which determines the direction of the arrow.


Implementation
    public function get direction():IPoint
fillproperty 
fill:IFill

The IFill the arrow is filled with.


Implementation
    public function get fill():IFill
    public function set fill(value:IFill):void
lengthproperty 
length:Number  [read-only]

The length of the arrow.


Implementation
    public function get length():Number
scaleproperty 
scale:Number

Defines the scale, the arrow is painted with.


Implementation
    public function get scale():Number
    public function set scale(value:Number):void
strokeproperty 
stroke:IStroke

The IStroke the arrow's outline is drawn with.


Implementation
    public function get stroke():IStroke
    public function set stroke(value:IStroke):void
Constructor Detail
ArrowPaintable()Constructor
public function ArrowPaintable(anchor:IPoint, direction:IPoint, length:Number)

Don't call the constructor directly - use the create factory method.

Parameters
anchor:IPoint
 
direction:IPoint
 
length:Number
Method Detail
calculateBounds()method
public function calculateBounds(scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle

Returns a tight rectangular area where the whole rendering would fit into.

Implementations can use the scratch rectangle to put their results in and return it as the result of the operation. Client has to always provide a non-null instance as a parameter. They may however decide to return an internally cached or dynamically created IRectangle implementation and disregard the scratch parameter. If calculating the bounds is too expensive or the painting is not bound to a certain area, this method may return null. If nothing is painted, this method should return an empty rectangle, where either or both the width and height is non-positive or ImmutableRectangle.Empty.

Parameters

scratch:IMutableRectangle — An instance that can optionally be used to fill with the corresponding values and be returned
 
ctx:ICanvasContext — The context to calculate the bounds for (currently not used)

Returns
IRectangle — The bounds or null to indicate an unbound area
create()method 
public static function create(type:uint, anchor:IPoint, direction:IPoint, stroke:IStroke, fill:IFill):ArrowPaintable

Factory method which will create an arrow of the given type and dimensions.

Parameters

type:uint — Type of the arrow as defined in ArrowType
 
anchor:IPoint — The point the arrow is anchored to by reference.
 
direction:IPoint — The direction of the arrow by reference.
 
stroke:IStroke — The stroke the arrow is painted with.
 
fill:IFill — The fill the arrow is filled with.

Returns
ArrowPaintable — An ArrowPaintable specified by the above parameters.

See also

createDisplayObject()method 
public function createDisplayObject(context:IDisplayObjectContext):DisplayObject

Creates a new DisplayObject which represents the styled model item.

This implementation creates a new YDisplayObject and calls paint using the objects YDisplayObject.

Parameters

context:IDisplayObjectContext

Returns
DisplayObject

See also

updateDisplayObject
paint
YDisplayObject.yGraphics
paint()method 
public function paint(g:YGraphics, ctx:IPaintContext):void

Transforms the given YGraphics matrix so that the arrow is pointing right and the arrow tip is at (0, 0). The actual rendering of the arrow is delegated to paintArrow(). This method is called by createDisplayObject using the YGraphics of the newly created YDisplayObject.

Parameters

g:YGraphics — The graphics context to paint into.
 
ctx:IPaintContext — The paint context.

See also

paintArrow
YDisplayObject.yGraphics
paintArrow()method 
protected function paintArrow(g:YGraphics):void

Paints the arrow in the given YGraphics object, assuming that the arrow is pointing to the right and the arrow tip is at (0, 0).

This method is called by paint

.

Subclasses have to override this method

Parameters

g:YGraphics — The graphics context to paint into.

updateDisplayObject()method 
public function updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject

Updates the given DisplayObject.

Parameters

oldDisplayObject:DisplayObject
 
context:IDisplayObjectContext

Returns
DisplayObject

See also