GoLinks - how to serialize manually?


When a link is created between two nodes the user can move the line that is the link.

What I would like to know is what would be the recommended way that I could record/traverse the resulting line positioning and possible segments - when I save the diagram in my own format.

Or put another way, I wish to save the line data in my own format and then resupply to Go Diagram when deserialized so that the diagram with the users’ modifications to the line positioning is retained.

Many thanks

The basic idea is that you need to save the set of points that the link (a GoStroke) has, and then restore them when loading.
You can get an array of PointFs by calling GoLink.CopyPointsArray().
You can set the points by calling GoLink.SetPoints. But you should do so after setting the other link properties which might result in a call to CalculateStroke(), which will likely throw away the points and determine its own standard path. That means after setting GoLink.FromPort, ToPort, Orthogonal, AvoidsNodes, and maybe some other properties, and also after having moved both ports to their final positions.
There are a couple of examples of this in the sample applications: Processor and OrgCharter/GraphML.

Great many thanks Walter