ThinkGeo.com    |     Documentation    |     Premium Support

Alternative to CurrentExtentChanged while panning

Greetings,


I was wondering if there was an event that fired only when the current extent is changed, but only at the end of an operation.  I am looking at loading data at certain extents and potentially need to reload the data when the current extent changes, however I would like to only load it at the end of a pan operation rather than several times throughout the pan.  I'd also like to keep my map in multi-threaded mode.


Thanks,


Ryan



Ryan,


Thanks for your post and questions.
 
First , there was a event in the MapControl, while it will be fired every time the extent changed, that is to say, when you panning , the event will be fired again and again.

winformsMap1.CurrentExtentChanged += new EventHandler<CurrentExtentChangedWinformsMapEventArgs>(winformsMap1_CurrentExtentChanged);

void winformsMap1_CurrentExtentChanged(object sender, CurrentExtentChangedWinformsMapEventArgs e)
{
    System.Diagnostics.Debug.WriteLine("winformsMap1_CurrentExtentChanged");
}

 
Second, If this event cannot satify your requrirements, I guss you need to use another a litte trick way by using some events in the ExtentOverlay:

        winformsMap1.ExtentOverlay.MapMouseUp += new EventHandler<MapMouseUpInteractiveOverlayEventArgs>(ExtentOverlay_MapMouseUp);
        winformsMap1.ExtentOverlay.MapMouseDoubleClick += new EventHandler<MapMouseDoubleClickInteractiveOverlayEventArgs>(ExtentOverlay_MapMouseDoubleClick);
        winformsMap1.ExtentOverlay.MapMouseWheel += new EventHandler<MapMouseWheelInteractiveOverlayEventArgs>(ExtentOverlay_MapMouseWheel);


        void ExtentOverlay_MapMouseWheel(object sender, MapMouseWheelInteractiveOverlayEventArgs e)
        {
            // Deal with MouseWheel to change the extent.
            System.Diagnostics.Debug.WriteLine("ExtentOverlay_MapMouseWheel");
        }

        void ExtentOverlay_MapMouseDoubleClick(object sender, MapMouseDoubleClickInteractiveOverlayEventArgs e)
        {
            // Deal with Pan to change the extent.
            System.Diagnostics.Debug.WriteLine("ExtentOverlay_MapMouseDoubleClick");
        }

        void ExtentOverlay_MapMouseUp(object sender, MapMouseUpInteractiveOverlayEventArgs e)
        {
            // Deal with double click to change the extent.
            System.Diagnostics.Debug.WriteLine("ExtentOverlay_MapMouseUp");
        }

 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

 Hi ,


I tried your first option in MapSuite Webedition 3.0. 


When I do this.. I unable to do the zooming.. when I zoom, it automatically comes to the current extent level. So I can't zoom in to street level.


But this post back remove the lines which drew using InMemoryFeatureOverlay. I am using CustomOverlay apart from I am using simplemarker overlay.. 


Thanks.


C.Raja.



Raja, 
  
 We have a ExtentChangedEvent sample in our installed samples which you could find its source code at "Samples\NavigateTheMap\ExtentChangedEvent.aspx", please refer to it. 
  
 For the second issue, there are several things that can cause this problem, please check the items below: 
 1. Have you stored the drawn lines into InMemoryFeatureLayer before the doing a post back? 
 2. Please remember “Redraw” the Overlay that contains InMemoryFeatureLayer you defined. 
 Please refer to the installed DrawEditShapes sample whihc you can find its source code at "Samples\MapShapes\DrawEditShapes.aspx". 
  
 After the answer, I have a suggestion, could you post the question to the “MapSuite WebEdition” discussion forum, which makes easy for us to solve your issues, thanks a lot. 
  
 Any more questions just feel free to let me know. 
   
 Thanks, 
   
 Johnny