Class Link

GoDiagram®
v10.0.11
by Northwoods Software®

A Link is a Part that connects Nodes. The link relationship is directional, going from FromNode to ToNode. A link can connect to a specific port element in a node, as named by the FromPortId and ToPortId properties.

Namespace: Northwoods.Go
Assembly: Northwoods.GoDiagram.WinForms.dll
public class Link : Part, IHasContextMenu, IHasToolTip

For more discussion, see Introduction to Links.

To add a Link to a Diagram when using a GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort> you should do something like:

myDiagram.StartTransaction("make new link");
(myDiagram.Model as MyModel).AddLinkData(new MyLinkData { From = "Alpha", To = "Beta" });
myDiagram.CommitTransaction("make new link");

where you would substitute the keys of the actual nodes that you want to connect with a link. This will cause a Link to be created (copying the template found in LinkTemplateMap), added to the Diagram in some Layer (based on LayerName), and bound to the link data (resulting in Data referring to that link data object).

If you are using a TreeModel<TNodeData, TNodeKey, TSharedData>, there are no link data objects, so you just need to call SetParentKeyForNodeData(TNodeData, TNodeKey) to specify the "parent" node's key for a "child" node data.

To find a Link given a link data object in the GraphLinksModel<TNodeData, TNodeKey, TSharedData, TLinkData, TLinkKey, TPort>, call FindLinkForData(object). When using a TreeModel<TNodeData, TNodeKey, TSharedData>, call either FindNodeForData(object) or FindNodeForKey(object) to get a Node, and then call FindTreeParentLink() to get the Link, if any exists.

To find a link that connects two nodes, call FindLinksTo(Node, string, string) or FindLinksBetween(Node, string, string). With the former method, the direction matters; with the latter method it returns links in either direction.

A link's position and size are determined by the two nodes that it connects. Normally there should be a Shape as the main element in this Link. This shape is what users will see as the "line" or "wire" -- you can set its Stroke and other "stroke..." properties to control its appearance.

The link will compute a route (a sequence of points) going from the FromNode's port element to the ToNode's port element. That route is used to generate the path of the main shape. Properties that affect the nature of the route and the geometry of the path include:

For more discussion and examples, see Links.

There are additional properties that affect how the end of the link connects to a port element of a node. There are duplicate properties, ones for the "to" end and ones for the "from" end:

These properties normally have "default" values, causing the link's routing and path-geometry generating to get the corresponding values from the connected port element. This scheme permits an individual link to have its own specific connection to a port, taking precedence over how the port normally expects links to connect to it. For example, several of the Layout classes sets these properties on each Link as part of their route computation for links.

For more discussion and examples, see Link Points.

Elements other than the main Shape in the Link may act as decorations on the link, including arrowheads and labels. You can control where they are located along the link route and how they are oriented. Because these decorations may be any GraphObject, they are all properties of that class. The properties include:

If you do not set the SegmentIndex property, the object is positioned to be at the middle of the link.

For more discussion and examples, see Link Labels.

It is easy to add arrowheads to your link template. Just add a Shape with the appearance properties that you want, and also set the ToArrow or FromArrow property to the name of the kind of arrowhead that you want. Doing so automatically sets the "Segment..." properties that are appropriate for the chosen arrowhead.

More than one shape may automatically get the route geometry. This is useful when you want to have multiple link shapes with different thicknesses to create a gradient effect across the path of the link or to produce parallel lines along the path. Just set IsPanelMain to true on each such Shape.

If you want the user to be able to reconnect a link, using the RelinkingTool, you need to set one or both of RelinkableFrom and RelinkableTo to true. The RelinkingTool shows a FromHandleArchetype and/or a ToHandleArchetype when the link is selected. Such a relink handle can be dragged by the user to start a relinking operation.

If you want the user to be able to change the path of the link, using the LinkReshapingTool, set Reshapable to true. The LinkReshapingTool shows reshape handles that the user can drag to shift the position of a point in the link's route. The HandleArchetype is copied for each reshape handle.

Often if a Link is reshapable, you will want to save the route in the model so that it can be restored upon load. To save the route automatically, add a TwoWay Binding on the Points property: new Binding("Points").MakeTwoWay().

