CenterAndScale
Base Type: MapArea
A class that defines the center point and scale for a map.
Property |
Type |
Description |
---|---|---|
Center |
The location on which to center the map. | |
DevBottom |
int |
The X cooridnate for bottom right corner point. |
DevBottomSpecified |
bool |
Indicates if DevBottom is specified. |
DevLeft |
int |
The X coordinate for the upper left corner point. |
DevLeftSpecified |
bool |
Indicates if DevLeft is specified. |
DevRight |
int |
The Y coordinate for the bottom right corner point. |
DevRightSpecified |
bool |
Indicates if DevRight is specified. |
DevTop |
int |
The X coordinate for the upper left corner point. |
DevTopSpecified |
bool |
Indicates if DevTop is specified. |
DPI |
double |
The device resolution of the image. |
DPISpecified |
bool |
Indicates if DPI is specified. |
Scale |
double |
The map scale. |
Remarks
To use, create a new object and set the geographic extent of the map by setting a center point and a map scale. Set the MapDescription.MapArea property to this newly created object. If the spatial reference of the map service has changed, remember to adjust the spatial reference of the center point to match the new spatial reference.
Note that this object does not compute map extent. When used with the ExportMapImage method, the returned MapImage object can be used to get the updated map extent.
Examples
C#
MapService_MapServer mapService = new MapService_MapServer();
mapService.Url = "http://localhost:6080/arcgis/services/MapService/MapServer";
MapServerInfo mapInfo = mapService.GetServerInfo(mapService.GetDefaultMapName());
MapDescription mapDesc = mapInfo.DefaultMapDescription;
ImageType imgType = new ImageType();
imgType.ImageFormat = esriImageFormat.esriImagePNG;
imgType.ImageReturnType = esriImageReturnType.esriImageReturnURL;
ImageDisplay imgDisp = new ImageDisplay();
imgDisp.ImageHeight = pictureBox1.Height;
imgDisp.ImageWidth = pictureBox1.Width;
imgDisp.ImageDPI = 96;
ImageDescription imgDesc = new ImageDescription();
imgDesc.ImageDisplay = imgDisp;
imgDesc.ImageType = imgType;
PointN pointN = new PointN();
pointN.X = -100;
pointN.Y = 35;
CenterAndScale centerScale = new CenterAndScale();
centerScale.Center = pointN;
centerScale.Scale = mapService.ComputeScale(mapDesc, imgDisp) / 4;
mapDesc.MapArea = centerScale;
MapImage mapImage = mapService.ExportMapImage(mapDesc, imgDesc);