Isis 3.0 Object Programmers' Reference
Home
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ApolloMetricCamera.cpp
Go to the documentation of this file.
1
20
#include "
ApolloMetricCamera.h
"
21
22
#include "
ApolloMetricDistortionMap.h
"
23
24
#include "
CameraDetectorMap.h
"
25
#include "
CameraFocalPlaneMap.h
"
26
#include "
CameraGroundMap.h
"
27
#include "
CameraSkyMap.h
"
28
#include "
FileName.h
"
29
#include "
IException.h
"
30
#include "
IString.h
"
31
#include "
iTime.h
"
32
#include "
NaifStatus.h
"
33
#include "
ReseauDistortionMap.h
"
34
35
using namespace
std;
36
namespace
Isis {
48
ApolloMetricCamera::ApolloMetricCamera(
Cube
&cube) :
FramingCamera
(cube) {
49
NaifStatus::CheckErrors
();
50
51
// Get the camera characteristics
52
SetFocalLength
();
53
SetPixelPitch
();
54
55
// Setup detector map
56
new
CameraDetectorMap
(
this
);
57
58
// Setup focal plane map
59
CameraFocalPlaneMap
*focalMap =
new
CameraFocalPlaneMap
(
this
,
naifIkCode
());
60
focalMap->
SetDetectorOrigin
(
ParentSamples
() / 2.0,
ParentLines
() / 2.0);
61
62
QString ppKey(
"INS"
+
toString
(
naifIkCode
()) +
"_PP"
);
63
QString odkKey(
"INS"
+
toString
(
naifIkCode
()) +
"_OD_K"
);
64
QString decenterKey(
"INS"
+
toString
(
naifIkCode
()) +
"_DECENTER"
);
65
66
new
ApolloMetricDistortionMap
(
this
,
getDouble
(ppKey, 0),
67
getDouble
(ppKey, 1),
getDouble
(odkKey, 0),
getDouble
(odkKey, 1),
68
getDouble
(odkKey, 2),
getDouble
(decenterKey, 0),
69
getDouble
(decenterKey, 1),
getDouble
(decenterKey, 2));
70
71
// Setup the ground and sky map
72
new
CameraGroundMap
(
this
);
73
new
CameraSkyMap
(
this
);
74
75
Pvl
&lab = *cube.
label
();
76
const
PvlGroup
&inst = lab.
findGroup
(
"Instrument"
,
Pvl::Traverse
);
77
78
// The Spacecraft Name should be either Apollo 15, 16, or 17. The name
79
// itself could be formatted any number of ways, but the number contained
80
// in the name should be unique between the missions
81
QString spacecraft = inst.
findKeyword
(
"SpacecraftName"
)[0];
82
if
(spacecraft.contains(
"15"
)) {
83
p_ckFrameId
= -915240;
84
p_ckReferenceId
= 1;
85
p_spkTargetId
= -915;
86
}
87
else
if
(spacecraft.contains(
"16"
)) {
88
p_ckFrameId
= -916240;
89
p_ckReferenceId
= 1;
90
p_spkTargetId
= -916;
91
}
92
else
if
(spacecraft.contains(
"17"
)) {
93
p_ckFrameId
= -917240;
94
p_ckReferenceId
= 1;
95
p_spkTargetId
= -917;
96
}
97
else
{
98
QString msg =
"File does not appear to be an Apollo image"
;
99
throw
IException
(
IException::User
, msg,
_FILEINFO_
);
100
}
101
102
// Create a cache and grab spice info since it does not change for
103
// a framing camera (fixed spacecraft position and pointing)
104
// Convert the start time to et
105
setTime
((QString)inst[
"StartTime"
]);
106
LoadCache
();
107
NaifStatus::CheckErrors
();
108
}
109
131
pair<iTime, iTime>
ApolloMetricCamera::ShutterOpenCloseTimes
(
double
time,
132
double
exposureDuration) {
133
pair<iTime, iTime> shuttertimes;
134
// To get shutter start (open) time, subtract half exposure duration
135
shuttertimes.first = time - (exposureDuration / 2.0);
136
// To get shutter end (close) time, add half exposure duration
137
shuttertimes.second = time + (exposureDuration / 2.0);
138
return
shuttertimes;
139
}
140
}
// End Apollo namespace
141
153
extern
"C"
Isis::Camera
*
ApolloMetricCameraPlugin
(
Isis::Cube
&cube) {
154
return
new
Isis::ApolloMetricCamera
(cube);
155
}