ESRI.ArcGIS.ADF.IMS
CenterAt(Int32,Int32) Method
See Also  Example
ESRI.ArcGIS.ADF.IMS.Carto Namespace > View Class > CenterAt Method : CenterAt(Int32,Int32) Method




pixelX
The X coordinate of the screen-point (pixel-point) on which you want the map re-centered.
pixelY
The Y coordinate of the screen-point (pixel-point) on which you want the map re-centered.
Re-centers the map to a specified screen point.

Syntax

Visual Basic (Declaration) 
Public Overloads Overridable Function CenterAt( _
   ByVal pixelX As Integer, _
   ByVal pixelY As Integer _
) As CartoImage
Visual Basic (Usage)Copy Code
Dim instance As View
Dim pixelX As Integer
Dim pixelY As Integer
Dim value As CartoImage
 
value = instance.CenterAt(pixelX, pixelY)
C# 
public virtual CartoImage CenterAt( 
   int pixelX,
   int pixelY
)

Parameters

pixelX
The X coordinate of the screen-point (pixel-point) on which you want the map re-centered.
pixelY
The Y coordinate of the screen-point (pixel-point) on which you want the map re-centered.

Return Value

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

Example

This example sets the MapView's height and width in pixels, along with an initial envelope, then re-centers the map based on a pixel location in the map.
C#Copy Code
mapView.ImageDescriptor.Width = Convert.ToInt32(imgMap.Width.Value); 

mapView.ImageDescriptor.Height = Convert.ToInt32(imgMap.Height.Value); 

mapView.Extent = new Envelope(10, 30, 30, 50); 

  

CartoImage resultImage = mapView.CenterAt(150, 50); 

imgMap.ImageUrl = resultImage.Url; 

    
Visual BasicCopy Code
mapView.ImageDescriptor.Width = CInt(imgMap.Width.Value)

mapView.ImageDescriptor.Height = CInt(imgMap.Height.Value)

mapView.Extent = New Envelope(10, 30, 30, 50)



Dim resultImage As CartoImage = mapView.CenterAt(150, 50)

imgMap.ImageUrl = resultImage.Url

Remarks

Typically this method will be used to allow the user to click on a pixel location in the map to re-center the map. This method allows panning the map without converting the pixel location to map coordinates. The method handles the necessary envelope calculations for you.

If a pixel value is greater than the pixels in the map image, the map will be panned as if the map image were actually as large as the pixel value, so that the pan is panned a to a location beyond where the map currently displays.

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.