USGS

Isis 3.0 Developer's Reference (API)

Home

Apollo.h

Go to the documentation of this file.
00001 #ifndef Apollo_h
00002 #define Apollo_h
00003 
00027 #include "iTime.h"
00028 #include "iString.h"
00029 #include "iException.h"
00030 
00031 namespace Isis {
00043   class Apollo {
00044     public:
00045       
00046       Apollo (iString spacecraft, iString instrument) {
00047         initialize(spacecraft.UpCase(), instrument.UpCase());
00048       };
00049       
00050       Apollo(iString filename) {
00051         iString spacecraft, instrument;
00052         if (filename.substr(0,4) == "AS15") spacecraft = "APOLLO 15";
00053         else if (filename.substr(0,4) == "AS16") spacecraft = "APOLLO 16";
00054         else if (filename.substr(0,4) == "AS17") spacecraft = "APOLLO 17";
00055         // throw an error
00056         else {
00057           iString msg = "The image filename does not match the required formatting.";
00058           throw iException::Message(iException::User,msg,_FILEINFO_);
00059         }
00060         
00061         if (filename.substr(5,1) == "M") instrument = "METRIC";
00062         else if (filename.substr(5,1) == "P") instrument = "PANORAMIC";
00063         else if (filename.substr(5,1) == "H") instrument = "HASSELBLAD";
00064         // throw an error
00065         else {
00066           iString msg = "The image filename does not match the required formatting.";
00067           throw iException::Message(iException::User,msg,_FILEINFO_);
00068         }
00069         
00070         initialize(spacecraft, instrument);
00071       };
00072 
00074       ~Apollo () {};
00075       
00076       bool IsMetric () {return p_instrumentId == "METRIC";}
00077       bool IsPanoramic () {return p_instrumentId == "PANORAMIC";}
00078       bool IsHasselblad () {return p_instrumentId == "HASSELBLAD";}
00079       bool IsApollo15 () {return p_spacecraftName == "APOLLO 15";}
00080       bool IsApollo16 () {return p_spacecraftName == "APOLLO 16";}
00081       bool IsApollo17 () {return p_spacecraftName == "APOLLO 17";}
00082       int Width () {return p_imageWidth;};
00083       int Height () {return p_imageHeight;};
00084       int Bands () { return p_imageBands;};
00085       int ReseauDimension () {return p_reseauDimension;};
00086       double PixelPitch () {return p_imagePixelPitch;};
00087       iString SpacecraftName () {return p_spacecraftName;};
00088       iString InstrumentId () {return p_instrumentId;};
00089       iString NaifFrameCode () {return p_naifFrameCode;};
00090       iString TargetName () {return "MOON";};
00091       iTime LaunchDate () {return p_launchDate;};
00092 
00093       private:
00094       
00095       void initialize(iString spacecraft, iString instrument) {
00096         if (instrument == "METRIC") {
00097           p_instrumentId = "METRIC";
00098           p_reseauDimension = 403;
00099           p_imageWidth = 22900;
00100           p_imageHeight = 22900;
00101           p_imageBands = 1;
00102           p_imagePixelPitch = 200.5;
00103         }
00104         else if (instrument == "PANORAMIC") {
00105           p_instrumentId = "PANORAMIC";
00106           p_reseauDimension = 0;
00107           p_imageWidth = 231480; // 228987
00108           p_imageHeight = 23007;
00109           p_imageBands = 1;
00110           p_imagePixelPitch =200.5;
00111         }
00112         else if (instrument == "HASSELBLAD") {
00113           p_instrumentId = "HASSELBLAD";
00114           p_reseauDimension = 403;
00115           p_imageWidth = 12800;
00116           p_imageHeight = 12800;
00117           p_imageBands = 3;
00118           p_imagePixelPitch = 200.5;
00119         }
00120         else {
00121           iString msg = "Unknown instrument: " + instrument;
00122           throw Isis::iException::Message(Isis::iException::Pvl,msg, _FILEINFO_);
00123         }
00124         
00125         if (spacecraft == "APOLLO 15" ){
00126           p_spacecraftName = "APOLLO 15";
00127           // Apollo 15 launched 1971-07-26 at 13:34 GMT
00128           p_launchDate = "1971-07-26T13:33:39.11";
00129           if (IsMetric()) p_naifFrameCode = "-915240";
00130           else if (IsPanoramic()) p_naifFrameCode = "-915230";
00131         }
00132         else if (spacecraft == "APOLLO 16") {
00133           p_spacecraftName = "APOLLO 16";
00134           // Apollo 16 launched 1972-04-16 at 17:54 GMT
00135           p_launchDate = "1972-04-16T17:53:36.238";
00136           if (IsMetric()) p_naifFrameCode = "-916240";
00137           else if (IsPanoramic()) p_naifFrameCode = "-916230";
00138         }
00139         else if (spacecraft == "APOLLO 17") {
00140           p_spacecraftName = "APOLLO 17";
00141           // Apollo 17 launched 1972-12-07 at 05:33 GMT
00142           p_launchDate = "1972-12-07T05:33:00.000";
00143           if (IsMetric()) p_naifFrameCode = "-917240";
00144           else if (IsPanoramic()) p_naifFrameCode = "-917230";
00145         }
00146         else {
00147           iString msg = "Unknown spacecraft: " + spacecraft;
00148           throw Isis::iException::Message(Isis::iException::Pvl,msg, _FILEINFO_);
00149         }
00150       }
00151       
00152       int p_imageWidth, p_imageHeight, p_imageBands, p_reseauDimension;
00153       double p_imagePixelPitch;
00154       iString p_spacecraftName, p_instrumentId, p_naifFrameCode;
00155       iTime p_launchDate;
00156     };
00157 };
00158 
00159 #endif