casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MWCRTZoomer.h
Go to the documentation of this file.
00001 //# MWCRTZoomer.h: MultiWorldCanvas event-based zoomer
00002 //# Copyright (C) 2000,2001,2002
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TRIALDISPLAY_MWCRTZOOMER_H
00029 #define TRIALDISPLAY_MWCRTZOOMER_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/Arrays/Vector.h>
00033 #include <display/DisplayEvents/MWCRectTool.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 // <summary>
00038 // Multi WorldCanvas event-based zoomer
00039 // </summary>
00040 //
00041 // <use visibility=export>
00042 //
00043 // <reviewed reviewer="" data="yyyy/mm/dd" tests="" demos="">
00044 // </reviewed>
00045 //
00046 // <prerequisites>
00047 //   <li> WCRectTool
00048 // </prerequisites>
00049 //
00050 // <etymology>
00051 // MWCRTZoomer stands for WorldCanvas Rectangling Tool Zoomer
00052 // </etymology>
00053 //
00054 // <synopsis>
00055 // This class finalises the functionality in WCRectTool to implement
00056 // event-based zooming on a WorldCanvas.  Double clicking inside the
00057 // constructed rectangle results in zooming in; double clicking outside
00058 // the rectangle gives zooming out.
00059 // </synopsis>
00060 //
00061 // <example>
00062 // </example>
00063 //
00064 // <motivation>
00065 // Zooming is an essential tool for interacting with data displays.
00066 // </motivation>
00067 //
00068 // <todo asof="1999/02/10">
00069 //   <li> Nothing known
00070 // </todo>
00071 
00072 class MWCRTZoomer : public MWCRectTool {
00073 
00074  public:
00075 
00076   // Constructor
00077   MWCRTZoomer(Display::KeySym keysym = Display::K_Pointer_Button1);
00078 
00079   // Destructor
00080   virtual ~MWCRTZoomer();
00081 
00082   // This function resets the zoom
00083   virtual void unzoom();
00084   
00085   //This function zooms with a given blc,trc
00086   virtual void zoom(const Vector<Double> &linBlc, 
00087                     const Vector<Double> &linTrc);
00088 
00089   // zoom in/out by given factor
00090   //<group>
00091   virtual void zoomIn(Double factor=2.);
00092   virtual void zoomOut(Double factor=2.);
00093   //</group>
00094 
00095  protected:
00096 
00097   // Handle double-click inside or outside the rectangle; called by
00098   // the base class when these events occur.  They execute
00099   // zoom-in/zoom-out on the tool's active WC's (which should all
00100   // have indentical linear coordinates for their draw areas--they
00101   // certainly will have, after a zoom).
00102   // Then the routines invoke the zoomed() callback, below.
00103   // <group>
00104   virtual void doubleInside();
00105   virtual void doubleOutside();
00106   // </group>
00107 
00108   // This function is called when a zoom occurs.  It is supplied
00109   // with the linear coords of the new zoom box, and thus can be
00110   // implemented to do further actions, such as reporting the 
00111   // new zoom box to the application
00112   virtual void zoomed(const Vector<Double> &linBlc, 
00113                       const Vector<Double> &linTrc);
00114 
00115  private:
00116   
00117   // get the linear coords of the current zoom box
00118   void getLinearCoords(Vector<Double> &blc, Vector<Double> &trc);
00119 
00120 };
00121 
00122 
00123 } //# NAMESPACE CASA - END
00124 
00125 #endif