casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MWCPositionVelocityTool.h
Go to the documentation of this file.
00001 //# MWCPositionVelocityTool.h: MultiWorldCanvas position velocity tool
00002 //# Copyright (C) 2012
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 VIEWER_MWCPOSITIONVELOCITYTOOL_H_
00028 #define VIEWER_MWCPOSITIONVELOCITYTOOL_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 position velocity 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         // MWCPositionVelocityTool implements a position-velocity tool using the MultiWorldCanvas
00053         // </etymology>
00054         //
00055         // <synopsis>
00056         // </synopsis>
00057         //
00058         // <example>
00059         // </example>
00060         //
00061         // <motivation>
00062         // </motivation>
00063         //
00064         // <todo asof="">
00065         // </todo>
00066 
00067         class MWCPositionVelocityTool : public MultiWCTool, public DTVisible {
00068   
00069                 public:  
00070                         // Constructor
00071                         MWCPositionVelocityTool( Display::KeySym keysym = Display::K_Pointer_Button1, Bool scrollingAllowed = True );
00072   
00073                         // Destructor
00074                         virtual ~MWCPositionVelocityTool();
00075   
00076                         // Reset to non-showing, non-active.  Refreshes if necessary to erase
00077                         // (unless skipRefresh==True).
00078                         // (Does not unregister from WCs or disable future event handling).
00079                         virtual void reset(Bool skipRefresh=False);
00080 
00081                 protected:
00082                         // Functions called by the base class mouse event handling operators -
00083                         // these maintain the state of the pan vector and order it to be drawn
00084                         // via refresh().
00085                         // <group>
00086                         virtual void keyPressed(const WCPositionEvent &/*ev*/);
00087                         virtual void keyReleased(const WCPositionEvent &/*ev*/);
00088                         virtual void moved(const WCMotionEvent &/*ev*/, const viewer::region::region_list_type & /*selected_regions*/);
00089                         // </group>
00090 
00091                         // draw the distance vector on a PixelCanvas.  (To be called only by the
00092                         // base class refresh event handler).
00093                         virtual void draw(const WCRefreshEvent&/*ev*/, const viewer::region::region_list_type & /*selected_regions*/);
00094 
00095                 private:
00096                         // Should we respond to mouse movement and button release?  Should
00097                         // we draw?  Set when the button is pushed in one of the tool's WCs.
00098                         Bool itsActive;
00099 
00100                         // are the units in x and y identical?
00101                         Bool itsEqualUnits;
00102 
00103                         // pixel coordinates of the pan vector.  1 = anchor, 2 = new position.
00104                         Int itsX1, itsY1, itsX2, itsY2, itsX3, itsY3;
00105 
00106                         // axis index for RA and DEC
00107                         Int itsRaIndex, itsDecIndex;
00108         };
00109 
00110 
00111 } //# NAMESPACE CASA - END
00112 
00113 #endif
00114 
00115