ESRI.ArcGIS.ADF.IMS
ZoomOut Method
See Also  Example
ESRI.ArcGIS.ADF.IMS.Carto Namespace > View Class : ZoomOut Method




envelope
The envelope by which you want to scale this zoom out operation.
Zooms out.

Syntax

Visual Basic (Declaration) 
Public Overridable Function ZoomOut( _
   ByVal envelope As Envelope _
) As CartoImage
Visual Basic (Usage)Copy Code
Dim instance As View
Dim envelope As Envelope
Dim value As CartoImage
 
value = instance.ZoomOut(envelope)
C# 
public virtual CartoImage ZoomOut( 
   Envelope envelope
)

Parameters

envelope
The envelope by which you want to scale this zoom out operation.

Return Value

New zoomed map image, in the form of a CartoImage object. Use CartoImage.Url to retrieve the image's URL.

Example

This example zooms the current map out with an envelope one-half the current dimensions in x and y. The resulting map extent covers twice the previous extent in x and y.
C#Copy Code
mapView.Extent = new Envelope(-10, -10, 10, 10); 

  

// Pass an envelope one-half the width/height of current map extent 

mapView.ZoomOut(new Envelope(-5, -5, 5, 5)); 

  

// Map now covers twice the extent in x and y (-20, -20, 20, 20) 

env = mapView.Extent; 

lblCartoImage.Text = "<br>Extent after zoom: " + env.XMin.ToString() + "," + env.XMax.ToString() 

            + ", " + env.YMin.ToString() + "," + env.YMax.ToString(); 

    
Visual BasicCopy Code
mapView.Extent = New Envelope(-10, -10, 10, 10)



' Pass an envelope one-half the width/height of current map extent

mapView.ZoomOut(New Envelope(-5, -5, 5, 5))



' Map now covers twice the extent In x And y (-20, -20, 20, 20)

env = mapView.Extent

lblCartoImage.Text = "<br>Extent after zoom: " + env.XMin.ToString() + "," + env.XMax.ToString() _

            + ", " + env.YMin.ToString() + "," + env.YMax.ToString()

Remarks

A typical use of this method is to allow the user to draw a box within the map, and have the map zoom out based on the box drawn. The smaller the box in this case, the more the map will zoom out. For example, if the box drawn is one-half the width and height of the map, then the redrawn map will zoom out to cover twice the extent in x and y. If the box drawn is one-fourth the width and height of the map, the new extent will cover four times the extent of the previous map in x and y.

Additionally, the new map will be re-centered at the middle of the box drawn by the user.

Only the x or the y dimension of the envelope passed to ZoomOut is actually used to calculate the scale factor for zooming out. The dimension used is the one that is largest in comparison to the current map extent in the respective direction. As an example, assume the current map covers 2000 kilometers in x, and 1000 kilometers in y. If the envelope passed to ZoomOut covers 500 kilometers in x and y, then the envelope is 1/2 the size of the current map's x dimension, but only 1/4 the current y dimension. The x scale factor is therefore used to zoom out, and the new map will cover twice the extent in x and y compared to the original map.

Caution: The envelope passed to ZoomOut must be smaller in both x and y dimensions than the current map extent in the respective x and y. If either dimension is larger than the current map dimension, a System.ArgumentOutOfRangeException will be thrown, saying that the value must be between -1 and the absolute minimum double value (-1.798E308). For example, if your current map covers 1000 kilometers in each dimension, and you pass and envelope with a height of 1500 kilometers, you will receive an error.

Any Zoom, Pan, CenterAt or Draw method which changes the map extent also changes the map extent for the MapView.

Note that all zoom, pan, and re-center methods cause the server to generate a map, whether it is accessed or not. If the result of this method is not assigned to a CartoImage object, the image can be retrieved with the Image property of the view.

See Also

© 2010 All Rights Reserved.