casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
DisplayMethod.h
Go to the documentation of this file.
00001 //# DisplayMethod.h: Base class for drawing data in the Display Library
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002
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_DISPLAYMETHOD_H
00029 #define TRIALDISPLAY_DISPLAYMETHOD_H
00030 
00031 //# aips includes:
00032 #include <casa/aips.h>
00033 
00034 //# display library includes:
00035 #include <display/Display/DisplayEnums.h>
00036 #include <display/Display/AttributeBuffer.h>
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 
00040 //# forwards:
00041 class WorldCanvasHolder;
00042 class Attribute;
00043 class DisplayData;
00044 
00045 // <summary>
00046 // Base class for drawing a particular element (view) of a DisplayData.
00047 // </summary>
00048 //
00049 // <synopsis> 
00050 // This base class defines an interface for drawing a single view of a
00051 // DisplayData object.  The fundamental idea is that a DisplayData
00052 // class will manage one or more DisplayMethod objects, and request
00053 // the individual objects to draw as necessary.
00054 // </synopsis>
00055 
00056 class DisplayMethod {
00057  public:
00058 
00059   // Constructor.  DisplayMethods need to know who their parent
00060   // DisplayData is.
00061   DisplayMethod(DisplayData *parentDisplayData);
00062 
00063   // Destructor.
00064   virtual ~DisplayMethod();
00065 
00066   // Draw on the provided WorldCanvasHolder.
00067   virtual void draw(Display::RefreshReason reason,
00068                     WorldCanvasHolder &wcHolder) = 0;
00069 
00070   // clear drawlist state.
00071   // dk note 11/03:  Only used by the PrincipleAxesDM branch, where the
00072   // implementation has been moved.  Implementation should remain null
00073   // on the CachingDD/DM branch, which uses different interface (purgeCache)
00074   // and state for this.
00075   virtual void cleanup();
00076 
00077   // Set & remove restrictions
00078   // <group>
00079   void addRestriction(Attribute& newAt, Bool permanent);
00080   void addRestrictions(AttributeBuffer& newBuf);
00081   void setRestriction(Attribute& newAt);
00082   void setRestrictions(AttributeBuffer& newBuf);
00083   void removeRestriction(const String& name);
00084   Bool existRestriction(const String& name);
00085   void clearRestrictions();
00086   // </group>
00087 
00088   // match restriction
00089   // <group>
00090   Bool matches(Attribute& at);
00091   Bool matches(AttributeBuffer& atBuf);
00092   // </group>
00093 
00094 
00095   // Allow DisplayData objects to find out about restrictions in
00096   // DisplayMethod elements...
00097   friend class DisplayData;
00098 
00099  protected:
00100 
00101   AttributeBuffer  restrictions;
00102 
00103   // (Required) default constructor.
00104   DisplayMethod();
00105 
00106   // (Required) copy constructor.
00107   DisplayMethod(const DisplayMethod &other);
00108 
00109   // (Required) copy assignment.
00110   void operator=(const DisplayMethod &other);
00111   
00112   // Return the parent DisplayData.
00113   DisplayData *parentDisplayData() 
00114     { return itsParentDisplayData; }
00115 
00116  private:
00117 
00118   DisplayData *itsParentDisplayData;
00119 
00120 };
00121 
00122 
00123 } //# NAMESPACE CASA - END
00124 
00125 #endif