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

A holder to interface between DisplayDatas and a WorldCanvas. More...

#include <WorldCanvasHolder.h>

Inheritance diagram for casa::WorldCanvasHolder:
casa::WCRefreshEH casa::WCMotionEH casa::WCPositionEH casa::WCSizeControlHandler casa::WCCoordinateHandler casa::DisplayEH

Public Member Functions

 WorldCanvasHolder (WorldCanvas *canvas)
 Constructor. More...
 
virtual ~WorldCanvasHolder ()
 Destructor. More...
 
virtual WorldCanvasworldCanvas () const
 Return the WorldCanvas which is held by this WorldCanvasHolder. More...
 
virtual void addDisplayData (DisplayData *dData, int position)
 Add a DisplayData object to the list of DisplayDatas registered on the held WorldCanvas by this WorldCanvasHolder. More...
 
virtual void removeDisplayData (DisplayData &dData, casacore::Bool ignoreRefresh=false)
 Remove a DisplayData from the list of DisplayDatas which are registered by this WorldCanvasHolder for display on the held WorldCanvas. More...
 
virtual casacore::uInt nDisplayDatas () const
 How many DisplayDatas are registered? More...
 
void setRestriction (const Attribute &restriction)
 Install a single restriction, or a buffer of restrictions, on the WorldCanvasHolder which DisplayData must match in order that they be allowed to draw themselves. More...
 
void setRestrictions (const AttributeBuffer &resBuff)
 
casacore::Bool existRestriction (const casacore::String &name) const
 Check if a named restriction exists. More...
 
void setBlinkMode (bool mode)
 Set whether or not the viewer is in blink mode. More...
 
void removeRestriction (const casacore::String &restrictionName)
 Remove the named restriction, or all restrictions, from the WorldCanvasHolder. More...
 
void removeRestrictions ()
 
casacore::Bool matchesRestriction (const Attribute &restriction) const
 Determine whether the restrictions installed on the WorldCanvasHolder match the given restriction or buffer of restrictions. More...
 
casacore::Bool matchesRestrictions (const AttributeBuffer &buffer) const
 
const AttributeBufferrestrictionBuffer () const
 Return the buffer of restrictions installed on this WorldCanvasHolder. More...
 
virtual void refresh (const Display::RefreshReason &reason=Display::UserCommand, const casacore::Bool &explicitrequest=true)
 Invoke a refresh on the WorldCanvas, ie. More...
 
virtual casacore::Bool executeSizeControl (WorldCanvas *wCanvas)
 Handle size control requests originating from the WorldCanvas. More...
 
virtual void operator() (const WCPositionEvent &ev)
 Distribute a WCPositionEvent originating from the held WorldCanvas over the DisplayDatas. More...
 
virtual void operator() (const WCRefreshEvent &ev)
 Distribute a WCRefreshEvent originating from the held WorldCanvas over the DisplayDatas. More...
 
virtual void operator() (const WCMotionEvent &ev)
 Distribute a WCMotionEvent originating from the held WorldCanvas over the DisplayDatas. More...
 
virtual void handleEvent (DisplayEvent &ev)
 Handle other, generic types of events. More...
 
virtual casacore::Bool linToWorld (casacore::Vector< casacore::Double > &world, const casacore::Vector< casacore::Double > &lin)
 casacore::Coordinate conversion routines, handled for the WorldCanvas. More...
 
virtual casacore::Bool worldToLin (casacore::Vector< casacore::Double > &lin, const casacore::Vector< casacore::Double > &world)
 transform the world point (N-dimensional) into a lin coordinate (2-dimensional), returning false if the coordinate could not be transformed. More...
 
virtual casacore::Bool linToWorld (casacore::Matrix< casacore::Double > &world, casacore::Vector< casacore::Bool > &failures, const casacore::Matrix< casacore::Double > &lin)
 Batch transformation where each row of lin is a coordinate that is transformed into each row of world. More...
 
virtual casacore::Bool worldToLin (casacore::Matrix< casacore::Double > &lin, casacore::Vector< casacore::Bool > &failures, const casacore::Matrix< casacore::Double > &world)
 Batch transformation where each row of world is a coordinate that is transformed into each row of lin. More...
 
virtual casacore::uInt nWorldAxes () const
 Return the number of world axes, which is hard-wired to 2. More...
 
virtual casacore::uInt nelements ()
 Maximum number of animation frames of all registered DDs which are valid for the WC's current CS state. More...
 
