Packagecom.yworks.canvas.drawing
Classpublic class GeneralPathVisualCreator
InheritanceGeneralPathVisualCreator Inheritance ShapePaintable Inheritance Object

An IDisplayObjectCreator implementations for rendering a GeneralPath.



Public Properties
 PropertyDefined By
 Inheritedfill : IFill
The fill to use for painting in the created DisplayObject.
ShapePaintable
  path : GeneralPath
Returns the path to render.
GeneralPathVisualCreator
 Inheritedstroke : IStroke
The stroke to use for painting in the created DisplayObject.
ShapePaintable
Public Methods
 MethodDefined By
  
Creates a new instance.
GeneralPathVisualCreator
  
[override] Returns a tight rectangular area where the whole rendering would fit into.
GeneralPathVisualCreator
  
[override] Creates a new DisplayObject from scratch.
GeneralPathVisualCreator
 Inherited
createFixedViewEllipse(center:IPoint, width:Number, height:Number):ShapePaintable
[static] Creates a dynamic display object creator that will use an IPoint to draw and fill an ellipse in the created DisplayObject in the view coordinate system with a zoom level invariant width and height.
ShapePaintable
 Inherited
[static] Creates a dynamic display object creator that draws a given path in the created DisplayObject.
ShapePaintable
 Inherited
createPointModelEllipse(center:IPoint, width:Number, height:Number):ShapePaintable
[static] Creates a dynamic display object creator that will use an IPoint to draw and fill an ellipse in the created DisplayObject.
ShapePaintable
 Inherited
[static] Creates a dynamic display object creator that will use two points to draw a rectangle in the created DisplayObject.
ShapePaintable
 Inherited
[static]
ShapePaintable
 Inherited
[static] Creates a dynamic display object creator that will use an IRectangle to draw and fill a rectangle in the created DisplayObject.
ShapePaintable
 Inherited
[static] Creates a dynamic display object creator that will use a IOrientedRectangle to draw and fill an IOrientedRectangle in the created DisplayObject in the view coordinate system.
ShapePaintable
 Inherited
[static] Creates a dynamic display object creator that will use a IRectangle to draw and fill a rectangle in the created DisplayObject in the view coordinate system.
ShapePaintable
  
isHit(x:Number, y:Number, ctx:ICanvasContext):Boolean
[override] Determines if something has been hit at the given coordinates in the world coordinate system.
GeneralPathVisualCreator
  
[override] Implements the IMarqueeTestable interface and tests for marquee intersections with the shape.
GeneralPathVisualCreator
  
[override] Performs the actual painting into the given graphics context.
GeneralPathVisualCreator
  
updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
[override] Updates the given DisplayObject or creates a new one.
GeneralPathVisualCreator
Property Detail
pathproperty
path:GeneralPath

Returns the path to render.


Implementation
    public function get path():GeneralPath
    public function set path(value:GeneralPath):void
Constructor Detail
GeneralPathVisualCreator()Constructor
public function GeneralPathVisualCreator(path:GeneralPath)

Creates a new instance.

Parameters
path:GeneralPath — The path to render.
Method Detail
calculateBounds()method
override 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
createDisplayObject()method 
override public function createDisplayObject(context:IDisplayObjectContext):DisplayObject

Creates a new DisplayObject from scratch.

Parameters

context:IDisplayObjectContext — The context for which the display object is created.

Returns
DisplayObject — A DisplayObject.
isHit()method 
override public function isHit(x:Number, y:Number, ctx:ICanvasContext):Boolean

Determines if something has been hit at the given coordinates in the world coordinate system.

Parameters

x:Number — the x-coordinate in world coordinate system
 
y:Number — the y-coordinate in world coordinate system
 
ctx:ICanvasContext — the context the hit test is performed in

Returns
Boolean — whether something has been hit
isInBox()method 
override public function isInBox(box:IRectangle, ctx:ICanvasContext):Boolean

Implements the IMarqueeTestable interface and tests for marquee intersections with the shape.

Parameters

box:IRectangle
 
ctx:ICanvasContext

Returns
Boolean
paint()method 
override public function paint(g:YGraphics, ctx:IPaintContext):void

Performs the actual painting into the given graphics context.

Parameters

g:YGraphics — The graphics context to paint into
 
ctx:IPaintContext — Currently not used

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

Updates the given DisplayObject or creates a new one.

Implementors can decide whether they update the given display object or create a new one. Updating can mean re-rendering or updating size and/or coordinates.

Parameters

oldDisplayObject:DisplayObject — The display object to update.
 
context:IDisplayObjectContext — The context for which the display object should be updated.

Returns
DisplayObject — The updated display object or a completely new display object.