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

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

#include <MultiWCTool.h>

Inheritance diagram for casa::MultiWCTool:
casa::DisplayTool casa::WCPositionEH casa::WCMotionEH casa::WCRefreshEH casa::DisplayEH casa::MWCCrosshairTool casa::MWCEllipseTool casa::MWCPannerTool casa::MWCPolylineTool casa::MWCPolyTool casa::MWCPositionVelocityTool casa::MWCRectTool casa::MWCRulerlineTool casa::RegionTool

Public Member Functions

 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 disable ()
 
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...
 
virtual void reset (casacore::Bool=false)
 Derived classes should implement this to return to the non-showing, non-active state. 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 void handleEvent (DisplayEvent &)
 Classes that contain this interface (i.e., derive from it) can override this method to implement actions for whatever types of DisplayEvent they're interested in. More...
 
virtual ~DisplayEH ()
 

Protected Member Functions

virtual void keyPressed (const WCPositionEvent &)
 Functions called by the local event handling operators - by default they do nothing, so a derived class needs only implement the events it cares about. More...
 
virtual void keyReleased (const WCPositionEvent &)
 
virtual void otherKeyPressed (const WCPositionEvent &)
 
virtual void otherKeyReleased (const WCPositionEvent &)
 
virtual void moved (const WCMotionEvent &, const viewer::region::region_list_type &)
 
virtual void updateRegion ()
 
virtual void clicked (casacore::Int, casacore::Int)
 
virtual void doubleClicked (casacore::Int, casacore::Int)
 
virtual void draw (const WCRefreshEvent &, const viewer::region::region_list_type &)
 Draw whatever should be drawn (if anything) on current WC. More...
 
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 Attributes

WorldCanvasitsCurrentWC
 WC being (or to be) drawn on (may be 0 initially). More...
 

Private Member Functions

 MultiWCTool ()
 copy, default constructors (do not use) More...
 
 MultiWCTool (const MultiWCTool &other)
 
MultiWCTooloperator= (const MultiWCTool &other)
 

Private Attributes

std::list< WorldCanvas * > itsWCList
 
casacore::Bool itsEventHandlersRegistered
 whether the event handlers are registered More...
 

Friends

class MWCRTZoomer
 The WorldCanvases to which this tool is connected. More...
 
class MWCPannerTool
 

Detailed Description

Base class for MultiWorldCanvas event-based tools.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

<prerequisites> WCPositionEH WCMotionEH WCRefreshEH </prerequisites>

Etymology

MultiWCTool stands for MultiWorldCanvas Tool

Synopsis

This class is a base class upon which tools which respond to various events on a WorldCanvas can be built. It wraps up the position, motion and refresh events so that the programmer sees them all coming into one class, where they can be dealt with in a unified manner. MultiWCTool is not actually abstract, so the programmer need only write handlers for the events in which they are interested.

Example

Motivation

The majority of tools written for the WorldCanvas will fall into the category that this class serves: they respond to a single key or mouse button, and they potentially need to respond to position, motion and refresh events.

To Do

Definition at line 89 of file MultiWCTool.h.

Constructor & Destructor Documentation

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.

virtual casa::MultiWCTool::~MultiWCTool ( )
virtual

Destructor.

casa::MultiWCTool::MultiWCTool ( )
private

copy, default constructors (do not use)

casa::MultiWCTool::MultiWCTool ( const MultiWCTool other)
private

Member Function Documentation

virtual void casa::MultiWCTool::addWorldCanvas ( WorldCanvas worldcanvas)
virtual

Add/remove a WorldCanvas from the control of this tool.

virtual void casa::MultiWCTool::addWorldCanvases ( PanelDisplay pdisp)
virtual

Add/Remove a list of WorldCanvases from PanelDisplay.

virtual void casa::MultiWCTool::clicked ( casacore::Int  ,
casacore::Int   
)
inlineprotectedvirtual
virtual void casa::MultiWCTool::disable ( )
virtual
virtual void casa::MultiWCTool::doubleClicked ( casacore::Int  ,
casacore::Int   
)
inlineprotectedvirtual
virtual void casa::MultiWCTool::draw ( const WCRefreshEvent ,
const viewer::region::region_list_type  
)
protectedvirtual
virtual void casa::MultiWCTool::enable ( )
virtual

Switch the tool on/off - this simply registers or unregisters the event handlers on the WorldCanvases.

Implements casa::DisplayTool.

Reimplemented in casa::RegionTool.

