casa
5.7.0-16
|
Base class for WorldCanvas event-based crosshair tools. More...
#include <WCCrosshairTool.h>
Public Member Functions | |
WCCrosshairTool (WorldCanvas *wcanvas, Display::KeySym keysym=Display::K_Pointer_Button1, const casacore::Bool persistent=true) | |
Constructor requires a WorldCanvas to operate on, and optional specifications of the key to respond to, and whether the crosshair should be persistent. More... | |
virtual | ~WCCrosshairTool () |
Destructor. More... | |
virtual void | disable () |
Switch the tool off: this calls the base class disable, and then erases the crosshair if necessary. More... | |
virtual void | keyPressed (const WCPositionEvent &) |
Functions called by the local event handling operators - these handle the drawing of the crosshair. More... | |
virtual void | keyReleased (const WCPositionEvent &) |
virtual void | otherKeyPressed (const WCPositionEvent &) |
virtual void | moved (const WCMotionEvent &, const viewer::region::region_list_type &) |
virtual void | refresh (const WCRefreshEvent &) |
virtual void | doubleInside () |
Functions special to the crosshair event handling: called when there is a double click inside or outside the crosshair. More... | |
virtual void | doubleOutside () |
virtual void | crosshairReady () |
Functions called when the crosshair is ready and not being editted, and when this status changes. More... | |
virtual void | crosshairNotReady () |
virtual void | get (casacore::Int &x1, casacore::Int &y1) const |
Retrieve the crosshair position. More... | |
Public Member Functions inherited from casa::WCTool | |
WCTool (WorldCanvas *wcanvas, const Display::KeySym &keysym=Display::K_Pointer_Button1) | |
Constructor taking a pointer to a WorldCanvas to which this tool will attach, and a primary key to respond to. More... | |
virtual | ~WCTool () |
Destructor. More... | |
virtual void | enable () |
Switch the tool on/off - this simply registers or unregisters the event handlers. More... | |
virtual void | operator() (const WCPositionEvent &ev) |
Required operators for event handling - these are called when an events occur, and distribute the events to the "user-level" methods. More... | |
virtual void | operator() (const WCMotionEvent &ev) |
virtual void | operator() (const WCRefreshEvent &ev) |
virtual void | otherKeyReleased (const WCPositionEvent &) |
virtual WorldCanvas * | worldCanvas () const |
Get the WorldCanvas that this Tool is attached to. More... | |
virtual PixelCanvas * | pixelCanvas () const |
Get the PixelCanvas that this Tool is attached to via its WorldCanvas. More... | |
Public Member Functions inherited from casa::DisplayTool | |
virtual | ~DisplayTool () |
Destructor. More... | |
virtual void | setKey (const Display::KeySym &keysym) |
Set/get which key to catch. More... | |
virtual Display::KeySym | getKey () const |
Public Member Functions inherited from casa::DTVisible | |
DTVisible () | |
Default constructor. More... | |
virtual | ~DTVisible () |
Destructor. More... | |
virtual casacore::String | drawColor () const |
Return the color to use. More... | |
virtual casacore::Int | lineWidth () const |
Return the line width to use. More... | |
virtual casacore::Double | doubleClickInterval () const |
Return the double click interval (in seconds). More... | |
Private Types | |
enum | AdjustMode { Off, Move } |
adjustment mode More... | |
Private Member Functions | |
virtual void | set (const casacore::Int &x1, const casacore::Int &y1) |
set the coordinates of the crosshair More... | |
virtual void | preserve () |
set/get only the anchor point More... | |
virtual void | restore () |
virtual void | draw (const casacore::Bool drawHandles=false) |
draw the crosshair on the WorldCanvas' PixelCanvas. More... | |
virtual void | reset () |
reset this drawer More... | |
Additional Inherited Members | |
Protected Member Functions inherited from casa::WCTool | |
WCTool () | |
(Required) default constructor. More... | |
WCTool (const WCTool &other) | |
(Required) copy constructor. More... | |
WCTool & | operator= (const WCTool &other) |
(Required) copy assignment. More... | |
Protected Member Functions inherited from casa::DisplayTool | |
DisplayTool (const Display::KeySym &keysym=Display::K_Pointer_Button1) | |
Constructor taking a key to which this tool will initially be attached, typically one of the pointer buttons. More... | |
DisplayTool (const DisplayTool &other) | |
Copy constructor - construct a new DisplayTool from other , using copy semantics. More... | |
DisplayTool & | operator= (const DisplayTool &other) |
Copy assignment using copy semantics. More... | |
Display::KeyModifier | keyModifiers () |
Return the modifier mask. More... | |
Protected Member Functions inherited from casa::DTVisible | |
DTVisible (const DTVisible &other) | |
(Required) copy constructor. More... | |
DTVisible & | operator= (const DTVisible &other) |
(Required) copy assignment. More... | |
Base class for WorldCanvas event-based crosshair tools.
Public interface
<prerequisites> WCTool </prerequisites>
WCCrosshairTool stands for WorldCanvas Crosshair Tool.
This class adds to its base WCTool to provide a tool for placing and moving a crosshair on a WorldCanvas. While WCCrosshairTool is not abstract, it performs no useful function. The programmer should derive from this class, and override the functions doubleInside and doubleOutside, which are called when the user double-clicks the key or mouse button inside or outside the existing crosshair respectively. It is up to the programmer to decide what double clicks inside and outside the crosshair correspond to, although it is recommended that a double click inside correspond to the main action of the tool (eg. emitting the current position to an outside controller), and a double click outside correspond to a secondary action of the tool, if indeed a secondary action exists.
The crosshair is drawn by simply clicking at the location the crosshair should be placed. Once constructed, the crosshair can be relocated by dragging inside the crosshair. The crosshair is removed from the display when the Esc key is pressed.
Many activities on the WorldCanvas will be based on the user placing a crosshair, and then proceeding to some action with that crosshair. A nice example is emitting positions to be caught by some external controlling process.
Definition at line 88 of file WCCrosshairTool.h.
|
private |
casa::WCCrosshairTool::WCCrosshairTool | ( | WorldCanvas * | wcanvas, |
Display::KeySym | keysym = Display::K_Pointer_Button1 , |
||
const casacore::Bool | persistent = true |
||
) |
Constructor requires a WorldCanvas to operate on, and optional specifications of the key to respond to, and whether the crosshair should be persistent.
A persistent crosshair will "stick around" after a double click action.
|
virtual |
Destructor.
|
inlinevirtual |
Definition at line 130 of file WCCrosshairTool.h.
|
inlinevirtual |
Functions called when the crosshair is ready and not being editted, and when this status changes.
Definition at line 129 of file WCCrosshairTool.h.
|
virtual |
Switch the tool off: this calls the base class disable, and then erases the crosshair if necessary.
Reimplemented from casa::WCTool.
|
inlinevirtual |
Functions special to the crosshair event handling: called when there is a double click inside or outside the crosshair.
Definition at line 122 of file WCCrosshairTool.h.
|
inlinevirtual |
Definition at line 123 of file WCCrosshairTool.h.
|
privatevirtual |
draw the crosshair on the WorldCanvas' PixelCanvas.
|
virtual |
Retrieve the crosshair position.
|
virtual |
Functions called by the local event handling operators - these handle the drawing of the crosshair.
In special conditions, namely double clicking the key, they will pass control on to the doubleInside and doubleOutside functions.
Reimplemented from casa::WCTool.
|
virtual |
Reimplemented from casa::WCTool.
|
virtual |
Reimplemented from casa::WCTool.
|
virtual |
Reimplemented from casa::WCTool.
|
privatevirtual |
set/get only the anchor point
virtual void set(const casacore::Int &x1, const casacore::Int &y1); virtual void get(casacore::Int &x1, casacore::Int &y1) const ;
preserve/restore the world coordinates
|
virtual |
Reimplemented from casa::WCTool.
|
privatevirtual |
reset this drawer
|
privatevirtual |
|
privatevirtual |
set the coordinates of the crosshair
|
private |
Definition at line 203 of file WCCrosshairTool.h.
|
private |
Definition at line 197 of file WCCrosshairTool.h.
|
private |
Definition at line 197 of file WCCrosshairTool.h.
|
private |
is some activity taking place with the crosshair?
Definition at line 148 of file WCCrosshairTool.h.
|
private |
Definition at line 161 of file WCCrosshairTool.h.
|
private |
position that move started from
Definition at line 193 of file WCCrosshairTool.h.
|
private |
Definition at line 193 of file WCCrosshairTool.h.
|
private |
do we have a crosshair drawn yet?
Definition at line 154 of file WCCrosshairTool.h.
|
private |
does the crosshair persist after double clicks?
Definition at line 139 of file WCCrosshairTool.h.
|
private |
what radius is the crosshair? in pixels
Definition at line 142 of file WCCrosshairTool.h.
|
private |
store the times of the last two presses here:
Definition at line 203 of file WCCrosshairTool.h.
|
private |
position of last press event
Definition at line 196 of file WCCrosshairTool.h.
|
private |
Definition at line 196 of file WCCrosshairTool.h.
|
private |
position of last release event
Definition at line 200 of file WCCrosshairTool.h.
|
private |
Definition at line 200 of file WCCrosshairTool.h.
|
private |
has the crosshair been moved?
Definition at line 151 of file WCCrosshairTool.h.
|
private |
is the crosshair on screen?
Definition at line 145 of file WCCrosshairTool.h.
|
private |
Definition at line 166 of file WCCrosshairTool.h.
|
private |
coordinates of the crosshair: pixel and world
Definition at line 165 of file WCCrosshairTool.h.
|
private |
Definition at line 165 of file WCCrosshairTool.h.