casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
casa::WCRectTool Class Reference

Base class for WorldCanvas event-based rectangle tools. More...

#include <WCRectTool.h>

Inheritance diagram for casa::WCRectTool:
casa::WCTool casa::DTVisible casa::DisplayTool casa::WCRTRegion casa::WCRTZoomer

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 WorldCanvasworldCanvas () const
 Get the WorldCanvas that this Tool is attached to. More...
 
virtual PixelCanvaspixelCanvas () 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...
 

Private Attributes

casacore::Bool itsRectanglePersistent
 do the rectangles persist after double clicks? More...
 
casacore::Bool itsOnScreen
 is the rectangle on screen? More...
 
casacore::Bool itsActive
 are we actively zooming? More...
 
casacore::Bool itsMoved
 have we moved? More...
 
casacore::Bool itsRectangleExists
 do we have a rectangle drawn yet? More...
 
WCRectTool::AdjustMode itsAdjustMode
 
casacore::Int itsX1
 coordinates of the rectangle: pixel and world More...
 
casacore::Int itsY1
 
casacore::Int itsX2
 
casacore::Int itsY2
 
casacore::Vector
< casacore::Double
itsStoredWorldBlc
 
casacore::Vector
< casacore::Double
itsStoredWorldTrc
 
casacore::Vector< casacore::IntitsHX
 storage of the handle coordinates More...
 
casacore::Vector< casacore::IntitsHY
 
casacore::Int itsBaseMoveX
 position that move started from More...
 
casacore::Int itsBaseMoveY
 
casacore::Int itsLastPressX
 position of last press event More...
 
casacore::Int itsLastPressY
 
casacore::Int its2ndLastPressX
 
casacore::Int its2ndLastPressY
 
casacore::Int itsLastReleaseX
 position of last release event More...
 
casacore::Int itsLastReleaseY
 
casacore::Double itsLastPressTime
 store the times of the last two presses here: More...
 
casacore::Double its2ndLastPressTime
 

Additional Inherited Members

- Protected Member Functions inherited from casa::WCTool
 WCTool ()
 (Required) default constructor. More...
 
 WCTool (const WCTool &other)
 (Required) copy constructor. More...
 
WCTooloperator= (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...
 
DisplayTooloperator= (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...
 
DTVisibleoperator= (const DTVisible &other)
 (Required) copy assignment. More...
 

Detailed Description

Base class for WorldCanvas event-based rectangle tools.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

<prerequisites> WCTool </prerequisites>

Etymology

WCRectTool stands for WorldCanvas Rectangle Tool

Synopsis

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.

Example

Motivation

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.

To Do

Definition at line 88 of file WCRectTool.h.

Member Enumeration Documentation

adjustment mode

Enumerator
Off 
Move 

Definition at line 152 of file WCRectTool.h.

Constructor & Destructor Documentation

casa::WCRectTool::WCRectTool ( WorldCanvas wcanvas,
Display::KeySym  keysym = Display::K_Pointer_Button1,
const casacore::Bool  persistent = false 
)

Constructor.

virtual casa::WCRectTool::~WCRectTool ( )
virtual

Destructor.

Member Function Documentation

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 ( )
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.

virtual void casa::WCRectTool::doubleOutside ( )
inlinevirtual

Reimplemented in casa::WCRTZoomer.

Definition at line 121 of file WCRectTool.h.

virtual void casa::WCRectTool::draw ( const casacore::Bool  drawHandles = false)
privatevirtual

draw the rubberband box on a PixelCanvas

virtual void casa::WCRectTool::get ( casacore::Int x1,
casacore::Int y1,
casacore::Int x2,
casacore::Int y2 
) const
virtual

Retrieve the rectangle corners.

virtual void casa::WCRectTool::get ( casacore::Int x1,
casacore::Int y1 
) const
privatevirtual
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 ( )
privatevirtual

preserve/restore the world coordinates

virtual void casa::WCRectTool::rectangleNotReady ( )
inlinevirtual

Definition at line 128 of file WCRectTool.h.

virtual void casa::WCRectTool::rectangleReady ( )
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 void casa::WCRectTool::refresh ( const WCRefreshEvent ev)
virtual

Reimplemented from casa::WCTool.

virtual void casa::WCRectTool::reset ( )
privatevirtual

reset this drawer

virtual void casa::WCRectTool::restore ( )
privatevirtual
virtual void casa::WCRectTool::set ( const casacore::Int x1,
const casacore::Int y1,
const casacore::Int x2,
const casacore::Int y2 
)
privatevirtual

set the coordinates of the rectangle

virtual void casa::WCRectTool::set ( const casacore::Int x1,
const casacore::Int y1 
)
privatevirtual

set/get only the anchor point

Member Data Documentation

casacore::Double casa::WCRectTool::its2ndLastPressTime
private

Definition at line 201 of file WCRectTool.h.

casacore::Int casa::WCRectTool::its2ndLastPressX
private

Definition at line 195 of file WCRectTool.h.

casacore::Int casa::WCRectTool::its2ndLastPressY
private

Definition at line 195 of file WCRectTool.h.

casacore::Bool casa::WCRectTool::itsActive
private

are we actively zooming?

Definition at line 143 of file WCRectTool.h.

WCRectTool::AdjustMode casa::WCRectTool::itsAdjustMode
private

Definition at line 156 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsBaseMoveX
private

position that move started from

Definition at line 191 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsBaseMoveY
private

Definition at line 191 of file WCRectTool.h.

casacore::Vector<casacore::Int> casa::WCRectTool::itsHX
private

storage of the handle coordinates

Definition at line 188 of file WCRectTool.h.

casacore::Vector<casacore::Int> casa::WCRectTool::itsHY
private

Definition at line 188 of file WCRectTool.h.

casacore::Double casa::WCRectTool::itsLastPressTime
private

store the times of the last two presses here:

Definition at line 201 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsLastPressX
private

position of last press event

Definition at line 194 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsLastPressY
private

Definition at line 194 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsLastReleaseX
private

position of last release event

Definition at line 198 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsLastReleaseY
private

Definition at line 198 of file WCRectTool.h.

casacore::Bool casa::WCRectTool::itsMoved
private

have we moved?

Definition at line 146 of file WCRectTool.h.

casacore::Bool casa::WCRectTool::itsOnScreen
private

is the rectangle on screen?

Definition at line 140 of file WCRectTool.h.

casacore::Bool casa::WCRectTool::itsRectangleExists
private

do we have a rectangle drawn yet?

Definition at line 149 of file WCRectTool.h.

casacore::Bool casa::WCRectTool::itsRectanglePersistent
private

do the rectangles persist after double clicks?

Definition at line 137 of file WCRectTool.h.

casacore::Vector<casacore::Double> casa::WCRectTool::itsStoredWorldBlc
private

Definition at line 161 of file WCRectTool.h.

casacore::Vector<casacore::Double> casa::WCRectTool::itsStoredWorldTrc
private

Definition at line 161 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsX1
private

coordinates of the rectangle: pixel and world

Definition at line 160 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsX2
private

Definition at line 160 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsY1
private

Definition at line 160 of file WCRectTool.h.

casacore::Int casa::WCRectTool::itsY2
private

Definition at line 160 of file WCRectTool.h.


The documentation for this class was generated from the following file: