Layers and Connected Nodes

I’ve got different layers and nodes with links.
If I set a special option in a link it is moved to a special layer (other than the default layer, but it’s never one of the same layers the nodes could be on).
If I reset the special option to the default value, the link gets copied back to the layer it has been before. But then the nodes are no longer connected correctly. I may move all nodes connected to the links and the link stays just right in place.

Again short:

I’ve got nodes on layers (node-layers).
And Links on other layers (link-layers).

Copying a link to another links-layers and then copy it back to the link-layer it has been on before, the links are no longer connected correctly.

What will I have to do?

Internal reconnection after doing this (i.e. searching the nodes and the correct ports and recreate the link) didn’t work.

Please help.

How do you change the link’s layer? If you first Remove it from its layer and then Add it to the other layer, I can see that trying to reset its ports doesn’t seem to work.
My first suggestion is not to Remove the link from its layer, but just directly do the Add, so that it can change the layer, or “transfer” it, without having to do the OnLayerChanged side effects of disconnecting the link from its ports.
My second suggestion, if you cannot do the first one, is to set the link’s FromPort and ToPort to null before resetting them to the desired (original) ports.

Just adding the links to another layer is exactly what I did first. Didn’t work. Don’t know why. Added by

LinkLayer.Add(link). Then Added to SpecialLinkLayer.Add(link). And then again added to LinkLayer.Add(link).

But then the ports could not be correctly reset neither by me, nor by my program.



Sorry, I guess, that wouldn’t help.

I will do a more thorough research and repost the results here.

Ok, found it. There was a sort of 2nd “hidden” remove.

This created the effect to not recorrect the links correctly by adding them to another layer.



Did it. :-)