Package | com.yworks.graph.drawing |
Class | public class SimpleAbstractNodeStyle |
Inheritance | SimpleAbstractNodeStyle Object |
Implements | INodeStyle |
paint
, calculateBounds
,
isVisible
, isHit
, isInBox
, lookup
, getIntersection
,
isInside
and getOutline
methods implemented in the style.
To use this style, one has to subclass SimpleAbstractNodeStyle
and override at least
the paint
method. The default implementations of the other methods do use the node's layout rectangle e.g.
for hit tests and to determine the bounds and edge intersection.
Property | Defined By | ||
---|---|---|---|
styleRenderer : IStyleRenderer [read-only]
Gets the renderer implementation that has been supplied to
this instance upon creation. | SimpleAbstractNodeStyle |
Method | Defined By | ||
---|---|---|---|
Creates a new instance
| SimpleAbstractNodeStyle | ||
clone():Object
Returns this instance. | SimpleAbstractNodeStyle | ||
Prepares the rendering of an IModelItem in a CanvasComponent by
adding ICanvasObject's to the provided canvas. | SimpleAbstractNodeStyle |
Method | Defined By | ||
---|---|---|---|
Calculates the bounds for the node in the given context. | SimpleAbstractNodeStyle | ||
This style's renderer delegates the display object creation to this method. | SimpleAbstractNodeStyle | ||
getIntersection(node:INode, innerX:Number, innerY:Number, outerX:Number, outerY:Number, intersectionPoint:IPointSetter):Boolean
Gets the intersection of a line with the visual representation of the node. | SimpleAbstractNodeStyle | ||
Gets the outline of the visual style. | SimpleAbstractNodeStyle | ||
Determines whether the visual representation of the node has been hit at the given location. | SimpleAbstractNodeStyle | ||
Determines whether the visualization for the specified node is included in the marquee selection. | SimpleAbstractNodeStyle | ||
Determines whether the provided point is geometrically inside the visual bounds of th node. | SimpleAbstractNodeStyle | ||
Determines whether the visualization for the specified node is visible in the context. | SimpleAbstractNodeStyle | ||
Performs the lookup operation for the lookup calls to the renderer. | SimpleAbstractNodeStyle | ||
updateDisplayObject(node:INode, oldDisplayObject:DisplayObject, ctx:IDisplayObjectContext):DisplayObject
This style's renderer delegates updating the display object to this method. | SimpleAbstractNodeStyle |
styleRenderer | property |
styleRenderer:IStyleRenderer
[read-only] Gets the renderer implementation that has been supplied to this instance upon creation.
public function get styleRenderer():IStyleRenderer
SimpleAbstractNodeStyle | () | Constructor |
public function SimpleAbstractNodeStyle()
Creates a new instance
calculateBounds | () | method |
protected function calculateBounds(node:INode, scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle
Calculates the bounds for the node in the given context.
This method is called in response to a calculateBounds
call to the instance that has
been queried from the renderer.
This implementation simply sets the node layout.
Parameters
node:INode — The node to which this style instance is assigned.
| |
scratch:IMutableRectangle — The mutable rectangle to set the calculated bounds.
| |
ctx:ICanvasContext — The canvas context.
|
IRectangle — The visual bounds of the visual representation.
|
See also
clone | () | method |
public function clone():Object
Returns this instance.
If subclasses implement properties which should be set in the clone, too, this method has to be overridden.
ReturnsObject — this ;
|
createDisplayObject | () | method |
protected function createDisplayObject(node:INode, ctx:IDisplayObjectContext):DisplayObject
This style's renderer delegates the display object creation to this method.
Subclasses have to override this method and implement their own createDisplayObject
method.
Parameters
node:INode — The display object context.
| |
ctx:IDisplayObjectContext — The node to render.
|
DisplayObject |
IllegalOperationError — if not overridden.
|
See also
getIntersection | () | method |
protected function getIntersection(node:INode, innerX:Number, innerY:Number, outerX:Number, outerY:Number, intersectionPoint:IPointSetter):Boolean
Gets the intersection of a line with the visual representation of the node.
This method is called in response to a getIntersection
call to the instance that has been
queried from the renderer.
This implementation simply uses the outline to determine the intersection or the node layout if the outline
is null
.
If it is feasible to determine the intersection point for the current shape, this method should be implemented
in addition to getOutline
to improve performance.
Parameters
node:INode — The node to which this style instance is assigned.
| |
innerX:Number — The X coordinate of the first point of the line that is inside the shape.
| |
innerY:Number — The Y coordinate of the first point of the line that is inside the shape.
| |
outerX:Number — The X coordinate of the second point of the line that is outside the shape.
| |
outerY:Number — The Y coordinate of the second point of the line that is outside the shape.
| |
intersectionPoint:IPointSetter — The intersection point that is set if this method returns true .
|
Boolean — Whether an intersection was found.
|
getOutline | () | method |
protected function getOutline(node:INode):GeneralPath
Gets the outline of the visual style.
This implementation yields the node layout. Implementing this method influences the behavior of isHit
,
isInside
and getIntersection
since default implementations delegate to it.
Parameters
node:INode — The node to which this style instance is assigned.
|
GeneralPath — The outline of the visual representation of null .
|
install | () | method |
public function install(canvas:CanvasComponent, group:ICanvasObjectGroup, modelItem:IModelItem):Array
Prepares the rendering of an IModelItem
in a CanvasComponent
by
adding ICanvasObject
's to the provided canvas.
Implementations may add zero or more ICanvasObject
instances to
the given CanvasComponent
. The group
parameter
can be used as a hint for implementations. They can add their newly created
canvas objects to the given group. However they are not obliged to do that.
Parameters
canvas:CanvasComponent — The canvas to install the canvas objects in.
| |
group:ICanvasObjectGroup — A hint that tells the implementation where to add the canvas objects.
| |
modelItem:IModelItem — The item to install a visual representation for.
|
Array — An array of zero or more canvas objects that have been installed
in the canvas by this method or null if nothing was installed.
|
isHit | () | method |
protected function isHit(node:INode, x:Number, y:Number, ctx:ICanvasContext):Boolean
Determines whether the visual representation of the node has been hit at the given location.
This method is called in response to a isHit
call to the instance that has benn queried from
the renderer.
This implementation uses the node outline to determine whether the node has been hit.
Parameters
node:INode — The node to which this style instance is assigned.
| |
x:Number — The x coordinate to test.
| |
y:Number — The y coordinate to test.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified node representation is hit; false otherwise.
|
See also
isInBox | () | method |
protected function isInBox(node:INode, box:IRectangle, ctx:ICanvasContext):Boolean
Determines whether the visualization for the specified node is included in the marquee selection.
This method is called in response to a isInBox
call to the instance that has been queried
from the renderer.
This implementation simply tests whether the node bounds intersect the marquee box.
Parameters
node:INode — The node to which this style instance is assigned.
| |
box:IRectangle — The marquee selection box.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified node is selected by the marquee rectangle; false otherwise.
|
See also
isInside | () | method |
protected function isInside(node:INode, x:Number, y:Number):Boolean
Determines whether the provided point is geometrically inside the visual bounds of th node.
This method is called in response to a isInside
call to the instance that has been queried
from the renderer.
This implementation simply uses the outline to determine whether the point is contained or the node layout
if the outline is null
. If it is feasible to determine whether the given point lies inside
the shape, this method should be implemented in addition to getOutline
to improve performance.
Parameters
node:INode — The node to which this style instance is assigned.
| |
x:Number — The x coordinate to test.
| |
y:Number — The y coordinate to test.
|
Boolean — Whether the coordinate are considered to lie inside the shape.
|
isVisible | () | method |
protected function isVisible(node:INode, clip:IRectangle, ctx:ICanvasContext):Boolean
Determines whether the visualization for the specified node is visible in the context.
This method is called in response to a isVisible
call to the instance that has been queried
from the renderer.
This implementation simply tests whether the bounds intersect the clip.
Parameters
node:INode — The node to which this style instance is assigned.
| |
clip:IRectangle — The clipping rectangle.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified node is visible in the clipping rectangle, false otherwise.
|
See also
lookup | () | method |
protected function lookup(node:INode, type:Class):Object
Performs the lookup
operation for the lookup
calls to the renderer.
This implementation yields null
for everything but:
Parameters
node:INode — The node to use for the context query.
| |
type:Class — The type to query.
|
Object — An implementation of the type or null .
|
updateDisplayObject | () | method |
protected function updateDisplayObject(node:INode, oldDisplayObject:DisplayObject, ctx:IDisplayObjectContext):DisplayObject
This style's renderer delegates updating the display object to this method.
This implementation just delegates to createDisplayObject
so subclasses should
override this method to improve rendering performance.
Parameters
node:INode — The display object context.
| |
oldDisplayObject:DisplayObject — The node to render.
| |
ctx:IDisplayObjectContext — The display object to update.
|
DisplayObject |
See also