A node based on GoIconicNode can have zero inbound links and at most one outbound link. I want to flip the image N, S, E, or W, depending upon from which of those directions the link emanates. What change event should I catch, and what method or property is best to use to determine current link direction?
Probably you want to override GoPort.OnLinkChanged. You can examine the position of the object that is the result of link.GetOtherPort(this).
Do you already have code for rotating GoImages?
I thought I would simply maintain 4 separate images, since this only applies to one specific node type and image.
I thought perhaps, since the link can emanate from only those 4 points on the port, that there may have been state kept somewhere indicating which of those points was current. I assume you’re saying that I should calculate the angle of the link and test something like if -45 < angle <= 45, then point is North, etc.? I had thought this might be error prone since I do not know exactly how GoDiagram makes the determination.
Sorry, I didn’t understand your intent. Yes, you could just look at the first (or last) point of the stroke to decide which side of the port the link is connected at.
That point is actually the value returned by GoPort.GetFromLinkPoint or GetToLinkPoint, which is what GoLink.CalculateStroke calls to figure out where to end the link’s stroke.
Thank you for the assistance, the calculation works well now. I’m unable to get the iconic node’s image to change however. I’m using node.CreateIcon(imageList, imageIndex); Is it necessary to destroy the node, and recreate the node and links, in order to change the image?
No, you should just have to set the GoImage.Index property. (And the ImageList property, if you need to.)