Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ArcGIS Desktop API - check if rendering has finished

Tags:

c#

arcgis

I've recently inherited a large project in C#, which uses ArcGIS to render some area plans. People currently using it kept complaining about an extremely poor performance of the tool and it's my task now to make it faster.

When I first looked at the code, I was terrified. It was full of 30-60s sleeps System.Threading.Sleep(30000); after every call to gis api causing simple actions to take minutes.

After a bit of testing, it became clear that removing them caused sketches to be incompelte or full of artifacts, simply because the scene hasn't been fully rendered before performing next actions.

My question is simple. Is there a way to get the current status of ArcGIS rendered, so instead of waiting for the 'default' 30s, I can stop the tool only until ArcGis flags the current view as ready?

Thank you

Edit: Sample Code

doc.ActiveView = (IActiveView)doc.PageLayout;
doc.ActiveView.ContentsChanged();
System.Threading.Thread.Sleep(5000);
doc.PageLayout.ZoomToWhole();    
System.Threading.Thread.Sleep(30000);

I can provide more code fragments, but I think the question is more generic, and not directly my-code related.

like image 214
ZorleQ Avatar asked Feb 22 '13 13:02

ZorleQ


1 Answers

I've had a quick look around the documentation and found the following:

  1. IPageLayoutControlEvents
  2. IActiveViewEvents

It looks like they be useful, particularly the "AfterDraw" events. I'd imagine you could listen to the relevant events to enable/disable your tool as needed.

like image 116
Richard Smith Avatar answered Sep 30 '22 16:09

Richard Smith