If I have the extents (upper left and lower right lat/lon coords) of the
domain I am interested in and I have a simple mouse mode that I made (seen
below)
public class ZoomOutMouseMode extends CoordMouseMode{
//Member variable
public final static transient String modeID = "ZoomOut";
//Default Constructor
public ZoomOutMouseMode(){}
//A simple mouse mode to zoom out on a mouse press
public ZoomOutMouseMode(boolean shouldConsumeEvents) {
super(modeID, shouldConsumeEvents);
}
//Do a quick zoom out when the mouse is pressed
public void mousePressed(MouseEvent e){
e.getComponent().requestFocus();
if(!mouseSupport.fireMapMousePressed(e) && e.getSource() instanceof
MapBean){
MapBean mapBean = (MapBean)e.getSource();
mapBean.setCenter((mapBean.getProjection()).inverse(e.getPoint()));
mapBean.setScale(mapBean.getScale() * 1.5f);
}
}
}
How can I disallow them to zoom out further than those extents? As you can
also see I re-center the map when the user clicks to zoom out.
I basically don't want the user to ever see (or zoom out beyond) anything
outside the extents of interest (which are defined at startup).
I thought this would be easy but am finding it a bit difficult and was
hoping someone had done something similar before.
~Ben
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Sep 09 2004 - 13:35:57 EDT