Group: Forum Members
Last Active: 14 Years Ago
Posts: 4,
Visits: 1
|
I have a large set of shapes. I want to allow the user to cancel the layout if they don't want to wait anymore. Can you please suggest the best way to go about this.
I have been using the NOrthogonalGraphLayout as follows:
NOrthogonalGraphLayout layout = new NOrthogonalGraphLayout(); layout.MultiThreaded = true; NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); NLayoutContext layoutContext = new NLayoutContext(); layoutContext.GraphAdapter = new NShapeGraphAdapter(); layoutContext.BodyAdapter = new NShapeBodyAdapter(document);
NDrawingBodyContainerAdapter adapter = new NDrawingBodyContainerAdapter(document); layoutContext.BodyContainerAdapter = adapter; layout.Layout(shapes, layoutContext);
I have tried subscribing to the LayingOutGraph event, so that I could set the cancel argument, but it only seems to fire once. I also tried calling the layout routine in another thread, however that had a cross-thread problem accessing the view.
Also, is there a way to show a progress UI during the layout?
Thanks.
|