casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MWCRulerlineTool.h
Go to the documentation of this file.
00001 //# MWCPannerTool.h: MultiWorldCanvas panning tool 
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 
00027 #ifndef TRIALDISPLAY_MWCRULERTOOL_H
00028 #define TRIALDISPLAY_MWCRULERTOOL_H
00029 
00030 #include <casa/aips.h>
00031 #include <casa/Arrays/Vector.h>
00032 #include <display/DisplayEvents/MultiWCTool.h>
00033 #include <display/DisplayEvents/DTVisible.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 class WorldCanvas;
00038 
00039 // <summary>
00040 // Multi WorldCanvas event-based ruler line tool
00041 // </summary>
00042 //
00043 // <use visibility=export>
00044 //
00045 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00046 // </reviewed>
00047 //
00048 // <prerequisites>
00049 // </prerequisites>
00050 //
00051 // <etymology>
00052 // MWCRulerlineTool stands for MultiWorldCanvas ruler line Tool
00053 // </etymology>
00054 //
00055 // <synopsis>
00056 // </synopsis>
00057 //
00058 // <example>
00059 // </example>
00060 //
00061 // <motivation>
00062 // A nice little tool to measure distances on the screen.
00063 // </motivation>
00064 //
00065 // <todo asof="2011/06/10">
00066 // Does not get the proper units if measuring distances on a frequency axis.
00067 // </todo>
00068 
00069 class MWCRulerlineTool : public MultiWCTool, public DTVisible {
00070   
00071  public:  
00072   // Constructor
00073   MWCRulerlineTool(Display::KeySym keysym = Display::K_Pointer_Button1,
00074                  Bool scrollingAllowed = True);
00075   
00076   // Destructor
00077   virtual ~MWCRulerlineTool();
00078   
00079   // Reset to non-showing, non-active.  Refreshes if necessary to erase
00080   // (unless skipRefresh==True).
00081   // (Does not unregister from WCs or disable future event handling).
00082   virtual void reset(Bool skipRefresh=False);
00083 
00084  protected:
00085   // Functions called by the base class mouse event handling operators -
00086   // these maintain the state of the pan vector and order it to be drawn
00087   // via refresh().
00088   // <group>
00089   virtual void keyPressed(const WCPositionEvent &/*ev*/);
00090   virtual void keyReleased(const WCPositionEvent &/*ev*/);
00091   virtual void moved(const WCMotionEvent &/*ev*/, const viewer::region::region_list_type & /*selected_regions*/);
00092   // </group>
00093 
00094   // draw the distance vector on a PixelCanvas.  (To be called only by the
00095   // base class refresh event handler).
00096   virtual void draw(const WCRefreshEvent&/*ev*/, const viewer::region::region_list_type & /*selected_regions*/);
00097 
00098  private:
00099   // Should we respond to mouse movement and button release?  Should
00100   // we draw?  Set when the button is pushed in one of the tool's WCs.
00101   Bool itsActive;
00102 
00103   // are the units in x and y identical?
00104   Bool itsEqualUnits;
00105 
00106   // pixel coordinates of the pan vector.  1 = anchor, 2 = new position.
00107   Int itsX1, itsY1, itsX2, itsY2, itsX3, itsY3;
00108 
00109   // axis index for RA and DEC
00110   Int itsRaIndex, itsDecIndex;
00111 };
00112 
00113 
00114 } //# NAMESPACE CASA - END
00115 
00116 #endif
00117 
00118