casa
$Rev:20696$
|
Base class for MultiWorldCanvas event-based tools. More...
#include <MultiWCTool.h>
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. | |
WorldCanvas * | itsCurrentWC |
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) | |
MultiWCTool & | operator= (const MultiWCTool &other) |
Private Attributes | |
List< WorldCanvas * > | itsWCList |
The WorldCanvases to which this tool is connected. | |
Bool | itsEventHandlersRegistered |
whether the event handlers are registered |
Base class for MultiWorldCanvas event-based tools.
Public interface
<prerequisites> WCPositionEH WCMotionEH WCRefreshEH </prerequisites>
MultiWCTool stands for MultiWorldCanvas Tool
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.
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.
Definition at line 89 of file MultiWCTool.h.
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] |
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] |
Reimplemented in casa::QtPVToolRegion, casa::QtPolylineToolRegion, casa::QtPTRegion, casa::QtELRegion, casa::QtOldPTRegion, casa::QtPointRegion, casa::QtOldELRegion, casa::QtRTRegion, and casa::QtOldRTRegion.
Definition at line 150 of file MultiWCTool.h.
virtual void casa::MultiWCTool::disable | ( | ) | [virtual] |
Implements casa::DisplayTool.
Reimplemented in casa::RegionTool, casa::MWCCrosshairTool, casa::MultiPVTool, casa::MultiRectTool, casa::MultiPolyTool, casa::MWCPolylineTool, casa::MWCPolyTool, casa::MWCRectTool, casa::MWCEllipseTool, and casa::MultiPolylineTool.
virtual void casa::MultiWCTool::doubleClicked | ( | Int | , |
Int | |||
) | [inline, protected, virtual] |
Reimplemented in casa::QtPVToolRegion, casa::QtPolylineToolRegion, casa::QtPTRegion, casa::QtELRegion, casa::QtOldPTRegion, casa::QtPointRegion, casa::QtOldELRegion, casa::QtRTRegion, and casa::QtOldRTRegion.
Definition at line 151 of file MultiWCTool.h.
virtual void casa::MultiWCTool::draw | ( | const WCRefreshEvent & | , |
const viewer::region::region_list_type & | |||
) | [protected, virtual] |
Draw whatever should be drawn (if anything) on current WC.
Should only be called by refresh event handler.
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::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] |
Reimplemented in casa::MultiPVTool, casa::MultiRectTool, casa::MultiPolyTool, casa::MultiPolylineTool, casa::MWCCrosshairTool, casa::MWCPolyTool, casa::MWCEllipseTool, casa::MWCPolylineTool, casa::MWCRectTool, casa::MWCPannerTool, casa::RegionTool, casa::MWCRulerlineTool, and casa::MWCPositionVelocityTool.
virtual void casa::MultiWCTool::moved | ( | const WCMotionEvent & | , |
const viewer::region::region_list_type & | |||
) | [protected, virtual] |
Reimplemented in casa::MultiPVTool, casa::MultiRectTool, casa::MultiPolyTool, casa::MWCCrosshairTool, casa::MultiPolylineTool, casa::MWCEllipseTool, casa::MWCPolyTool, casa::MWCRectTool, casa::MWCPolylineTool, casa::MWCPannerTool, casa::RegionTool, casa::MWCRulerlineTool, and casa::MWCPositionVelocityTool.
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] |
Reimplemented in casa::QtPVTool, casa::QtCrossTool, casa::QtRectTool, casa::QtEllipseTool, casa::QtOldRectTool, casa::QtPolylineTool, casa::QtOldEllipseTool, casa::QtPolyTool, and casa::QtOldPolyTool.
Definition at line 149 of file MultiWCTool.h.
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 183 of file MultiWCTool.h.
whether the event handlers are registered
Definition at line 198 of file MultiWCTool.h.
List<WorldCanvas *> casa::MultiWCTool::itsWCList [private] |
The WorldCanvases to which this tool is connected.
Definition at line 195 of file MultiWCTool.h.
ListIter<WorldCanvas *>* casa::MultiWCTool::itsWCListIter [mutable, protected] |
An iterator for the WorldCanvases.
Definition at line 170 of file MultiWCTool.h.