casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CachingDisplayMethod.h
Go to the documentation of this file.
00001 //# CachingDisplayMethod.h: assistance for auto-caching DisplayData objects
00002 //# Copyright (C) 1999,2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TRIALDISPLAY_CACHINGDISPLAYMETHOD_H
00029 #define TRIALDISPLAY_CACHINGDISPLAYMETHOD_H
00030 
00031 #include <casa/aips.h>
00032 #include <display/Display/DisplayEnums.h>
00033 #include <display/DisplayDatas/DisplayMethod.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 class AttributeBuffer;
00038 class WorldCanvas;
00039 class WorldCanvasHolder;
00040 class CachingDisplayData;
00041 
00042 // <summary> 
00043 // Assistance class for auto-caching of DisplayData objects.
00044 // </summary>
00045 
00046 // <use visibility=export>
00047 
00048 // <reviewed reviewer="" data="" tests="" demos="">
00049 // </reviewed>
00050 
00051 // <prerequisite>
00052 // <li> <linkto class=DisplayMethod> DisplayMethod </linkto>
00053 // <li> <linkto class=CachingDisplayData> CachingDisplayData </linkto>
00054 // </prerequisite>
00055 
00056 // <etymology>
00057 // "CachingDisplayMethod" is an implementation of a <linkto
00058 // class=DisplayMethod> DisplayMethod </linkto> which provides a
00059 // single element in a cache of individual depictions of some data.
00060 // </etymology>
00061 
00062 // <synopsis>
00063 // </synopsis>
00064 
00065 
00066 class CachingDisplayMethod : public DisplayMethod {
00067 
00068  public:
00069 
00070   // Constructor.  A single instance of a CachingDisplayMethod is
00071   // setup to draw on a particular WorldCanvas, and only when
00072   // particular conditions, as stored in the provided
00073   // AttributeBuffers, are met.  The parent DisplayData is given
00074   // in <src>parentDisplayData</src>.
00075   CachingDisplayMethod(WorldCanvas *worldCanvas, 
00076                        AttributeBuffer *wchAttributes,
00077                        AttributeBuffer *ddAttributes,
00078                        CachingDisplayData *parentDisplayData);
00079 
00080   // Destructor.
00081   virtual ~CachingDisplayMethod();
00082 
00083   // Return the WorldCanvas recorded in this CachingDisplayMethod.
00084   virtual WorldCanvas *worldCanvas() 
00085     { return itsWorldCanvas; }
00086 
00087   // Draw this slice of data on the supplied WorldCanvasHolder.
00088   virtual void draw(Display::RefreshReason reason, 
00089                     WorldCanvasHolder &wcHolder);
00090 
00091  protected:
00092 
00093   // (Required) default constructor.
00094   CachingDisplayMethod();
00095 
00096   // (Required) copy constructor.
00097   CachingDisplayMethod(const CachingDisplayMethod &other);
00098 
00099   // (Required) copy assignment.
00100   void operator=(const CachingDisplayMethod &other);
00101 
00102   // Draw into a cached drawing list, called by draw function.
00103   // The return value is set False if the DM could not draw or
00104   // does not wish a drawlist to be saved.
00105   virtual Bool drawIntoList(Display::RefreshReason reason,
00106                             WorldCanvasHolder &wcHolder) = 0;
00107 
00108  private:
00109 
00110   // Store for the WorldCanvas which this has previously drawn upon.
00111   WorldCanvas *itsWorldCanvas;
00112 
00113   // Store for WorldCanvasHolder- and DisplayData-specific
00114   // AttributeBuffers.
00115   AttributeBuffer *itsWCHAttributes, *itsDDAttributes;
00116 
00117   // Do we have a cached drawing list?
00118   Bool itsHasList;
00119 
00120   // Store for cached drawing list number.
00121   uInt itsCachedDrawingList;
00122 
00123 };
00124 
00125 
00126 } //# NAMESPACE CASA - END
00127 
00128 #endif