If a Link is Reshapable, it is also possible to allow the user to add and remove segments from the link's route by setting Resegmentable to true. This causes the LinkReshapingTool to add resegmenting handles at the midpoints of each segment. The MidHandleArchetype is copied for each resegment handle. When the user drags such a resegmenting handle, a new segment is inserted into the route. Also, when the user drags a reshape handle such that two adjacent segments end up in a straight line, a segment is removed from the route.

For more discussion and examples, see Links, Link Labels, and Link Points.

To control what links a user may draw or reconnect, please read about Validation.

To customize linking and relinking behavior, please read Introduction to the Linking Tools and Introduction to the RelinkingTool. For customizing the reshaping of Links, see Introduction to the LinkReshapingTool.

Only Links that are in Diagrams can have connections with Nodes. Templates should not be connected with Nodes, be members of Groups, or have any Adornments.

Constructors

Constructs an empty link that does not connect any nodes. If you want the link to be seen, you must provide a Shape as an element to be used as the visual path for the link.

Declaration
public Link()

Properties

Gets or sets how the route is computed, including whether it uses the points of its old route to determine the new route.

Declaration
public LinkAdjusting Adjusting { get; set; }
Property Value
Type Description
LinkAdjusting

The value must be one of None, End, Scale, or Stretch.

The default value is None -- the route is completely recalculated each time.

Gets or sets how rounded the corners are for adjacent line segments when the Curve is None, JumpGap, or JumpOver and the two line segments are orthogonal to each other.

Declaration
public double Corner { get; set; }
Property Value
Type Description
double

The default value is zero -- there is no curve at a corner.

Gets or sets the way the path is generated from the route's points.

Declaration
public LinkCurve Curve { get; set; }
Property Value
Type Description
LinkCurve

The value must be one of None, Bezier, JumpGap, or JumpOver.

Setting this property to JumpOver or JumpGap requires the Diagram to do considerable computation when calculating Link routes. Consider not using a Jump... value with Diagrams that contain large numbers of Links if you are targeting slow devices.

The default value is None -- each link segment is a straight line.

Gets or sets how far the control points are offset when the Curve is Bezier or when there are multiple links between the same two ports.

Declaration
public double Curviness { get; set; }
Property Value
Type Description
double

The default value is NaN -- the actual curviness is computed based on how many links connect the same pair of ports.

Gets or sets the length of the first segment, when the computed "from spot" at the FromPort is not None.

Declaration
public override double FromEndSegmentLength { get; set; }
Property Value
Type Description
double
Overrides

The default value is NaN, meaning that the value actually comes from the FromEndSegmentLength property of the FromPort. This value also limits how short the FromShortLength may be drawn.

For examples of how to use this property, see Link Connection Points.

Gets or sets the Node that this link comes from.

Declaration
public Node FromNode { get; set; }
Property Value
Type Description
Node

The FromPortId specifies which port the link comes from. The default value is null -- this link is not coming from any node.

A template should not be connected with any node.

This read-only property returns a GraphObject that is the "from" port that this link is connected from.

Declaration
public GraphObject FromPort { get; }
Property Value
Type Description
GraphObject

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.

Declaration
public Action<Link, GraphObject, GraphObject> FromPortChanged { get; set; }
Property Value
Type Description
Action<Link, GraphObject, GraphObject>

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.

If the value is a function, that function must not modify which nodes or links this link connects with. The "from" node and/or port has already been changed -- trying to change it again may produce undefined behavior.

The default value is null -- no function is called.

Gets or sets the identifier of the port that this link comes from.

Declaration
public string FromPortId { get; set; }
Property Value
Type Description
string

The default value is the empty string.

Gets or sets how far the end segment stops short of the actual port.

Declaration
public override double FromShortLength { get; set; }
Property Value
Type Description
double
Overrides

Positive values are limited by the FromEndSegmentLength or FromEndSegmentLength. Negative values cause the link to extend into the port. The default value is NaN -- the value actually comes from the FromShortLength property of the FromPort.

For examples of how to use this property, see Link Connection Points. If you want to move an arrowhead away from the start of the link route, set the arrowhead Shape's SegmentOffset.

Gets or sets where this link should connect at the FromPort.

Declaration
public Spot FromSpot { get; set; }
Property Value
Type Description
Spot

