Multiple Ports per GoBasicNode


Hey there… what would the best way be to put multiple ports onto one GoBasicNode… example if its shape is a rectangle… then have a port on each corner… how would i do this…?



It might be easiest to use GoTextNode, and override LayoutChildren to position each of its four ports to be at the corners instead of at the middle sides.
You’ll note that the GraphNode class in FlowCharter does a similar thing, adjusting the positions of ports when the shape is a parallelogram or a trapezoid.


do you know what the performance impact on using n ports on a single object?


also by multiple ports I ment {n} ports


GoTextNode doesn’t satisfy what I need… it only allows four ports… I need n (I may need 0 - 1000000000) - no jokes


never mind I figured it out


OK, I thought you just wanted a node with four ports.
I suggest a look at the MultiPortNode example class, which is derived from GoIconicNode. You can use a GoShape instead of the standard GoImage as the Icon. Call Initialize(null, null, …). You might not want to use all of the MultiPortNode class, particularly the use of MultiPortNodePort, which may have features you don’t care for.
I suppose you could do the same deriving from GoBasicNode, but I haven’t tried that.
Regarding performance–I don’t think you’ll be able to create a billion objects. Even creating a million top-level objects (depending on the complexity of each object) stresses the system, because that’s a fairly large operating system working set. But that can work, as our testing has verified.
But if you are careful to make sure LayoutChildren doesn’t have bad behavior when there are a lot of ports, you should be OK with thousands of ports on a node. To avoid N^2 layout behavior, make sure you make use of the GoObject.Initializing flag, to do the LayoutChildren work after you have added all the ports to the node.


Demo1 has some cool things in which will definetly utilise
Thanx for the help