casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
WCMotionEvent.h
Go to the documentation of this file.
00001 //# WCMotionEvent.h: class which stores WorldCanvas motion event information
00002 //# Copyright (C) 1993,1994,1995,1996,1998,1999,2000
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_WCMOTIONEVENT_H
00029 #define TRIALDISPLAY_WCMOTIONEVENT_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/Arrays/Vector.h>
00033 #include <display/DisplayEvents/WorldCanvasEvent.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 class WorldCanvas;
00038 
00039 // <summary>
00040 // Class which stores WorldCanvas motion event information.
00041 // </summary>
00042 
00043 // <use visibility=export>
00044 
00045 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00046 // </reviewed>
00047 
00048 // <etymology>
00049 // "WCMotionEvent" is a contraction and concatentation of
00050 // "WorldCanvas", "Motion" and "Event", and describes motion events
00051 // occuring on WorldCanvases.
00052 // </etymology>
00053 
00054 // <synopsis>
00055 // This class adds to the information stored in the <linkto
00056 // class=WorldCanvasEvent>WorldCanvasEvent</linkto> class.  It adds
00057 // informatino describing the current position of the mouse or
00058 // pointing device, and the state of the keyboard modifiers (including 
00059 // the mouse buttons).
00060 // </synopsis>
00061 
00062 // <example>
00063 // </example>
00064 
00065 // <motivation>
00066 // A compact way of passing motion event information around the
00067 // WorldCanvas-oriented display classes was needed, with a functional
00068 // but tight and efficient interface.
00069 // </motivation>
00070 
00071 // <thrown>
00072 // None.
00073 // </thrown>
00074 
00075 // <todo asof="1999/10/15">
00076 // None.
00077 // </todo>
00078 
00079 class WCMotionEvent : public WorldCanvasEvent {
00080 
00081  public:
00082 
00083   // Constructor taking a pointer to the WorldCanvas for which the
00084   // event is valid, the state of the keyboard and pointer modifiers,
00085   // and the pixel, linear and world coordinates of the event.
00086   WCMotionEvent(WorldCanvas *wc, const uInt &modifiers,
00087                 const Int &pixX, const Int &pixY, 
00088                 const Double &linX, const Double &linY,
00089                 const Vector<Double> &world);
00090   
00091   // copy constructor.
00092   WCMotionEvent(const WCMotionEvent &other);
00093 
00094   // Destructor.
00095   virtual ~WCMotionEvent();
00096 
00097   // The x and y pixel position of the pointer when the event
00098   // occurred.
00099   // <group>
00100   virtual Int pixX() const 
00101     { return itsPixX; }
00102   virtual Int pixY() const 
00103     { return itsPixY; }
00104   // </group>
00105 
00106   // The x and y linear coordinates of the event.
00107   // <group>
00108   virtual Double linX() const 
00109     { return itsLinX; }
00110   virtual Double linY() const 
00111     { return itsLinY; }
00112   // </group>
00113 
00114   // The world coordinates describing where the event occurred.
00115   virtual const Vector<Double> &world() const 
00116     { return itsWorld; }
00117   
00118   // Return the state of the "modifiers": this is made up of mask bits 
00119   // referring to various keys on the keyboard (eg. Control, Shift,
00120   // etc.) and the mouse buttons.
00121   virtual uInt modifiers() const 
00122     { return itsModifiers; }
00123   
00124  protected:
00125 
00126   // (Required) default constructor.
00127   WCMotionEvent();
00128 
00129   // (Required) copy assignment.
00130   WCMotionEvent &operator=(const WCMotionEvent &other);
00131   friend class QtDisplayPanel;          /*** to access assignment operator to save "last event" ***/
00132 
00133  private:
00134   
00135   // Store the pixel position of the event here.
00136   Int itsPixX, itsPixY;
00137 
00138   // Store the linear position of the event here.
00139   Double itsLinX, itsLinY;
00140 
00141   // Store the world position of the event here.
00142   Vector<Double> itsWorld;
00143 
00144   // Store the button and keyboard modifier masks here.
00145   uInt itsModifiers;
00146 
00147 };
00148 
00149 
00150 } //# NAMESPACE CASA - END
00151 
00152 #endif
00153 
00154