Bbox maxBounds = new Bbox(mapInfo.getMaxBounds());
Bbox initialBounds = new Bbox(mapInfo.getInitialBounds());
// if the max bounds was not configured, take the union of initial and layer bounds
if (maxBounds.isAll()) {
for (ClientLayerInfo layerInfo : mapInfo.getLayers()) {
maxBounds = (Bbox) initialBounds.clone();
maxBounds = maxBounds.union(new Bbox(layerInfo.getMaxExtent()));
}
}
mapView.setMaxBounds(maxBounds);
mapView.applyBounds(initialBounds, MapView.ZoomOption.LEVEL_CLOSEST);