GoBoxNode with maximum 4 links

Hi walter,

we are using here the version, and I would like to implement a GoBoxNode object, that can receive at most 4 links and each link should be alone on its side.
I know, that the GoBoxNode uses 4 GoBoxPorts, but I would like to enforce the autolayout to get the best autolinking in order to put each link to an edge and still look reasonable, not scrambled..
thank you very much for your support

GoBoxNode just uses 1 GoBoxPort, and it overrides GetFromLinkPoint / GetToLinkPoint and GetFromLinkDir / GetToLinkDir, etc to make the port connect on the side closest to the other end of the link.

What layout are you using? Note that TreeLayout has SetPortSpots...

To improve the tree layout of single-port nodes such as GoBasicNode and GoIconicNode, the GoLayoutTree.SetPortSpots method sets the values of GoPort.FromSpot and GoPort.ToSpot to force links to come out or go into the ports in certain directions at certain locations, according to the GoLayoutTree.Angle.

Hi again,

I am not using any kind of layout, I would like to prevent this from happening (following picture) :
The circled parts are Ports derived from GoBoxPort and am evaluating the possibility of changing those ports with GoBoxNode.. but anyway, for the moment I am trying to get it to work in a nice way, that is.. each link on the correct side.

I think you want something more like GoTextNode that has 4 explicit ports, one on each edge. You’ll have to write some code to manage where the connections go. Implement CanLinkTo and CanLinkFrom in your port class to only allow 1 connection per port. (See ActivityPort in the Processor Sample)