The default value is Default, meaning that the value actually comes from the FromSpot property of the FromPort.

This property is set by some layouts, if SetsPortSpot(s) or SetsChildPortSpot is true.

For examples of how to use this property, see Link Connection Points.

This read-only property returns the Geometry that is used by the Path, the link Shape based on the route points.

Declaration
public Geometry Geometry { get; }
Property Value
Type Description
Geometry

This geometry is automatically generated using the route points and other properties such as the Curve. The points of the Geometry are in local coordinates, whereas the Points of the link route are in document coordinates.

More than one Shape may share this geometry as its Geometry, if there is more than one shape element in the Link with IsPanelMain set to true.

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.

Declaration
public bool IsLabeledLink { get; }
Property Value
Type Description
bool

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.

Declaration
public bool IsOrthogonal { get; }
Property Value
Type Description
bool

This property is completely dependent on the Routing property. Values of Orthogonal and AvoidsNodes causes this property to be true.

The points in the route might not actually form an orthogonal route, but when the route is computed the intent is to maintain orthogonality.

Gets or sets whether this Link is part of the tree for tree operations such as FindTreeChildrenNodes() or CollapseTree(int).

Declaration
public bool IsTreeLink { get; set; }
Property Value
Type Description
bool

The initial value is true.

This read-only property returns the Links's Model data key if it is in a Diagram and is backed by Model data, otherwise this returns null.

Declaration
public override object Key { get; }
Property Value
Type Description
object
Overrides

If the link data is in a GraphLinksModel, the LinkKeyProperty must not be an empty string.

This read-only property returns an iterator over the Nodes that act as labels on this Link.

Declaration
public IReadOnlyCollection<Node> LabelNodes { get; }
Property Value
Type Description
IReadOnlyCollection<Node>

Setting LabeledLink to refer to this Link will add that Node to this collection.

Do not confuse these Nodes with the GraphObjects that are part of this Link Panel. Those objects can also be used as "labels", but not as objects to which there can be link connections, because those panel elements cannot be Nodes. Those panel objects can be used for other purposes too, such as arrowheads.

A template should not have any label nodes.

This read-only property returns the angle of the path at the MidPoint.

Declaration
public double MidAngle { get; }
Property Value
Type Description
double

This read-only property returns the point at the middle of the path, in document coordinates.

Declaration
public Point MidPoint { get; }
Property Value
Type Description
Point

This read-only property returns the main Shape representing the path of this Link.

Declaration
public Shape Path { get; }
Property Value
Type Description
Shape

The value depends on there being an element in this Link that is a Shape and that has IsPanelMain set to true. This shape is what displays the stroke going from one node to another node.

This path shape's geometry is automatically generated based on the Points of this link's route, depending on other properties such as Curve. Note that the points are in document coordinates, but the path's Geometry will have points that are in local Shape coordinates. This Shape's Scale should be one and Angle should be zero.

If there is no Shape with IsPanelMain set to true, the Link will use the first Shape for its path.

Gets or sets the list of Points in the route.

Declaration
public IList<Point> Points { get; set; }
Property Value
Type Description
IList<Point>

All of the Points must be 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.

The setter also accepts an Array of alternating X,Y point values [1, 2, 3, 4, 5, 6], or an Array of Objects each of which has (lowercase) "x" and "y" properties that are numbers [{"x":1,"y":2}, {"x":3,"y":4}, {"x":5,"y":6}].

Ownership of the list and all of its Points that is provided to the setter is transferred to this Link.

This read-only property returns the number of points in the route.

Declaration
public int PointsCount { get; }
Property Value
Type Description
int

Gets or sets whether the user may reconnect an existing link at the "from" end.

Declaration
public bool RelinkableFrom { get; set; }
Property Value
Type Description
bool

This affects the behavior of the RelinkingTool.

The initial value is false.

Gets or sets whether the user may reconnect an existing link at the "to" end.

Declaration
public bool RelinkableTo { get; set; }
Property Value
Type Description
bool

This affects the behavior of the RelinkingTool.

The initial value is false.

Gets or sets whether the user may change the number of segments in this Link, if the link has straight segments.

Declaration
public bool Resegmentable { get; set; }
Property Value
Type Description
bool

This affects the behavior of the LinkReshapingTool when Curve is not Bezier.

