Package | com.yworks.graph.drawing |
Class | public class SimpleAbstractEdgeStyle |
Inheritance | SimpleAbstractEdgeStyle Object |
Implements | IEdgeStyle |
IEdgeStyle
.
The only method that needs to be implemented by subclasses is createDisplayObject
. This implementation differs
from the straightforward IEdgeStyle
implementation in that there is no visible separation between
the IEdgeStyle
and its IEdgeStyleRenderer
. Instead the renderer used by the base
class is fixed and delegates all calls back to the style instance.
The CustomStyle
Tutorial demonstrates how to create a custom style by subclassing
SimpleAbstractEdgeStyle
.
Property | Defined By | ||
---|---|---|---|
sourceArrow : IArrow [read-only]
Gets the visual arrow at the source end of edges that use this style. | SimpleAbstractEdgeStyle | ||
styleRenderer : IStyleRenderer [read-only]
Gets the renderer implementation for this instance. | SimpleAbstractEdgeStyle | ||
targetArrow : IArrow [read-only]
Gets the visual arrow at the target end of edges that use this style. | SimpleAbstractEdgeStyle |
Method | Defined By | ||
---|---|---|---|
clone():Object
Returns this instance. | SimpleAbstractEdgeStyle | ||
Gets the path of the edge. | SimpleAbstractEdgeStyle | ||
getSegmentCount(edge:IEdge):int
Gets the number of segments of the edge. | SimpleAbstractEdgeStyle | ||
Gets the tangent to the edge at the specified ratio of a segment of the edge and the corresponding touch point. | SimpleAbstractEdgeStyle | ||
Gets the tangent to the edge at the specified ratio and the corresponding touch point. | SimpleAbstractEdgeStyle | ||
Prepares the rendering of an IModelItem in a CanvasComponent by
adding ICanvasObject's to the provided canvas. | SimpleAbstractEdgeStyle |
Method | Defined By | ||
---|---|---|---|
Calculates the bounds for the edge in the given context. | SimpleAbstractEdgeStyle | ||
This style's renderer delegates the display object creation to this method. | SimpleAbstractEdgeStyle | ||
Convenience method that crops the edge's path at the nodes. | SimpleAbstractEdgeStyle | ||
getArrowDisplayObjectCreator(edge:IEdge, path:GeneralPath, arrow:IArrow, atSource:Boolean):IDisplayObjectCreator
Convenience method that returns an IDisplayObjectCreator for the source or target arrow
of an edge. | SimpleAbstractEdgeStyle | ||
getSourceArrowAnchor(path:GeneralPath, arrow:IArrow, anchorPoint:IPointSetter, arrowDirection:IPointSetter):Boolean
Convenience method that calculates the source arrow anchor and direction for a given arrow and path. | SimpleAbstractEdgeStyle | ||
getTargetArrowAnchor(path:GeneralPath, arrow:IArrow, anchorPoint:IPointSetter, arrowDirection:IPointSetter):Boolean
Convenience method that calculates the target arrow anchor and direction for a given arrow and path. | SimpleAbstractEdgeStyle | ||
Determines whether the visual representation of the edge has been hit at the given location. | SimpleAbstractEdgeStyle | ||
Determines whether the visualization for the specified edge is included in the marquee selection. | SimpleAbstractEdgeStyle | ||
Determines whether the visualization for the specified edge is visible in the context. | SimpleAbstractEdgeStyle | ||
Performs the lookup operation for the lookup calls to the renderer. | SimpleAbstractEdgeStyle | ||
updateDisplayObject(edge:IEdge, oldDisplayObject:DisplayObject, ctx:IDisplayObjectContext):DisplayObject
This style's renderer delegates updating the display object to this method. | SimpleAbstractEdgeStyle |
sourceArrow | property |
sourceArrow:IArrow
[read-only] Gets the visual arrow at the source end of edges that use this style.
This implementation return null
.
public function get sourceArrow():IArrow
styleRenderer | property |
styleRenderer:IStyleRenderer
[read-only] Gets the renderer implementation for this instance.
This private implementation will delegate all API calls back to this instance.
public function get styleRenderer():IStyleRenderer
targetArrow | property |
targetArrow:IArrow
[read-only] Gets the visual arrow at the target end of edges that use this style.
This implementation return null
.
public function get targetArrow():IArrow
calculateBounds | () | method |
protected function calculateBounds(edge:IEdge, scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle
Calculates the bounds for the edge 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 yields a rectangle containing the locations of the source and target ports
of the edge and the locations of all its bends.
Parameters
edge:IEdge — The edge 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(edge:IEdge, 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
edge:IEdge — The display object context.
| |
ctx:IDisplayObjectContext — The edge to render.
|
DisplayObject |
IllegalOperationError — if not overridden.
|
See also
cropPath | () | method |
protected function cropPath(edge:IEdge, sourceArrow:IArrow, targetArrow:IArrow, pathToCrop:GeneralPath):void
Convenience method that crops the edge's path at the nodes.
This implementation uses the IEdgeIntersectionCalculator
instances
found in the lookup
of the source and target port
of the edge to perform the actual cropping.
Parameters
edge:IEdge — The edge the path to crop belongs to.
| |
sourceArrow:IArrow — The arrow at the source end of the edge that should be respected for the cropping.
| |
targetArrow:IArrow — The arrow at the target end of the edge that should be respected for the cropping.
| |
pathToCrop:GeneralPath — The path that should be cropped.
|
See also
getArrowDisplayObjectCreator | () | method |
protected function getArrowDisplayObjectCreator(edge:IEdge, path:GeneralPath, arrow:IArrow, atSource:Boolean):IDisplayObjectCreator
Convenience method that returns an IDisplayObjectCreator
for the source or target arrow
of an edge.
This method relies on the getSourceArrowAnchor
and
and getTargetArrowAnchor
methods to operate correctly.
Parameters
edge:IEdge — The edge to create an arrow display object creator for.
| |
path:GeneralPath — The edge path used to calculate the source and target arrow anchor.
| |
arrow:IArrow — The arrow providing its display object creator.
| |
atSource:Boolean — Whether the given arrow is the source or target arrow.
|
IDisplayObjectCreator |
getPath | () | method |
public function getPath(edge:IEdge):GeneralPath
Gets the path of the edge.
This implementation creates a polygonal line including the source port, bends and target port.
Parameters
edge:IEdge — The edge.
|
GeneralPath — The polygonal edge path.
|
getSegmentCount | () | method |
public function getSegmentCount(edge:IEdge):int
Gets the number of segments of the edge.
This implementation gets the edge path
and calls its getSegmentCount
method.
Parameters
edge:IEdge — The edge.
|
int — The number of segments.
|
See also
getSegmentTangent | () | method |
public function getSegmentTangent(edge:IEdge, segment:int, ratio:Number, p:YPoint, v:YPoint):Boolean
Gets the tangent to the edge at the specified ratio of a segment of the edge and the corresponding touch point.
This implementation returns the result of the calculateSegmentTangent
method of class GeomSupport
with the polygonal line defined by the source port, the target port and the bends of the edge.
Parameters
edge:IEdge — The edge.
| |
segment:int — Index of the segment of the edge.
| |
ratio:Number — A value between 0 and 1 inclusively that indicates a ratio from the beginning to the end of the
segment of the edge.
| |
p:YPoint — The point to set the touch point of the tangent.
| |
v:YPoint — The point to set the tangent vector.
|
Boolean — true , if a tangent was obtained with the specified parameters.
|
See also
getSourceArrowAnchor | () | method |
protected function getSourceArrowAnchor(path:GeneralPath, arrow:IArrow, anchorPoint:IPointSetter, arrowDirection:IPointSetter):Boolean
Convenience method that calculates the source arrow anchor and direction for a given arrow and path.
Parameters
path:GeneralPath — The path of the edge.
| |
arrow:IArrow — The arrow.
| |
anchorPoint:IPointSetter — The anchor point result.
| |
arrowDirection:IPointSetter — The arrow direction result
|
Boolean — Whether the values are valid.
|
getTangent | () | method |
public function getTangent(edge:IEdge, ratio:Number, p:YPoint, v:YPoint):Boolean
Gets the tangent to the edge at the specified ratio and the corresponding touch point. This implementation returns the tangent of the edge's path.
Parameters
edge:IEdge — The edge.
| |
ratio:Number — A value between 0 and 1 inclusively that indicates a ratio from the beginning to the end
of the path of the edge.
| |
p:YPoint — The point to set the touch point of the tangent.
| |
v:YPoint — The point to set the tangent vector.
|
Boolean — true , if a tangent was obtained with the specified parameters.
|
See also
getTargetArrowAnchor | () | method |
protected function getTargetArrowAnchor(path:GeneralPath, arrow:IArrow, anchorPoint:IPointSetter, arrowDirection:IPointSetter):Boolean
Convenience method that calculates the target arrow anchor and direction for a given arrow and path.
Parameters
path:GeneralPath — The path of the edge.
| |
arrow:IArrow — The arrow.
| |
anchorPoint:IPointSetter — The anchor point result.
| |
arrowDirection:IPointSetter — The arrow direction result
|
Boolean — Whether the values are valid.
|
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(edge:IEdge, x:Number, y:Number, ctx:ICanvasContext):Boolean
Determines whether the visual representation of the edge 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 returns the result of the polyLineContains
method of class GeomSupport
with the polygonal line defined by the source port, the target port and the bends of the edge and the hit test
radius of the ICanvasContext
.
Parameters
edge:IEdge — The edge 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 edge representation is hit; false otherwise.
|
See also
isInBox | () | method |
protected function isInBox(edge:IEdge, box:IRectangle, ctx:ICanvasContext):Boolean
Determines whether the visualization for the specified edge 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 returns the result of the polyLineIntersects
method of class GeomSupport
with the polygonal line defined by the source port, the target port and the bends of the edge and the hit test
radius of the ICanvasContext
.
Parameters
edge:IEdge — The edge to which this style instance is assigned.
| |
box:IRectangle — The marquee selection box.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified edge is selected by the marquee rectangle; false otherwise.
|
See also
isVisible | () | method |
protected function isVisible(edge:IEdge, clip:IRectangle, ctx:ICanvasContext):Boolean
Determines whether the visualization for the specified edge 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
edge:IEdge — The edge to which this style instance is assigned.
| |
clip:IRectangle — The clipping rectangle.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified edge is visible in the clipping rectangle, false otherwise.
|
See also
lookup | () | method |
protected function lookup(edge:IEdge, type:Class):Object
Performs the lookup
operation for the lookup
calls to the renderer.
This implementation yields null
for everything but:
Parameters
edge:IEdge — The edge 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(edge:IEdge, 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
edge:IEdge — The display object context.
| |
oldDisplayObject:DisplayObject — The edge to render.
| |
ctx:IDisplayObjectContext — The display object to update.
|
DisplayObject |
See also