ThinkGeo.com    |     Documentation    |     Premium Support

CurrentExtentChanged problem

Hi all,


In my CurrentExtentChanged event handler, i have methods to update all the drawings and markers on the map. Everytime the user click and drag the map, the CurrentExtentChanged event fired, and my methods get executed.


This seem ok, but every time it fires, the system looks unresponsive, it was busy doing something. So i use an int to count the number of times it fired: it fired around 5-20 times, depending on how far you drag the map. It significantly slows down the system.  The other one, CurrenScaleChanged did fired correctly, it fires only once for every mousewheel movement.


Is there any way to let the CurrentExtentChanged fire only once when map is dragged?


 


Ric



Ric, 
  
 I am afraid you can’t do that in version 3.0.199. I have added this to our tracking system to make sure we review it before the next release. 
  
 For now you can call your methods when MouseUp event fired. Sorry for the inconveniences. 
  
 Thanks, 
 ThinkGeo support 


Ric, 
  
   I feel your pain one this one.  We have the same kinds of issues with panning.  The problem is that as you are panning the current extent is actually changing.  The scale doesn’t change when you pan only if you zoom in or out.  If you want to do something on the extent change but do not want to do it on a pan until the extent calms down a bit is to try the following.  Create a windows forms timer that is set for maybe one second.  Then in put your extent change code in the event of the time.  Now the good part, when the extent change is called you check if the timer is running.  If it is not running then you start it, if it is running you stop and start it again.  This means that while the extent is changing more than once a second the timer will not fire.  Once the extent hasn’t change for one second then it will.  Make sure to use a Winforms timer and not a threading timer as the Winforms timer integrates well with the UI threading system and will not cause you threading problems that the other timer may.  You can play around with the timer time to see what works best. 
  
 David