virtual void cleanup ()
 Force a cleanup of all the DisplayDatas which are registered with this WorldCanvasHolder. More...
 
const DisplayDatacsMaster () const
 The DD in charge of setting WC coordinate state (0 if none). More...
 
casacore::Bool isCSmaster (const DisplayData *dd) const
 Is the specified DisplayData the one in charge of WC state? (During DD::sizeControl() execution, it means instead that the DD has permission to become CSmaster, if it can). More...
 
void clearCSMasterSettings (WorldCanvas *wCanvas, bool clearZoom=true)
 
casacore::Bool wasCSmaster (DisplayData *dd=0) const
 Was the passed DD the last CS master (or, if no DD passed, was there any CS master)? For convenience of the DDs during the next sizeControl execution, in determining whether a CS master change is occurring, and whether anyone was master before. More...
 
virtual casacore::Bool syncCSmaster (const WorldCanvasHolder *wch)
 used by PanelDisplay on new WCHs to keep a consistent CS master on all its main display WC[H]s. More...
 
bool setCSMaster (DisplayData *dd)
 
const std::list< DisplayData * > & displaylist () const
 
casacore::Float getDrawUnit () const
 Returns the current pgp draw unit, which depends on the x-range of the data currently being displayed. More...
 
std::string errorMessage () const
 
- 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::WCMotionEH
 WCMotionEH ()
 Default Constructor Required. More...
 
virtual ~WCMotionEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::WCPositionEH
 WCPositionEH ()
 Default Constructor Required. More...
 
virtual ~WCPositionEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::WCSizeControlHandler
 WCSizeControlHandler ()
 Default Constructor Required. More...
 
virtual ~WCSizeControlHandler ()
 Destructor. More...
 
- Public Member Functions inherited from casa::WCCoordinateHandler
 WCCoordinateHandler ()
 Default Constructor Required. More...
 
virtual ~WCCoordinateHandler ()
 Routines that give the axes names and the unit. More...
 

Static Public Attributes

static const casacore::String BLINK_MODE
 

Private Member Functions

casacore::String getTitleDDName (const casacore::Vector< casacore::Bool > &conforms) const
 
DisplayDatagetTitleDDBlink (const casacore::Vector< casacore::Bool > &conforms) const
 
DisplayDatagetTitleDDNormal (const casacore::Vector< casacore::Bool > &conforms) const
 
casacore::String getTitle (DisplayData *dd) const
 
void labelAxes (const casacore::Vector< casacore::Bool > &conforms, const WCRefreshEvent &ev)
 
void labelAxesBlink (const casacore::Vector< casacore::Bool > &conforms, const WCRefreshEvent &ev)
 
void labelAxesNormal (const casacore::Vector< casacore::Bool > &conforms, const WCRefreshEvent &ev)
 
void setControllingTitle (const casacore::Vector< casacore::Bool > &conforms)
 
void clearSubstituteTitles ()
 
casacore::Vector< casacore::BoolgetConformance () const
 

Private Attributes

bool blinkMode
 true if the viewer is in blink mode. More...
 
WorldCanvasitsWorldCanvas
 The WorldCanvas that is held by this WorldCanvasHolder. More...
 
std::list< DisplayData * > itsDisplayList
 A list containing the DisplayDatas that are registered on this WorldCanvasHolder. More...
 
DisplayDatacontrollingDD
 
void * itsLastCSmaster
 The CS master in effect after executeSizeControl was last run (0 if none). More...
 
casacore::Float drawUnit
 
std::string error_string
 

Detailed Description

A holder to interface between DisplayDatas and a WorldCanvas.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

The WorldCanvasHolder "holds" a WorldCanvas and some number of DisplayDatas which are "registered" on the WorldCanvas. It actually registers itself to handle the WC events, and passes the events on to the DDs.

Synopsis

Example

Motivation

Definition at line 83 of file WorldCanvasHolder.h.

Constructor & Destructor Documentation

casa::WorldCanvasHolder::WorldCanvasHolder ( WorldCanvas canvas)

Constructor.

A WorldCanvas must be provided for the constructed WorldCanvasHolder to "hold".

virtual casa::WorldCanvasHolder::~WorldCanvasHolder ( )
virtual

Destructor.

Member Function Documentation

virtual void casa::WorldCanvasHolder::addDisplayData ( DisplayData dData,
int  position 
)
virtual

