Isis 3.0 Programmer Reference
Back | Home
Apollo.h
Go to the documentation of this file.
1 #ifndef Apollo_h
2 #define Apollo_h
3 
27 #include "iTime.h"
28 #include "IString.h"
29 #include "IException.h"
30 
31 namespace Isis {
43  class Apollo {
44  public:
45 
46  Apollo (QString spacecraft, QString instrument) {
47  initialize(spacecraft.toUpper(), instrument.toUpper());
48  };
49 
50  Apollo(QString filename) {
51  QString spacecraft, instrument;
52  if (filename.mid(0,4) == "AS15") spacecraft = "APOLLO 15";
53  else if (filename.mid(0,4) == "AS16") spacecraft = "APOLLO 16";
54  else if (filename.mid(0,4) == "AS17") spacecraft = "APOLLO 17";
55  // throw an error
56  else {
57  QString msg = "The image filename does not match the required formatting.";
59  }
60 
61  if (filename.mid(5,1) == "M") instrument = "METRIC";
62  else if (filename.mid(5,1) == "P") instrument = "PANORAMIC";
63  else if (filename.mid(5,1) == "H") instrument = "HASSELBLAD";
64  // throw an error
65  else {
66  QString msg = "The image filename does not match the required formatting.";
68  }
69 
70  initialize(spacecraft, instrument);
71  };
72 
74  ~Apollo () {};
75 
76  bool IsMetric () {return p_instrumentId == "METRIC";}
77  bool IsPanoramic () {return p_instrumentId == "PANORAMIC";}
78  bool IsHasselblad () {return p_instrumentId == "HASSELBLAD";}
79  bool IsApollo15 () {return p_spacecraftName == "APOLLO 15";}
80  bool IsApollo16 () {return p_spacecraftName == "APOLLO 16";}
81  bool IsApollo17 () {return p_spacecraftName == "APOLLO 17";}
82  int Width () {return p_imageWidth;};
83  int Height () {return p_imageHeight;};
84  int Bands () { return p_imageBands;};
85  int ReseauDimension () {return p_reseauDimension;};
86  double PixelPitch () {return p_imagePixelPitch;};
87  QString SpacecraftName () {return p_spacecraftName;};
88  QString InstrumentId () {return p_instrumentId;};
89  QString NaifFrameCode () {return p_naifFrameCode;};
90  QString TargetName () {return "MOON";};
91  iTime LaunchDate () {return p_launchDate;};
92 
93  private:
94 
95  void initialize(QString spacecraft, QString instrument) {
96  if (instrument == "METRIC") {
97  p_instrumentId = "METRIC";
98  p_reseauDimension = 403;
99  p_imageWidth = 22900;
100  p_imageHeight = 22900;
101  p_imageBands = 1;
102  p_imagePixelPitch = 200.5;
103  }
104  else if (instrument == "PANORAMIC") {
105  p_instrumentId = "PANORAMIC";
106  p_reseauDimension = 0;
107  p_imageWidth = 231480; // 228987
108  p_imageHeight = 23007;
109  p_imageBands = 1;
110  p_imagePixelPitch =200.5;
111  }
112  else if (instrument == "HASSELBLAD") {
113  p_instrumentId = "HASSELBLAD";
114  p_reseauDimension = 403;
115  p_imageWidth = 12800;
116  p_imageHeight = 12800;
117  p_imageBands = 3;
118  p_imagePixelPitch = 200.5;
119  }
120  else {
121  QString msg = "Unknown instrument: " + instrument;
122  throw IException(IException::Unknown, msg, _FILEINFO_);
123  }
124 
125  if (spacecraft == "APOLLO 15" ){
126  p_spacecraftName = "APOLLO 15";
127  // Apollo 15 launched 1971-07-26 at 13:34 GMT
128  p_launchDate = "1971-07-26T13:33:39.11";
129  if (IsMetric()) p_naifFrameCode = "-915240";
130  else if (IsPanoramic()) p_naifFrameCode = "-915230";
131  }
132  else if (spacecraft == "APOLLO 16") {
133  p_spacecraftName = "APOLLO 16";
134  // Apollo 16 launched 1972-04-16 at 17:54 GMT
135  p_launchDate = "1972-04-16T17:53:36.238";
136  if (IsMetric()) p_naifFrameCode = "-916240";
137  else if (IsPanoramic()) p_naifFrameCode = "-916230";
138  }
139  else if (spacecraft == "APOLLO 17") {
140  p_spacecraftName = "APOLLO 17";
141  // Apollo 17 launched 1972-12-07 at 05:33 GMT
142  p_launchDate = "1972-12-07T05:33:00.000";
143  if (IsMetric()) p_naifFrameCode = "-917240";
144  else if (IsPanoramic()) p_naifFrameCode = "-917230";
145  }
146  else {
147  QString msg = "Unknown spacecraft: " + spacecraft;
148  throw IException(IException::Unknown, msg, _FILEINFO_);
149  }
150  }
151 
152  int p_imageWidth, p_imageHeight, p_imageBands, p_reseauDimension;
153  double p_imagePixelPitch;
154  QString p_spacecraftName, p_instrumentId, p_naifFrameCode;
155  iTime p_launchDate;
156  };
157 };
158 
159 #endif
~Apollo()
Destroys the Apollo object.
Definition: Apollo.h:74
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
A type of error that could only have occurred due to a mistake on the user's part (e...
Definition: IException.h:134
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:126
Reads user Apollos from a data file.
Definition: Apollo.h:43
Isis exception class.
Definition: IException.h:99

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:14:15