The automagic caching also handles the case where a single
DisplayData is registered on more than one
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.
Destructor.
Install the default options for this DisplayData.
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:
Retrieve the current and default options and parameter types.
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.
Purges cache, to avoid reusing images with the
wrong colormap, then calls base class version.
Empty cache completely.
Empty cache of all DMs for a given WCH.
Return the current options of this DisplayData as an
AttributeBuffer. The caller must delete the returned buffer.
(Required) copy constructor.
(Required) copy assignment.
Clear out cache entries beyond end of list.
Install the default options for this DisplayData.
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.
Member Description
CachingDisplayData()
Constructor.
virtual ~CachingDisplayData()
virtual void setDefaultOptions()
virtual Bool setOptions(Record &rec, Record &recOut)
virtual Record getOptions()
virtual void refreshEH(const WCRefreshEvent &ev)
virtual void notifyRegister(WorldCanvasHolder *wcHolder)
virtual void notifyUnregister(WorldCanvasHolder& wcHolder, Bool ignoreRefresh = False)
virtual void setColormap(Colormap *cmap, Float weight)
virtual void purgeCache()
virtual void purgeCache(const WorldCanvasHolder& wch)
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()
virtual void setCaching(const Bool caching)
Turn caching on/off.
CachingDisplayData(const CachingDisplayData &other)
void operator=(const CachingDisplayData &other)
void trimCache()
void installDefaultOptions()