casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MWCPannerTool.h
Go to the documentation of this file.
1 //# MWCPannerTool.h: MultiWorldCanvas panning tool
2 //# Copyright (C) 2000,2001,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 
27 #ifndef TRIALDISPLAY_MWCPANNERTOOL_H
28 #define TRIALDISPLAY_MWCPANNERTOOL_H
29 
30 #include <casa/aips.h>
31 #include <casa/Arrays/Vector.h>
34 
35 namespace casa { //# NAMESPACE CASA - BEGIN
36 
37  class WorldCanvas;
38 
39 // <summary>
40 //
41 // </summary>
42 //
43 // <use visibility=export>
44 //
45 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
46 // </reviewed>
47 //
48 // <prerequisites>
49 // <li> MWCTool
50 // </prerequisites>
51 //
52 // <etymology>
53 // MWCPannerTool stands for MultiWorldCanvas Panner Tool
54 // </etymology>
55 //
56 // <synopsis>
57 // This class provides panning functionality. The zoomed() function should
58 // be overriden to catch the event, if needed.
59 //
60 // The pan line is drawn by dragging the mouse from one point to
61 // another. The release of the mouse button triggers the movement of the
62 // image by the same displacement.
63 //
64 // The Tool also responds to the arrow keys, scroll wheel, et. al.,
65 // moving the zoom window in the same direction through the image.
66 // A constructor parameter is provided to turn these features off,
67 // if needed.
68 // </synopsis>
69 //
70 // <example>
71 // </example>
72 //
73 // <motivation>
74 // Panning is a common function in most visualization applications
75 // </motivation>
76 //
77 // <todo asof="2001/02/24">
78 // Nothing known
79 // </todo>
80 
81  class MWCPannerTool : public MultiWCTool, public DTVisible {
82 
83  public:
84  // Constructor
86  casacore::Bool scrollingAllowed = true);
87 
88  // Destructor
89  virtual ~MWCPannerTool();
90 
91  // Reset to non-showing, non-active. Refreshes if necessary to erase
92  // (unless skipRefresh==true).
93  // (Does not unregister from WCs or disable future event handling).
94  virtual void reset(casacore::Bool skipRefresh=false);
95 
96  protected:
97 
98  // Functions called by the base class mouse event handling operators -
99  // these maintain the state of the pan vector and order it to be drawn
100  // via refresh(), send the pan request to the WC, and pass on notice
101  // of the pan (zoomed()) when it is complete.
102  // functions
103  // <group>
104  virtual void keyPressed(const WCPositionEvent &/*ev*/);
105  virtual void keyReleased(const WCPositionEvent &/*ev*/);
106  virtual void moved(const WCMotionEvent &/*ev*/, const viewer::region::region_list_type & /*selected_regions*/);
107  virtual void otherKeyPressed(const WCPositionEvent &/*ev*/);
108  // </group>
109 
110  // draw the pan vector on a PixelCanvas. (To be called only by the
111  // base class refresh event handler).
112  virtual void draw(const WCRefreshEvent&/*ev*/, const viewer::region::region_list_type & /*selected_regions*/);
113 
114  // Output callback to indicate that we have zoomed. Override to
115  // handle, if needed.
116  virtual void zoomed(const casacore::Vector<casacore::Double> &/*linBlc*/,
117  const casacore::Vector<casacore::Double> &/*linTrc*/) { };
118 
119  private:
120 
121  // execute the pan. shift is the (2-element) shift vector for the
122  // zoom window, in linear coordinates. Resets the tool, removing
123  // the line (if any) from screen
124  virtual void pan(casacore::Vector<casacore::Double> &shift);
125 
126  // Should we respond to mouse movement and button release? Should
127  // we draw? Set when the button is pushed in one of the tool's WCs.
129 
130  // pixel coordinates of the pan vector. 1 = anchor, 2 = new position.
132 
133  // allow scrolling via arrow keys, et. al.?
135 
136  // prevents key repeat from piling up scroll events,
137  // if refresh can't keep up with them
138  // <group>
141  // </group>
142 
143  };
144 
145 
146 } //# NAMESPACE CASA - END
147 
148 #endif
149 
150 
virtual void moved(const WCMotionEvent &, const viewer::region::region_list_type &)
int Int
Definition: aipstype.h:50
casacore::Int itsY1
Class which stores WorldCanvas refresh event information.
virtual void keyReleased(const WCPositionEvent &)
casacore::Int itsY2
virtual void reset(casacore::Bool skipRefresh=false)
Reset to non-showing, non-active.
virtual void draw(const WCRefreshEvent &, const viewer::region::region_list_type &)
draw the pan vector on a PixelCanvas.
casacore::Bool itsScrollingAllowed
allow scrolling via arrow keys, et.
virtual ~MWCPannerTool()
Destructor.
casacore::Double itsLastScrollTime
prevents key repeat from piling up scroll events, if refresh can&#39;t keep up with them ...
Class which stores WorldCanvas motion event information.
Definition: WCMotionEvent.h:79
double Double
Definition: aipstype.h:55
virtual void pan(casacore::Vector< casacore::Double > &shift)
execute the pan.
virtual void otherKeyPressed(const WCPositionEvent &)
MWCPannerTool(Display::KeySym keysym=Display::K_Pointer_Button1, casacore::Bool scrollingAllowed=true)
Constructor.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Int itsX2
Class providing draw style settings for visible DisplayTools.
Definition: DTVisible.h:95
Class which stores WorldCanvas position event information.
virtual void keyPressed(const WCPositionEvent &)
Functions called by the base class mouse event handling operators - these maintain the state of the p...
Base class for MultiWorldCanvas event-based tools.
Definition: MultiWCTool.h:89
casacore::Int itsX1
pixel coordinates of the pan vector.
casacore::Int itsLastKey
casacore::Bool itsActive
Should we respond to mouse movement and button release? Should we draw? Set when the button is pushed...
std::set< Region * > region_list_type
Definition: RegionEnums.h:14
virtual void zoomed(const casacore::Vector< casacore::Double > &, const casacore::Vector< casacore::Double > &)
Output callback to indicate that we have zoomed.
KeySym
Keysyms for PixelCanvas keyboard events.
Definition: DisplayEnums.h:412