SavedBounds


#1

I have many GoSubGraphs imbricated. When all are collapsed I must find the Positions of GoSubgraphs which a children like there a no collapse.
I don’t know what formula to apply. I read the documentation and that is not enough.

Please help.


#2

When a GoSubGraph is collapsed, you can look up the saved Size and saved relative Position of an immediate child. This information is kept in the SavedBounds hash table.


#3

I know that … I have teh parent colapsed and evidently all children is collapsed. I tried to find out the coordinates of children when this is colapsed ( like the this is not …I mean i want to obtain the coordintes like on expand situation of children) but I don’t obtain the same result. If you can tell an indication please tell me … I need the formule for obtain coordinates on expand when I am on collapse … please tell me more …



Thks


#4

Here’s the definition of GoSubGraph.ExpandChild:
protected virtual void ExpandChild(GoObject child, PointF hpos) {
if (child == this.CollapsedObject)
return; // don’t want to make Visible
if (child is GoLink || child is GoLabeledLink) {
GoStroke stroke = null;
if (child is GoLink)
stroke = (GoLink)child;
else
stroke = ((GoLabeledLink)child).RealLink;
if (this.SavedPaths.ContainsKey(stroke)) {
PointF[] vec = (PointF[])this.SavedPaths[stroke];
for (int i = 0; i < vec.Length; i++) {
PointF p = vec;
p.X += hpos.X;
p.Y += hpos.Y;
vec = p;
}
stroke.SetPoints(vec);
}
} else {
if (this.SavedBounds.ContainsKey(child)) {
RectangleF r = (RectangleF)this.SavedBounds[child];
child.Bounds = new RectangleF(hpos.X + r.X, hpos.Y + r.Y, r.Width, r.Height);
}
}
child.Visible = true;
}

As you can see, the SavedBounds hashtable contains the information you need. If you have nested subgraphs and you are interested in one of their children, I suppose you can figure that out by adding up the offsets recursively.


#5

Hi,



I understand very well the recursive mechanism.



But I have the next situation:

I have a GoSUbGraph parent and a GoSubGraph child.

The GosunGraph parent it is situated at top-left corner of the GoSubGraph parent when GoSUbGRaph parent it is expanded.

If I collapse the GoSubGraph parent the I read in SavedBound the coordinates of GoSubGRaph child I obtain the next values: ( 10.0, 0.0, some_width, some_height );



I don’t understand where are come 10.0 value from?

I don’t understand because this must be zero … and Y must be the height of handle of GoSubgraph parent …



GoSubGraph child is located under Handle of GoSunGraph parent and when I collapse the coordinates of GoSubGraph child are saved in SavedBound ( relative coodinates ) relative to the position of Handle of the GosubGraphParent?



Which meaning has PointF hpos in you example ?



Thaks …


#6

That “hpos” point is the result of a call to ComputeReferencePoint(). Normally this is just the GoSubGraph.Handle.Position.