ZoomAndCenterMapView Example - Java

The following shows a Java example that returns a ZoomAndCenterMapView object.


public static ZoomAndCenterMapView getZoomAndCenterMapView() throws Exception
{
    ZoomAndCenterMapView zoomAndCenterMapView = new ZoomAndCenterMapView();
    zoomAndCenterMapView.setHeight(600);
    zoomAndCenterMapView.setWidth(800);
    zoomAndCenterMapView.setUnit(PaperUnit.PIXEL);
    //sets the map resolution. If not specified, the default one is set to 96 DPI
    //zoomAndCenterMapView.setMapResolution(200);

    Distance distance = new Distance();
    distance.setValue(2000.0);
    distance.setUom(DistanceUnit.KILOMETER);
    zoomAndCenterMapView.setZoomLevel(distance);

    Point point = BuildGeometry.buildPoint();
    zoomAndCenterMapView.setMapCenter(point);
    return zoomAndCenterMapView;
}