RE: [OpenMap Users] disallowing zooming out too far

From: Hudson Brian R Contr AFRL/IFSF <>
Date: Thu, 9 Sep 2004 18:39:24 -0000

Think about it... it's a pretty basic if statement really...
It would look something like this:
float maxScale = ProjMath.getScale(upperLeft, lowerRight,
float currentScale = mapBean.getProjection().getScale();
float newScale = currentScale * 1.5f;
if(newScale > maxScale) {
    newScale = maxScale;
Brian Hudson

-----Original Message-----
From: [] On
Behalf Of Ben Podoll
Sent: Thursday, September 09, 2004 1:35 PM
Subject: [OpenMap Users] disallowing zooming out too far

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 ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Sep 09 2004 - 14:42:43 EDT

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