ZoomAndCenterMapView Example - Java - Latest

Spectrum Spatial Guide

Product type
Software
Portfolio
Locate
Product family
Spectrumâ„¢ software
Product
Spectrumâ„¢ software > Spatial > Spectrum Spatial
Version
Latest
ft:locale
en-US
Product name
Spectrum Technology Platform
ft:title
Spectrum Spatial Guide
Copyright
2025
First publish date
2007
ft:lastEdition
2025-03-07
ft:lastPublication
2025-03-07T10:28:48.112000

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;
}