casa
$Rev:20696$
|
A holder to interface between DisplayDatas and a WorldCanvas. More...
#include <WorldCanvasHolder.h>
Public Member Functions | |
WorldCanvasHolder (WorldCanvas *canvas) | |
Constructor. | |
virtual | ~WorldCanvasHolder () |
Destructor. | |
virtual WorldCanvas * | worldCanvas () const |
Return the WorldCanvas which is held by this WorldCanvasHolder. | |
virtual void | addDisplayData (DisplayData *dData) |
Add a DisplayData object to the list of DisplayDatas registered on the held WorldCanvas by this WorldCanvasHolder. | |
virtual void | removeDisplayData (DisplayData &dData, Bool ignoreRefresh=False) |
Remove a DisplayData from the list of DisplayDatas which are registered by this WorldCanvasHolder for display on the held WorldCanvas. | |
virtual const uInt | nDisplayDatas () const |
How many DisplayDatas are registered? | |
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. | |
void | setRestrictions (const AttributeBuffer &resBuff) |
const Bool | existRestriction (const String &name) const |
Check if a named restriction exists. | |
void | setBlinkMode (bool mode) |
Set whether or not the viewer is in blink mode. | |
void | removeRestriction (const String &restrictionName) |
Remove the named restriction, or all restrictions, from the WorldCanvasHolder. | |
void | removeRestrictions () |
Bool | matchesRestriction (const Attribute &restriction) const |
Determine whether the restrictions installed on the WorldCanvasHolder match the given restriction or buffer of restrictions. | |
Bool | matchesRestrictions (const AttributeBuffer &buffer) const |
const AttributeBuffer * | restrictionBuffer () const |
Return the buffer of restrictions installed on this WorldCanvasHolder. | |
virtual void | refresh (const Display::RefreshReason &reason=Display::UserCommand, const Bool &explicitrequest=True) |
Invoke a refresh on the WorldCanvas, ie. | |
virtual Bool | executeSizeControl (WorldCanvas *wCanvas) |
Handle size control requests originating from the WorldCanvas. | |
virtual void | operator() (const WCPositionEvent &ev) |
Distribute a WCPositionEvent originating from the held WorldCanvas over the DisplayDatas. | |
virtual void | operator() (const WCRefreshEvent &ev) |
Distribute a WCRefreshEvent originating from the held WorldCanvas over the DisplayDatas. | |
virtual void | operator() (const WCMotionEvent &ev) |
Distribute a WCMotionEvent originating from the held WorldCanvas over the DisplayDatas. | |
virtual void | handleEvent (DisplayEvent &ev) |
Handle other, generic types of events. | |
virtual Bool | linToWorld (Vector< Double > &world, const Vector< Double > &lin) |
Coordinate conversion routines, handled for the WorldCanvas. | |
virtual Bool | worldToLin (Vector< Double > &lin, const Vector< Double > &world) |
transform the world point (N-dimensional) into a lin coordinate (2-dimensional), returning False if the coordinate could not be transformed. | |
virtual Bool | linToWorld (Matrix< Double > &world, Vector< Bool > &failures, const Matrix< Double > &lin) |
Batch transformation where each row of lin is a coordinate that is transformed into each row of world. | |
virtual Bool | worldToLin (Matrix< Double > &lin, Vector< Bool > &failures, const Matrix< Double > &world) |
Batch transformation where each row of world is a coordinate that is transformed into each row of lin. | |
virtual uInt | nWorldAxes () const |
Return the number of world axes, which is hard-wired to 2. | |
virtual const uInt | nelements () |
Maximum number of animation frames of all registered DDs which are valid for the WC's current CS state. | |
virtual void | cleanup () |
Force a cleanup of all the DisplayDatas which are registered with this WorldCanvasHolder. | |
const DisplayData * | csMaster () const |
The DD in charge of setting WC coordinate state (0 if none). | |
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). | |
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. | |
virtual 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. | |
bool | setCSMaster (DisplayData *dd) |
const std::list< DisplayData * > & | displaylist () const |
Float | getDrawUnit () const |
Returns the current pgp draw unit, which depends on the x-range of the data currently being displayed. | |
Static Public Attributes | |
static const String | BLINK_MODE |
Private Attributes | |
bool | blinkMode |
True if the viewer is in blink mode. | |
WorldCanvas * | itsWorldCanvas |
The WorldCanvas that is held by this WorldCanvasHolder. | |
std::list< DisplayData * > | itsDisplayList |
A list containing the DisplayDatas that are registered on this WorldCanvasHolder. | |
DisplayData * | controllingDD |
void * | itsLastCSmaster |
The CS master in effect after executeSizeControl was last run (0 if none). | |
Float | drawUnit |
A holder to interface between DisplayDatas and a WorldCanvas.
Public interface
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.
Definition at line 79 of file WorldCanvasHolder.h.
Constructor.
A WorldCanvas must be provided for the constructed WorldCanvasHolder to "hold".
virtual casa::WorldCanvasHolder::~WorldCanvasHolder | ( | ) | [virtual] |
Destructor.
virtual void casa::WorldCanvasHolder::addDisplayData | ( | DisplayData * | dData | ) | [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.
const DisplayData* casa::WorldCanvasHolder::csMaster | ( | ) | const [inline] |
The DD in charge of setting WC coordinate state (0 if none).
Definition at line 216 of file WorldCanvasHolder.h.
References casa::WorldCanvas::csMaster(), and itsWorldCanvas.
const std::list<DisplayData*>& casa::WorldCanvasHolder::displaylist | ( | ) | const [inline] |
Definition at line 238 of file WorldCanvasHolder.h.
References itsDisplayList.
virtual Bool casa::WorldCanvasHolder::executeSizeControl | ( | WorldCanvas * | wCanvas | ) | [virtual] |
Handle size control requests originating from the WorldCanvas.
Implements casa::WCSizeControlHandler.
const Bool casa::WorldCanvasHolder::existRestriction | ( | const String & | name | ) | const [inline] |
Check if a named restriction exists.
Definition at line 125 of file WorldCanvasHolder.h.
References casa::WorldCanvas::existRestriction(), and itsWorldCanvas.
Float casa::WorldCanvasHolder::getDrawUnit | ( | ) | const |
Returns the current pgp draw unit, which depends on the x-range of the data currently being displayed.
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.
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 221 of file WorldCanvasHolder.h.
References casa::WorldCanvas::isCSmaster(), and itsWorldCanvas.
virtual Bool casa::WorldCanvasHolder::linToWorld | ( | Vector< Double > & | world, |
const Vector< Double > & | lin | ||
) | [virtual] |
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.
Referenced by linToWorld().
virtual Bool casa::WorldCanvasHolder::linToWorld | ( | Matrix< Double > & | world, |
Vector< Bool > & | failures, | ||
const Matrix< Double > & | lin | ||
) | [inline, virtual] |
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 Vector<Double> version of linToWorld.
Reimplemented from casa::WCCoordinateHandler.
Definition at line 193 of file WorldCanvasHolder.h.
References linToWorld().
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 149 of file WorldCanvasHolder.h.
References itsWorldCanvas, and casa::WorldCanvas::matchesRestriction().
Bool casa::WorldCanvasHolder::matchesRestrictions | ( | const AttributeBuffer & | buffer | ) | const [inline] |
Definition at line 150 of file WorldCanvasHolder.h.
References itsWorldCanvas, and casa::WorldCanvas::matchesRestrictions().
virtual const uInt casa::WorldCanvasHolder::nDisplayDatas | ( | ) | const [virtual] |
How many DisplayDatas are registered?
virtual const 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 uInt casa::WorldCanvasHolder::nWorldAxes | ( | ) | const [inline, virtual] |
Return the number of world axes, which is hard-wired to 2.
Implements casa::WCCoordinateHandler.
Definition at line 203 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 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, |
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 String & | restrictionName | ) | [inline] |
Remove the named restriction, or all restrictions, from the WorldCanvasHolder.
Definition at line 137 of file WorldCanvasHolder.h.
References itsWorldCanvas, and casa::WorldCanvas::removeRestriction().
void casa::WorldCanvasHolder::removeRestrictions | ( | ) | [inline] |
Definition at line 140 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 155 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 130 of file WorldCanvasHolder.h.
References blinkMode.
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 116 of file WorldCanvasHolder.h.
References itsWorldCanvas, and casa::WorldCanvas::setRestriction().
void casa::WorldCanvasHolder::setRestrictions | ( | const AttributeBuffer & | resBuff | ) | [inline] |
Definition at line 119 of file WorldCanvasHolder.h.
References itsWorldCanvas, and casa::WorldCanvas::setRestrictions().
virtual 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.
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 228 of file WorldCanvasHolder.h.
References itsLastCSmaster.
virtual WorldCanvas* casa::WorldCanvasHolder::worldCanvas | ( | ) | const [inline, virtual] |
Return the WorldCanvas which is held by this WorldCanvasHolder.
Definition at line 95 of file WorldCanvasHolder.h.
References itsWorldCanvas.
Referenced by casa::RSUtils::hasDirectionCoordinate(), and casa::RSUtils::worldSystem().
virtual Bool casa::WorldCanvasHolder::worldToLin | ( | Vector< Double > & | lin, |
const Vector< 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.
Referenced by worldToLin().
virtual Bool casa::WorldCanvasHolder::worldToLin | ( | Matrix< Double > & | lin, |
Vector< Bool > & | failures, | ||
const Matrix< Double > & | world | ||
) | [inline, virtual] |
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 Vector<Double> version of worldToLin.
Reimplemented from casa::WCCoordinateHandler.
Definition at line 197 of file WorldCanvasHolder.h.
References worldToLin().
const String casa::WorldCanvasHolder::BLINK_MODE [static] |
Definition at line 247 of file WorldCanvasHolder.h.
bool casa::WorldCanvasHolder::blinkMode [private] |
True if the viewer is in blink mode.
Definition at line 251 of file WorldCanvasHolder.h.
Referenced by setBlinkMode().
Definition at line 259 of file WorldCanvasHolder.h.
Float casa::WorldCanvasHolder::drawUnit [private] |
Definition at line 269 of file WorldCanvasHolder.h.
std::list<DisplayData*> casa::WorldCanvasHolder::itsDisplayList [private] |
A list containing the DisplayDatas that are registered on this WorldCanvasHolder.
Definition at line 258 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 268 of file WorldCanvasHolder.h.
Referenced by wasCSmaster().
The WorldCanvas that is held by this WorldCanvasHolder.
Definition at line 254 of file WorldCanvasHolder.h.
Referenced by csMaster(), existRestriction(), isCSmaster(), matchesRestriction(), matchesRestrictions(), removeRestriction(), removeRestrictions(), restrictionBuffer(), setRestriction(), setRestrictions(), and worldCanvas().