Cartesian.hxx

Go to the documentation of this file.
00001 
00002 
00003 
00004 //-----------------------------------------------------------------------------
00005 // CVS: $Revision: 4695 $, $Date: 2008-04-09 16:18:42 +0100 (Wed, 09 Apr 2008) $, $Author: EckhardSutorius $
00006 //-----------------------------------------------------------------------------
00007 #ifndef CARTESIAN_H
00008 #define CARTESIAN_H
00009 
00010 #include "Constants.h"
00011 #include "Converter.h"
00012 #include "DataMethod.hxx"
00013 #include "DataOps.h"
00014 #include "StringOps.h"
00015 //-----------------------------------------------------------------------------
00018 template<typename DataType>
00019 class Cartesian : public DataMethod<DataType>
00020 {
00021 public:
00023   Cartesian() { DataMethod<DataType>::methodName = "Cartesian"; }
00024 
00026   virtual ~Cartesian() {}
00027 
00031   void setSource(IntMap& tbls, IntMap& cols, StringMap units)
00032   {
00033     raColno  = cols[0];
00034     decColno = cols[1];
00035     Converter converter;
00036     mDecFact = converter.getFactor(units[0], "RADIANS");
00037     mRAFact  = converter.getFactor(units[1], "RADIANS");
00038   }
00039 
00042   void setTarget(IntMap& cols, StringMap units)
00043   {
00044     cxColno = cols[0];
00045     cyColno = cols[1];
00046     czColno = cols[2];
00047   }
00048 
00050   void doit(TableData<DataType>& data, int row1, int row2)
00051   {
00052     for (int rowNo = row1; rowNo < row2; ++rowNo)
00053     {
00054       // Input RA and DEC
00055       double ra, dec;
00056       data.value(raColno, rowNo, ra);
00057       data.value(decColno, rowNo, dec);
00058 
00059       // Cartesian components
00060       double cx, cy, cz;
00061       DataOps::calcCartesian(mRAFact * ra, mDecFact * dec, cx, cy, cz);
00062 
00063       // Assign to correct columns
00064       data.assign(cxColno, rowNo, cx);
00065       data.assign(cyColno, rowNo, cy);
00066       data.assign(czColno, rowNo, cz);
00067     }
00068   }
00069   // No data from raw data included
00070   void doit2(TableData<DataType>& rawData, TableData<DataType>& data, int row1, int row2) { }
00071 
00072 private:
00073   int cxColno;
00074   int cyColno;
00075   int czColno;
00076   int raColno;
00077   int decColno;
00078   double mDecFact;
00079   double mRAFact;
00080 };
00081 //-----------------------------------------------------------------------------
00082 #endif
00083 //-----------------------------------------------------------------------------
00084 // Change log:
00085 //
00086 // 27-May-2004,  IAB: Original version.
00087 // 22-Mar-2007,  RSC: Robustified against dodgy WCS values.
00088 //  2-May-2007,  RSC: Reverted to original design of allowing dodgy WCS values.
00089 //  7-Apr-2008, ETWS: Upgraded to use new detection table layout.

Generated on Thu Apr 2 21:52:15 2009 for WfcamSrc by  doxygen 1.5.2