WorldCanvasHolder.h

Classes

WorldCanvasHolder -- A holder to interface between DisplayDatas and a WorldCanvas (full description)

class WorldCanvasHolder : public WCRefreshEH, public WCMotionEH, public WCPositionEH, public WCSizeControlHandler, public WCCoordinateHandler

Interface

Public Members
WorldCanvasHolder(WorldCanvas *canvas)
virtual ~WorldCanvasHolder()
virtual WorldCanvas *worldCanvas() const
virtual void addDisplayData(DisplayData *dData)
virtual void removeDisplayData(DisplayData& dData, Bool ignoreRefresh = False)
virtual const uInt nDisplayDatas() const
virtual void setRestriction(const Attribute& restriction)
virtual void setRestrictions(const AttributeBuffer& resBuff)
virtual const Bool existRestriction(const String& name) const
virtual void removeRestriction(const String& restrictionNAme)
virtual void removeRestrictions()
virtual Bool matchesRestriction(const Attribute& restriction) const
virtual Bool matchesRestrictions(const AttributeBuffer& buffer) const
virtual const AttributeBuffer *restrictionBuffer() const
virtual void refresh(const Display::RefreshReason &reason = Display::UserCommand, const Bool &explicitrequest = True)
virtual Bool executeSizeControl(WorldCanvas *wCanvas)
virtual void operator()(const WCPositionEvent &ev)
virtual void operator()(const WCRefreshEvent &ev)
virtual void operator()(const WCMotionEvent &ev)
virtual void handleEvent(DisplayEvent& ev)
virtual Bool linToWorld(Vector<Double>& world, const Vector<Double>& lin)
virtual Bool worldToLin(Vector<Double>& lin, const Vector<Double>& world)
virtual Bool linToWorld(Matrix<Double> & world, Vector<Bool> & failures, const Matrix<Double> & lin)
virtual Bool worldToLin(Matrix<Double> & lin, Vector<Bool> & failures, const Matrix<Double> & world)
virtual Vector<String> worldAxisNames()
virtual Vector<String> worldAxisUnits()
virtual uInt nWorldAxes() const
virtual const uInt nelements()
virtual void cleanup()
virtual const DisplayData* csMaster() const
virtual Bool isCSmaster(const DisplayData *dd) const
virtual Bool wasCSmaster(DisplayData* dd=0) const
virtual Bool syncCSmaster(const WorldCanvasHolder* wch)

Description

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

Member Description

WorldCanvasHolder(WorldCanvas *canvas)

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

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. ignoreRefresh tells the DD not to refresh just to clean up DMs

virtual const uInt nDisplayDatas() const

How many DisplayDatas are registered?

virtual void setRestriction(const Attribute& restriction)
virtual void setRestrictions(const AttributeBuffer& resBuff)

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.

virtual const Bool existRestriction(const String& name) const

Check if a named restriction exists.

virtual void removeRestriction(const String& restrictionNAme)
virtual void removeRestrictions()

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

virtual Bool matchesRestriction(const Attribute& restriction) const
virtual Bool matchesRestrictions(const AttributeBuffer& buffer) const

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

virtual 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. this is a shorthand for WorldCanvasHolder->worldCanvas()->refresh(reason);.

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. 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.

virtual Bool linToWorld(Matrix<Double> & world, Vector<Bool> & failures, const Matrix<Double> & lin)

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.

virtual Bool linToWorld(Vector<Double>& world, const Vector<Double>& lin)
virtual Bool worldToLin(Vector<Double>& lin, const Vector<Double>& world)
virtual Bool worldToLin(Matrix<Double> & lin, Vector<Bool> & failures, const Matrix<Double> & world)

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.

virtual Vector<String> worldAxisNames()
virtual Vector<String> worldAxisUnits()

Return the names and units of the world coordinate axes.

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.

virtual const DisplayData* csMaster() const

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

virtual 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).

virtual 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. This affects whether any old zoom window is retained or completely reset.

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. Sets [default] CS master dd to that of passed wch (if that dd is registered here), and gets it to reset WC coordinate state.