Adding top and Bottom Ports

We have subclassed GoGeneralNode and added our functionality. We are using logic very similar to AutoLinkingPort example to dynamically create ports. I would like to know how to compute conveniently ports on the top and bottom of the node.
We have convenience methods on Node for AddLeftPort(…) and AddRightPort(…). When the # of ports on left and right reach a threshold I would like to start adding ports on the top and bottom of the node.
Is there an easy way to do it, than computing the relative positon from the X-Y co-ordinates and doing it?
Thanks,
Prasad Muppirala

It’s probably better to override LayoutChildren, so that no matter why or when, the ports will be positioned at the appropriate place. For example, GoGroup.LayoutChildren will be called whenever any child (such as the Icon) is resized, or whenever any child is Added to or Removed from the group.
The SequencedNode example class from Demo1 demonstrates doing this for a single port at the top and a single port at the bottom.