[OpenMap Users] disallowing zooming out too far

From: Ben Podoll <benjamin.podoll_at_und.edu>
Date: Thu, 9 Sep 2004 12:34:51 -0500

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


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){


      if(!mouseSupport.fireMapMousePressed(e) && e.getSource() instanceof

         MapBean mapBean = (MapBean)e.getSource();


         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.



[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

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT