Link splitting


#1

Hello,
I am trying to develop a functionality for creating ‘link intersections’. I have made this: when the user drags a link over an existing one, I insert a connection-port in the document, in the position the user clicked, and try to split the existing link into 2 smaller links:
IGoPort iprOriginalToPort = originalLink.ToPort;
originalLink.ToPort = connection_port;
view.CreateLink(connection_port, iprOriginalToPort);
This works fine, the only problem is that the new resulting links, have the arraypoints recomputed. That is it is likely that the newly resulted links do not follow the path of the original link. Sometimes they do, sometimes the don’t… depending on how, the strokes are computed.
Is there an easy way to make this splitting, or I have to manually handle the PointArray of the orginal link, to split it and re-apply it to the smaller links?
Thank you in advance
Mihai


#2

Yes, you need to remember the set of points before modifying the original link, figure out which points you want to use for each link afterwards, and finally set all those points on each link after you have finished setting the ports and making any other modifications that would call GoLink.CalculateStroke.