casa
$Rev:20696$
|
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 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. | |
virtual | ~WCCrosshairTool () |
Destructor. | |
virtual void | disable () |
Switch the tool off: this calls the base class disable, and then erases the crosshair if necessary. | |
virtual void | keyPressed (const WCPositionEvent &) |
Functions called by the local event handling operators - these handle the drawing of the crosshair. | |
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. | |
virtual void | doubleOutside () |
virtual void | crosshairReady () |
Functions called when the crosshair is ready and not being editted, and when this status changes. | |
virtual void | crosshairNotReady () |
virtual void | get (Int &x1, Int &y1) const |
Retrieve the crosshair position. | |
Private Types | |
enum | AdjustMode { Off, Move } |
adjustment mode More... | |
Private Member Functions | |
virtual void | set (const Int &x1, const Int &y1) |
set the coordinates of the crosshair | |
virtual void | preserve () |
set/get only the anchor point | |
virtual void | restore () |
virtual void | draw (const Bool drawHandles=False) |
draw the crosshair on the WorldCanvas' PixelCanvas. | |
virtual void | reset () |
reset this drawer | |
Private Attributes | |
Bool | itsCrosshairPersistent |
does the crosshair persist after double clicks? | |
Int | itsCrosshairRadius |
what radius is the crosshair? in pixels | |
Bool | itsOnScreen |
is the crosshair on screen? | |
Bool | itsActive |
is some activity taking place with the crosshair? | |
Bool | itsMoved |
has the crosshair been moved? | |
Bool | itsCrosshairExists |
do we have a crosshair drawn yet? | |
WCCrosshairTool::AdjustMode | itsAdjustMode |
Int | itsX1 |
coordinates of the crosshair: pixel and world | |
Int | itsY1 |
Vector< Double > | itsStoredWorldPosition |
Int | itsBaseMoveX |
position that move started from | |
Int | itsBaseMoveY |
Int | itsLastPressX |
position of last press event | |
Int | itsLastPressY |
Int | its2ndLastPressX |
Int | its2ndLastPressY |
Int | itsLastReleaseX |
position of last release event | |
Int | itsLastReleaseY |
Double | itsLastPressTime |
store the times of the last two presses here: | |
Double | its2ndLastPressTime |
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.
enum casa::WCCrosshairTool::AdjustMode [private] |
casa::WCCrosshairTool::WCCrosshairTool | ( | WorldCanvas * | wcanvas, |
Display::KeySym | keysym = Display::K_Pointer_Button1 , |
||
const 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 casa::WCCrosshairTool::~WCCrosshairTool | ( | ) | [virtual] |
Destructor.
virtual void casa::WCCrosshairTool::crosshairNotReady | ( | ) | [inline, virtual] |
Definition at line 130 of file WCCrosshairTool.h.
virtual void casa::WCCrosshairTool::crosshairReady | ( | ) | [inline, virtual] |
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 void casa::WCCrosshairTool::disable | ( | ) | [virtual] |
Switch the tool off: this calls the base class disable, and then erases the crosshair if necessary.
Reimplemented from casa::WCTool.
virtual void casa::WCCrosshairTool::doubleInside | ( | ) | [inline, virtual] |
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.
virtual void casa::WCCrosshairTool::doubleOutside | ( | ) | [inline, virtual] |
Definition at line 123 of file WCCrosshairTool.h.
virtual void casa::WCCrosshairTool::draw | ( | const Bool | drawHandles = False | ) | [private, virtual] |
draw the crosshair on the WorldCanvas' PixelCanvas.
virtual void casa::WCCrosshairTool::get | ( | Int & | x1, |
Int & | y1 | ||
) | const [virtual] |
Retrieve the crosshair position.
virtual void casa::WCCrosshairTool::keyPressed | ( | const WCPositionEvent & | ) | [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 void casa::WCCrosshairTool::keyReleased | ( | const WCPositionEvent & | ) | [virtual] |
Reimplemented from casa::WCTool.
virtual void casa::WCCrosshairTool::moved | ( | const WCMotionEvent & | , |
const viewer::region::region_list_type & | |||
) | [virtual] |
Reimplemented from casa::WCTool.
virtual void casa::WCCrosshairTool::otherKeyPressed | ( | const WCPositionEvent & | ) | [virtual] |
Reimplemented from casa::WCTool.
virtual void casa::WCCrosshairTool::preserve | ( | ) | [private, virtual] |
set/get only the anchor point
virtual void set(const Int &x1, const Int &y1); virtual void get(Int &x1, Int &y1) const ;
preserve/restore the world coordinates
virtual void casa::WCCrosshairTool::refresh | ( | const WCRefreshEvent & | ) | [virtual] |
Reimplemented from casa::WCTool.
virtual void casa::WCCrosshairTool::reset | ( | ) | [private, virtual] |
reset this drawer
virtual void casa::WCCrosshairTool::restore | ( | ) | [private, virtual] |
virtual void casa::WCCrosshairTool::set | ( | const Int & | x1, |
const Int & | y1 | ||
) | [private, virtual] |
set the coordinates of the crosshair
Definition at line 203 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::its2ndLastPressX [private] |
Definition at line 197 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::its2ndLastPressY [private] |
Definition at line 197 of file WCCrosshairTool.h.
Bool casa::WCCrosshairTool::itsActive [private] |
is some activity taking place with the crosshair?
Definition at line 148 of file WCCrosshairTool.h.
Definition at line 161 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::itsBaseMoveX [private] |
position that move started from
Definition at line 193 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::itsBaseMoveY [private] |
Definition at line 193 of file WCCrosshairTool.h.
do we have a crosshair drawn yet?
Definition at line 154 of file WCCrosshairTool.h.
does the crosshair persist after double clicks?
Definition at line 139 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::itsCrosshairRadius [private] |
what radius is the crosshair? in pixels
Definition at line 142 of file WCCrosshairTool.h.
store the times of the last two presses here:
Definition at line 203 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::itsLastPressX [private] |
position of last press event
Definition at line 196 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::itsLastPressY [private] |
Definition at line 196 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::itsLastReleaseX [private] |
position of last release event
Definition at line 200 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::itsLastReleaseY [private] |
Definition at line 200 of file WCCrosshairTool.h.
Bool casa::WCCrosshairTool::itsMoved [private] |
has the crosshair been moved?
Definition at line 151 of file WCCrosshairTool.h.
Bool casa::WCCrosshairTool::itsOnScreen [private] |
is the crosshair on screen?
Definition at line 145 of file WCCrosshairTool.h.
Definition at line 166 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::itsX1 [private] |
coordinates of the crosshair: pixel and world
Definition at line 165 of file WCCrosshairTool.h.
Int casa::WCCrosshairTool::itsY1 [private] |
Definition at line 165 of file WCCrosshairTool.h.