casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ScrollingRasterDD.h
Go to the documentation of this file.
00001 //# ScrollingRasterDD.h: Base class for scrolling DisplayData objects
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004
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_SCROLLINGRASTERDD_H
00029 #define TRIALDISPLAY_SCROLLINGRASTERDD_H
00030 
00031 #include <display/DisplayDatas/PrincipalAxesDD.h>
00032 
00033 #include <casa/Arrays/Array.h>
00034 #include <lattices/Lattices/Lattice.h>
00035 #include <casa/Containers/Record.h>
00036 
00037 #include <images/Images/ImageInterface.h>
00038 #include <lattices/Lattices/MaskedLattice.h>
00039 #include <lattices/Lattices/LatticeStatistics.h>
00040 #include <lattices/Lattices/SubLattice.h>
00041 #include <lattices/Lattices/LatticeConcat.h>
00042 
00043 // <summary>
00044 // Base class for scrolling DisplayData objects
00045 // </summary>
00046 
00047 namespace casa { //# NAMESPACE CASA - BEGIN
00048 
00049 class WCResampleHandler;
00050 
00051 class ScrollingRasterDM;
00052 
00053 class ScrollingRasterDD : public PrincipalAxesDD {
00054 
00055 public:
00056   ScrollingRasterDD(const uInt nDim, 
00057     const IPosition, const Vector<String>, const Vector<String>,
00058     uInt sAxis = 2, uInt scanNo = 100);
00059   virtual ~ScrollingRasterDD();
00060   
00061   virtual void updateLattice(const Record &){};
00062   virtual void updateLattice(Array<Float> &, CoordinateSystem &);
00063   
00064   virtual String className() { 
00065     return String("ScrollingRasterDD"); 
00066   }
00067 
00068   virtual Bool setOptions(Record &rec, Record &recOut);
00069   virtual Record getOptions();
00070 
00071   virtual void setDefaultOptions();
00072   
00073   // distribute options to all the axis labellers - empty here, we use WorldAxesDD
00074   virtual Bool setLabellerOptions(Record &, Record &){return False;}
00075 
00076   // retrieve options from the axis labellers - empty here, we use WorldAxesDD
00077   virtual Record getLabellerOptions(){Record rec; return rec;}
00078   
00079 
00080   virtual Bool sizeControl(WorldCanvasHolder& wcHolder, 
00081                    AttributeBuffer& holderBuf);
00082 
00083   virtual WCResampleHandler *resampleHandler() { return itsResampleHandler; }
00084 
00085 protected:
00086   friend class ScrollingRasterDM;
00087   
00088   virtual void updateLatticeConcat(Array<Float>* = NULL , CoordinateSystem* = NULL);
00089   virtual void initLattice(const Record &);
00090   virtual void initLattice(const Float, const Float, const uInt);
00091 
00092   virtual void recreateEmptyLattices(uInt changedScanNumber = 0);
00093 
00094   virtual const IPosition dataShape() const;
00095   virtual const uInt dataDim() const;
00096   virtual const Unit dataUnit() const;
00097   virtual void setupElements();
00098   virtual void getMinAndMax(); 
00099   virtual void updateLatticeStatistics();
00100   
00101   //virtual void refresh(Bool);
00102   
00103   virtual Bool labelAxes(const WCRefreshEvent &ev);
00104   
00105   virtual MaskedLattice<Float>* maskedLattice() 
00106     { return itsLatticeConcatPtr; }
00107 
00108   virtual Display::DisplayDataType classType()
00109     { return Display::Raster; }
00110   // Pure virtual function from DisplayData...
00111   String dataType() const { return "scrolling"; }
00112   
00113   virtual String showValue(const Vector<Double> &world);
00114   virtual const Float dataValue(IPosition pos);
00115   virtual const Bool maskValue(const IPosition &pos);
00116 
00117   virtual Vector<String> worldAxisNames() const;
00118   virtual Vector<String> worldAxisUnits() const;
00119 
00120   // (Required) default constructor.
00121   ScrollingRasterDD(uInt mAxis=2, uInt scanNo=100);
00122 
00123   // (Required) copy constructor.
00124   ScrollingRasterDD(const ScrollingRasterDD &other);
00125 
00126   // (Required) copy assignment.
00127   void operator=(const ScrollingRasterDD &other);
00128 
00129   // Set Spectral preference -> not used here.
00130   virtual void setSpectralPreference (
00131     CoordinateSystem& /*cSys*/, const String&, const String& ){}
00132   
00133   void setHeaderMin(Float x){ itsHeaderMin = x; }
00134   void setHeaderMax(Float x){ itsHeaderMax = x; }
00135   Float headerMin() { return itsHeaderMin; }
00136   Float headerMax() { return itsHeaderMax; }
00137   void setScanNumber(uInt x){ itsScanNumber = x; }
00138   uInt scanNumber() { return itsScanNumber; }
00139   Bool headerReceived() { return itsHeaderReceived; }
00140   void setHeaderReceived(Bool x) { itsHeaderReceived = x; }
00141   
00142   IPosition latticesShape(){ return itsLattices[0]->shape(); }
00143   uInt shiftAxis(){ return itsShiftAxis; }
00144   
00145   void setNeedResize(const Bool x) { itsNeedResize = x; }
00146   Bool needResize() { return itsNeedResize; }
00147   
00148   IPosition fixedPos() { return itsFixedPos; }
00149 
00150   //void setPlaneNumber(const uInt x) { itsPlaneNumber = x; }
00151   //uInt planeNumber() { return itsPlaneNumber; }
00152 
00153   void setLatticeShape(const IPosition x) { itsLatticeShape = x; }
00154   IPosition latticeShape() { return itsLatticeShape; }
00155 
00156 private:
00157   // Worker function for c'tors.
00158   void initSRDD(const Vector<String> aAxisNames, const Vector<String> aAxisUnits,
00159                 uInt mAxis);
00160 
00161   uInt nDim; 
00162 
00163   //ImageInterface<Float> *itsImagePtr;
00165   LatticeConcat<Float>* itsLatticeConcatPtr;
00166   //MaskedLattice<Float>  *itsMaskedLatticePtr;
00167   LatticeStatistics<Float> *itsLatticeStatisticsPtr;
00168   SubLattice<Float> *itsFilledDisplayedLatticePtr;
00169   //Int itsM2Axis;
00170   IPosition itsFixedPos;
00171   
00172   Int itsFilledCount;
00173 
00174   MaskedLattice<Float> **itsLattices;
00175 
00176   Bool itsNeedResize;
00177   uInt itsShiftAxis;
00178 
00179   Bool itsHeaderReceived;
00180   Float itsHeaderMin;
00181   Float itsHeaderMax;
00182   uInt itsScanNumber;
00183   IPosition itsLatticeShape;
00184   //IPosition itsScanShape;
00185   //uInt itsPlaneNumber;
00186   
00187    // storage for the display parameters
00188   String itsResample;
00189 
00190   // pointer to resampler
00191   WCResampleHandler *itsResampleHandler;
00192 
00193 };
00194 
00195 
00196 } //# NAMESPACE CASA - END
00197 
00198 #endif
00199