ZoomAndCenterMapView Example - C#

The following shows a C# example that returns a ZoomAndCenterMapView object.


public static ZoomAndCenterMapView createZoomAndCenterMapView()
{
    ZoomAndCenterMapView zc = new ZoomAndCenterMapView();
    zc.Height = 600;
    zc.Width = 800;
    zc.unit = PaperUnit.Pixel;

    //sets the map resolution. If not specified, the default one is set to 96 DPI
    //zc.mapResolution = 200;

    // set up the zoom level of the map
    // it represents the full width of the map
    Distance zl = new Distance();
    zl.Value = 2000.0;
    zl.uom = DistanceUnit.Kilometer;
    zc.ZoomLevel = zl;

    // set the map centre of the map view
    Point centre = BuildGeometry.buildPoint();

    zc.MapCenter = centre;

    return zc;
}