Group layout initially draws nodes at origin

Hi,

I’m trying to layout some groups stacked as vertical swimlanes, then within those I have nodes laid out vertically downwards from the top. I’ve got my layout working, and that calculates the correct co-ordinates every time. I then have an option to “hide” a group, which collapses its subgraph and changes its dimensions so that it is very thin. Upon unhide I have to relayout my diagram in order to reposition swimlanes to the right of the group, however when I run the layout I initially see the new “unhidden” nodes in the top left of the graph, before they quickly reposition to the group’s location. This causes a strange jumping effect for my group.

I turned animation on in order to try to see what is happening, and it looks as though the nodes are moving from their old location, to where the group is initially positioned (in the top left), then the group is moving to its location after that. This would be fine, but I don’t want animation, I just want the nodes in the place I told them to be.

So I seem to be getting some intermediary steps of the layout process being drawn on the screen as it lays out (despite animations being off). Is there some way to delay any rendering taking effect until the entire layout has been calculated? It’s worth noting that the way I’m doing this is that there is a diagram layout that positions each group, and each group has a layout positioning its nodes within it. At the moment the only solution I have is to put a loading image in front of the diagram before a layout and hide it upon layout completion, however this causes the whole diagram to flicker if the layout is quick.

Thanks,
Will

So you have implemented a custom DiagramLayout for your Groups? If so, does it respect the value of DiagramLayout.ArrangementOrigin?

The Arrangement origin is left at 0,0 which seems fine to me, and that’s how the layout is assuming things are positioned. There is no problem with the actual layout, the nodes eventually get put in the correct place. The problem is that there appear to be some steps in between.

It’s as though turning off animation hasn’t actually done that, but has instead made the animation really fast. The result being 2 frames of animation, when I just want the last one. My current thinking is that I’m going to have to try implementing some insane form of double buffering where I capture the image of the diagram before the layout, then put that in front of the diagram while it lays out. Surely there must be an easier way than this?

I just tried modifying the SwimLanes sample to turn off animation. Each time there is a layout, I do not notice that any of the group member nodes move temporarily to be near the origin and then move to where they belong.

I also tried a long animation, and again the nodes in the lanes (other than the first lane) never go near the origin.

Hi Walter,

Apologies for the delay, I was called onto other work.

I wonder if the key difference here is that I’m performing the layout following a change to the IsSubGraphExpanded property of the group. The reason I have to do this is that upon changing this, the size of the group changes and needs to push other groups across. Might this be causing the issue? I will try to put a sample together to reproduce this behaviour.

Regards,
Will

Hi Walter,

I have extracted out my code into a sample app that recreates this behaviour, however it contains code I cannot publish publicly. Is there an email address I can send this app to?

Thanks,
Will

Sure, GoXam at our nwoods.com domain.

Thanks Walter,

I’ve sent an email with the project, let me know if you don’t receive it.

Regards,
Will

Hi Walter,

Thanks for your reply, I have implemented the change to the layout, which does reduce the jump, but I think the problem is that I am making things visible, while changing widths, and laying out the diagram, and these things are all trying to complete in quick succession. I settled on the solution to convert the control into a png and putting that as an image source in front of the diagram until the layout was completed (essentially implementing double buffering). It might be a nice feature for the future for GoXam to offer this built in, so that we could suspend visual updates until we’d done all the work, but for now this has resolved my issue.

I’ll now try and get a repro case for the link clipping.

Regards,
Will