The initial value is false.

This read-only property returns the bounds of the link geometry in document coordinates.

Declaration
public Rect RouteBounds { get; }
Property Value
Type Description
Rect

Gets or sets whether the link's path tries to avoid other nodes.

Declaration
public LinkRouting Routing { get; set; }
Property Value
Type Description
LinkRouting

The value must be one of Normal, Orthogonal, or AvoidsNodes.

Setting this property to AvoidsNodes requires the Diagram to do considerable computation when calculating Link routes. Consider not using the AvoidsNodes with Diagrams that contain large numbers of Nodes and Links if you are targeting slow devices. When using AvoidsNodes, dragging performance can be improved by setting IsComplexRoutingRealtime to false.

The default value is Normal -- the route is primarily a single straight segment, with possible short end segments when connecting with ports that have a "spot" value as the FromSpot or FromSpot or ToSpot or ToSpot.

Gets or sets how far the control points are from the points of the route when Routing is Orthogonal and Curve is Bezier.

Declaration
public double Smoothness { get; set; }
Property Value
Type Description
double

The default value is 0.5. Values of this property typically fall in the range of 0.0 to 1.0. A value of 0.0 indicates that the control points of the curve are at the end points, which will result in straight line segments. A value of 1.0 indicates that the control points are one-third of the link's length away from the end point along the direction of the link, and the same distance away in a perpendicular direction. The distance scales linearly with the value of this property, even with negative values and values greater than 1.0.

Gets or sets the length of the last segment.

Declaration
public override double ToEndSegmentLength { get; set; }
Property Value
Type Description
double
Overrides

The default value is NaN, meaning that the value actually comes from the ToEndSegmentLength property of the ToPort. This value also limits how short the ToShortLength may be drawn.

For examples of how to use this property, see Link Connection Points.

Gets or sets the Node that this link goes to.

Declaration
public Node ToNode { get; set; }
Property Value
Type Description
Node

The ToPortId specifies which port the link goes to. The default value is null -- this link is not going to any node.

A template should not be connected with any node.

This read-only property returns a GraphObject that is the "to" port that this link is connected to.

Declaration
public GraphObject ToPort { get; }
Property Value
Type Description
GraphObject

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.

Declaration
public Action<Link, GraphObject, GraphObject> ToPortChanged { get; set; }
Property Value
Type Description
Action<Link, GraphObject, GraphObject>

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.

If the value is a function, that function must not modify which nodes or links this link connects with. The "to" node and/or port has already been changed -- trying to change it again may produce undefined behavior.

The default value is null -- no function is called.

Gets or sets the identifier of the port that this link goes to.

Declaration
public string ToPortId { get; set; }
Property Value
Type Description
string

The default value is the empty string.

Gets or sets how far the end segment stops short of the actual port.

Declaration
public override double ToShortLength { get; set; }
Property Value
Type Description
double
Overrides

Positive values are limited by the ToEndSegmentLength or ToEndSegmentLength. Negative values cause the link to extend into the port. The default value is NaN -- the value actually comes from the ToShortLength property of the ToPort.

For examples of how to use this property, see Link Connection Points. If you want to move an arrowhead away from the end of the link route, set the arrowhead Shape's SegmentOffset.

Gets or sets where this link should connect at the ToPort.

Declaration
public override Spot ToSpot { get; set; }
Property Value
Type Description
Spot
Overrides

The default value is Default, meaning that the value actually comes from the ToSpot property of the ToPort.

This property is set by some layouts, if SetsPortSpot(s) or SetsChildPortSpot is true.

For examples of how to use this property, see Link Connection Points.

Methods

Add a point at the end of the route; this may only be called within an override of ComputePoints().

Declaration
public void AddPoint(Point p)
Parameters
Type Name Description
Point p

The new point in document coordinates, which should not have infinite or NaN coordinate values, and which must not be modified afterwards.

This predicate returns true if RelinkableFrom is true, if the layer's AllowRelink is true, and if the diagram's AllowRelink is true.

Declaration
public virtual bool CanRelinkFrom()
Returns
Type Description
bool

true if the user may relink the From end of this link.

This does not check IsReadOnly or IsReadOnly, but commands and tools should check those properties.

