casa
$Rev:20696$
|
Base class for MultiWorldCanvas event-based crosshair tools. More...
#include <MWCCrosshairTool.h>
Public Member Functions | |
MWCCrosshairTool (Display::KeySym keysym=Display::K_Pointer_Button1, const Bool persistent=True) | |
Constructor specifies the button to respond to, and whether the crosshair should remain on screen after the button is released. | |
virtual | ~MWCCrosshairTool () |
Destructor. | |
virtual void | get (Int &x, Int &y) const |
Retrieve the crosshair position in pixels. | |
virtual void | getLin (Double &x, Double &y) const |
Rectrive the crosshair position in Lin. | |
virtual void | getWorld (Double &x, Double &y) const |
Rectrive the crosshair position in World. | |
virtual void | disable () |
Switch the tool off: this calls the base class disable to turn off event handling, and then erases the crosshair if necessary. | |
virtual void | setCross (Bool cross=False) |
set crosshair cursor type | |
virtual void | reset (Bool skipRefresh=False) |
Reset to non-showing, non-active crosshair. | |
virtual void | handleEvent (DisplayEvent &ev) |
handle events, via new-style interface. | |
Protected Member Functions | |
virtual void | keyPressed (const WCPositionEvent &) |
Functions called by the base class mouse/kbd event handling operators-- and normally only those. | |
virtual void | keyReleased (const WCPositionEvent &) |
virtual void | otherKeyPressed (const WCPositionEvent &) |
virtual void | moved (const WCMotionEvent &, const viewer::region::region_list_type &) |
virtual void | draw (const WCRefreshEvent &, const viewer::region::region_list_type &) |
draw the crosshair on the object's currently active WC. | |
virtual void | crosshairReady (const String &) |
Called when the crosshair position has been chosen. | |
Private Member Functions | |
virtual void | set (Int x, Int y) |
Set the current position from pixel coordinates. | |
Private Attributes | |
Vector< Double > | itsPos |
the last crosshair position. | |
Vector< Double > | itsWorld |
Bool | itsPersist |
should the crosshair remain visible after its button is released? | |
Int | itsRadius |
what is the crosshair radius? (screen pixels) | |
Bool | itsShowing |
was the crosshair drawing visible after last refresh cycle? | |
Bool | itsShow |
should the crosshair be drawn when X,Y are in the zoom window? | |
Bool | itsCross |
draw crosshair | |
Bool | itsBtnDn |
is the crosshair's button down? (True when the tool's button was pressed in a WC where it is handling events, and has not yet been released, or the tool reset). |
Base class for MultiWorldCanvas event-based crosshair tools.
Public interface
<prerequisites> WCTool </prerequisites>
MWCCrosshairTool stands for MultiWorldCanvas Crosshair Tool.
This class adds to its base MWCTool to provide a tool for placing and moving a crosshair on a WorldCanvas. While MWCCrosshairTool is not abstract, it performs no useful function. The programmer should derive from this class, and override the crosshairReady function, which is called when the mouse button is pressed, moved, or released within a WC draw area where events are handled. The get() function then retrieves the crosshair position in screen pixels.
The crosshair will track the mouse as long as it is within the WC draw area and the button is pressed. The persistent parameter determines whether the crosshair remains visible once the button is released. The crosshair is removed when it is dragged off the draw area or the Esc key is pressed within the WC.
Many activities on the WorldCanvas will be based on the user causing some action by placing or moving a crosshair. Emitted positions are to be caught by some external process or method.
Definition at line 84 of file MWCCrosshairTool.h.
casa::MWCCrosshairTool::MWCCrosshairTool | ( | Display::KeySym | keysym = Display::K_Pointer_Button1 , |
const Bool | persistent = True |
||
) |
Constructor specifies the button to respond to, and whether the crosshair should remain on screen after the button is released.
Base class methods must also be called to register event handling for the desired WorldCanvas[es].
virtual casa::MWCCrosshairTool::~MWCCrosshairTool | ( | ) | [virtual] |
Destructor.
virtual void casa::MWCCrosshairTool::crosshairReady | ( | const String & | ) | [inline, protected, virtual] |
Called when the crosshair position has been chosen.
Override to handle the crosshair-position-ready 'event'. evtype is "down" "move" or "up" depending on the state of the mouse leading to this event.
Reimplemented in casa::QtOldCrossTool.
Definition at line 147 of file MWCCrosshairTool.h.
virtual void casa::MWCCrosshairTool::disable | ( | ) | [virtual] |
Switch the tool off: this calls the base class disable to turn off event handling, and then erases the crosshair if necessary.
Reimplemented from casa::MultiWCTool.
virtual void casa::MWCCrosshairTool::draw | ( | const WCRefreshEvent & | , |
const viewer::region::region_list_type & | |||
) | [protected, virtual] |
draw the crosshair on the object's currently active WC.
Only to be called by the base class refresh event handler. Derived objects should use refresh() if they need to redraw, but even that is normally handled automatically.
Reimplemented from casa::MultiWCTool.
virtual void casa::MWCCrosshairTool::get | ( | Int & | x, |
Int & | y | ||
) | const [virtual] |
Retrieve the crosshair position in pixels.
A derived crosshairReady() routine would use this.
virtual void casa::MWCCrosshairTool::getLin | ( | Double & | x, |
Double & | y | ||
) | const [virtual] |
Rectrive the crosshair position in Lin.
virtual void casa::MWCCrosshairTool::getWorld | ( | Double & | x, |
Double & | y | ||
) | const [virtual] |
Rectrive the crosshair position in World.
virtual void casa::MWCCrosshairTool::handleEvent | ( | DisplayEvent & | ev | ) | [virtual] |
handle events, via new-style interface.
Currently just for reset event.
Reimplemented from casa::DisplayEH.
virtual void casa::MWCCrosshairTool::keyPressed | ( | const WCPositionEvent & | ) | [protected, virtual] |
Functions called by the base class mouse/kbd event handling operators-- and normally only those.
This is the input that controls the crosshair's action. When the crosshair is ready (positioned on the draw area) the crosshairReady() routine is called.
Reimplemented from casa::MultiWCTool.
virtual void casa::MWCCrosshairTool::keyReleased | ( | const WCPositionEvent & | ) | [protected, virtual] |
Reimplemented from casa::MultiWCTool.
virtual void casa::MWCCrosshairTool::moved | ( | const WCMotionEvent & | , |
const viewer::region::region_list_type & | |||
) | [protected, virtual] |
Reimplemented from casa::MultiWCTool.
virtual void casa::MWCCrosshairTool::otherKeyPressed | ( | const WCPositionEvent & | ) | [protected, virtual] |
Reimplemented from casa::MultiWCTool.
virtual void casa::MWCCrosshairTool::reset | ( | Bool | skipRefresh = False | ) | [virtual] |
Reset to non-showing, non-active crosshair.
Refreshes if necessary to erase (unless skipRefresh==True). (Does not unregister from WCs or disable future event handling).
Reimplemented from casa::MultiWCTool.
virtual void casa::MWCCrosshairTool::set | ( | Int | x, |
Int | y | ||
) | [private, virtual] |
Set the current position from pixel coordinates.
To do: reset the tool when the WC CS (linToWorld) transformation changes. (There is a WorldCoordinateChange RefreshReason, but it is not currently used when WC CS/Coordinatehandlers are set/changed).
virtual void casa::MWCCrosshairTool::setCross | ( | Bool | cross = False | ) | [virtual] |
set crosshair cursor type
Bool casa::MWCCrosshairTool::itsBtnDn [private] |
is the crosshair's button down? (True when the tool's button was pressed in a WC where it is handling events, and has not yet been released, or the tool reset).
Definition at line 181 of file MWCCrosshairTool.h.
Bool casa::MWCCrosshairTool::itsCross [private] |
draw crosshair
Definition at line 176 of file MWCCrosshairTool.h.
Bool casa::MWCCrosshairTool::itsPersist [private] |
should the crosshair remain visible after its button is released?
Definition at line 164 of file MWCCrosshairTool.h.
Vector<Double> casa::MWCCrosshairTool::itsPos [private] |
the last crosshair position.
(zooms will change pixel but not linear coordinates; therefore this position is stored in the latter).
Definition at line 160 of file MWCCrosshairTool.h.
Int casa::MWCCrosshairTool::itsRadius [private] |
what is the crosshair radius? (screen pixels)
Definition at line 167 of file MWCCrosshairTool.h.
Bool casa::MWCCrosshairTool::itsShow [private] |
should the crosshair be drawn when X,Y are in the zoom window?
Definition at line 173 of file MWCCrosshairTool.h.
Bool casa::MWCCrosshairTool::itsShowing [private] |
was the crosshair drawing visible after last refresh cycle?
Definition at line 170 of file MWCCrosshairTool.h.
Vector<Double> casa::MWCCrosshairTool::itsWorld [private] |
Definition at line 161 of file MWCCrosshairTool.h.