casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LatticePADMRaster.h
Go to the documentation of this file.
00001 //# LatticePADMRaster.h: drawing axis bound lattice elements as rasters
00002 //# Copyright (C) 1996,1997,1998,1999,2000,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_LATTICEPADMRASTER_H
00029 #define TRIALDISPLAY_LATTICEPADMRASTER_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 template <class T> class LatticePADisplayData;
00042 class WorldCanvas;
00043 template <class T> class Vector;
00044 template <class T> class Matrix;
00045 
00046 // <summary>
00047 // Class to draw a raster image of a slice of 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="LatticeAsRaster">LatticeAsRaster</linkto>
00057 // </prerequisite>
00058 //
00059 // <etymology>
00060 // The purpose of this class is to draw "raster" images of data that
00061 // is "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 LatticeAsRaster class.  One or more
00068 // instances of this class are created by a single LatticeAsRaster
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 LatticeAsRaster 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 LatticeAsRaster,
00077 // in, for example, a support function for a constructor:
00078 // <srcblock>
00079 // template <class T>
00080 // void LatticeAsRaster<T>::setupElements(IPosition fixedPos) {
00081 //   if (nPixelAxes > 2) {
00082 //     nImages = dataLattice()->shape()(zAxisNum);
00083 //     DDelement.resize(nImages);
00084 //     for (uInt index = 0; index < nImages; index++) {
00085 //       fixedPos(zAxisNum) = index;
00086 //       DDelement[index] = (LatticePADisplayMethod<T> *)new 
00087 //       LatticePADMRaster<T>(dataLattice(), xAxisNum, yAxisNum,
00088 //                            zAxisNum, fixedPos, this);
00089 //     }
00090 //   } else {
00091 //     nImages = 1;
00092 //     DDelement.resize(nImages);
00093 //     DDelement[0] = (LatticePADisplayMethod<T> *)new
00094 //       LatticePADMRaster<T>(dataLattice(), xAxisNum, yAxisNum, this);
00095 //   }
00096 // }
00097 // </srcblock>
00098 // </example>
00099 //
00100 // <motivation>
00101 // Displaying 2-dimensional slices of a lattice-based data volume is
00102 // a standard display requirement for astronomical data visualization
00103 // and presentation.
00104 // </motivation>
00105 //
00106 // <templating arg=T>
00107 // </templating>
00108 //
00109 // <thrown>
00110 // </thrown>
00111 //
00112 // <todo asof="yyyy/mm/dd">
00113 // </todo>
00114 
00115 template <class T> class LatticePADMRaster : public LatticePADisplayMethod<T> {
00116 
00117  public:
00118 
00119   // Constructors: >2d and 2d.  xAxis and yAxis specify which axis in 
00120   // the Lattice (0-based) should be mapped to X and Y on the display
00121   // device: ie. 2-d slices of the data to be displayed have these as
00122   // axes.  mAxis specifies the "movie" axis, which is the axis along
00123   // which different slices are taken.  fixedPos is an IPosition
00124   // having the same length as the number of dimensions in the array, 
00125   // and indicates the fixed axis values for axes in the data that are
00126   // not specified as xAxis or yAxis: indeed, <src>fixedPos(mAxis)</src>
00127   // indicates which pixel value along the movie axis that this
00128   // particular object looks after.
00129   // <group>
00130   LatticePADMRaster(const uInt xAxis,
00131                     const uInt yAxis, const uInt mAxis,
00132                     const IPosition fixedPos,
00133                     LatticePADisplayData<T> *arDat);
00134   LatticePADMRaster(const uInt xAxis,
00135                     const uInt yAxis, LatticePADisplayData<T> *arDat);
00136   // </group>
00137 
00138   // Destructor
00139   virtual ~LatticePADMRaster();
00140 
00141   // Invoke (much more rapid) redraw of previous color-index rendering if
00142   // applicable (i.e., only during colormap 'fiddling' -- ColorTableChange
00143   // refresh).  Return value indicates success.
00144   virtual Bool dataRedrawSelf(WorldCanvas*,  Display::RefreshReason);
00145   
00146   // Actually draw on the display device.  The WorldCanvasHolder will
00147   // tell the LatticeAsRaster that it should now draw, which will in
00148   // turn determine which of its one or more LatticePADMRaster objects 
00149   // should draw by matching the movie value on the WorldCanvas.  The 
00150   // raster is drawn from world coordinate blc to trc.
00151   virtual uInt dataDrawSelf(WorldCanvas *wCanvas,
00152                             const Vector<Double> &blc,
00153                             const Vector<Double> &trc,
00154                             const IPosition &start,
00155                             const IPosition &shape,
00156                             const IPosition &stride,
00157                             const Bool usePixelEdges = False);
00158 
00159   //# Make parent members known.
00160 protected:
00161   using LatticePADisplayMethod<T>::parentDisplayData;
00162 };
00163 
00164 
00165 } //# NAMESPACE CASA - END
00166 
00167 #ifndef AIPS_NO_TEMPLATE_SRC
00168 #include <display/DisplayDatas/LatticePADMRaster.tcc>
00169 #endif //# AIPS_NO_TEMPLATE_SRC
00170 #endif