Packagecom.yworks.graph.drawing
Classpublic class PathBasedEdgeStyleRenderer
InheritancePathBasedEdgeStyleRenderer Inheritance AbstractEdgeStyleRenderer Inheritance AbstractStyleRenderer
SubclassesPolylineEdgeStyleRenderer

An abstract base class for IEdgeStyleRenderer implementations that are based on the calculation of a GeneralPath.

See also

IEdgeStyleRenderer
com.yworks.canvas.drawing.GeneralPath


Public Properties
 PropertyDefined by
 Inheriteditem : IModelItem
Gets the currently configured item.
AbstractStyleRenderer
 Inheritedstyle : IVisualStyle
Gets the currently configured style.
AbstractStyleRenderer
 InheritedstyleDescriptor : ICanvasObjectDescriptor
Gets the ICanvasObjectDescriptor to use for new installations.
AbstractStyleRenderer
Protected Properties
 PropertyDefined by
  path : GeneralPath
The path instance that this instance is working with.
PathBasedEdgeStyleRenderer
Public Methods
 MethodDefined by
  
Returns a tight rectangular area where the whole rendering would fit into.
PathBasedEdgeStyleRenderer
 Inherited
Configures the style and item parameters, calls configure and returns this.
AbstractStyleRenderer
 Inherited
Configures the style and item parameters, does not call configure and returns this.
AbstractStyleRenderer
  
This method is overridden for performance reasons.
PathBasedEdgeStyleRenderer
 Inherited
Configures the style and item parameters, calls configure and returns this.
AbstractStyleRenderer
 Inherited
Gets an implementation of the IPaintable interface that can handle the provided item and its associated style.
AbstractEdgeStyleRenderer
  
Returns a representation of the visible path of the edge in form of a GeneralPath
PathBasedEdgeStyleRenderer
 Inherited
Gets an implementation of the IPathGeometry interface that can handle the provided edge and its associated style.
AbstractEdgeStyleRenderer
 Inherited
Returns the number of "segments" this edge's path consists of.
AbstractEdgeStyleRenderer
 Inherited
getSegmentTangent(segment:int, ratio:Number, c:YPoint, up:YPoint):Boolean
Calculates the tangent on the edge's path at the given segment and ratio point.
AbstractEdgeStyleRenderer
 Inherited
getTangent(ratio:Number, c:YPoint, up:YPoint):Boolean
Calculates the tangent on the edge's path at the given ratio point.
AbstractEdgeStyleRenderer
 Inherited
install(canvas:CanvasComponent, group:ICanvasObjectGroup, modelItem:IModelItem):Array
Installs the model in the canvas at the given group using the styleDescriptor.
AbstractStyleRenderer
  
isHit(x:Number, y:Number, ctx:ICanvasContext):Boolean
This method is overriden for performance reasons.
PathBasedEdgeStyleRenderer
  
isInBox(box:IRectangle, ctx:ICanvasContext):Boolean
Returns true if the corresponding item is considered to intersect the given rectangular box.
This method may return false if the item cannot be selected using a selection marquee or optionally if the item is only partially contained within the box.
PathBasedEdgeStyleRenderer
 Inherited
isVisible(clip:IRectangle, ctx:ICanvasContext):Boolean
Calls configure and tests the item using the style for a visible intersection with the clip bounds.
AbstractStyleRenderer
 Inherited
lookup(type:Class):Object
Implements the ILookup interface.
AbstractStyleRenderer
  
paint(g:YGraphics, ctx:IPaintContext):void
Paints the path
PathBasedEdgeStyleRenderer
Protected Methods
 MethodDefined by
  
configure():void
Prepares this instance for subsequent calls after the style and item have been initialized.
PathBasedEdgeStyleRenderer
  
This method should create the basic uncropped path given the control points.
PathBasedEdgeStyleRenderer
 Inherited
Factory method for the StyleDescriptor property.
AbstractEdgeStyleRenderer
  
cropPath(pathToCrop:GeneralPath):void
Crops the edge's path at the nodes.
PathBasedEdgeStyleRenderer
  
getSmoothing():Number
Gets the smoothing factor
PathBasedEdgeStyleRenderer
  
getSourceArrowAnchor(arrow:IArrow, anchorPoint:IPointSetter, arrowDirection:IPointSetter):Boolean
Calculate and update the anchor and the source arrow's direction vector.
PathBasedEdgeStyleRenderer
  
getStroke():IStroke
Gets the pen to use for painting the path.
PathBasedEdgeStyleRenderer
  
