/**
* Update the rectangle, and perhaps the entire map if needed.
*/
private void updatePov() {
MapView mapView = getMapModel().getMapView();
WorldViewTransformer transformer = new WorldViewTransformer(mapView);
Bbox targetBox = targetMap.getMapModel().getMapView().getBounds();
Bbox overviewBox = mapView.getBounds();
// check if bounds are valid
if (Double.isNaN(overviewBox.getX())) {
return;
}
// zoom if current view is too small
if (dynamicOverview && !overviewBox.contains(targetBox)) {
// mapView.applyBounds(overviewBox.union(targetBox), MapView.ZoomOption.LEVEL_FIT);
// super.onMapViewChanged(null);
}
// calculate boxSize
Coordinate viewBegin = transformer.worldToView(targetBox.getOrigin());
Coordinate viewEnd = transformer.worldToView(targetBox.getEndPoint());
double width = Math.abs(viewEnd.getX() - viewBegin.getX());
double height = Math.abs(viewEnd.getY() - viewBegin.getY());
viewBegin.setY(viewBegin.getY() - height);