- I
- I
Remarks
The only method that needs to be implemented by subclasses is getPath. The other callback methods like getStroke, getSourceArrow, and getTargetArrow can be overridden to easily customize the path visualization.
Unlike a direct IEdgeStyle implementation, PathEdgeStyleBase does not expose a separate IEdgeStyleRenderer. The base class uses a fixed renderer and simply forwards its calls back to the style instance.
Note that if your subclass has private fields (defined with JavaScript's # name syntax), the clone method needs to be overridden for the cloning to work properly.
See Also
Developer's Guide
Members
Constructors
Initializes a new instance of the PathEdgeStyleBase class.
Properties
Gets whether the rendered path should use the BridgeManager to add bridges to it.
Multiple CSS classes can be set by separating them with spaces, just like with the class attribute.
The default value is the empty string.
Gets the renderer implementation for this instance.
Implements
IEdgeStyle.rendererMethods
Creates a new object that is a copy of the current instance.
Immutable subclasses should consider returning this for the best performance.
The base class implementation creates a simple shallow clone that copies all own properties to a new instance. This will not work for classes that use private fields or properties (defined with JavaScript's # name syntax) as no constructors will be run and implementations like this cannot be accessed from outside the classes that declare them.
Classes that use private members or require special initialization must override this method and manually create a new instance or call super.clone() and then explicitly copy the private fields and properties explicitly.
Return Value
- Object
- A new object that is a copy of this instance using a memberwise clone.
Implements
ICloneable.cloneCreates the visualization for the edge's path.
This method is called in response to a createVisual call to the instance that has been queried from the renderer.
This visualization uses the callbacks getCroppedPath, getStroke, getSourceArrow, getTargetArrow, getSourceArrowAnchor, getTargetArrowAnchor, addBridges, and getBridgeCreator.
Parameters
- context: IRenderContext
- The render context.
- edge: IEdge
- The edge to which this style instance is assigned.
Return Value
- Visual
- The visual as required by the createVisual interface.
See Also
API
- updateVisual
Gets the bounds of the visual for the edge in the given context.
Parameters
- context: ICanvasContext
- The canvas context.
- edge: IEdge
- The edge to which this style instance is assigned.
Return Value
- Rect
- The visual bounds of the visual representation.
null) will be passed to the BridgeManager's addBridges method.Parameters
- edge: IEdge
- The edge.
Return Value
- IBridgeCreator
- This implementation returns
null.
Crops the raw path obtained from getPath to accommodate for cropping and arrow heads.
Parameters
- edge: IEdge
- The edge to create the path for.
Return Value
- GeneralPath
- The path for the given edge or
nullif the edge is currently invisible.
Parameters
- context: IRenderContext
- The context to yield the obstacles for.
- edge: IEdge
- The edge.
Return Value
- GeneralPath
- Either
nullor the result of getCroppedPath.
See Also
Implementations may create their own GeneralPath or use the utility methods createPolylinePath and createSelfLoopPath to create simple polyline paths.
Cropping of the path will be performed in getCroppedPath which delegates to this method, first. For visualization, hit testing, and the like, it will be smoothed, if getSmoothingLength returns a positive value.
Parameters
- edge: IEdge
- The edge to create the path for.
Return Value
- GeneralPath
- The path for the given edge or
nullif the edge is currently invisible.
Gets the number of segments of the edge.
Gets the value that determines the radius of the smoothing arcs that can be added to the path at the bends.
0.0d, which effectively turns off path smoothing.Parameters
- edge: IEdge
- The edge.
Return Value
- number
- The radius of the arcs to use at the bends of the path.
Gets the policy with which smoothing is applied to the path when getSmoothingLength returns a value larger than 0.
Parameters
- edge: IEdge
- The edge.
Return Value
- SmoothingPolicy
- The policy with which smoothing is applied to the path.
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.
Return Value
- Tangent
- The anchor and directional vector of the arrow, if it exists.
Gets a value indicating whether the first and last segments of the path should always begin and end with a straight line segment, respectively.
Given high enough values for getSmoothingLength, the first and last segments may become completely curved. This property prevents this from happening, e.g., to prevent arrowheads from colliding with the smoothed edge path.
This implementation returns false.
Parameters
- edge: IEdge
- The edge.
Return Value
- boolean
trueif the first and last segments should remain straight; otherwise,false.
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.
Return Value
- Tangent
- The anchor and directional vector of the arrow, if it exists.
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 been queried from the renderer.
This implementation returns the result of the pathContains method considering the pen thickness and the hitTestRadius.
Parameters
- context: IInputModeContext
- The input mode context.
- location: Point
- The point to test.
- edge: IEdge
- The edge to which this style instance is assigned.
Return Value
- boolean
trueif the specified edge representation is hit;falseotherwise.
See Also
API
- hitsPolyline
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 pathIntersects method considering the pen thickness and the hitTestRadius.
Parameters
- context: IInputModeContext
- The input mode context.
- rectangle: Rect
- The marquee selection box.
- edge: IEdge
- The edge to which this style instance is assigned.
Return Value
- boolean
trueif the specified edge is visible and selected by the marquee rectangle;falseotherwise.
Determines whether the visualization for the specified edge is included in the lasso selection.
This method is called in response to a isInPath call to the instance that has been queried from the renderer.
This implementation uses the results of the areaIntersects method considering the pen thickness and the hitTestRadius.
Parameters
- context: IInputModeContext
- The input mode context.
- lassoPath: GeneralPath
- The lasso selection path.
- edge: IEdge
- The edge to which this style instance is assigned.
Return Value
- boolean
trueif the specified edge is visible and selected by the lasso path;falseotherwise.
Determines whether the visualization for the specified edge is visible in the context.
Parameters
- context: ICanvasContext
- The canvas context.
- rectangle: Rect
- The clipping rectangle.
- edge: IEdge
- The edge to which this style instance is assigned.
Return Value
- boolean
trueif the specified edge is visible in the clipping rectangle;falseotherwise.
This implementation yields null for everything but:
- IHitTestable
- IVisualCreator
- IBoundsProvider
- IVisibilityTestable
- IMarqueeTestable
- ILassoTestable
- ILookup
- IPathGeometry
- IObstacleProvider
For these interfaces, an implementation will be returned that delegates to the methods in this instance.
Parameters
- edge: IEdge
- The edge to use for the context lookup.
- type: Constructor
- The type to query.
Return Value
- any
- An implementation of the
typeornull.
Updates the visual previously created by createVisual.
Parameters
- context: IRenderContext
- The render context.
- oldVisual: Visual
- The visual that has been created in the call to createVisual.
- edge: IEdge
- The edge to which this style instance is assigned.
Return Value
- Visual
- The visual as required by the createVisual interface.
See Also
API
- createVisual
Static Methods
Parameters
- edge: IEdge
- The edge to create the polyline path for.
Return Value
- GeneralPath
- A polyline path including the ports and bends of the edge.
Special implementation that will create a self-loop path for the given edge.
Parameters
- edge: IEdge
- The edge to create the self-loop path for.
- roundSelfLoop: boolean
- Whether to create a round self-loop path. If
false, a rectangular path will be created. - selfLoopDistance?: number
- The distance the self-loop stretches from the node bounds. This has only an effect if the edge has no bends.
Return Value
- GeneralPath
- A path for a self-loop.
Crops the edge's path at its source and target nodes.
Parameters
- edge: IEdge
- The edge to crop the path for.
- path: GeneralPath
- The path that should be cropped.
- sourceArrow?: IArrow
- The optional arrow at the source side of the path to consider when cropping.
- targetArrow?: IArrow
- The optional arrow at the target side of the path to consider when cropping.
Return Value
- GeneralPath
- The cropped path. This can be either the same instance of the given path or a newly created instance.