A foundational implementation of IEdgeStyle that delegates its behavior to several style instances.
Implements
- I
- I
Remarks
This class can be used to combine multiple SVG-based style instances into one.
The following aspects will be delegated to all instances:
- creating and updating the visuals.
- testing for visibility.
- hit testing.
- calculating the total bounds of the edge.
- determining if an edge is within a rectangular marquee selection area.
- determining if an edge is within a lasso selection path.
The following aspects will be delegated to the first/main style, only:
- looking up the context.
- calculating the intersection points for edges.
- determining the number of segments.
- calculating the path of an edge.
This class can be subclassed like EdgeStyleBase<TVisual> to allow for custom implementations of the various aspects of the delegation.
See Also
Developer's Guide
Members
Show:
Constructors
Creates a new instance of this style.
Creates a new instance of this style.
Parameters
- mainStyle: IEdgeStyle
- The main style which will be rendered first and to which all requests will delegate to.
- additionalStyles: IEdgeStyle
- Additional styles which will be rendered on top and which will also be included in the hit-, visibility-, and bounds tests.
Properties
Gets the renderer implementation for this instance.
Gets the renderer implementation for this instance.
The private implementation will delegate all API calls back to this instance.
readonlyfinal
Defined in
EdgeStyleBase.rendererGets a readonly list of the styles used by this instance.
Gets a readonly list of the styles used by this instance.
The first item is the main instance, and the others are the additional instances rendered on top in order. The list always has at least one member.
readonlyfinal
Methods
protected
Parameters
- context: IRenderContext
- The context for the rendering.
- group: SVGGElement
- The container to which the arrows should be added.
- edge: IEdge
- The edge that is being rendered.
- edgePath: GeneralPath
- The edge path.
- sourceArrow: IArrow
- The source arrow.
- targetArrow: IArrow
- The target arrow.
Defined in
EdgeStyleBase.addArrowsReturns a memberwise clone.
Returns a memberwise clone.
This will also clone the style instances.
Return Value
- Object
- A clone of this instance.
Overrides
EdgeStyleBase.cloneCreates the visual by delegating to all styles.
Creates the visual by delegating to all styles.
protected
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
Overrides
EdgeStyleBase.createVisualCrops the edge's path at the nodes.
Crops the edge's path at the nodes.
This implementation uses the IEdgePathCropper instances found in the lookup of the source and target port of the edge to perform the actual cropping.
protected
Parameters
- edge: IEdge
- The edge that is being rendered.
- sourceArrow: IArrow
- The source arrow instance.
- targetArrow: IArrow
- The target arrow instance.
- path: GeneralPath
- The path that should be cropped.
Return Value
- GeneralPath
- The cropped path. This can be either the same instance of the given path or a newly created instance.
Defined in
EdgeStyleBase.cropPathCalculates the bounds as the union of bounds from all styles.
Calculates the bounds as the union of bounds from all styles.
protected
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.
Overrides
EdgeStyleBase.getBoundsGets the path from the first style as the reference.
Gets the path from the first style as the reference.
protected
Parameters
- edge: IEdge
- The edge.
Return Value
- GeneralPath
- The path of the supplied edge.
Overrides
EdgeStyleBase.getPathGets the segment count from the first style as the reference.
Gets the segment count from the first style as the reference.
protected
Parameters
- edge: IEdge
- The edge.
Return Value
- number
- The segment count for the supplied edge.
Overrides
EdgeStyleBase.getSegmentCountCalculates the source arrow anchor and direction for a given arrow and path.
Calculates the source arrow anchor and direction for a given arrow and path.
protected
Parameters
- path: GeneralPath
- The path of the edge.
- arrow: IArrow
- The arrow.
Return Value
- Tangent
- The anchor and directional vector of the arrow, if any exist.
Defined in
EdgeStyleBase.getSourceArrowAnchorDetermines the tangent for the first style as the reference.
Determines the tangent for the first style as the reference.
protected
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 edge path.
Return Value
- Tangent
- The tangent, if it exists.
Overrides
EdgeStyleBase.getTangentDetermines the tangent for the first style as the reference.
Determines the tangent for the first style as the reference.
protected
Parameters
- edge: IEdge
- The edge.
- segmentIndex: number
- Index of the edge segment.
- ratio: number
- A value between 0 and 1 inclusively that indicates a ratio from the beginning to the end of the edge segment.
Return Value
- Tangent
- The tangent, if it exists.
Overrides
EdgeStyleBase.getTangentForSegmentCalculates the target arrow anchor and direction for a given arrow and path.
Calculates the target arrow anchor and direction for a given arrow and path.
protected
Parameters
- path: GeneralPath
- The path of the edge.
- arrow: IArrow
- The arrow.
Return Value
- Tangent
- The anchor and directional vector of the arrow, if any exist.
Defined in
EdgeStyleBase.getTargetArrowAnchorChecks whether any style is hit at the given location.
Checks whether any style is hit at the given location.
protected
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 is hit;falseotherwise.
Overrides
EdgeStyleBase.isHitDetermines if the edge is in the box based on any style.
Determines if the edge is in the box based on any style.
protected
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.
Overrides
EdgeStyleBase.isInBoxDetermines if the edge is in the path based on any style.
Determines if the edge is in the path based on any style.
protected
Parameters
- context: IInputModeContext
- The input mode context.
- path: 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.
Overrides
EdgeStyleBase.isInPathDetermines visibility based on the visibility of all styles.
Determines visibility based on the visibility of all styles.
protected
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.
Overrides
EdgeStyleBase.isVisiblePerforms a lookup using the first style as the reference.
Performs a lookup using the first style as the reference.
protected
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.
Overrides
EdgeStyleBase.lookupprotected
Parameters
- context: IRenderContext
- The context for the rendering.
- group: SVGGElement
- The container to which the arrows should be added.
- edge: IEdge
- The edge that is being rendered.
- edgePath: GeneralPath
- The edge path.
- sourceArrow: IArrow
- The source arrow.
- targetArrow: IArrow
- The target arrow.
Defined in
EdgeStyleBase.updateArrowsUpdates the visual by delegating to all styles.
Updates the visual by delegating to all styles.
protected
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