PathBasedEdgeStyleRenderer<TStyleextends IEdgeStyle>
An abstract base class for IEdgeStyleRenderer implementations that are based on the calculation of a GeneralPath.
Type Parameters
- TStyle: IEdgeStyle
- The exact type of style to use for this instance.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.styles.PathBasedEdgeStyleRenderer
See Also
Constructors
Creates a new instance of PathBasedEdgeStyleRenderer<TStyle>.
Parameters
A map of options to pass to the method.
- edgeStyleType - Class
- The exact type of style to use for this instance.
Properties
Gets whether the rendered path should use the BridgeManager to add bridges to it.
Gets or sets the currently configured edge.
Gets or sets the policy with which smoothing is applied to the path when getSmoothingLength returns a value larger than 0.
Remarks
Gets or sets a value indicating whether the first and last segments of the path should always begin and end with a straight line segment, respectively.
Remarks
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.
The default value is false
.
Methods
Prepares this instance for subsequent calls after the style and edge have been initialized.
Remarks
Upon invocation the style and edge properties have been populated by the getVisualCreator, getBoundsProvider, getHitTestable, or getMarqueeTestable methods.
Subclasses which override this method have to call the base implementation, first.
This method should create the basic uncropped path given the control points.
Special implementation that will create a self loop path.
Remarks
Parameters
A map of options to pass to the method.
- roundSelfLoop - boolean
- Whether to create a round self loop path. If
false
a rectangular path will be created.
Returns
- ↪GeneralPath
- A path for a self loop.
See Also
This method is called by the framework to create a Visual that will be included into the IRenderContext.
Remarks
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The context that describes where the visual will be used.
Returns
- ↪Visual
- The visual to include in the canvas object visual tree. This may be
null
.
See Also
Implements
Crops the edge's path at the nodes.
Remarks
Parameters
A map of options to pass to the method.
- path - GeneralPath
- The path that should be cropped.
Returns
- ↪GeneralPath
- The cropped path. This is can be either the same instance of the given path or a newly created instance.
See Also
Returns a tight rectangular area where the whole rendering would fit into.
Remarks
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- the context to calculate the bounds for
Returns
Implements
Configures the style
and edge
parameters, calls configure and returns this
.
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to retrieve the bounds provider for. The value will be stored in the edge property.
- style - IEdgeStyle
- The style to associate with the edge. The value will be stored in the style property.
Returns
- ↪IBoundsProvider
this
See Also
Implements
Yields the IBridgeCreator to use for adding bridges to the created path.
Remarks
null
) will be passed to the BridgeManager's addBridges method.Returns
- ↪IBridgeCreator
- This implementation returns
null
.
Configures the style
and edge
parameters, does not call configure and returns this
.
Remarks
this
or an instance that depends on a correctly configured this
.Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to query the context for. The value will be stored in the edge property.
- style - IEdgeStyle
- The style to associate with the edge. The value will be stored in the style property.
Returns
- ↪ILookup
this
See Also
Implements
Configures the style
and edge
parameters and returns this
.
Remarks
null
value.Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to provide an instance for
- style - IEdgeStyle
- The style to use for the querying hit tests
Returns
- ↪IHitTestable
- An implementation that may be used to subsequently perform hit tests. Clients should not cache this instance and must always call this method immediately before using the value returned. This enables the use of the flyweight design pattern for implementations. This method may return
null
to indicate that the edge cannot be hit tested.
See Also
Implements
Configures the style
and edge
parameters, calls configure and returns this
.
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to query marquee intersection tests. The value will be stored in the edge property.
- style - IEdgeStyle
- The style to associate with the edge. The value will be stored in the style property.
Returns
- ↪IMarqueeTestable
this
See Also
Implements
Returns createPath unless isVisible yields false
for the provided context and clip.
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The context to yield the obstacles for.
Returns
- ↪GeneralPath
- Either
null
or the result of createPath.
See Also
Implements
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.
Implements
Gets an implementation of the IPathGeometry interface that can handle the provided edge and its associated style.
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to provide an instance for
- style - IEdgeStyle
- The style to use for the painting
Returns
- ↪IPathGeometry
this
See Also
Implements
Returns the number of "segments" this edge's path consists of.
Remarks
Returns
- ↪number
- the number of segments or
-1
if there is no such thing as a segment for this edge.
See Also
Implements
Calculates the tangent on the edge's path at the given ratio point.
Remarks
Parameters
A map of options to pass to the method.
- ratio - number
- a value in [0,1] where 0 is the source's end and 1 is at the target's end of the visible edge path
Returns
- ↪Tangent
- The tangential line, if any exists.
See Also
Implements
Calculates the tangent on the edge's path at the given ratio point for the given segment.
Remarks
Parameters
A map of options to pass to the method.
- segmentIndex - number
- the segment to use for the calculation
- ratio - number
- a value in [0,1] where 0 is the source's end and 1 is at the target's end of the segment
Returns
- ↪Tangent
- The tangential line, if any exists.
See Also
Implements
Configures the style
and edge
parameters, does not call configure and returns this
.
Remarks
Configure
in isVisible.Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to query visibility tests. The value will be stored in the edge property.
- style - IEdgeStyle
- The style to associate with the edge. The value will be stored in the style property.
Returns
- ↪IVisibilityTestable
this
See Also
Implements
Configures the style
and edge
parameters, calls configure and returns this
.
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to retrieve the IVisualCreator for. The value will be stored in the edge property.
- style - IEdgeStyle
- The style to associate with the edge. The value will be stored in the style property.
Returns
- ↪IVisualCreator
this
See Also
Implements
This method is overridden for performance reasons.
Remarks
This implementation uses isVisible 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
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
A map of options to pass to the method.
- context - IInputModeContext
- the context the hit test is performed in
- location - Point
- the coordinates in world coordinate system
Returns
- ↪boolean
- whether something has been hit
See Also
Implements
Returns true
if the corresponding item is considered to intersect the given rectangular box.
Remarks
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.
Implementations should respect the hitTestRadius if marquee selections should behave differently on different zoom levels.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- the current input mode context
- rectangle - Rect
- the box describing the marquee's bounds
Returns
- ↪boolean
true
if the item is considered to be captured by the marquee
Implements
Returns true
if the corresponding item is considered to intersect the given path.
Remarks
This method may return false
if the item cannot be selected using a lasso selection or optionally if the item is only partially contained within the path.
Implementations should respect the hitTestRadius if lasso selections should behave differently on different zoom levels.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- the current input mode context
- path - GeneralPath
- the path describing the lasso selection bounds
Returns
- ↪boolean
true
if the item is considered to be captured by the lasso
Implements
Calls configure and test the edge using the style for a visible intersection with the clip bounds.
Remarks
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- the current canvas context
- rectangle - Rect
- the clip bounds
Returns
- ↪boolean
true
if the edge may be painted within the clip bounds.
See Also
Implements
Returns an instance that implements the given type or null
.
Remarks
null
implementations for the types, nor does it have to return the same instance any time. Also it depends on the type and context whether the instance returned stays up to date or needs to be reobtained for subsequent use.Type Parameters
- T: any
Parameters
A map of options to pass to the method.
- type - Class<T>
- The type for which an instance shall be returned.
Returns
- ↪T
- an instance that is assignable to type or
null
See Also
Implements
This method updates or replaces a previously created Visual for inclusion in the IRenderContext.
Remarks
The CanvasComponent uses this method to give implementations a chance to update an existing Visual that has previously been created by the same instance during a call to createVisual. Implementation may update the oldVisual
and return that same reference, or create a new visual and return the new instance or null
.
I most cases oldVisual
is a visual instance that has been returned by the createVisual method of this instance. This is, however, not guaranteed. Implementations have to be aware of this.
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The context that describes where the visual will be used in.
- oldVisual - Visual
- The visual instance to be updated.
Returns
- ↪Visual
oldVisual
, if this instance modified the visual, or a new visual that should replace the existing one in the canvas object visual tree.
See Also
Implements
Fields
The path instance that this instance is working with.
Static Methods
createRectangleSelfLoop
(sx: number, sy: number, oppositeX: number, oppositeY: number, tx: number, ty: number) : GeneralPathCreates a rectangular self loop path.
Parameters
A map of options to pass to the method.
- sx - number
- The x coordinate of the source port.
- sy - number
- The y coordinate of the source port.
- oppositeX - number
- The x coordinate of the single control point.
- oppositeY - number
- The y coordinate of the single control point.
- tx - number
- The x coordinate of the target port.
- ty - number
- The y coordinate of the target port.
Returns
- ↪GeneralPath
- A path that describes a rectangular self loop.
See Also
Creates a rectangular self loop path.
Parameters
A map of options to pass to the method.
- coordinates - number[]
- The coordinates of the path points, alternating x and y values.
See Also
createRoundSelfLoop
(sx: number, sy: number, oppositeX: number, oppositeY: number, tx: number, ty: number) : GeneralPathCreates a round self loop path.
Parameters
A map of options to pass to the method.
- sx - number
- The x coordinate of the source port.
- sy - number
- The y coordinate of the source port.
- oppositeX - number
- The x coordinate of the single control point.
- oppositeY - number
- The y coordinate of the single control point.
- tx - number
- The x coordinate of the target port.
- ty - number
- The y coordinate of the target port.
Returns
- ↪GeneralPath
- A path that describes a round self loop.