casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MWCAnimator.h
Go to the documentation of this file.
00001 //# MWCAnimator.h: Animator for MultiWCHolder class
00002 //# Copyright (C) 2000,2001,2003
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_MWCANIMATOR_H
00029 #define TRIALDISPLAY_MWCANIMATOR_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/Containers/List.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 class MultiWCHolder;
00037 class AttributeBuffer;
00038 class RecordInterface;
00039 
00040 // <summary>
00041 // Animator for MultiWCHolder class.
00042 // </summary>
00043 // <use visibility=export>
00044 // 
00045 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00046 // </reviewed>
00047 // 
00048 // <etymology>
00049 // </etymology>
00050 //
00051 // <synopsis> 
00052 // </synopsis>
00053 //
00054 // <motivation>
00055 // </motivation>
00056 //
00057 // <todo>
00058 // </todo>
00059 
00060 class MWCAnimator {
00061 
00062  public:
00063 
00064   // Constructor which makes an isolated MWCAnimator.
00065   MWCAnimator();
00066   
00067   // Constructor which makes a MWCAnimator which is connected to
00068   // the specified MultiWCHolder.
00069   MWCAnimator(MultiWCHolder &mholder);
00070 
00071   // Destructor.
00072   virtual ~MWCAnimator();
00073   
00074   // Add or remove a MultiWCHolder, or remove all MultiWCHolders
00075   // from this MWCAnimator.  <src>mholder</src> is
00076   // added at the end of the list.
00077   // <group>
00078   virtual void addMWCHolder(MultiWCHolder &mholder);
00079   virtual void removeMWCHolder(MultiWCHolder &mholder);
00080   virtual void removeMWCHolders();
00081   // </group>
00082 
00083   // Install the given restriction, spaced by the given increment, on
00084   // all MultiWCHolders.  Ultimately this will go private and be
00085   // called (for example) by next(), prev().  But for now we leave it
00086   // public for testing purposes.  After being called,
00087   // <src>restrictions</src> is the set of restrictions which have
00088   // been placed on the final WorldCanvasHolder of the final
00089   // MultiWCHolder in the list.
00090   virtual void setLinearRestrictions(AttributeBuffer &restrictions,
00091                                      const AttributeBuffer &increments);
00092 
00093   // Install a restriction of the given name, and initial value and
00094   // increment, on all MultiWCHolders.  This is templated and the
00095   // templates are valid for any type which can be added to an
00096   // AttributeBuffer.  This function simply sets up a single-element
00097   // AttributeBuffer and calls <src>setLinearRestrictions</src>.
00098   template <class T> void setLinearRestriction(const String &name,
00099                                                const T &value,
00100                                                const T &increment,
00101                                                const T& tol);
00102 
00103   // Install a restriction described by the given RecordInterface,
00104   // on all MultiWCHolders.  This method simply extracts the fields
00105   // <src>name</src>, <src>value</src>, and <src>increment</src>
00106   // from <src>rec</src>, and calls the explicit version of 
00107   // <src>setLinearRestriction</src>.  The <src>value</src> and 
00108   // <src>increment</src> fields can contain either Int, Float
00109   // or Double data at the moment.
00110   virtual void setLinearRestriction(const RecordInterface &rec);
00111 
00112   // Remove a restriction (including a 'linear' (ramped) one).
00113   // (Can be (and is) used to remove 'bindex' restriction).
00114   virtual void removeRestriction(const String& name);
00115 
00116  private:
00117   
00118   // The list of MultiWCHolders that are connected to this MWCAnimator.
00119   List<MultiWCHolder *> itsMWCHList;
00120   
00121   // Do we already have this MultiWCHolder registered?
00122   const Bool isAlreadyRegistered(const MultiWCHolder &holder);
00123   
00124 };
00125 
00126 } //# NAMESPACE CASA - END
00127 
00128 #ifndef AIPS_NO_TEMPLATE_SRC
00129 #include <display/DisplayEvents/MWCAniTemplates.tcc>
00130 #endif
00131 
00132 #endif