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::CachingDisplayData Class Reference

Base class for auto-caching DisplayData objects. More...

#include <CachingDisplayData.h>

Inheritance diagram for casa::CachingDisplayData:
casa::DisplayData casa::DisplayOptions casa::DisplayEH casa::DlTarget casa::ActiveCaching2dDD casa::PassiveCachingDD casa::Histogram2dDD casa::MSAsRaster casa::Profile2dDD casa::TblAsContourDD casa::TblAsRasterDD casa::TblAsXYDD casa::WedgeDD casa::AxesDisplayData casa::DrawingDisplayData casa::PassiveTableDD casa::RegionShape

List of all members.

Public Member Functions

 CachingDisplayData ()
 Constructor.
virtual ~CachingDisplayData ()
 Destructor.
virtual void setDefaultOptions ()
 Install the default options for this DisplayData.
virtual Bool setOptions (Record &rec, Record &recOut)
 Apply options stored in rec to the DisplayData.
virtual Record getOptions ()
 Retrieve the current and default options and parameter types.
virtual void refreshEH (const WCRefreshEvent &ev)
 Refresh event handler which is called indirectly by the WorldCanvas, via the WorldCanvasHolder.
virtual void notifyRegister (WorldCanvasHolder *wcHolder)
virtual void notifyUnregister (WorldCanvasHolder &wcHolder, Bool ignoreRefresh=False)
 ignoreRefresh tells the DD not to refresh just to clean up DMs
virtual void setColormap (Colormap *cmap, Float weight)
 Purges cache, to avoid reusing images with the wrong colormap, then calls base class version.
virtual void purgeCache ()
 Empty cache completely.
virtual void purgeCache (const WorldCanvasHolder &wch)
 Empty cache of all DMs for a given WCH.

Protected Member Functions

virtual CachingDisplayMethodnewDisplayMethod (WorldCanvas *worldCanvas, AttributeBuffer *wchAttributes, AttributeBuffer *ddAttributes, CachingDisplayData *dd)=0
 Create a new (Caching)DisplayMethod for drawing on the given WorldCanvas when the AttributeBuffers are suitably matched to the current state of this DisplayData and of the WorldCanvas/Holder.
virtual AttributeBuffer optionsAsAttributes ()
 Return the current options of this DisplayData as an AttributeBuffer.
virtual void setCaching (const Bool caching)
 Return any additional Attributes to consider when searching the cache.
 CachingDisplayData (const CachingDisplayData &other)
 (Required) copy constructor.
void operator= (const CachingDisplayData &other)
 (Required) copy assignment.

Protected Attributes

Bool restorePCColormap_
 The default is False.

Private Member Functions

void trimCache ()
 Clear out cache entries beyond end of list.
void installDefaultOptions ()
 Install the default options for this DisplayData.

Private Attributes

Bool itsCachingState
 Caching state.
Int itsDefaultMaximumCacheSize
 Default and actual maximum length of element list.
Int itsOptionsMaximumCacheSize
List< void * > itsElementList
 List containing the CachingDisplayMethods for this CachingDisplayData.
ListIter< void * > * itsElementListIter
 Iterator for itsElementList.

Detailed Description

Base class for auto-caching DisplayData objects.

Intended use:

Public interface

Prerequisite

Etymology

"CachingDisplayData" is an implementation of a DisplayData which provides automatic caching of individual depictions of the data.

Synopsis

This class adds to the interface defined in DisplayData . It adds an "automagic" caching system, which takes care of managing a set of individual drawings made by the DisplayData, and using previously generated drawing commands where applicable. For example, the user might be playing a movie of several frames in a DisplayData. The automagic caching will ensure that after one complete loop, while parameters affecting the display of the data do not change, all subsequent drawings will be made from a cache of drawing commands. Furthermore, provided the cache is large enough, the user may alter parameters, view some more frames, then return the parameters to their original state, and there may still be older cached drawings which can be used.

The automagic caching also handles the case where a single DisplayData is registered on more than one WorldCanvasHolder . Thus a miniature view of the data could be shown in one window, and an expanded view in another, with full automagic caching available on both.

This is a base class. Derived classes must implement the newDisplayMethod method, which is called to construct a new CachingDisplayMethod when the cache cannot satisfy the current drawing request. The method optionsAsAttributes should also be implemented: when a new CachingDisplayMethod is constructed, the return value of this method will be used to tag the parameters used in the drawing itself. Finally, the method cachingAttributes can be over-ridden, and should return any additional Attributes which should be considered in searches of the cache.

Motivation

Most DisplayData classes will offer more than one view of the data. Caching is therefore desirable to improve display speed for re-display of individual views of the data. It is nice to keep the caching in one place, hence this class.

Definition at line 103 of file CachingDisplayData.h.


Constructor & Destructor Documentation

Constructor.

Destructor.

(Required) copy constructor.