Add a DisplayData object to the list of DisplayDatas registered on the held WorldCanvas by this WorldCanvasHolder.

virtual void casa::WorldCanvasHolder::cleanup ( )
virtual

Force a cleanup of all the DisplayDatas which are registered with this WorldCanvasHolder.

void casa::WorldCanvasHolder::clearCSMasterSettings ( WorldCanvas wCanvas,
bool  clearZoom = true 
)
void casa::WorldCanvasHolder::clearSubstituteTitles ( )
private
const DisplayData* casa::WorldCanvasHolder::csMaster ( ) const
inline

The DD in charge of setting WC coordinate state (0 if none).

Definition at line 233 of file WorldCanvasHolder.h.

References casa::WorldCanvas::csMaster(), and itsWorldCanvas.

const std::list<DisplayData*>& casa::WorldCanvasHolder::displaylist ( ) const
inline

Definition at line 261 of file WorldCanvasHolder.h.

References itsDisplayList.

std::string casa::WorldCanvasHolder::errorMessage ( ) const
inlinevirtual

Implements casa::WCCoordinateHandler.

Definition at line 273 of file WorldCanvasHolder.h.

References error_string.

virtual casacore::Bool casa::WorldCanvasHolder::executeSizeControl ( WorldCanvas wCanvas)
virtual

Handle size control requests originating from the WorldCanvas.

Implements casa::WCSizeControlHandler.

casacore::Bool casa::WorldCanvasHolder::existRestriction ( const casacore::String name) const
inline

Check if a named restriction exists.

Definition at line 134 of file WorldCanvasHolder.h.

References casa::WorldCanvas::existRestriction(), and itsWorldCanvas.

casacore::Vector<casacore::Bool> casa::WorldCanvasHolder::getConformance ( ) const
private
casacore::Float casa::WorldCanvasHolder::getDrawUnit ( ) const

Returns the current pgp draw unit, which depends on the x-range of the data currently being displayed.

casacore::String casa::WorldCanvasHolder::getTitle ( DisplayData dd) const
private
DisplayData* casa::WorldCanvasHolder::getTitleDDBlink ( const casacore::Vector< casacore::Bool > &  conforms) const
private
casacore::String casa::WorldCanvasHolder::getTitleDDName ( const casacore::Vector< casacore::Bool > &  conforms) const
private
DisplayData* casa::WorldCanvasHolder::getTitleDDNormal ( const casacore::Vector< casacore::Bool > &  conforms) const
private
virtual void casa::WorldCanvasHolder::handleEvent ( DisplayEvent ev)
virtual

Handle other, generic types of events.

As with the handlers above, WCH handles these new events by simply passing them on to the DisplayDatas registered on it. WorldCanvasHolder inherits this new-style event handling interface from DisplayEH, via WCRefreshEH.

Reimplemented from casa::DisplayEH.

casacore::Bool casa::WorldCanvasHolder::isCSmaster ( const DisplayData dd) const
inline

Is the specified DisplayData the one in charge of WC state? (During DD::sizeControl() execution, it means instead that the DD has permission to become CSmaster, if it can).

Definition at line 240 of file WorldCanvasHolder.h.

References casa::WorldCanvas::isCSmaster(), and itsWorldCanvas.

void casa::WorldCanvasHolder::labelAxes ( const casacore::Vector< casacore::Bool > &  conforms,
const WCRefreshEvent ev 
)
private
void casa::WorldCanvasHolder::labelAxesBlink ( const casacore::Vector< casacore::Bool > &  conforms,
const WCRefreshEvent ev 
)
private
void casa::WorldCanvasHolder::labelAxesNormal ( const casacore::Vector< casacore::Bool > &  conforms,
const WCRefreshEvent ev 
)
private
virtual casacore::Bool casa::WorldCanvasHolder::linToWorld ( casacore::Vector< casacore::Double > &  world,
const casacore::Vector< casacore::Double > &  lin 
)
virtual

casacore::Coordinate conversion routines, handled for the WorldCanvas.

In future, they should be handled on the WC itself, via its own CS. At present, these requests are forwarded to the CSmaster DD, which should be equivalent in most cases.

Implements casa::WCCoordinateHandler.

virtual casacore::Bool casa::WorldCanvasHolder::linToWorld ( casacore::Matrix< casacore::Double > &  world,
casacore::Vector< casacore::Bool > &  failures,
const casacore::Matrix< casacore::Double > &  lin 
)
inlinevirtual

