ScaleAndCenterMapView Example - Java

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


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

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