getTargetArrowAnchor(arrow:IArrow, anchorPoint:IPointSetter, arrowDirection:IPointSetter):Boolean
Calculate and update the anchor and the target arrow's direction vector.
PathBasedEdgeStyleRenderer
 Inherited
paintArrows(g:YGraphics, ctx:IPaintContext):void
Paints the provided arrows using the graphics context.
AbstractEdgeStyleRenderer
 Inherited
setItem(item:IModelItem):void
Called by the various descriptor getters to initialize the item.
AbstractStyleRenderer
 Inherited
setStyle(style:IVisualStyle):void
Called by the various descriptor getters to initialize the style.
AbstractStyleRenderer
Property detail
pathproperty
protected var path:GeneralPath

The path instance that this instance is working with.

Method detail
calculateBounds()method
public override 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
configure()method 
protected override function configure():void

Prepares this instance for subsequent calls after the style and item have been initialized.

Upon invocation the style and item fields have been populated by the getPaintable or getBoundsProvider methods.

createPath()method 
protected function createPath():GeneralPath

This method should create the basic uncropped path given the control points.

Returns
GeneralPath — A path that has to be cropped, yet.
cropPath()method 
protected function cropPath(pathToCrop:GeneralPath):void

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
pathToCrop:GeneralPath — The path that should be cropped.

See also

getHitTestable()method 
public override function getHitTestable(item:IModelItem, style:IVisualStyle):IHitTestable

This method is overridden for performance reasons.

This implementation does not call configure. If subclasses depend on a configured instance in an override of isHit, they need to override this method, too and call configure if the base call returns a non-null value.

Parameters
item:IModelItem
 
style:IVisualStyle

Returns
IHitTestable

See also

getPath()method 
public override function getPath():GeneralPath

Returns a representation of the visible path of the edge in form of a GeneralPath

Returns
GeneralPath — An instance that describes the visible path or null if this is not applicable for the current geometry.
getSmoothing()method 
protected function getSmoothing():Number

Gets the smoothing factor

Returns
Number — The smoothing factor
getSourceArrowAnchor()method 
protected override function getSourceArrowAnchor(arrow:IArrow, anchorPoint:IPointSetter, arrowDirection:IPointSetter):Boolean

Calculate and update the anchor and the source arrow's direction vector.

Abstract method, has to be overriden by implementations.

Parameters
arrow:IArrow — The arrow to calculate the anchor for.
 
anchorPoint:IPointSetter — The tip of the arrow.
 
arrowDirection:IPointSetter — The direction vector of the arrow.

Returns
Boolean — Whether an anchor has been successfully determined.
getStroke()method 
protected function getStroke():IStroke

Gets the pen to use for painting the path.

Returns
IStroke — the stroke or null.
getTargetArrowAnchor()method 
protected override function getTargetArrowAnchor(arrow:IArrow, anchorPoint:IPointSetter, arrowDirection:IPointSetter):Boolean

Calculate and update the anchor and the target arrow's direction vector.

Abstract method, has to be overriden by implementations.

Parameters
arrow:IArrow — The arrow to calculate the anchor for.
 
anchorPoint:IPointSetter — The tip of the arrow.
 
arrowDirection:IPointSetter — The direction vector of the arrow.

Returns
Boolean — Whether an anchor has been successfully determined.
isHit()method 
public override function isHit(x:Number, y:Number, ctx:ICanvasContext):Boolean

This method is overriden for performance reasons.

This implementation uses the isVisible property as an early exit indicator. If isVisible returns false for a certain rectangle, the instance will not be configured but a non-hit will be assumed. Otherwise, this instance will be configured and the standard path based hit test routine is used.

Subclasses should not depend on the fact that configure has already been called. This may not be the case. If your subclass depends on configure being called, override getHitTestable and call configure after the base class call.

Parameters
x:Number
 
y:Number
 
ctx:ICanvasContext

Returns
Boolean

See also

isInBox()method 
public override function isInBox(box:IRectangle, ctx:ICanvasContext):Boolean

Returns true if the corresponding item is considered to intersect the given rectangular box.
This method may return false if the item cannot be selected using a selection marquee or optionally if the item is only partially contained within the box.

Parameters
box:IRectangle — The box describing the marquee's bounds
 
ctx:ICanvasContext — The current canvas context

Returns
Booleantrue if the item is considered to be captured by the marquee
paint()method 
public override function paint(g:YGraphics, ctx:IPaintContext):void

Paints the path

Parameters
g:YGraphics
 
ctx:IPaintContext

See also