ThinkGeo.com    |     Documentation    |     Premium Support

How to record map navigation?

in our project,we need to realize map’s GoPreviousExtent and GoNextExtent.And at first,i need to record the extent navigated.

as i know,in arcgis,there is a map event,NavigationCompleted,which is triggered after navigation is completed. But,in thinkgeo,i don’t find similar event.The event,ExtentChanged, is triggered several time during the navigation,so it is not what i want.

What should i do?

Thanks.

Hi Channing,



Yes, the ExtentChanged event is not fit for this case as the normal pan will trigger this event, please try the OverlaysDrawn event and then give a condition that ExtentChangedType is not Pan. Like:


    wpfMap1.OverlaysDrawn += wpfMap1_OverlaysDrawn;
 
    wpfMap1.CurrentExtent = new RectangleShape(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962);
    wpfMap1.Refresh();
}
 
void wpfMap1_OverlaysDrawn(object sender, OverlaysDrawnWpfMapEventArgs e)
{
    if (wpfMap1.ExtentOverlay.ExtentChangedType != ExtentChangedType.Pan)
    {
        RectangleShape currentExtent = e.WorldExtent;
    }
}

Please let us know if any questions.

Thanks,

Troy

Hi Troy,



It works!

Thanks for your help!

That’s great to hear it helps. 
 Any other questions, please feel free to let us know. 
  
 Thanks, 
 Troy

Hi Troy

I have tried to use your code snippet in my project, and it seems that when I pan the map I get ExtentChangedType.None instead of ExtentChangedType.Pan. Maybe a bug has sneaked in? I have also tried in a totally clean project with the same result.

I’m using version 9.0.309.0

Jonas

Hi Jonas,

We can not get the ExtentChangedType.Pan in version 9.0, Please try filtering the extent by binding ExtetnOverlay_Drawing Event, the code maybe like below:

private void ExtentOverlay_Drawing(object sender, DrawingOverlayEventArgs e)
    {
        ExtentInteractiveOverlay overlay = sender as ExtentInteractiveOverlay;
        if(overlay.ExtentChangedType != ExtentChangedType.Pan)
        {
            
        }
        else
        {
            
        }
    }

Thanks,
Peter

Hi Peter

We found another way so I have not tried your suggestion yet, but thanks for your answer! I’m sure it will come in handy later on.

Jonas

Hi Jonas,

Great! Very glad to hear it works for you.

Thanks,
Peter