casa
5.7.0-16
|
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 casacore::Bool persistent=false) | |
Constructor. More... | |
virtual | ~WCRectTool () |
Destructor. More... | |
virtual void | disable () |
Switch the tool off - this calls the base class disable, and then erases the rectangle if it's around. More... | |
virtual void | keyPressed (const WCPositionEvent &ev) |
Functions called by the local event handling operators - these handle the drawing of the rectangle. More... | |
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. More... | |
virtual void | doubleOutside () |
virtual void | rectangleReady () |
Functions called when a rectangle is ready and not being editted, and when this status changes. More... | |
virtual void | rectangleNotReady () |
virtual void | get (casacore::Int &x1, casacore::Int &y1, casacore::Int &x2, casacore::Int &y2) const |
Retrieve the rectangle corners. 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, const casacore::Int &x2, const casacore::Int &y2) |
set the coordinates of the rectangle More... | |
virtual void | set (const casacore::Int &x1, const casacore::Int &y1) |
set/get only the anchor point More... | |
virtual void | get (casacore::Int &x1, casacore::Int &y1) const |
virtual void | preserve () |
preserve/restore the world coordinates More... | |
virtual void | restore () |
virtual void | draw (const casacore::Bool drawHandles=false) |
draw the rubberband box on a 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 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.
|
private |
casa::WCRectTool::WCRectTool | ( | WorldCanvas * | wcanvas, |
Display::KeySym | keysym = Display::K_Pointer_Button1 , |
||
const casacore::Bool | persistent = false |
||
) |
Constructor.
|
virtual |
Destructor.
|
virtual |
Switch the tool off - this calls the base class disable, and then erases the rectangle if it's around.
Reimplemented from casa::WCTool.
|
inlinevirtual |
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.
|
inlinevirtual |
Reimplemented in casa::WCRTZoomer.
Definition at line 121 of file WCRectTool.h.
|
privatevirtual |
draw the rubberband box on a PixelCanvas
|
virtual |
Retrieve the rectangle corners.
|
privatevirtual |
|
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 |
Reimplemented from casa::WCTool.
|
virtual |
Reimplemented from casa::WCTool.
|
virtual |
Reimplemented from casa::WCTool.
|
privatevirtual |
preserve/restore the world coordinates
|
inlinevirtual |
Definition at line 128 of file WCRectTool.h.
|
inlinevirtual |
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 |
Reimplemented from casa::WCTool.
|
privatevirtual |
reset this drawer
|
privatevirtual |
|
privatevirtual |
set the coordinates of the rectangle
|
privatevirtual |
set/get only the anchor point
|
private |
Definition at line 201 of file WCRectTool.h.
|
private |
Definition at line 195 of file WCRectTool.h.
|
private |
Definition at line 195 of file WCRectTool.h.
|
private |
are we actively zooming?
Definition at line 143 of file WCRectTool.h.
|
private |
Definition at line 156 of file WCRectTool.h.
|
private |
position that move started from
Definition at line 191 of file WCRectTool.h.
|
private |
Definition at line 191 of file WCRectTool.h.
|
private |
storage of the handle coordinates
Definition at line 188 of file WCRectTool.h.
|
private |
Definition at line 188 of file WCRectTool.h.
|
private |
store the times of the last two presses here:
Definition at line 201 of file WCRectTool.h.
|
private |
position of last press event
Definition at line 194 of file WCRectTool.h.
|
private |
Definition at line 194 of file WCRectTool.h.
|
private |
position of last release event
Definition at line 198 of file WCRectTool.h.
|
private |
Definition at line 198 of file WCRectTool.h.
|
private |
have we moved?
Definition at line 146 of file WCRectTool.h.
|
private |
is the rectangle on screen?
Definition at line 140 of file WCRectTool.h.
|
private |
do we have a rectangle drawn yet?
Definition at line 149 of file WCRectTool.h.
|
private |
do the rectangles persist after double clicks?
Definition at line 137 of file WCRectTool.h.
|
private |
Definition at line 161 of file WCRectTool.h.
|
private |
Definition at line 161 of file WCRectTool.h.
|
private |
coordinates of the rectangle: pixel and world
Definition at line 160 of file WCRectTool.h.
|
private |
Definition at line 160 of file WCRectTool.h.
|
private |
Definition at line 160 of file WCRectTool.h.
|
private |
Definition at line 160 of file WCRectTool.h.