casa
$Rev:20696$
|
Base class for WorldCanvas event-based rectangle tools. More...
#include <WCRectTool.h>
Public Member Functions | |
WCRectTool (WorldCanvas *wcanvas, Display::KeySym keysym=Display::K_Pointer_Button1, const Bool persistent=False) | |
Constructor. | |
virtual | ~WCRectTool () |
Destructor. | |
virtual void | disable () |
Switch the tool off - this calls the base class disable, and then erases the rectangle if it's around. | |
virtual void | keyPressed (const WCPositionEvent &ev) |
Functions called by the local event handling operators - these handle the drawing of the rectangle. | |
virtual void | keyReleased (const WCPositionEvent &ev) |
virtual void | otherKeyPressed (const WCPositionEvent &ev) |
virtual void | moved (const WCMotionEvent &ev, const viewer::region::region_list_type &) |
virtual void | refresh (const WCRefreshEvent &ev) |
virtual void | doubleInside () |
Functions special to the rectangle event handling - called when there is a double click inside/outside the rectangle. | |
virtual void | doubleOutside () |
virtual void | rectangleReady () |
Functions called when a rectangle is ready and not being editted, and when this status changes. | |
virtual void | rectangleNotReady () |
virtual void | get (Int &x1, Int &y1, Int &x2, Int &y2) const |
Retrieve the rectangle corners. | |
Private Types | |
enum | AdjustMode { Off, Move } |
adjustment mode More... | |
Private Member Functions | |
virtual void | set (const Int &x1, const Int &y1, const Int &x2, const Int &y2) |
set the coordinates of the rectangle | |
virtual void | set (const Int &x1, const Int &y1) |
set/get only the anchor point | |
virtual void | get (Int &x1, Int &y1) const |
virtual void | preserve () |
preserve/restore the world coordinates | |
virtual void | restore () |
virtual void | draw (const Bool drawHandles=False) |
draw the rubberband box on a PixelCanvas | |
virtual void | reset () |
reset this drawer | |
Private Attributes | |
Bool | itsRectanglePersistent |
do the rectangles persist after double clicks? | |
Bool | itsOnScreen |
is the rectangle on screen? | |
Bool | itsActive |
are we actively zooming? | |
Bool | itsMoved |
have we moved? | |
Bool | itsRectangleExists |
do we have a rectangle drawn yet? | |
WCRectTool::AdjustMode | itsAdjustMode |
Int | itsX1 |
coordinates of the rectangle: pixel and world | |
Int | itsY1 |
Int | itsX2 |
Int | itsY2 |
Vector< Double > | itsStoredWorldBlc |
Vector< Double > | itsStoredWorldTrc |
Vector< Int > | itsHX |
storage of the handle coordinates | |
Vector< Int > | itsHY |
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 rectangle tools.
Public interface
<prerequisites> WCTool </prerequisites>
WCRectTool stands for WorldCanvas Rectangle Tool
This class adds to its base WCTool to provide a tool for drawing, resizing and moving rectangles on a WorldCanvas. While WCRectTool is not abstract, it performs no useful function. The programmer should derive from this class, and implement the functions doubleInside and doubleOutside, which are called when the user double-clicks the key or mouse button inside or outside an existing rectangle respectively. It is up to the programmer to decide what double clicks inside and outside the rectangle correspond to, although it is recommended that a double click inside correspond to the main action of the tool, and a double click outside correspond to a secondary action of the tool, if indeed a secondary action exists.
The rectangle is drawn by dragging the mouse from one corner to the diagonally opposite corner. Once constructed, the rectangle can be resized by dragging its corners, or relocated by dragging inside the rectangle. The rectangle is removed from the display when the Esc key is pressed.
Many activities on the WorldCanvas will be based on the user drawing a rectangle, and then proceeding to some action with that rectangle. A nice example is zooming.
Definition at line 88 of file WCRectTool.h.
enum casa::WCRectTool::AdjustMode [private] |
casa::WCRectTool::WCRectTool | ( | WorldCanvas * | wcanvas, |
Display::KeySym | keysym = Display::K_Pointer_Button1 , |
||
const Bool | persistent = False |
||
) |
Constructor.
virtual casa::WCRectTool::~WCRectTool | ( | ) | [virtual] |
Destructor.
virtual void casa::WCRectTool::disable | ( | ) | [virtual] |
Switch the tool off - this calls the base class disable, and then erases the rectangle if it's around.
Reimplemented from casa::WCTool.
virtual void casa::WCRectTool::doubleInside | ( | ) | [inline, virtual] |
Functions special to the rectangle event handling - called when there is a double click inside/outside the rectangle.
Reimplemented in casa::WCRTRegion, and casa::WCRTZoomer.
Definition at line 120 of file WCRectTool.h.
virtual void casa::WCRectTool::doubleOutside | ( | ) | [inline, virtual] |
Reimplemented in casa::WCRTZoomer.
Definition at line 121 of file WCRectTool.h.
virtual void casa::WCRectTool::draw | ( | const Bool | drawHandles = False | ) | [private, virtual] |
draw the rubberband box on a PixelCanvas
virtual void casa::WCRectTool::get | ( | Int & | x1, |
Int & | y1, | ||
Int & | x2, | ||
Int & | y2 | ||
) | const [virtual] |
Retrieve the rectangle corners.
virtual void casa::WCRectTool::get | ( | Int & | x1, |
Int & | y1 | ||
) | const [private, virtual] |
virtual void casa::WCRectTool::keyPressed | ( | const WCPositionEvent & | ev | ) | [virtual] |
Functions called by the local event handling operators - these handle the drawing of the rectangle.
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::WCRectTool::keyReleased | ( | const WCPositionEvent & | ev | ) | [virtual] |
Reimplemented from casa::WCTool.
virtual void casa::WCRectTool::moved | ( | const WCMotionEvent & | ev, |
const viewer::region::region_list_type & | |||
) | [virtual] |
Reimplemented from casa::WCTool.
virtual void casa::WCRectTool::otherKeyPressed | ( | const WCPositionEvent & | ev | ) | [virtual] |
Reimplemented from casa::WCTool.
virtual void casa::WCRectTool::preserve | ( | ) | [private, virtual] |
preserve/restore the world coordinates
virtual void casa::WCRectTool::rectangleNotReady | ( | ) | [inline, virtual] |
Definition at line 128 of file WCRectTool.h.
virtual void casa::WCRectTool::rectangleReady | ( | ) | [inline, virtual] |
Functions called when a rectangle is ready and not being editted, and when this status changes.
Definition at line 127 of file WCRectTool.h.
virtual void casa::WCRectTool::refresh | ( | const WCRefreshEvent & | ev | ) | [virtual] |
Reimplemented from casa::WCTool.
virtual void casa::WCRectTool::reset | ( | ) | [private, virtual] |
reset this drawer
virtual void casa::WCRectTool::restore | ( | ) | [private, virtual] |
virtual void casa::WCRectTool::set | ( | const Int & | x1, |
const Int & | y1, | ||
const Int & | x2, | ||
const Int & | y2 | ||
) | [private, virtual] |
set the coordinates of the rectangle
virtual void casa::WCRectTool::set | ( | const Int & | x1, |
const Int & | y1 | ||
) | [private, virtual] |
set/get only the anchor point
Double casa::WCRectTool::its2ndLastPressTime [private] |
Definition at line 201 of file WCRectTool.h.
Int casa::WCRectTool::its2ndLastPressX [private] |
Definition at line 195 of file WCRectTool.h.
Int casa::WCRectTool::its2ndLastPressY [private] |
Definition at line 195 of file WCRectTool.h.
Bool casa::WCRectTool::itsActive [private] |
are we actively zooming?
Definition at line 143 of file WCRectTool.h.
Definition at line 156 of file WCRectTool.h.
Int casa::WCRectTool::itsBaseMoveX [private] |
position that move started from
Definition at line 191 of file WCRectTool.h.
Int casa::WCRectTool::itsBaseMoveY [private] |
Definition at line 191 of file WCRectTool.h.
Vector<Int> casa::WCRectTool::itsHX [private] |
storage of the handle coordinates
Definition at line 188 of file WCRectTool.h.
Vector<Int> casa::WCRectTool::itsHY [private] |
Definition at line 188 of file WCRectTool.h.
Double casa::WCRectTool::itsLastPressTime [private] |
store the times of the last two presses here:
Definition at line 201 of file WCRectTool.h.
Int casa::WCRectTool::itsLastPressX [private] |
position of last press event
Definition at line 194 of file WCRectTool.h.
Int casa::WCRectTool::itsLastPressY [private] |
Definition at line 194 of file WCRectTool.h.
Int casa::WCRectTool::itsLastReleaseX [private] |
position of last release event
Definition at line 198 of file WCRectTool.h.
Int casa::WCRectTool::itsLastReleaseY [private] |
Definition at line 198 of file WCRectTool.h.
Bool casa::WCRectTool::itsMoved [private] |
have we moved?
Definition at line 146 of file WCRectTool.h.
Bool casa::WCRectTool::itsOnScreen [private] |
is the rectangle on screen?
Definition at line 140 of file WCRectTool.h.
Bool casa::WCRectTool::itsRectangleExists [private] |
do we have a rectangle drawn yet?
Definition at line 149 of file WCRectTool.h.
Bool casa::WCRectTool::itsRectanglePersistent [private] |
do the rectangles persist after double clicks?
Definition at line 137 of file WCRectTool.h.
Vector<Double> casa::WCRectTool::itsStoredWorldBlc [private] |
Definition at line 161 of file WCRectTool.h.
Vector<Double> casa::WCRectTool::itsStoredWorldTrc [private] |
Definition at line 161 of file WCRectTool.h.
Int casa::WCRectTool::itsX1 [private] |
coordinates of the rectangle: pixel and world
Definition at line 160 of file WCRectTool.h.
Int casa::WCRectTool::itsX2 [private] |
Definition at line 160 of file WCRectTool.h.
Int casa::WCRectTool::itsY1 [private] |
Definition at line 160 of file WCRectTool.h.
Int casa::WCRectTool::itsY2 [private] |
Definition at line 160 of file WCRectTool.h.