ThinkGeo.com    |     Documentation    |     Premium Support

Refreshing Overlays

Hi


 


Can you let me know how to refresh only one overlay


 


Best regards



Jerome, 


Welcome to ThinkGeo Desktop Forum!
 
Following codes shows to you how to only refresh one particular Overlay.

//WorldOverlay is the targetOverlay to be refreshed Only.
worldOverlay.Lock.EnterReadLock();
try
{
   // change Layer style/ LayerCount etc
}
finally
{
    worldOverlay.Lock.ExitWriteLock();
}

winformsMap1.Refresh();

You can take a reference at the HowDoI samples\ EfficientlyMoveAPlanceImage sample, maybe it is exactly what you want to do.
 
 
Also, you can have a look at the video talked about the latest Desktop Edition if you are interested.
 
Thanks for your post and any more questions just let me know.
 
Thanks.
 
Yale

It's worth noting that if you just want to force an overlays refresh, in the Try block do:


 


overlay.lock.isdirty = true


 


This marks the overlay for redraw.



Thanks for your sharing, Nelson. 
  
 If you do not develop multi-threading App, it is almost same effect to mark it Dirty or use the Try—Finally to lock it. 
  
 But when you develop multi-threading App, even you mark it Dirty, it will have threading problem if you DO NOT use the lock system for the overlay when you want to read/write it. 
  
  
 And we DONOT suggest you manually mark the Overlay.IsDirty property even though it seems coding easily. 
  
 Just take a look a the video for more details if you are interested. 
 gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/16/aft/5798/afv/topic/Default.aspx 
  
  
 Thanks. 
  
 Yale