Batch transformation where each row of lin is a coordinate that is transformed into each row of world.

On input, if the i'th position in the failures vector is true, the i'th transformation is not attempted. If the j'th transformation fails, the j'th position in the failures vector will be set. The return value is true only when the failures vector has no position set to true; This function is implemented in this base class by making repeated calls to the casacore::Vector<casacore::Double> version of linToWorld.

Reimplemented from casa::WCCoordinateHandler.

Definition at line 208 of file WorldCanvasHolder.h.

References casa::WCCoordinateHandler::linToWorld().

casacore::Bool casa::WorldCanvasHolder::matchesRestriction ( const Attribute restriction) const
inline

Determine whether the restrictions installed on the WorldCanvasHolder match the given restriction or buffer of restrictions.

Definition at line 158 of file WorldCanvasHolder.h.

References itsWorldCanvas, and casa::WorldCanvas::matchesRestriction().

casacore::Bool casa::WorldCanvasHolder::matchesRestrictions ( const AttributeBuffer buffer) const
inline
virtual casacore::uInt casa::WorldCanvasHolder::nDisplayDatas ( ) const
virtual

How many DisplayDatas are registered?

virtual casacore::uInt casa::WorldCanvasHolder::nelements ( )
virtual

Maximum number of animation frames of all registered DDs which are valid for the WC's current CS state.

virtual casacore::uInt casa::WorldCanvasHolder::nWorldAxes ( ) const
inlinevirtual

Return the number of world axes, which is hard-wired to 2.

Implements casa::WCCoordinateHandler.

Definition at line 220 of file WorldCanvasHolder.h.

virtual void casa::WorldCanvasHolder::operator() ( const WCPositionEvent ev)
virtual

Distribute a WCPositionEvent originating from the held WorldCanvas over the DisplayDatas.

Implements casa::WCPositionEH.

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

Distribute a WCRefreshEvent originating from the held WorldCanvas over the DisplayDatas.

Implements casa::WCRefreshEH.

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

Distribute a WCMotionEvent originating from the held WorldCanvas over the DisplayDatas.

Implements casa::WCMotionEH.

virtual void casa::WorldCanvasHolder::refresh ( const Display::RefreshReason reason = Display::UserCommand,
const casacore::Bool explicitrequest = true 
)
virtual

Invoke a refresh on the WorldCanvas, ie.

this is a shorthand for WorldCanvasHolder->worldCanvas()->refresh(reason);.

virtual void casa::WorldCanvasHolder::removeDisplayData ( DisplayData dData,
casacore::Bool  ignoreRefresh = false 
)
virtual

Remove a DisplayData from the list of DisplayDatas which are registered by this WorldCanvasHolder for display on the held WorldCanvas.

ignoreRefresh tells the DD not to refresh just to clean up DMs

void casa::WorldCanvasHolder::removeRestriction ( const casacore::String restrictionName)
inline

Remove the named restriction, or all restrictions, from the WorldCanvasHolder.

Definition at line 146 of file WorldCanvasHolder.h.

References itsWorldCanvas, and casa::WorldCanvas::removeRestriction().

void casa::WorldCanvasHolder::removeRestrictions ( )
inline

Definition at line 149 of file WorldCanvasHolder.h.

References itsWorldCanvas, and casa::WorldCanvas::removeRestrictions().

const AttributeBuffer* casa::WorldCanvasHolder::restrictionBuffer ( ) const
inline

Return the buffer of restrictions installed on this WorldCanvasHolder.

Definition at line 168 of file WorldCanvasHolder.h.

References itsWorldCanvas, and casa::WorldCanvas::restrictionBuffer().

void casa::WorldCanvasHolder::setBlinkMode ( bool  mode)
inline

Set whether or not the viewer is in blink mode.

Definition at line 139 of file WorldCanvasHolder.h.

References blinkMode.

void casa::WorldCanvasHolder::setControllingTitle ( const casacore::Vector< casacore::Bool > &  conforms)
private
bool casa::WorldCanvasHolder::setCSMaster ( DisplayData dd)
void casa::WorldCanvasHolder::setRestriction ( const Attribute restriction)
inline

Install a single restriction, or a buffer of restrictions, on the WorldCanvasHolder which DisplayData must match in order that they be allowed to draw themselves.

Definition at line 121 of file WorldCanvasHolder.h.

