Gets or sets how the route is computed, including whether it uses the points of its old route to determine the new route.
The value must be one of Link.None|None, Link.End|End, Link.Scale|Scale, or Link.Stretch|Stretch.
Gets or sets how rounded the corners are for adjacent line segments when the #curve
is Link.None|None, Link.JumpGap|JumpGap, or Link.JumpOver|JumpOver and
the two line segments are orthogonal to each other.
Gets or sets the way the path is generated from the route's points.
The value must be one of Link.None|None, Link.Bezier|Bezier, Link.JumpGap|JumpGap, or Link.JumpOver|JumpOver.
Gets or sets the length of the first segment, when the computed "from spot" at the #fromPort is not Spot.None.
The default value is NaN, meaning that the value
actually comes from the GraphObject#fromEndSegmentLength property of the #fromPort.
This value also limits how short the #fromShortLength may be drawn.
Gets or sets the Node that this link comes from.
The #fromPortId specifies which port the link comes from.
The default value is null -- this link is not coming from any node.
This read-only property returns a GraphObject that is the "from" port that this link is connected from.
The #fromNode provides the node that the link is coming from.
The #fromPortId provides the identifier for which port this link is coming from;
you can set that property in order to change the value of this property.
This method may return null.
Gets or sets the function that is called after this Link changes which Node or port it connects from.
The first argument will be this Link.
The second argument will be the old GraphObject port.
The third argument will be the new GraphObject port.
Gets or sets how far the end segment stops short of the actual port.
Positive values are limited by the #fromEndSegmentLength or GraphObject#fromEndSegmentLength.
Negative values cause the link to extend into the port.
The default value is NaN -- the value actually comes from the
GraphObject#fromShortLength property of the #fromPort.
Gets or sets where this link should connect at the #fromPort.
The default value is Spot.Default, meaning that the value
actually comes from the GraphObject#fromSpot property of the #fromPort.
This read-only property is true when this Link has any label Nodes, Nodes that are owned by this Link
and are arranged along its path in the same manner as elements of the Link Panel.
This read-only property is true if #routing is a value that implies that the points
of the route should be orthogonal, such that each point shares a common X or a common Y value
with the immediately previous and next points.
This property is completely dependent on the #routing property.
Values of Link.Orthogonal and Link.AvoidsNodes causes this property to be true.
This read-only property returns an iterator over the Nodes that act as labels on this Link.
Setting Node#labeledLink to refer to this Link
will add that Node to this collection.
Gets or sets the List of Points in the route.
All of the Points must be Point#isReal -- no NaN or infinite values --
and all of the points are in document coordinates.
Although this list may be replaced by setting this property,
one must not modify the contents of the List directly.
Gets or sets whether the user may change the number of segments in this Link,
if the link has straight segments.
This affects the behavior of the LinkReshapingTool when #curve is not Link.Bezier.
Gets or sets whether the link's path tries to avoid other nodes.
The value must be one of Link.Normal|Normal, Link.Orthogonal|Orthogonal, or Link.AvoidsNodes|AvoidsNodes.
Gets or sets the length of the last segment.
The default value is NaN, meaning that the value
actually comes from the GraphObject#toEndSegmentLength property of the #toPort.
This value also limits how short the #toShortLength may be drawn.
Gets or sets the Node that this link goes to.
The #toPortId specifies which port the link goes to.
The default value is null -- this link is not going to any node.
This read-only property returns a GraphObject that is the "to" port that this link is connected to.
The #toNode provides the node that the link is going to.
The #toPortId provides the identifier for which port this link is going to;
you can set that property in order to change the value of this property.
This method may return null.
Gets or sets the function that is called after this Link changes which Node or port it connects to.
The first argument will be this Link.
The second argument will be the old GraphObject port.
The third argument will be the new GraphObject port.
Gets or sets how far the end segment stops short of the actual port.
Positive values are limited by the #toEndSegmentLength or GraphObject#toEndSegmentLength.
Negative values cause the link to extend into the port.
The default value is NaN -- the value actually comes from the
GraphObject#toShortLength property of the #toPort.
Gets or sets where this link should connect at the #toPort.
The default value is Spot.Default, meaning that the value
actually comes from the GraphObject#toSpot property of the #toPort.
Add a point at the end of the route; this may only be called within an override of #computePoints.
@param {Point} p The new point in document coordinates, which should not have infinite or NaN coordinate values, and which must not be modified afterwards.
@see #getPoint
@see #setPoint
@see #insertPoint
@see #removePoint
@since 1.6
(undocumented)
Add a point at the end of the route; this may only be called within an override of #computePoints.
@param {number} x The new X, which should not be infinite or NaN, in document coordinates.
@param {number} y The new Y, which should not be infinite or NaN, in document coordinates.
(undocumented)
Sort the Links between two ports and invalidate their routes.
Only one of the Links in the bundle will get this method called -- it is undetermined which Link is chosen.
Remove all of the points from this link's route; this may only be called within an override of #computePoints.
@see #getPoint
@see #setPoint
@see #insertPoint
@see #addPoint
@see #removePoint
@since 1.6
Returns the #curviness, if it's a number,
or else a computed value based on how many links connect this pair of nodes/ports,
by calling #computeSpacing on each link.
Get the length of the end segment in document coordinates, typically a short distance, in document units.
For spot values that are Spot#isSide, this returns a computed value.
Depending on the from argument, this will return #fromEndSegmentLength or #toEndSegmentLength.
If the value is NaN, this will return the #fromPort's GraphObject#fromEndSegmentLength
or the #toPort's GraphObject#toEndSegmentLength.
Find the approximate point of the other end of the link in document coordinates.
This is useful when computing the connection point when there is no specific spot, to have an idea of which general direction the link should be going.
By default this will return the center of the other port.
The code that constructs a new route by modifying the #points.
It is only called by #updateRoute, when needed.
All route points are always in document coordinates.
Returns the expected spacing between this link and others that connect this link's fromPort and toPort.
This calls #computeThickness and also takes any "mid label"'s breadth into account.
Get the Spot that describes how the end of the link should connect with the port.
Depending on the from argument, this will return #fromSpot or #toSpot.
If the value is Spot#isDefault, this will return the #fromPort's GraphObject#fromSpot
or the #toPort's GraphObject#toSpot.
Find the index of the segment that is closest to a given point.
This assumes the route only has straight line segments.
It ignores any jump-overs or jump-gaps.
@param {Point} p the Point, in document coordinates.
@return {number} int the index of the segment, from zero to the number of points minus 2.
(undocumented)
Returns the first label that should be at the "middle" of the link, if there is any such label.
Elements that have .isPanelMain === true are ignored, including the #path.
Elements that have a GraphObject#segmentIndex set are ignored, such as arrowheads.
If there are no label objects within the Link Panel, consider any #labelNodes
whose segmentIndex has not been set.
This could be overridden to return a different label than the first one, or to always return null.
@expose
@return {GraphObject}
Compute the direction in which a link should go from a given connection point.
@expose
@param {Node} node
@param {GraphObject} port the GraphObject representing a port on the node.
@param {Point} linkpoint the connection point, in document coordinates.
@param {Spot} spot a Spot value describing where the link should connect.
@param {boolean} from true if the link is coming out of the port; false if going to the port.
@param {boolean} ortho whether the link should have orthogonal segments.
@param {Node} othernode the node at the other end of the link.
@param {GraphObject} otherport the GraphObject port at the other end of the link.
@return {number} the absolute angle, in degrees.
@since 1.2
Compute the point on a node/port in document coordinates at which the route of a link should end.
@expose
@param {Node} node
@param {GraphObject} port the GraphObject representing a port on the node.
@param {Spot} spot a Spot value describing where the link should connect.
@param {boolean} from true if the link is coming out of the port; false if going to the port.
@param {boolean} ortho whether the link should have orthogonal segments.
@param {Node} othernode the node at the other end of the link.
@param {GraphObject} otherport the GraphObject port at the other end of the link.
@param {Point=} result an optional Point that is modified and returned; otherwise it allocates and returns a new Point
@return {Point} in document coordinates.
@since 1.2
Compute the intersection point in document coordinates for the edge of a particular port GraphObject, given a point,
when no particular spot or side has been specified.
@expose
@param {Node} node
@param {GraphObject} port the GraphObject representing a port on the node.
@param {Point} focus the point in document coordinates to/from which the link should point,
normally the center of the port.
@param {Point} p often this point is far away from the node, to give a general direction,
particularly an orthogonal one.
@param {boolean} from true if the link is coming out of the port; false if going to the port.
@param {Point=} result an optional Point that is modified and returned; otherwise it allocates and returns a new Point
@return {Point} the point in document coordinates of the intersection point on the edge of the port.
@since 1.2
Given a Node, return the node at the other end of this link.
@param {Node} node
@return {Node} This may return the same node, if the link is reflexive.
Given a GraphObject that is a "port", return the port at the other end of this link.
@param {GraphObject} port
@return {GraphObject} This may return the same object, if the link is reflexive.
Insert a point at a particular position in the route, without replacing an existing point; this may only be called within an override of #computePoints.
@param {number} i int The zero-based index of the new point.
@param {Point} p The new point in document coordinates, which should not have infinite or NaN coordinate values, and which must not be modified afterwards.
@see #getPoint
@see #setPoint
@see #addPoint
@see #removePoint
@since 1.6
(undocumented)
Insert a point at a particular position in the route, without replacing an existing point; this may only be called within an override of #computePoints.
@param {number} i int The zero-based index of the new point.
@param {number} x The new X, which should not be infinite or NaN, in document coordinates.
@param {number} y The new Y, which should not be infinite or NaN, in document coordinates.
Declare that the route (the #points) of this Link need to be recomputed soon.
This causes #updateRoute to be called, which will call #computePoints
to perform the actual determination of the route.
@since 1.6
Produce a Geometry given the points of this route,
depending on the value of #curve and #corner and perhaps other properties.
The points of the Geometry are in local coordinates, whereas the #points of the link route are in document coordinates.
Move this link to a new position.
This also shifts all of the Points in the route accordingly.
This also moves any #labelNodes.
@param {Point} newpos a new Point in document coordinates.
@param {boolean=} useLocation true if you want to set the #location instead of the position. False by default.
Remove a particular point from the route; this may only be called within an override of #computePoints.
@param {number} i int The zero-based index of the point to extract.
@see #getPoint
@see #setPoint
@see #insertPoint
@see #addPoint
@see #clearPoints
@since 1.6
Sets a particular point of the route; this may only be called within an override of #computePoints.
@param {number} i int The zero-based index of the desired point.
@param {Point} p The new point in document coordinates, which should not have infinite or NaN coordinate values, and which must not be modified afterwards.
@see #getPoint
@see #insertPoint
@see #addPoint
@see #removePoint
@since 1.6
(undocumented)
Sets a particular point of the route; this may only be called within an override of #computePoints.
@param {number} i int The zero-based index of the desired point.
@param {number} x The new X, which should not be infinite or NaN, in document coordinates.
@param {number} y The new Y, which should not be infinite or NaN, in document coordinates.
(undocumented)
Allow calls to #setPoint, #addPoint, #insertPoint,
#removePoint, and #clearPoints.
You must call #commitRoute when you are done modifying the route.
This method recomputes the route if the route is invalid,
to make sure the #points are up-to-date.
This method calls #computePoints in order to calculate a new route.