virtual void casa::MultiWCTool::keyPressed ( const WCPositionEvent )
protectedvirtual

Functions called by the local event handling operators - by default they do nothing, so a derived class needs only implement the events it cares about.

Reimplemented in casa::MultiPVTool, casa::MultiRectTool, casa::MultiPolyTool, casa::MultiPolylineTool, casa::MWCCrosshairTool, casa::MWCPolyTool, casa::MWCRectTool, casa::MWCEllipseTool, casa::MWCPolylineTool, casa::RegionTool, casa::MWCPannerTool, casa::MWCRulerlineTool, and casa::MWCPositionVelocityTool.

virtual void casa::MultiWCTool::keyReleased ( const WCPositionEvent )
protectedvirtual
virtual void casa::MultiWCTool::moved ( const WCMotionEvent ,
const viewer::region::region_list_type  
)
protectedvirtual
virtual void casa::MultiWCTool::operator() ( const WCPositionEvent ev)
virtual

Required operators for event handling - these are called when events occur, and distribute the events to the "user-level" methods.

Implements casa::WCPositionEH.

virtual void casa::MultiWCTool::operator() ( const WCMotionEvent ev)
virtual

default sends event to cout

Implements casa::WCMotionEH.

virtual void casa::MultiWCTool::operator() ( const WCRefreshEvent ev)
virtual

original handler interface (still used for WCRefreshEvents)

Implements casa::WCRefreshEH.

MultiWCTool& casa::MultiWCTool::operator= ( const MultiWCTool other)
private
virtual void casa::MultiWCTool::otherKeyPressed ( const WCPositionEvent )
protectedvirtual
virtual void casa::MultiWCTool::otherKeyReleased ( const WCPositionEvent )
protectedvirtual

Reimplemented in casa::RegionTool.

virtual void casa::MultiWCTool::refresh ( )
protectedvirtual

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.

Mouse and kbd event handlers within the tools now call this in response to drawing state changes, rather than calling draw() directly, so that only valid tool drawings are displayed, even when more than one is active. NB: the meaning of this routine has changed to be more in line with the rest of the DL (i.e., it now causes, rather than responds to, refresh events).

virtual void casa::MultiWCTool::removeWorldCanvas ( WorldCanvas worldcanvas)
virtual
virtual void casa::MultiWCTool::removeWorldCanvases ( PanelDisplay pdisp)
virtual
virtual void casa::MultiWCTool::reset ( casacore::Bool  = false)
inlinevirtual

Derived classes should implement this to return to the non-showing, non-active state.

It should not unregister the tool from WCs or disable event handling. If skipRefresh is false and the tool was showing, it also calls refresh() to erase. (The caller should set skipRefresh=true (only) if it will handle refresh itself).

Reimplemented in casa::MWCCrosshairTool, casa::MultiPVTool, casa::MultiRectTool, casa::MultiPolyTool, casa::MWCPolyTool, casa::MWCPolylineTool, casa::MWCRectTool, casa::MWCEllipseTool, casa::MultiPolylineTool, casa::MWCPannerTool, casa::MWCRulerlineTool, and casa::MWCPositionVelocityTool.

Definition at line 136 of file MultiWCTool.h.

virtual void casa::MultiWCTool::resetClip ( )
protectedvirtual
virtual void casa::MultiWCTool::setClipToDrawArea ( )
protectedvirtual

Cause subsequent drawing commands to be clipped to the current WC (or its drawing area).

Be sure to reset when finished drawing; clipping will apply to drawing on entire PC.

virtual void casa::MultiWCTool::setClipToWC ( )
protectedvirtual
virtual void casa::MultiWCTool::updateRegion ( )
inlineprotectedvirtual

Friends And Related Function Documentation

friend class MWCPannerTool
friend

Definition at line 193 of file MultiWCTool.h.

friend class MWCRTZoomer
friend

The WorldCanvases to which this tool is connected.

Definition at line 192 of file MultiWCTool.h.

Member Data Documentation

WorldCanvas* casa::MultiWCTool::itsCurrentWC
protected

WC being (or to be) drawn on (may be 0 initially).

WC where latest relevant input event was received.

Definition at line 180 of file MultiWCTool.h.

casacore::Bool casa::MultiWCTool::itsEventHandlersRegistered
private

whether the event handlers are registered

Definition at line 197 of file MultiWCTool.h.

std::list<WorldCanvas*> casa::MultiWCTool::itsWCList
private

Definition at line 194 of file MultiWCTool.h.


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