This predicate returns true if RelinkableTo is true, if the layer's AllowRelink is true, and if the diagram's AllowRelink is true.

Declaration
public virtual bool CanRelinkTo()
Returns
Type Description
bool

true if the user may relink the To end of this link.

This does not check IsReadOnly or IsReadOnly, but commands and tools should check those properties.

Remove all of the points from this link's route; this may only be called within an override of ComputePoints().

Declaration
public void ClearPoints()

Returns the Adjusting value, unless this Link's Diagram is animating and the routing is AvoidsNodes -- then it will return End.

Declaration
public virtual LinkAdjusting ComputeAdjusting()
Returns
Type Description
LinkAdjusting

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Returns the Curve, unless this link is supposed to pretend to be curved, as with reflexive links.

Declaration
public virtual LinkCurve ComputeCurve()
Returns
Type Description
LinkCurve

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

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.

Declaration
public virtual double ComputeCurviness()
Returns
Type Description
double

must be a real number, not NaN or infinity

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Get the length of the end segment in document coordinates, typically a short distance, in document units.

Declaration
public virtual double ComputeEndSegmentLength(Node node, GraphObject port, Spot spot, bool from)
Parameters
Type Name Description
Node node
GraphObject port

the GraphObject representing a port on the node.

Spot spot

a Spot value describing where the link should connect.

bool from

true if the link is coming out of the port; false if going to the port.

Returns
Type Description
double

a distance in document coordinates; must be a real number, not NaN or infinity.

For spot values that are 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 FromEndSegmentLength or the ToPort's ToEndSegmentLength.

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Compute the minimum length of a JumpOver or JumpGap.

Declaration
protected virtual double ComputeJumpLength()
Returns
Type Description
double

By default, this method just returns 10.

Find the approximate point of the other end of the link in document coordinates.

Declaration
public virtual Point ComputeOtherPoint(Node othernode, GraphObject otherport)
Parameters
Type Name Description
Node othernode
GraphObject otherport
Returns
Type Description
Point

approximately where the other end of this link might end, 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.

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Constructs a new route by modifying the Points.

Declaration
public virtual bool ComputePoints()
Returns
Type Description
bool

true if it computed a route of points

This is only called by UpdateRoute(), when needed. All route points are always in document coordinates.

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Overrides of this method may call a number of "protected" methods in order to build the route: ClearPoints(), AddPoint(Point), InsertPoint(int, Point), RemovePoint(int), SetPoint(int, Point). Overrides of this method must not set Points.

Other methods that are commonly called and may be overridden are: ComputeEndSegmentLength(Node, GraphObject, Spot, bool), ComputeSpot(bool, GraphObject), ComputeOtherPoint(Node, GraphObject), ComputeCurve(), ComputeCurviness(), HasCurviness(), ComputeThickness(), MakeGeometry().

Returns the expected spacing between this link and others that connect this link's fromPort and toPort.

Declaration
public virtual double ComputeSpacing()
Returns
Type Description
double

must be a real number, not NaN or infinity

This calls ComputeThickness() and also takes any "mid label""s breadth into account.

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Get the Spot that describes how the end of the link should connect with the port.

Declaration
public virtual Spot ComputeSpot(bool from, GraphObject port = null)
Parameters
Type Name Description
bool from
GraphObject port
Returns
Type Description
Spot

must not be Default, but may be None

Depending on the from argument, this will return FromSpot or ToSpot. If the value is IsDefault(), this will return the FromPort's FromSpot or the ToPort's ToSpot.

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Returns the thickness of this link.

Declaration
public virtual double ComputeThickness()
Returns
Type Description
double

a non-negative real number

By default it uses the strokeWidth of the main element, assuming it's a Shape. This is called by ComputeSpacing().

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Find the index of the segment that is closest to a given point.

Declaration
public double FindClosestSegment(Point p)
Parameters
Type Name Description
Point p

the Point, in document coordinates.

Returns
Type Description
double

int the index of the segment, from zero to the number of points minus 2.

This assumes the route only has straight line segments. It ignores any jump-overs or jump-gaps.

Compute the direction in which a link should go from a given connection point.

Declaration
public virtual int GetLinkDirection(Node node, GraphObject port, Point linkpoint, Spot spot, bool from, bool ortho, Node othernode, GraphObject otherport)
Parameters
Type Name Description
Node node
GraphObject port

