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

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

#include <MWCCrosshairTool.h>

Inheritance diagram for casa::MWCCrosshairTool:
casa::MultiWCTool casa::DTVisible casa::DisplayTool casa::WCPositionEH casa::WCMotionEH casa::WCRefreshEH casa::DisplayEH casa::QtOldCrossTool

Public Member Functions

 MWCCrosshairTool (Display::KeySym keysym=Display::K_Pointer_Button1, const casacore::Bool persistent=true)
 Constructor specifies the button to respond to, and whether the crosshair should remain on screen after the button is released. More...
 
virtual ~MWCCrosshairTool ()
 Destructor. More...
 
virtual void get (casacore::Int &x, casacore::Int &y) const
 Retrieve the crosshair position in pixels. More...
 
virtual void getLin (casacore::Double &x, casacore::Double &y) const
 Rectrive the crosshair position in Lin. More...
 
virtual void getWorld (casacore::Double &x, casacore::Double &y) const
 Rectrive the crosshair position in World. More...
 
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. More...
 
virtual void setCross (casacore::Bool cross=false)
 set crosshair cursor type More...
 
virtual void reset (casacore::Bool skipRefresh=false)
 Reset to non-showing, non-active crosshair. More...
 
virtual void handleEvent (DisplayEvent &ev)
 handle events, via new-style interface. More...
 
- Public Member Functions inherited from casa::MultiWCTool
 MultiWCTool (const Display::KeySym &keysym=Display::K_Pointer_Button1, bool enable_events=true)
 Constructor taking the primary key to which this tool will respond. More...
 
virtual ~MultiWCTool ()
 Destructor. More...
 
virtual void addWorldCanvas (WorldCanvas &worldcanvas)
 Add/remove a WorldCanvas from the control of this tool. More...
 
virtual void removeWorldCanvas (WorldCanvas &worldcanvas)
 
virtual void addWorldCanvases (PanelDisplay *pdisp)
 Add/Remove a list of WorldCanvases from PanelDisplay. More...
 
virtual void removeWorldCanvases (PanelDisplay *pdisp)
 
virtual void enable ()
 Switch the tool on/off - this simply registers or unregisters the event handlers on the WorldCanvases. More...
 
virtual void operator() (const WCPositionEvent &ev)
 Required operators for event handling - these are called when events occur, and distribute the events to the "user-level" methods. More...
 
virtual void operator() (const WCMotionEvent &ev)
 default sends event to cout More...
 
virtual void operator() (const WCRefreshEvent &ev)
 original handler interface (still used for WCRefreshEvents) 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::WCPositionEH
 WCPositionEH ()
 Default Constructor Required. More...
 
virtual ~WCPositionEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::WCMotionEH
 WCMotionEH ()
 Default Constructor Required. More...
 
virtual ~WCMotionEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::WCRefreshEH
 WCRefreshEH ()
 Default Constructor Required. More...
 
virtual ~WCRefreshEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::DisplayEH
virtual ~DisplayEH ()
 
- 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...
 

Protected Member Functions

virtual void keyPressed (const WCPositionEvent &)
 Functions called by the base class mouse/kbd event handling operators– and normally only those. More...
 
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. More...
 
virtual void crosshairReady (const casacore::String &)
 Called when the crosshair position has been chosen. More...
 
- Protected Member Functions inherited from casa::MultiWCTool
virtual void otherKeyReleased (const WCPositionEvent &)
 
virtual void updateRegion ()
 
virtual void clicked (casacore::Int, casacore::Int)
 
virtual void doubleClicked (casacore::Int, casacore::Int)
 
virtual void refresh ()
 Copy back-to-front buffer (erasing all MWCTool drawings), then cause this (and all MWCTools on current WC's PC) to draw (or not draw) themselves, according to their current state. More...
 
virtual void setClipToDrawArea ()
 Cause subsequent drawing commands to be clipped to the current WC (or its drawing area). More...
 
virtual void setClipToWC ()
 
virtual void resetClip ()
 
- 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...
 

Private Member Functions

virtual void set (casacore::Int x, casacore::Int y)
 Set the current position from pixel coordinates. More...
 

Private Attributes

casacore::Vector
< casacore::Double
itsPos
 the last crosshair position. More...
 
casacore::Vector
< casacore::Double
itsWorld
 
casacore::Bool itsPersist
 should the crosshair remain visible after its button is released? More...
 
casacore::Int itsRadius
 what is the crosshair radius? (screen pixels) More...
 
casacore::Bool itsShowing
 was the crosshair drawing visible after last refresh cycle? More...
 
casacore::Bool itsShow
 should the crosshair be drawn when X,Y are in the zoom window? More...
 
casacore::Bool itsCross
 draw crosshair More...
 
casacore::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). More...
 

Additional Inherited Members

- Protected Attributes inherited from casa::MultiWCTool
WorldCanvasitsCurrentWC
 WC being (or to be) drawn on (may be 0 initially). More...
 

Detailed Description

Base class for MultiWorldCanvas event-based crosshair tools.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

<prerequisites> WCTool </prerequisites>

Etymology

MWCCrosshairTool stands for MultiWorldCanvas Crosshair Tool.

Synopsis

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.

Example

Motivation

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.

Constructor & Destructor Documentation

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

Member Function Documentation

virtual void casa::MWCCrosshairTool::crosshairReady ( const casacore::String )
inlineprotectedvirtual

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  
)
protectedvirtual

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 ( casacore::Int x,
casacore::Int y 
) const
virtual

Retrieve the crosshair position in pixels.

A derived crosshairReady() routine would use this.

virtual void casa::MWCCrosshairTool::getLin ( casacore::Double x,
casacore::Double y 
) const
virtual

Rectrive the crosshair position in Lin.

virtual void casa::MWCCrosshairTool::getWorld ( casacore::Double x,
casacore::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 )
protectedvirtual

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 )
protectedvirtual

Reimplemented from casa::MultiWCTool.

virtual void casa::MWCCrosshairTool::moved ( const WCMotionEvent ,
const viewer::region::region_list_type  
)
protectedvirtual

Reimplemented from casa::MultiWCTool.

virtual void casa::MWCCrosshairTool::otherKeyPressed ( const WCPositionEvent )
protectedvirtual

Reimplemented from casa::MultiWCTool.

virtual void casa::MWCCrosshairTool::reset ( casacore::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 ( casacore::Int  x,
casacore::Int  y 
)
privatevirtual

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 ( casacore::Bool  cross = false)
virtual

set crosshair cursor type

Member Data Documentation

casacore::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.

casacore::Bool casa::MWCCrosshairTool::itsCross
private

draw crosshair

Definition at line 176 of file MWCCrosshairTool.h.

casacore::Bool casa::MWCCrosshairTool::itsPersist
private

should the crosshair remain visible after its button is released?

Definition at line 164 of file MWCCrosshairTool.h.

casacore::Vector<casacore::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.

casacore::Int casa::MWCCrosshairTool::itsRadius
private

what is the crosshair radius? (screen pixels)

Definition at line 167 of file MWCCrosshairTool.h.

casacore::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.

casacore::Bool casa::MWCCrosshairTool::itsShowing
private

was the crosshair drawing visible after last refresh cycle?

Definition at line 170 of file MWCCrosshairTool.h.

casacore::Vector<casacore::Double> casa::MWCCrosshairTool::itsWorld
private

Definition at line 161 of file MWCCrosshairTool.h.


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