casa
$Rev:20696$
|
Base class for auto-caching DisplayData objects. More...
#include <CachingDisplayData.h>
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 CachingDisplayMethod * | newDisplayMethod (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. |
Base class for auto-caching DisplayData objects.
Public interface
"CachingDisplayData" is an implementation of a DisplayData which provides automatic caching of individual depictions of the data.
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.
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.
virtual casa::CachingDisplayData::~CachingDisplayData | ( | ) | [virtual] |
Destructor.
casa::CachingDisplayData::CachingDisplayData | ( | const CachingDisplayData & | other | ) | [protected] |
(Required) copy constructor.
virtual Record casa::CachingDisplayData::getOptions | ( | ) | [virtual] |
Retrieve the current and default options and parameter types.
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.
void casa::CachingDisplayData::installDefaultOptions | ( | ) | [private] |
Install the default options for this DisplayData.
Reimplemented in casa::TblAsContourDD, casa::TblAsRasterDD, casa::TblAsXYDD, casa::DrawingDisplayData, casa::PassiveTableDD, and casa::WorldAxesDD.
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 AttributeBuffer casa::CachingDisplayData::optionsAsAttributes | ( | ) | [protected, virtual] |
Return the current options of this DisplayData as an AttributeBuffer.
The caller must delete the returned buffer.
Reimplemented in casa::Profile2dDD, casa::MSAsRaster, casa::TblAsContourDD, casa::TblAsRasterDD, casa::TblAsXYDD, casa::WedgeDD, casa::ActiveCaching2dDD, casa::PassiveCachingDD, casa::Histogram2dDD, casa::AxesDisplayData, casa::DrawingDisplayData, casa::SkyCatOverlayDD, casa::WorldAxesDD, and casa::PassiveTableDD.
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] |
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] |
Install the default options for this DisplayData.
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.
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.
void casa::CachingDisplayData::trimCache | ( | ) | [private] |
Clear out cache entries beyond end of list.
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<void *> casa::CachingDisplayData::itsElementList [private] |
List containing the CachingDisplayMethods for this CachingDisplayData.
Definition at line 207 of file CachingDisplayData.h.
ListIter<void *>* casa::CachingDisplayData::itsElementListIter [private] |
Iterator for itsElementList.
Definition at line 210 of file CachingDisplayData.h.
Definition at line 203 of file CachingDisplayData.h.
Bool casa::CachingDisplayData::restorePCColormap_ [protected] |
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.