An IIntersectionCalculator is responsible for calculating the intersection point between an edge and the visual representation of its source or target node.
Inheritance Hierarchy
IIntersectionCalculator
Remarks
This interface is especially useful in conjunction with PortCalculator when adjusting the final port locations after the layout is calculated.
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.IIntersectionCalculator
See Also
If the layout is executed using a LayoutExecutor and the portAdjustmentPolicy is set to another value than NEVER an IIntersectionCalculator which querys the node's IShapeGeometry for the node's getOutline is automatically used.
Methods
calculateIntersectionPoint
(nodeLayout: INodeLayout, xOffset: number, yOffset: number, dx: number, dy: number) : YPointCalculates an intersection point between the edge and the given INodeLayout.
Remarks
Implementing classes use a point on the connecting edge segment (specified with an offset to the node's center) along with a direction pointing to the node and calculate the intersection between this line and the node.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- nodeLayout - INodeLayout
- the layout information of the node
- xOffset - number
- the x-coordinate of a point on the last line segment relative to the node's center
- yOffset - number
- the y-coordinate of a point on the last line segment relative to the node's center
- dx - number
- the x-component of the normalized direction vector indicating the direction of the segment pointing towards the node
- dy - number
- the y-component of the normalized direction vector indicating the direction of the segment pointing towards the node
Returns
- ↪YPoint
- the intersection coordinates relative to the node's center or
null
if no such intersection was found
Static Methods
create
(calculateIntersectionPoint: function(INodeLayout, number, number, number, number):YPoint) : IIntersectionCalculatorCreates an implementation of the interface IIntersectionCalculator by using the given function as implementation for its calculateIntersectionPoint method.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- calculateIntersectionPoint - function(INodeLayout, number, number, number, number):YPoint
- A function for IIntersectionCalculator's single abstract method calculateIntersectionPoint.
Returns
- ↪IIntersectionCalculator
- An instance of the IIntersectionCalculator interface based on the given function.