the GraphObject representing a port on the node.

Point linkpoint

the connection point, in document coordinates.

Spot spot

a Spot value describing where the link should connect.

bool from

true if the link is coming out of the port; false if going to the port.

bool ortho

whether the link should have orthogonal segments.

Node othernode

the node at the other end of the link.

GraphObject otherport

the GraphObject port at the other end of the link.

Returns
Type Description
int

the absolute angle, in degrees.

Compute the point on a node/port in document coordinates at which the route of a link should end.

Declaration
public virtual Point GetLinkPoint(Node node, GraphObject port, Spot spot, bool from, bool ortho, Node othernode, GraphObject otherport)
Parameters
Type Name Description
Node node
GraphObject port

port the GraphObject representing a port on the node.

Spot spot

a Spot value describing where the link should connect.

bool from

true if the link is coming out of the port; false if going to the port.

bool ortho

whether the link should have orthogonal segments.

Node othernode

the node at the other end of the link.

GraphObject otherport

the GraphObject port at the other end of the link.

Returns
Type Description
Point

in document coordinates.

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.

Declaration
public virtual Point GetLinkPointFromPoint(Node node, GraphObject port, Point focus, Point p, bool from)
Parameters
Type Name Description
Node node
GraphObject port

port the GraphObject representing a port on the node.

Point focus

the point in document coordinates to/from which the link should point, normally the center of the port.

Point p

often this point is far away from the node, to give a general direction, particularly an orthogonal one.

bool from

true if the link is coming out of the port; false if going to the port.

Returns
Type Description
Point

the point in document coordinates of the intersection point on the edge of the port.

Given a Node, return the node at the other end of this link.

Declaration
public Node GetOtherNode(Node node)
Parameters
Type Name Description
Node node
Returns
Type Description
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.

Declaration
public GraphObject GetOtherPort(GraphObject port)
Parameters
Type Name Description
GraphObject port
Returns
Type Description
GraphObject

This may return the same object, if the link is reflexive.

Gets a particular point of the route.

Declaration
public Point GetPoint(int i)
Parameters
Type Name Description
int i

The zero-based index of the desired point.

Returns
Type Description
Point

in document coordinates

Returns true if an extra or a different point is needed based on Curviness.

Declaration
public virtual bool HasCurviness()
Returns
Type Description
bool

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

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().

Declaration
public void InsertPoint(int i, Point p)
Parameters
Type Name Description
int i

The zero-based index of the new point.

Point p

The new point in document coordinates, which should not have infinite or NaN coordinate values, and which must not be modified afterwards.

Declare that the route (the Points) of this Link need to be recomputed soon.

Declaration
public void InvalidateRoute()

This causes UpdateRoute() to be called, which will call ComputePoints() to perform the actual determination of the route.

Produce a Geometry given the points of this route, depending on the value of Curve and Corner and perhaps other properties.

Declaration
public virtual Geometry MakeGeometry()
Returns
Type Description
Geometry

The points of the Geometry are in local coordinates, whereas the Points of the link route are in document coordinates.

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

Move this link to a new position. This also shifts all of the Points in the route accordingly. This also moves any LabelNodes.

Declaration
public override void Move(Point newpos, bool useLocation = false)
Parameters
Type Name Description
Point newpos

a new Point in document coordinates.

bool useLocation

true if you want to set the Location instead of the position. False by default.

Overrides

Remove a particular point from the route; this may only be called within an override of ComputePoints().

Declaration
public void RemovePoint(int i)
Parameters
Type Name Description
int i

The zero-based index of the point to extract.

Sets a particular point of the route; this may only be called within an override of ComputePoints().

Declaration
public void SetPoint(int i, Point p)
Parameters
Type Name Description
int i

The zero-based index of the desired point.

Point p

The new point in document coordinates, which should not have infinite or NaN coordinate values, and which must not be modified afterwards.

This method recomputes the route if the route is invalid, to make sure the Points are up-to-date.

Declaration
public void UpdateRoute()

This method calls ComputePoints() in order to calculate a new route.

The route may become invalid if either connected node is moved, or if various properties are modified, such as Routing. Such changes will call InvalidateRoute().

It is unusual for you to have to call this method.

Implements