Packagecom.yworks.canvas.model
Interfacepublic interface IAddBridgesCallback

Callback used by BridgeManager to add bridges to a GeneralPath.

See also

com.yworks.canvas.model.BridgeManager


Public Methods
 MethodDefined By
  
Gets the height of the bridge for the given IPaintContext.
IAddBridgesCallback
  
Gets the width of the bridge for the given IPaintContext.
IAddBridgesCallback
  
Gets the crossing style to use in the given IPaintContext.
IAddBridgesCallback
  
Gets the bridge orientation style to use in the given IPaintContext.
IAddBridgesCallback
  
insertCustomBridge(context:IPaintContext, path:GeneralPath, x1:Number, y1:Number, x2:Number, y2:Number, gapLength:Number):void
Callback that will be used by the BridgeManager if the getCrossingStyle() method yields BridgeManager.STYLE_CUSTOM to actually insert a bridge into the given GeneralPath.
IAddBridgesCallback
Method Detail
getBridgeHeight()method
public function getBridgeHeight(context:IPaintContext):Number

Gets the height of the bridge for the given IPaintContext.

The height is the default height that will be used for drawing the non-custom crossing styles.

Parameters

context:IPaintContext — The context where the bridge will be created for.

Returns
Number — The non-negative preferred basic unscaled height of the bridge.
getBridgeWidth()method 
public function getBridgeWidth(context:IPaintContext):Number

Gets the width of the bridge for the given IPaintContext.

The width is the preferred length of the segment that will be removed from the original segment if it crosses an obstacle. That bridge will be made larger if multiple obstacle bridges would otherwise overlap. The bridge will be automatically made smaller if it happens to be near the end of a segment and would otherwise extend beyond the end of the segment.

Parameters

context:IPaintContext — The context where the bridge will be created for.

Returns
Number — The positive preferred width of the bridge.
getCrossingStyle()method 
public function getCrossingStyle(context:IPaintContext):uint

Gets the crossing style to use in the given IPaintContext.

The crossing style is detemined by the BridgeManager's STYLE constants: STYLE_GAP, STYLE_RECTANGLE, STYLE_RECTANGLE_SCALED, STYLE_TWO_SIDES, STYLE_TWO_SIDES_SCALED, STYLE_ARC, STYLE_ARC_SCALED and STYLE_CUSTOM.

Parameters

context:IPaintContext — The context in which the crossing will be used.

Returns
uint — The style to use, or BridgeManager.STYLE_CUSTOM in order to let BridgeManager call insertCustomBridge().

See also

getOrientationStyle()method 
public function getOrientationStyle(context:IPaintContext):uint

Gets the bridge orientation style to use in the given IPaintContext.

The orientation style is detemined by the BridgeManager's ORIENTATION constants: ORIENTATION_FLOW_RIGHT, ORIENTATION_FLOW_LEFT, ORIENTATION_POSITIVE, ORIENTATION_NEGATIVE, ORIENTATION_RIGHT, ORIENTATION_LEFT, ORIENTATION_DOWN and ORIENTATION_UP.

Parameters

context:IPaintContext — The context in which the style will be used.

Returns
uint — The style to use. Any value can be returned and will be ignored if the crossing style which is returned by getCrossingStyle() is set to BridgeManager.STYLE_CUSTOM.
insertCustomBridge()method 
public function insertCustomBridge(context:IPaintContext, path:GeneralPath, x1:Number, y1:Number, x2:Number, y2:Number, gapLength:Number):void

Callback that will be used by the BridgeManager if the getCrossingStyle() method yields BridgeManager.STYLE_CUSTOM to actually insert a bridge into the given GeneralPath.

When this method is called the GeneralPath's lastX" and lastY coordinates are not yet at x1 and y1, respectively. So most implementation should first GeneralPath.moveTo(x,y) that location. Also at the end of the call, implementation should make sure that the GeneralPath's end is at (x2,y2). The gapLength is provided for convenience so that the distance between (x1,y1) and (x2,y2) does not need to be calculated if it is needed for the drawing.

Parameters

context:IPaintContext — The context for the call.
 
path:GeneralPath — The path to append the bridge segment to.
 
x1:Number — The x coordinate of the starting point of the bridge.
 
y1:Number — The y coordinate of the starting point of the bridge.
 
x2:Number — The x coordinate of the end point of the bridge.
 
y2:Number — The y coordinate of the end point of the bridge.
 
gapLength:Number — The distance between the starting point and the end point.