casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
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

List of all members.

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.
virtual ~MultiWCTool ()
 Destructor.
virtual void addWorldCanvas (WorldCanvas &worldcanvas)
 Add/remove a WorldCanvas from the control of this tool.
virtual void removeWorldCanvas (WorldCanvas &worldcanvas)
virtual void addWorldCanvases (PanelDisplay *pdisp)
 Add/Remove a list of WorldCanvases from PanelDisplay.
virtual void removeWorldCanvases (PanelDisplay *pdisp)
virtual void enable ()
 Switch the tool on/off - this simply registers or unregisters the event handlers on the WorldCanvases.
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.
virtual void operator() (const WCMotionEvent &ev)
 default sends event to cout
virtual void operator() (const WCRefreshEvent &ev)
 original handler interface (still used for WCRefreshEvents)
virtual void reset (Bool=False)
 Derived classes should implement this to return to the non-showing, non-active state.

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.
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 (Int, Int)
virtual void doubleClicked (Int, Int)
virtual void draw (const WCRefreshEvent &, const viewer::region::region_list_type &)
 Draw whatever should be drawn (if anything) on current WC.
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.
virtual void setClipToDrawArea ()
 Cause subsequent drawing commands to be clipped to the current WC (or its drawing area).
virtual void setClipToWC ()
virtual void resetClip ()

Protected Attributes

ListIter< WorldCanvas * > * itsWCListIter
 An iterator for the WorldCanvases.
WorldCanvasitsCurrentWC
 WC being (or to be) drawn on (may be 0 initially).

Private Member Functions

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

Private Attributes

List< WorldCanvas * > itsWCList
 The WorldCanvases to which this tool is connected.
Bool itsEventHandlersRegistered
 whether the event handlers are registered

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.

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 ( Int  ,
Int   
) [inline, protected, virtual]
virtual void casa::MultiWCTool::disable ( ) [virtual]
virtual void casa::MultiWCTool::doubleClicked ( Int  ,
Int   
) [inline, protected, virtual]
virtual void casa::MultiWCTool::draw ( const WCRefreshEvent ,
const viewer::region::region_list_type  
) [protected, virtual]
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 ) [protected, virtual]

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::MWCCrosshairTool, casa::MultiPolylineTool, casa::MWCPolyTool, casa::MWCEllipseTool, casa::MWCRectTool, casa::MWCPolylineTool, casa::MWCPannerTool, casa::RegionTool, casa::MWCRulerlineTool, and casa::MWCPositionVelocityTool.

virtual void casa::MultiWCTool::keyReleased ( const WCPositionEvent ) [protected, virtual]
virtual void casa::MultiWCTool::moved ( const WCMotionEvent ,
const viewer::region::region_list_type  
) [protected, virtual]
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 ) [protected, virtual]
virtual void casa::MultiWCTool::otherKeyReleased ( const WCPositionEvent ) [protected, virtual]

Reimplemented in casa::RegionTool.

virtual void casa::MultiWCTool::refresh ( ) [protected, virtual]

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 ( Bool  = False) [inline, virtual]

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::MWCPolylineTool, casa::MWCPolyTool, 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 ( ) [protected, virtual]
virtual void casa::MultiWCTool::setClipToDrawArea ( ) [protected, virtual]

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 ( ) [protected, virtual]
virtual void casa::MultiWCTool::updateRegion ( ) [inline, protected, virtual]

Member Data Documentation

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

WC where latest relevant input event was received.

Definition at line 183 of file MultiWCTool.h.

whether the event handlers are registered

Definition at line 198 of file MultiWCTool.h.

The WorldCanvases to which this tool is connected.

Definition at line 195 of file MultiWCTool.h.

An iterator for the WorldCanvases.

Definition at line 170 of file MultiWCTool.h.


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