CoordinateReferenceSystem newcrs = (CoordinateReferenceSystem)event.getNewValue();
mapviewer.getMap().getViewportModelInternal().setCRS(newcrs);
}else if (event.getType() == EventType.BOUNDS){
//bounds have changed change the overview box correspondingly
if (!mainmap.getViewportModel().isBoundsChanging()) {
ReferencedEnvelope bnds = findNewOverviewZoom(mainmap.getViewportModel().getBounds(), mainmap.getRenderManager().getMapDisplay(), mapviewer.getMap().getViewportModel().getBounds());
mapviewer.getMap().getViewportModelInternal().setBounds(bnds);
}
mapviewer.getViewport().repaint();
}else{
// repaint to update the box representing the location
mapviewer.getViewport().repaint();
}
}
};
mainmap.getViewportModelInternal().addViewportModelListener(viewportListener);
mapviewer.getViewport().addPaneListener(new IMapDisplayListener(){
public void sizeChanged( MapDisplayEvent event ) {
//update the bounds
ReferencedEnvelope bnds = findNewOverviewZoom(mainmap.getViewportModel().getBounds(), mainmap.getRenderManager().getMapDisplay(), mapviewer.getMap().getViewportModel().getBounds());
mapviewer.getMap().getViewportModelInternal().setBounds(bnds);
}});
}