Layout Children

Hi,

When creating a composite node, what are the conventions for setting the size of the node and the calculating the size of the child nodes. I have a GoTextNode dervied class which can has 4 decorators. the decorators are visible depending on the value of a user controlled variable. The decorators are a GoNode derived class which contain a GoRectangle and a GoTriangle. The triangle has to point in different directions depending on the side its on.
I’m currently setting the decorator to an initial size of 0,0 i.e. hidden. Then when the user changes a property I change the size to 50,10 or 10,50 depending on the side they want it on. But my layout is screwed up. The decorator is always placed on the bottom and the bounds of the GotTextNode class get bigger.
Can someone give me some guidelines as to how I should approach this?

Regards,

Martin

The coordinate system is very simple – everything has “absolute” coordinates. This makes determining the relationship between objects trivial, since there are no “relative” coordinate transformations to make.
In LayoutChildren you do need to be careful that you are positioning/sizing child object relative to each other, and not to the group’s Bounds. The reason is that as you move children, the group’s Bounds may change, thereby changing where you think the group is.
However it’s common to get the group’s original Bounds, and then position everything based on that saved RectangleF. It’s getting the group Bounds after you have moved some children that can confuse your layout calculations.