References casacore::String::c_str(), casa::Attribute::getName(), casa::Attribute::getType(), itsWorldCanvas, and casa::WorldCanvas::setRestriction().

void casa::WorldCanvasHolder::setRestrictions ( const AttributeBuffer resBuff)
inline

Definition at line 128 of file WorldCanvasHolder.h.

References itsWorldCanvas, and casa::WorldCanvas::setRestrictions().

virtual casacore::Bool casa::WorldCanvasHolder::syncCSmaster ( const WorldCanvasHolder wch)
virtual

used by PanelDisplay on new WCHs to keep a consistent CS master on all its main display WC[H]s.

Sets [default] CS master dd to that of passed wch (if that dd is registered here), and gets it to reset WC coordinate state.

casacore::Bool casa::WorldCanvasHolder::wasCSmaster ( DisplayData dd = 0) const
inline

Was the passed DD the last CS master (or, if no DD passed, was there any CS master)? For convenience of the DDs during the next sizeControl execution, in determining whether a CS master change is occurring, and whether anyone was master before.

This affects whether any old zoom window is retained or completely reset.

Definition at line 250 of file WorldCanvasHolder.h.

References itsLastCSmaster.

virtual WorldCanvas* casa::WorldCanvasHolder::worldCanvas ( ) const
inlinevirtual

Return the WorldCanvas which is held by this WorldCanvasHolder.

Definition at line 99 of file WorldCanvasHolder.h.

References itsWorldCanvas.

Referenced by casa::RSUtils::hasDirectionCoordinate(), and casa::RSUtils::worldSystem().

virtual casacore::Bool casa::WorldCanvasHolder::worldToLin ( casacore::Vector< casacore::Double > &  lin,
const casacore::Vector< casacore::Double > &  world 
)
virtual

transform the world point (N-dimensional) into a lin coordinate (2-dimensional), returning false if the coordinate could not be transformed.

Derived classes should override.

Implements casa::WCCoordinateHandler.

virtual casacore::Bool casa::WorldCanvasHolder::worldToLin ( casacore::Matrix< casacore::Double > &  lin,
casacore::Vector< casacore::Bool > &  failures,
const casacore::Matrix< casacore::Double > &  world 
)
inlinevirtual

Batch transformation where each row of world is a coordinate that is transformed into each row of lin.

On input, if the i'th position in the failures vector is true, the i'th transformation is not attempted. If the j'th transformation fails, the j'th position in the failures vector will be set. The return value is true only when the failures vector has no position set to true; This function is implemented in this base class by making repeated calls to the casacore::Vector<casacore::Double> version of worldToLin.

Reimplemented from casa::WCCoordinateHandler.

Definition at line 213 of file WorldCanvasHolder.h.

References casa::WCCoordinateHandler::worldToLin().

Member Data Documentation

const casacore::String casa::WorldCanvasHolder::BLINK_MODE
static

Definition at line 271 of file WorldCanvasHolder.h.

bool casa::WorldCanvasHolder::blinkMode
private

true if the viewer is in blink mode.

Definition at line 277 of file WorldCanvasHolder.h.

Referenced by setBlinkMode().

DisplayData* casa::WorldCanvasHolder::controllingDD
private

Definition at line 285 of file WorldCanvasHolder.h.

casacore::Float casa::WorldCanvasHolder::drawUnit
private

Definition at line 295 of file WorldCanvasHolder.h.

std::string casa::WorldCanvasHolder::error_string
private

Definition at line 307 of file WorldCanvasHolder.h.

Referenced by errorMessage().

std::list<DisplayData*> casa::WorldCanvasHolder::itsDisplayList
private

A list containing the DisplayDatas that are registered on this WorldCanvasHolder.

Definition at line 284 of file WorldCanvasHolder.h.

Referenced by displaylist().

void* casa::WorldCanvasHolder::itsLastCSmaster
private

The CS master in effect after executeSizeControl was last run (0 if none).

For determining (via wasCSmaster(), above) whether a CS master change is occurring, and whether anyone was master before. This affects whether the old zoom window is retained or completely reset. (Note void*, rather than DD*, type: it is not intended to be dereferenced, just compared for equality. The original DD may not even exist by the time it is used).

Definition at line 294 of file WorldCanvasHolder.h.

Referenced by wasCSmaster().

WorldCanvas* casa::WorldCanvasHolder::itsWorldCanvas
private

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