Isis Developer Reference
Apollo.h
Go to the documentation of this file.
1#ifndef Apollo_h
2#define Apollo_h
3
10/* SPDX-License-Identifier: CC0-1.0 */
11
12#include "iTime.h"
13#include "IString.h"
14#include "IException.h"
15
16namespace Isis {
29 class Apollo {
30 public:
31
40 Apollo (QString spacecraft, QString instrument) {
41 initialize(spacecraft.toUpper(), instrument.toUpper());
42 };
43
44
53 Apollo(QString filename) {
54 QString spacecraft, instrument;
55 if (filename.mid(0,4) == "AS15") spacecraft = "APOLLO 15";
56 else if (filename.mid(0,4) == "AS16") spacecraft = "APOLLO 16";
57 else if (filename.mid(0,4) == "AS17") spacecraft = "APOLLO 17";
58 // throw an error
59 else {
60 QString msg = "The image filename does not match the required formatting.";
62 }
63
64 if (filename.mid(5,1) == "M") instrument = "METRIC";
65 else if (filename.mid(5,1) == "P") instrument = "PANORAMIC";
66 else if (filename.mid(5,1) == "H") instrument = "HASSELBLAD";
67 // throw an error
68 else {
69 QString msg = "The image filename does not match the required formatting.";
71 }
72
73 initialize(spacecraft, instrument);
74 };
75
76
78 ~Apollo () {};
79
85 bool IsMetric () {return p_instrumentId == "METRIC";}
86
87
93 bool IsPanoramic () {return p_instrumentId == "PANORAMIC";}
94
95
101 bool IsHasselblad () {return p_instrumentId == "HASSELBLAD";}
102
103
109 bool IsApollo15 () {return p_spacecraftName == "APOLLO 15";}
110
111
117 bool IsApollo16 () {return p_spacecraftName == "APOLLO 16";}
118
119
125 bool IsApollo17 () {return p_spacecraftName == "APOLLO 17";}
126
127
136 int Width () {return p_imageWidth;};
137
138
147 int Height () {return p_imageHeight;};
148
149
158 int Bands () { return p_imageBands;};
159
160
169 int ReseauDimension () {return p_reseauDimension;};
170
171
180 double PixelPitch () {return p_imagePixelPitch;};
181
182
188 QString SpacecraftName () {return p_spacecraftName;};
189
190
196 QString InstrumentId () {return p_instrumentId;};
197
198
207 QString NaifFrameCode () {return p_naifFrameCode;};
208
209
215 QString TargetName () {return "MOON";};
216
217
226 iTime LaunchDate () {return p_launchDate;};
227
228 private:
229
241 void initialize(QString spacecraft, QString instrument) {
242 if (instrument == "METRIC") {
243 p_instrumentId = "METRIC";
244 p_reseauDimension = 403;
245 p_imageWidth = 22900;
246 p_imageHeight = 22900;
247 p_imageBands = 1;
248 p_imagePixelPitch = 200.5;
249 }
250 else if (instrument == "PANORAMIC") {
251 p_instrumentId = "PANORAMIC";
252 p_reseauDimension = 0;
253 p_imageWidth = 231480; // 228987
254 p_imageHeight = 23007;
255 p_imageBands = 1;
256 p_imagePixelPitch = 200.5;
257 }
258 else if (instrument == "HASSELBLAD") {
259 p_instrumentId = "HASSELBLAD";
260 p_reseauDimension = 403;
261 p_imageWidth = 12800;
262 p_imageHeight = 12800;
263 p_imageBands = 3;
264 p_imagePixelPitch = 200.5;
265 }
266 else {
267 QString msg = "Unknown instrument: " + instrument;
268 throw IException(IException::Unknown, msg, _FILEINFO_);
269 }
270
271 if (spacecraft == "APOLLO 15" ){
272 p_spacecraftName = "APOLLO 15";
273 // Apollo 15 launched 1971-07-26 at 13:34 GMT
274 p_launchDate = "1971-07-26T13:33:39.11";
275 if (IsMetric()) p_naifFrameCode = "-915240";
276 else if (IsPanoramic()) p_naifFrameCode = "-915230";
277 }
278 else if (spacecraft == "APOLLO 16") {
279 p_spacecraftName = "APOLLO 16";
280 // Apollo 16 launched 1972-04-16 at 17:54 GMT
281 p_launchDate = "1972-04-16T17:53:36.238";
282 if (IsMetric()) p_naifFrameCode = "-916240";
283 else if (IsPanoramic()) p_naifFrameCode = "-916230";
284 }
285 else if (spacecraft == "APOLLO 17") {
286 p_spacecraftName = "APOLLO 17";
287 // Apollo 17 launched 1972-12-07 at 05:33 GMT
288 p_launchDate = "1972-12-07T05:33:00.000";
289 if (IsMetric()) p_naifFrameCode = "-917240";
290 else if (IsPanoramic()) p_naifFrameCode = "-917230";
291 }
292 else {
293 QString msg = "Unknown spacecraft: " + spacecraft;
294 throw IException(IException::Unknown, msg, _FILEINFO_);
295 }
296 }
297
298
299 int p_imageWidth;
300 int p_imageHeight;
301 int p_imageBands;
302 int p_reseauDimension;
303 double p_imagePixelPitch;
304 QString p_spacecraftName;
305 QString p_instrumentId;
306 QString p_naifFrameCode;
307 iTime p_launchDate;
308 };
309};
310
311#endif
#define _FILEINFO_
Macro for the filename and line number.
Definition IException.h:24
Reads user Apollos from a data file.
Definition Apollo.h:29
bool IsApollo15()
Checks if the spacecraft is Apollo 15.
Definition Apollo.h:109
QString TargetName()
Returns the target name which is always the Moon.
Definition Apollo.h:215
bool IsPanoramic()
Checks if the instrument is an Apollo Panoramic camera.
Definition Apollo.h:93
QString NaifFrameCode()
Returns the NAIF frame code.
Definition Apollo.h:207
Apollo(QString filename)
Constructor.
Definition Apollo.h:53
iTime LaunchDate()
Returns the launch date of the mission.
Definition Apollo.h:226
int ReseauDimension()
Returns the reseau dimension of the image.
Definition Apollo.h:169
double PixelPitch()
Returns pixel pitch for the image.
Definition Apollo.h:180
bool IsMetric()
Checks if the instrument is an Apollo Metric camera.
Definition Apollo.h:85
QString SpacecraftName()
Returns the spacecraft name.
Definition Apollo.h:188
bool IsHasselblad()
Checks if the instrument is an Apollo Hasselblad camera.
Definition Apollo.h:101
~Apollo()
Destroys the Apollo object.
Definition Apollo.h:78
int Bands()
Returns number of bands in the image.
Definition Apollo.h:158
int Height()
Returns the height of the image.
Definition Apollo.h:147
Apollo(QString spacecraft, QString instrument)
Constructor.
Definition Apollo.h:40
bool IsApollo17()
Checks if the spacecraft is Apollo 17.
Definition Apollo.h:125
int Width()
Returns the width of the image.
Definition Apollo.h:136
bool IsApollo16()
Checks if the spacecraft is Apollo 16.
Definition Apollo.h:117
QString InstrumentId()
Returns the instrument ID.
Definition Apollo.h:196
Isis exception class.
Definition IException.h:91
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition IException.h:118
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition IException.h:126
Parse and return pieces of a time string.
Definition iTime.h:65
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16