Member Function Documentation

virtual CachingDisplayMethod* casa::CachingDisplayData::newDisplayMethod ( WorldCanvas worldCanvas,
AttributeBuffer wchAttributes,
AttributeBuffer ddAttributes,
CachingDisplayData dd 
) [protected, pure virtual]

Create a new (Caching)DisplayMethod for drawing on the given WorldCanvas when the AttributeBuffers are suitably matched to the current state of this DisplayData and of the WorldCanvas/Holder.

Implemented in casa::RegionShape, casa::MSAsRaster, casa::Profile2dDD, casa::TblAsContourDD, casa::TblAsRasterDD, casa::TblAsXYDD, casa::WedgeDD, casa::Histogram2dDD, casa::AxesDisplayData, casa::DrawingDisplayData, casa::SkyCatOverlayDD, and casa::WorldAxesDD.

virtual void casa::CachingDisplayData::notifyRegister ( WorldCanvasHolder wcHolder) [virtual]

Reimplemented from casa::DisplayData.

Reimplemented in casa::MSAsRaster.

virtual void casa::CachingDisplayData::notifyUnregister ( WorldCanvasHolder wcHolder,
Bool  ignoreRefresh = False 
) [virtual]

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

Reimplemented from casa::DisplayData.

Reimplemented in casa::Profile2dDD, casa::MSAsRaster, and casa::WedgeDD.

void casa::CachingDisplayData::operator= ( const CachingDisplayData other) [protected]

(Required) copy assignment.

virtual void casa::CachingDisplayData::purgeCache ( ) [virtual]

Empty cache completely.

Reimplemented in casa::MSAsRaster.

Referenced by casa::MSAsRaster::purgeCache().

virtual void casa::CachingDisplayData::purgeCache ( const WorldCanvasHolder wch) [virtual]

Empty cache of all DMs for a given WCH.

Reimplemented in casa::MSAsRaster.

virtual void casa::CachingDisplayData::refreshEH ( const WCRefreshEvent ev) [virtual]

Refresh event handler which is called indirectly by the WorldCanvas, via the WorldCanvasHolder.

This function will take care of calling newDisplayMethod when necessary, and otherwise using an existing (previously cached) draw list.

Implements casa::DisplayData.

Reimplemented in casa::PassiveCachingDD, and casa::DrawingDisplayData.

virtual void casa::CachingDisplayData::setCaching ( const Bool  caching) [protected, virtual]

Return any additional Attributes to consider when searching the cache.

I guess I might put things like Colormap setup in here, since we need a way to handle the Colormap size being altered, and later returned to its original size/location in the PCColorTable, etc. Turn caching on/off.

virtual void casa::CachingDisplayData::setColormap ( Colormap cmap,
Float  weight 
) [virtual]

Purges cache, to avoid reusing images with the wrong colormap, then calls base class version.

Reimplemented from casa::DisplayData.

virtual void casa::CachingDisplayData::setDefaultOptions ( ) [virtual]
virtual Bool casa::CachingDisplayData::setOptions ( Record rec,
Record recOut 
) [virtual]

Apply options stored in rec to the DisplayData.

A return value of True means a refresh is needed. recOut contains any fields which were implicitly changed as a result of the call to this function. The options handled by this class are: cachesize: an integer specifying the maximum number of views which can be stored in the cache. The default value can be specified by the display.cachesize variable in the user's .aipsrc file, and in lieu of that, will be 256. If cachesize is lowered by a call to this method, the cache will be shrunk in size, with the oldest drawings being removed first.

Reimplemented from casa::DisplayData.

Reimplemented in casa::Profile2dDD, casa::MSAsRaster, casa::TblAsContourDD, casa::TblAsRasterDD, casa::TblAsXYDD, casa::WedgeDD, casa::ActiveCaching2dDD, casa::PassiveCachingDD, casa::Histogram2dDD, casa::AxesDisplayData, casa::WorldAxesDD, casa::DrawingDisplayData, casa::PassiveTableDD, and casa::SkyCatOverlayDD.

Clear out cache entries beyond end of list.


Member Data Documentation

Caching state.

Definition at line 200 of file CachingDisplayData.h.

Default and actual maximum length of element list.

Definition at line 203 of file CachingDisplayData.h.

List containing the CachingDisplayMethods for this CachingDisplayData.

Definition at line 207 of file CachingDisplayData.h.

Iterator for itsElementList.

Definition at line 210 of file CachingDisplayData.h.

Definition at line 203 of file CachingDisplayData.h.

The default is False.

Derived DDs (such as WedgeDD) can set it True so that the colormap on the PixelCanvas before the DD draws is restored to it afterward. The 'colormap fiddling' mouse tools can (unfortunately) only operate on the PC's current colormap; this kludge is an attempt to assure that the 'right' one is left there.

Definition at line 195 of file CachingDisplayData.h.


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