Hi Stoyo,
We are having a side effect when creating links which we can not seem to get around.
In the diagram that the user creates it is possible for a link to have the same shapenode for its origin, as well as its destination node, just with different anchor points.
A link is programmatically created and given the location of the anchor points, as well as some control points.
In the following screenshot, the "swirly link" was created with the following control points:
1) Create the link:
DiagramLink Edge = new DiagramLink(DiagramView.Diagram, GetShapeByNodeId(WfEdge.SourceNodeId), GetShapeByNodeId(WfEdge.TargetNodeId));
In this case the GetShapeByNodeId returns the same shape for both origin and destination shapes.
2)
Edge.OriginAnchor is set to 3.
Edge.DestinationAnchor is set to 0.
3)
At this point there are already control points in the link, and since we want to specify our own we clear the collection.
Edge.ControlPoints.Clear();
4)
All 5 control points are added using the Edge.ControlPoints.Add(PointF); method, with the following coordinates:
[150-311]
[135-311]
[134-271]
[200-271]
[200-286]
5)
After altering the control points we call UpdateFromPoints();.
6)
To finalize, we set the Edge.SegmentCount to Edge.ControlPoints.Count() - 1.
After 6, the control points collection now has 13 items instead of 5. Also, as you can see in this screenshot..
.. the link is not connected to the specified anchor points. At least, visually, because the OriginAnchor and DestinationAnchor are still set to the correct values of 3 and 0 respectively.
What I would like to see, is this (edited image):
Basically all my links behave like I want to (including anchors and control points), only the links where the origin and destination shapenode is the same this issue is occuring.
How can we get to a result as shown in the second image?
Kind regards,
Bas