Isis 3 Programmer Reference
VariableLineScanCameraDetectorMap.cpp
Go to the documentation of this file.
1 
25 #include "CameraFocalPlaneMap.h"
26 #include "iTime.h"
27 
28 namespace Isis {
40  Camera *parent,
41  std::vector< LineRateChange > &lineRates) :
43  lineRates[0].GetStartEt(),
44  lineRates[0].GetLineScanRate()),
45  p_lineRates(lineRates) {
46  }
47 
48 
53  }
54 
55 
68  const double line) {
69  // Use the parent SetDetector for the sample, which should work fine
70  if (!CameraDetectorMap::SetDetector(sample, line)) {
71  return false;
72  }
73 
74  // currEt is our known et time
75  double currEt = p_camera->time().Et();
76  int rateIndex = p_lineRates.size() - 1;
77 
78  while (rateIndex >= 0 && currEt < p_lineRates[rateIndex].GetStartEt() - 0.5) {
79  rateIndex --;
80  }
81 
82  if (rateIndex < 0) {
83  return false;
84  }
85 
86  int rateStartLine = p_lineRates[rateIndex].GetStartLine();
87  double rateStartEt = p_lineRates[rateIndex].GetStartEt();
88  double rate = p_lineRates[rateIndex].GetLineScanRate();
89 
90  double etDiff = currEt - rateStartEt;
91  p_parentLine = etDiff / rate + (rateStartLine - 0.5);
92 
93  //std::cout << "p_parentLine = " << p_parentLine << " = " << etDiff << "/" << rate << " + " << rateStartLine << std::endl;
94 
95  SetLineRate(rate);
96 
97  return true;
98  }
99 
100 
113  const double line) {
114  return SetParent(sample, line, 0.0);
115  }
116 
117 
131  const double line,
132  const double deltaT) {
133  if (!CameraDetectorMap::SetParent(sample, line, deltaT)) {
134  return false;
135  } //check to make sure we're not doubling the "DeltaT"
136 
138 
139  int rateIndex = p_lineRates.size() - 1;
140 
141  while (rateIndex >= 0 && line < p_lineRates[rateIndex].GetStartLine() - 0.5) {
142  rateIndex --;
143  }
144 
145  if (rateIndex < 0) {
146  return false;
147  }
148 
149  int rateStartLine = p_lineRates[rateIndex].GetStartLine();
150  double rateStartEt = p_lineRates[rateIndex].GetStartEt();
151  double rate = p_lineRates[rateIndex].GetLineScanRate();
152 
160  double et = rateStartEt + (line - (rateStartLine - 0.5)) * rate;
161  //printf("et = %.8f = %.8f + (%.3f - %i) * %.8f\n", et, rateStartEt, line, rateStartLine, rate);
162 
163  SetLineRate(rate);
164 
165  p_camera->setTime(et + deltaT);
166 
167  return true;
168  }
169 
170 
191  const double line,
192  const int band) const {
193  return lineRate(line).GetLineScanRate();
194  }
195 
196 
208  int rateIndex = p_lineRates.size() - 1;
209 
210  while (rateIndex >= 0 && line < p_lineRates[rateIndex].GetStartLine() - 0.5) {
211  rateIndex --;
212  }
213 
214  if (rateIndex < 0) {
215  //This may not be a good idea
216  // SetParent used to return false here
217  // exposureDuration used to throw an exception here
218  rateIndex = 0;
219  }
220 
221  return p_lineRates[rateIndex];
222  }
223 
224 }
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
VariableLineScanCameraDetectorMap(Camera *parent, std::vector< LineRateChange > &lineRates)
Constructs a VariableLineScanCameraDetectorMap.
void SetLineRate(const double lineRate)
Reset the line rate.
LineRateChange & lineRate(const double line) const
Get the line rate information for a given line.
Container class for storing timing information for a section of an image.
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
double p_detectorLine
Detector coordinate line value.
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
Definition: Sensor.cpp:112
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
Definition: Camera.cpp:2848
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
Camera * p_camera
Pointer to the camera.
virtual double exposureDuration(const double sample, const double line, const int band) const
This virtual method is for returning the exposure duration of a given pixel.
double p_parentLine
The parent line calculated from the detector.
Convert between parent image coordinates and detector coordinates.
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:139
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions...
Definition: Spice.cpp:809