Insert point to link in LinkTool

Hi walter, now i am customizing link tools. I want to insert points to the link while dragging the connection from one node to another. I thought i had to call myLink.RealLink.InsertPoint(…) when user presses . The point is inserted correctly but right after that deleted by GoLink.CalculateStroke(). Do you have any idea how i can do it instead?
PolygonDrawingTool of your demo sample did not help. With polygon class it is working.

RoutingLinkTool in Demo1 might be instructive.

Hi jzifu,

maybe this is helpful:

Every link has a “AdjustingStyle” property.
This property specifies how CalculateStroke should determine the points of the link’s stroke.

The default is “Calculate” (I think so) and that say that the connection is recalculate and the inserted points are deleted.

Maybe AdjustingStyle = GoLinkAdjustingStyle.End is helpful.


Setting AdjustingStyle did not change anything. But thank you very much for your idea, Asterix.

Walter, i examined RoutingLinkTool and it behaves exactly like i need it. Unfortunately RoutingLinkTool is based on GoTool and not on GoToolLinking. And if i want to replace linking tools with a kind of RoutingLinkTool i have to reimplement GoToolLinking. On the other hand i could extend GoToolLinkingNew and GoToolRelinking. But it will be quite inconsistent to use a GoStroke instead of a temporary link. So, suspended for near future :-( Or do you have any idea if i can change my link that InsertPoint works in linking mode?

GoLink inherits from GoStroke, so you can use your link class if you want instead of GoStroke as that tool does. Or if you are using GoLabeledLinks, you can just refer to the GoLabeledLink.RealLink.
GoToolLinkingNew is meant to be used as a modeless tool, not as a modal one. RoutingLinkTool was meant to be an example of a modal tool. I’m confident that the two could be merged.

Although RoutingLinkTool allows to insert points while dragging the connection from one node to the other, i would like to use a GoToolLinkingNew and GoToolRelinking. These classes are containing everything for linking (PortGravity, allow or deny link…) and i “just” need to extend it.

So i did some testing: My derived link tools are working fine, if i use my SankeyLink-class (derived from GoLink) or a GoLink. When i press while dragging the connection, points where added. When i use a GoLabeledLink or my NetEdgeSankey (derived from GoLabeledLink) adding points lead to strange behaviour. The inserted points are near the y-Axis through the FromNode and not under the mouse point. Walter, do you have any idea whats going wrong with GoLabeledLink and NetEdgeSankey?

That’s a neat idea–using the SPACE key to mark points to add.
Isn’t your code the same in either case, except that if it’s a labeled link, you add points to the GoLabeledLink.RealLink instead?

Yes it is the same. Just myView.NewLinkClass is set to a different class and different type cast in myLinkTool.DoKeyDown.

I just wrote a minimal app to test adding points to GoLabeledLink and GoLink. It works. So i am going to have a closer look at the class i inherited from GoLabeledLink…