casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LatticePADMVector.h
Go to the documentation of this file.
00001 //# LatticePADMVector.h: drawing axis bound lattice elements as vector fields
00002 //# Copyright (C) 1996,1997,1998,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_LATTICEPADMVECTOR_H
00029 #define TRIALDISPLAY_LATTICEPADMVECTOR_H
00030 
00031 //# aips includes:
00032 #include <casa/aips.h>
00033 
00034 //# display library includes:
00035 #include <display/DisplayDatas/LatticePADM.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 //# forwards:
00040 class IPosition;
00041 class WorldCanvas;
00042 template <class T> class LatticePADisplayData;
00043 template <class T> class Vector;
00044 template <class T> class Matrix;
00045 
00046 // <summary>
00047 // Class to draw a single vector map of a slice from an AIPS++ Lattice.
00048 // </summary>
00049 //
00050 // <use visibility=local>
00051 //
00052 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00053 // </reviewed>
00054 //
00055 // <prerequisite>
00056 // <li> <linkto class="LatticeAsVector">LatticeAsVector</linkto>
00057 // </prerequisite>
00058 //
00059 // <etymology>
00060 // The purpose of this class is to draw "vector" maps of data that
00061 // are "lattice"-based.  The "PADM" refers to PrincipalAxesDisplayMethod,
00062 // meaning that one or more instances of this class are used to actually
00063 // draw slices of a Lattice along its main axes.
00064 // </etymology>
00065 //
00066 // <synopsis>
00067 // This is a helper class for the LatticeAsVector class.  One or more
00068 // instances of this class are created by a single LatticeAsVector
00069 // object, each being responsible for drawing a different slice of the 
00070 // data.
00071 // </synopsis>
00072 //
00073 // <example>
00074 // This class should only be used by the LatticeAsVector class to
00075 // setup a number of views of an AIPS++ Image or Array.  As such, this
00076 // example simply outlines how this class is used by LatticeAsVector,
00077 // in, for example, a support function for a constructor:
00078 // <srcblock>
00079 // void LatticeAsVector::setupElements(IPosition fixedPos) {
00080 //   if (nPixelAxes > 2) {
00081 //     nImages = dataLattice()->shape()(zAxisNum);
00082 //     DDelement.resize(nImages);
00083 //     for (uInt index = 0; index < nImages; index++) {
00084 //       fixedPos(zAxisNum) = index;
00085 //       DDelement[index] = (LatticePADisplayMethod<Complex> *)new 
00086 //       LatticePADMVector(dataLattice(), xAxisNum, yAxisNum,
00087 //                            zAxisNum, fixedPos, this);
00088 //     }
00089 //   } else {
00090 //     nImages = 1;
00091 //     DDelement.resize(nImages);
00092 //     DDelement[0] = (LatticePADisplayMethod<Complex> *)new
00093 //       LatticePADMVector(dataLattice(), xAxisNum, yAxisNum, this);
00094 //   }
00095 // }
00096 // </srcblock>
00097 // </example>
00098 //
00099 // <motivation>
00100 // Displaying 2-dimensional slices of a lattice-based data volume is
00101 // a standard display requirement for astronomical data visualization
00102 // and presentation.
00103 // </motivation>
00104 //
00105 // <thrown>
00106 // </thrown>
00107 //
00108 // <todo asof="yyyy/mm/dd">
00109 // </todo>
00110 
00111 template <class T> class LatticePADMVector : public LatticePADisplayMethod<T> {
00112 
00113  public:
00114   
00115   // Constructors: >2d and 2d.  xAxis and yAxis specify which axis in 
00116   // the Lattice (0-based) should be mapped to X and Y on the display
00117   // device: ie. 2-d slices of the data to be displayed have these as
00118   // axes.  mAxis specifies the "movie" axis, which is the axis along
00119   // which different slices are taken.  fixedPos is an IPosition
00120   // having the same length as the number of dimensions in the array, 
00121   // and indicates the fixed axis values for axes in the data that are
00122   // not specified as xAxis or yAxis: indeed, <src>fixedPos(mAxis)</src>
00123   // indicates which pixel value along the movie axis that this
00124   // particular object looks after.
00125   // <group>
00126   LatticePADMVector(const uInt xAxis,
00127                     const uInt yAxis, const uInt mAxis,
00128                     const IPosition fixedPos,
00129                     LatticePADisplayData<T>* arDat);
00130   LatticePADMVector(const uInt xAxis,
00131                     const uInt yAxis, LatticePADisplayData<T>* arDat);
00132   // </group>
00133 
00134   // Destructor
00135   virtual ~LatticePADMVector();
00136 
00137   // Actually draw on the display device.  The WorldCanvasHolder will
00138   // tell the LatticeAsVector that it should now draw, which will in
00139   // turn determine which of its one or more LatticePADMVector objects 
00140   // should draw by matching the movie value on the WorldCanvas.  The 
00141   // vector is drawn in the world coordinate range blc to trc.
00142   virtual uInt dataDrawSelf(WorldCanvas *wCanvas,
00143                             const Vector<Double> &blc,
00144                             const Vector<Double> &trc,
00145                             const IPosition &start,
00146                             const IPosition &shape,
00147                             const IPosition &stride,
00148                             const Bool usePixelEdges = False);
00149 
00150  private:
00151 //
00152   Matrix<Float> getAmplitude(const Matrix<T>& data) const;
00153 
00154   //# Make parent members known.
00155 protected:
00156   using LatticePADisplayMethod<T>::parentDisplayData;
00157 };
00158 
00159 
00160 } //# NAMESPACE CASA - END
00161 
00162 #ifndef AIPS_NO_TEMPLATE_SRC
00163 #include <display/DisplayDatas/LatticePADMVector.tcc>
00164 #endif //# AIPS_NO_TEMPLATE_SRC
00165 #endif