Search this API

y.layout
Interface IntersectionCalculator


public interface IntersectionCalculator

Interface implemented by classes that are responsible for calculating the intersection point between an Edge and the visual representation of its source or target node. This interface is especially useful in conjunction with the PortCalculator LayoutStage.

See Also:
PortCalculator

Field Summary
static Object SOURCE_INTERSECTION_CALCULATOR_DPKEY
          Key to be used when registering a DataProvider to a graph instance that provides for each Edge object in a graph an IntersectionCalculator instance that is configured to calculate the intersection of the edge and the source node.
static Object TARGET_INTERSECTION_CALCULATOR_DPKEY
          Key to be used when registering a DataProvider to a graph instance that provides for each Edge object in a graph an IntersectionCalculator instance that is configured to calculate the intersection of the edge and the target node.
 
Method Summary
 YPoint calculateIntersectionPoint(NodeLayout nl, double xOffset, double yOffset, double dx, double dy)
          Calculates an intersection point given the coordinates of a point lying on the last/first segment of an Edge and a normalized direction.
 

Field Detail

SOURCE_INTERSECTION_CALCULATOR_DPKEY

static final Object SOURCE_INTERSECTION_CALCULATOR_DPKEY
Key to be used when registering a DataProvider to a graph instance that provides for each Edge object in a graph an IntersectionCalculator instance that is configured to calculate the intersection of the edge and the source node.


TARGET_INTERSECTION_CALCULATOR_DPKEY

static final Object TARGET_INTERSECTION_CALCULATOR_DPKEY
Key to be used when registering a DataProvider to a graph instance that provides for each Edge object in a graph an IntersectionCalculator instance that is configured to calculate the intersection of the edge and the target node.

Method Detail

calculateIntersectionPoint

YPoint calculateIntersectionPoint(NodeLayout nl,
                                  double xOffset,
                                  double yOffset,
                                  double dx,
                                  double dy)
Calculates an intersection point given the coordinates of a point lying on the last/first segment of an Edge and a normalized direction. If no such intersection can be found this method should return null.

Parameters:
nl - the currently calculated NodeLayout
xOffset - the relative (to the node's center) x-coordinate of a point on the last line segment
yOffset - the relative y-coordinate of a point on the last line segment
dx - the x component of the normalized direction vector indicating the direction of the segment pointing towards the node
dy - the y component of the normalized direction vector indicating the direction of the segment pointing towards the node
Returns:
the new relative (to the node's center) intersection coordinates or null if no such intersection could be found

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.