Select to view content in your preferred language

Zoom and Pan

444
2
04-29-2011 06:56 AM
JayKappy
Frequent Contributor
Is there a way that I can zoom and pan at the same time, or one after the other....I am using the below code to zoom to a features extent...
But I am looking to also shift the zoomed extent to the left or right....Can I pan by specifying a distance value in a particular direction? 

        ' TAKE THE NEW UNION EXTENT AND ZOOM OUT A TAD
        Dim ZoomTographicslayer2 As ESRI.ArcGIS.Client.Geometry.Envelope = NewExtent
        Dim expandPercentage2 As Double = 5
        Dim widthExpand2 As Double = ZoomTographicslayer2.Width * (expandPercentage2 / 8)
        Dim heightExpand2 As Double = ZoomTographicslayer2.Height * (expandPercentage2 / 8)
        Dim displayExtentParcelLocation2 As New ESRI.ArcGIS.Client.Geometry.Envelope(ZoomTographicslayer2.XMin - (widthExpand2 / 2), ZoomTographicslayer2.YMin - (heightExpand2 / 2), ZoomTographicslayer2.XMax + (widthExpand2 / 2), ZoomTographicslayer2.YMax + (heightExpand2 / 2))
        MyMap.ZoomTo(displayExtentParcelLocation2
)
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
These are related threads:
http://forums.arcgis.com/threads/22285-multiple-calls-to-Map.ZoomTo%28Envelope%29-doesn-t-always-see...
http://forums.arcgis.com/threads/25701-calling-Map.ZoomTo%28%29-and-then-Map.PanTo%28%29-can-cause-I...

The bug fixes are targeted for v2.2. If you make consecutive calls to ZoomTo() or PanTo(), the next call cancels the first.

If what you are trying to do is zoom to a geometry first and then pan, you need to wait for zoom to complete (Map.ExtentChanged will be fired), then you can call pan. Otherwise, the pan will cancel the zoom.
0 Kudos
dotMorten_esri
Esri Notable Contributor
in v2.2beta, you can use the MapAutomationPeer class to accomplish this by calling it in an animation loop (albeit it will require some fair amount of math to get just the way you want it :-))
0 Kudos