Routes are not retaining after reshaping it manually

Hi, we are facing an issue with links reshaping below are the steps:

  1. As we draw a link from Node A to Node B that links route (Points) sets automatically.
  2. Now, I am Reshaping or moving it using it’s adornments after reshaping I try to move, any of the connected node from the same link.
  3. As I move any connected node, the link start reshaping from the route which was set automatically (route which was set for the very first time when I’ve drawn that link) rather start reshaping from what I’ve set after link drawn using adornments (step 2).

I’ve checked it into your demo application. it’s happening there too. Do we have some event or technique to save these updated routes what user is setting using adornments.

Thanks

You could try setting Route.Adjusting to “End” or LinkAdjusting.End.

I think if I set Route.Adjusting to End I wouldn’t be able to change the link shape later.

Rather what I want is to keep the same shape even after I move the nodes or copy paste.
It should only alter when I do it so using the adornments.

is it possible to do so ?

I do not understand what you want. Some small screenshots/sketches would help.

It sounds as if you do not want the route to be recomputed when a connected node is moved, although perhaps only after the user has manually reshaped the route. If you implemented that, there would be an arbitrarily large gap between the end of the route and the position of the port.

Here are some screenshots:
Step 1: I draw nodes and links like this

Step 2: I reshape the link as below:

Step 3: And I move the top node a little bit and as soon as I move the link Route got reset and it lost all the changes that I had done for the link.

I want the link to be as in the second drawing even after the top node ( in this case) is moved. and it should change only when I opt to change the link shape/route.

This reset happens during Copy-Paste as well.

The purpose of Adjusting="End" is to provide that behavior while still maintaining the end points to keep the link in contact with both ports. By your screenshot you really do not want the link end points to touch their ports.

That is a very unusual request. I cannot recall anyone ever asking for that kind of functionality. Maybe you could implement that by setting Adjusting="End" and overriding Route.AdjustPoints to do nothing after the user has reshaped the route. That would also mean overriding LinkReshapingTool.DoReshape to set a flag recording the fact that the route had been reshaped.

I guess there is some confusion.

What I want is not the link touching the ports. Rather it was about the shape of the link. I have corrected the above image. Hope its clear now.

I tried using Adjusting=End but in this case I have to make LinkRouting as Orthogonal which also means I have to compromise the AvoidNodes feature. Actually I want to have both the features.

i.e. I don’t want the links to be reshaped when I copy-paste and also it should avoid nodes.

Any possibilities ?

I don’t think that feature is achievable now in GoXam. Basically, Routing==AvoidsNodes always takes precedence over Adjusting in computing the route. Sorry.

Hmm, upon further thought, perhaps overriding Route.ModifyEndPoints could do what you want. Basically you could check whether the current route crosses over any nodes – if so, return false, otherwise return true.

Just a thought about the implementation. I draw 2 nodes and the links as shown in the above diagram and I reroute the link as shown in the second image and when I copy the nodes and the links ( using rubberband Zoom) and I paste the copied link isn’t rerouting but the pasted link will get rerouted.

Can I replace the Route points of the pasted link with the ones of the coped links before the paste is happening ?
When exactly does the route gets reset to default ? Is it before the paste event or after the paste event ?

Thanks !!

After the paste, the Node and its elements are remeasured and rearranged, as must happen with all FrameworkElements, causing the node to invalidate the routes of connected links. And the elements of those new Links have to be measured and arranged too.

Can I avoid rearrangement and remeasuring while it is pasted ?

No, that is a fundamental part of the WPF architecture. However there might be a way to reset the route(s) in a Diagram.LayoutCompleted event handler, which is called after everything has settled down. Maybe one could override CommandHandler.CopyToClipboard to remember routes and CommandHandler.PasteFromClipboard to establish a Diagram.LayoutCompleted event handler to restore the routes and also unregister itself.