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::WCCrosshairTool Class Reference

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

#include <WCCrosshairTool.h>

Inheritance diagram for casa::WCCrosshairTool:
casa::WCTool casa::DTVisible casa::DisplayTool

Public Member Functions

 WCCrosshairTool (WorldCanvas *wcanvas, Display::KeySym keysym=Display::K_Pointer_Button1, const casacore::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. More...
 
virtual ~WCCrosshairTool ()
 Destructor. More...
 
virtual void disable ()
 Switch the tool off: this calls the base class disable, and then erases the crosshair if necessary. More...
 
virtual void keyPressed (const WCPositionEvent &)
 Functions called by the local event handling operators - these handle the drawing of the crosshair. More...
 
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. More...
 
virtual void doubleOutside ()
 
virtual void crosshairReady ()
 Functions called when the crosshair is ready and not being editted, and when this status changes. More...
 
virtual void crosshairNotReady ()
 
virtual void get (casacore::Int &x1, casacore::Int &y1) const
 Retrieve the crosshair position. 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)
 set the coordinates of the crosshair More...
 
virtual void preserve ()
 set/get only the anchor point More...
 
virtual void restore ()
 
virtual void draw (const casacore::Bool drawHandles=false)
 draw the crosshair on the WorldCanvas' PixelCanvas. More...
 
virtual void reset ()
 reset this drawer More...
 

Private Attributes

casacore::Bool itsCrosshairPersistent
 does the crosshair persist after double clicks? More...
 
casacore::Int itsCrosshairRadius
 what radius is the crosshair? in pixels More...
 
casacore::Bool itsOnScreen
 is the crosshair on screen? More...
 
casacore::Bool itsActive
 is some activity taking place with the crosshair? More...
 
casacore::Bool itsMoved
 has the crosshair been moved? More...
 
casacore::Bool itsCrosshairExists
 do we have a crosshair drawn yet? More...
 
WCCrosshairTool::AdjustMode itsAdjustMode
 
casacore::Int itsX1
 coordinates of the crosshair: pixel and world More...
 
casacore::Int itsY1
 
casacore::Vector
< casacore::Double
itsStoredWorldPosition
 
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 crosshair tools.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

<prerequisites> WCTool </prerequisites>

Etymology

WCCrosshairTool stands for WorldCanvas Crosshair Tool.

Synopsis

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.

Example

Motivation

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.

Member Enumeration Documentation

adjustment mode

Enumerator
Off 
Move 

Definition at line 157 of file WCCrosshairTool.h.

Constructor & Destructor Documentation

casa::WCCrosshairTool::WCCrosshairTool ( WorldCanvas wcanvas,
Display::KeySym  keysym = Display::K_Pointer_Button1,
const casacore::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.

Member Function Documentation

virtual void casa::WCCrosshairTool::crosshairNotReady ( )
inlinevirtual

Definition at line 130 of file WCCrosshairTool.h.

virtual void casa::WCCrosshairTool::crosshairReady ( )
inlinevirtual

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

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

Definition at line 123 of file WCCrosshairTool.h.

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

draw the crosshair on the WorldCanvas' PixelCanvas.

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

set/get only the anchor point

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

reset this drawer

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

set the coordinates of the crosshair

Member Data Documentation

casacore::Double casa::WCCrosshairTool::its2ndLastPressTime
private

Definition at line 203 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::its2ndLastPressX
private

Definition at line 197 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::its2ndLastPressY
private

Definition at line 197 of file WCCrosshairTool.h.

casacore::Bool casa::WCCrosshairTool::itsActive
private

is some activity taking place with the crosshair?

Definition at line 148 of file WCCrosshairTool.h.

WCCrosshairTool::AdjustMode casa::WCCrosshairTool::itsAdjustMode
private

Definition at line 161 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::itsBaseMoveX
private

position that move started from

Definition at line 193 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::itsBaseMoveY
private

Definition at line 193 of file WCCrosshairTool.h.

casacore::Bool casa::WCCrosshairTool::itsCrosshairExists
private

do we have a crosshair drawn yet?

Definition at line 154 of file WCCrosshairTool.h.

casacore::Bool casa::WCCrosshairTool::itsCrosshairPersistent
private

does the crosshair persist after double clicks?

Definition at line 139 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::itsCrosshairRadius
private

what radius is the crosshair? in pixels

Definition at line 142 of file WCCrosshairTool.h.

casacore::Double casa::WCCrosshairTool::itsLastPressTime
private

store the times of the last two presses here:

Definition at line 203 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::itsLastPressX
private

position of last press event

Definition at line 196 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::itsLastPressY
private

Definition at line 196 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::itsLastReleaseX
private

position of last release event

Definition at line 200 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::itsLastReleaseY
private

Definition at line 200 of file WCCrosshairTool.h.

casacore::Bool casa::WCCrosshairTool::itsMoved
private

has the crosshair been moved?

Definition at line 151 of file WCCrosshairTool.h.

casacore::Bool casa::WCCrosshairTool::itsOnScreen
private

is the crosshair on screen?

Definition at line 145 of file WCCrosshairTool.h.

casacore::Vector<casacore::Double> casa::WCCrosshairTool::itsStoredWorldPosition
private

Definition at line 166 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::itsX1
private

coordinates of the crosshair: pixel and world

Definition at line 165 of file WCCrosshairTool.h.

casacore::Int casa::WCCrosshairTool::itsY1
private

Definition at line 165 of file WCCrosshairTool.h.


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