Isis 3 Programmer Reference
BundleObservationVector.cpp
2 
3 #include <QDebug>
4 
5 #include "BundleObservation.h"
6 #include "IException.h"
7 
8 namespace Isis {
9 
14  }
15 
16 
28  }
29 
30 
37  clear();
38  }
39 
40 
51  if (&src != this) {
55  }
56  return *this;
57  }
58 
59 
84  QString observationNumber,
85  QString instrumentId,
86  BundleSettingsQsp bundleSettings) {
87  BundleObservationQsp bundleObservation;
88  bool addToExisting = false;
89 
90  if (bundleSettings->solveObservationMode() &&
91  m_observationNumberToObservationMap.contains(observationNumber)) {
92  bundleObservation = m_observationNumberToObservationMap.value(observationNumber);
93 
94  addToExisting = true;
95  }
96 
97  if (addToExisting) {
98  // if we have already added a BundleObservation with this number, we have to add the new
99  // BundleImage to this observation
100  bundleObservation->append(bundleImage);
101 
102  bundleImage->setParentObservation(bundleObservation);
103 
104  // update observation number to observation ptr map
105  m_observationNumberToObservationMap.insertMulti(observationNumber,bundleObservation);
106 
107  // update image serial number to observation ptr map
108  m_imageSerialToObservationMap.insertMulti(bundleImage->serialNumber(),bundleObservation);
109  }
110  else {
111  // create new BundleObservation and append to this vector
112  bundleObservation = BundleObservationQsp(new BundleObservation(bundleImage,
113  observationNumber,
114  instrumentId,
115  bundleSettings->bundleTargetBody()));
116 
117  if (!bundleObservation) {
118  QString message = "Unable to allocate new BundleObservation ";
119  message += "for " + bundleImage->fileName();
121  }
122 
123  bundleImage->setParentObservation(bundleObservation);
124 
125  // Find the bundle observation solve settings for this new observation
126  BundleObservationSolveSettings solveSettings;
127  // When there is only one bundle observation solve setting, use it for all observations
128  if ( bundleSettings->numberSolveSettings() == 1) {
129  solveSettings = bundleSettings->observationSolveSettings(0);
130  }
131  // Otherwise, we want to grab the bundle observation solve settings that is associated with
132  // the observation number for this new observation
133  else {
134  solveSettings = bundleSettings->observationSolveSettings(observationNumber);
135  }
136 
137  bundleObservation->setSolveSettings(solveSettings);
138 
139  bundleObservation->setIndex(size());
140 
141  append(bundleObservation);
142 
143  // update observation number to observation ptr map
144  m_observationNumberToObservationMap.insertMulti(observationNumber, bundleObservation);
145 
146  // update image serial number to observation ptr map
147  m_imageSerialToObservationMap.insertMulti(bundleImage->serialNumber(), bundleObservation);
148  }
149 
150  return bundleObservation;
151  }
152 
153 
160  int positionParameters = 0;
161 
162  for (int i = 0; i < size(); i++) {
163  BundleObservationQsp observation = at(i);
164  positionParameters += observation->numberPositionParameters();
165  }
166 
167  return positionParameters;
168  }
169 
170 
177  int pointingParameters = 0;
178 
179  for (int i = 0; i < size(); i++) {
180  BundleObservationQsp observation = at(i);
181  pointingParameters += observation->numberPointingParameters();
182  }
183 
184  return pointingParameters;
185  }
186 
187 
196  }
197 
198 
210  observationByCubeSerialNumber(QString cubeSerialNumber) {
211  BundleObservationQsp bundleObservation;
212 
213  if (m_imageSerialToObservationMap.contains(cubeSerialNumber))
214  bundleObservation = m_imageSerialToObservationMap.value(cubeSerialNumber);
215 
216  return bundleObservation;
217  }
218 
219 
226  int nObservations = size();
227  for (int i = 0; i < nObservations; i++) {
228  BundleObservationQsp observation = at(i);
229  observation->initializeExteriorOrientation();
230  }
231 
232  return true;
233  }
234 
235 
242  int nObservations = size();
243  for (int i = 0; i < nObservations; i++) {
244  BundleObservationQsp observation = at(i);
245  observation->initializeBodyRotation();
246  }
247 
248  return true;
249  }
250 }
251 
252 
This class is a container class for BundleObservations.
BundleObservationVector & operator=(const BundleObservationVector &src)
Assignment operator.
int numberParameters()
Returns the sum of the position parameters and pointing parameters for the contained BundleObservatio...
Class for bundle observations.
int numberPointingParameters()
Accesses the number of pointing parameters for the contained BundleObservations.
QMap< QString, BundleObservationQsp > m_imageSerialToObservationMap
Map between image serial number and pointer to observation.
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
QSharedPointer< BundleObservation > BundleObservationQsp
Typdef for BundleObservation QSharedPointer.
BundleObservationQsp addNew(BundleImageQsp image, QString observationNumber, QString instrumentId, BundleSettingsQsp bundleSettings)
Adds a new BundleObservation to this vector or fetches an existing BundleObservation if this vector a...
BundleObservationQsp observationByCubeSerialNumber(QString cubeSerialNumber)
Accesses a BundleObservation associated with the passed serial number.
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
QMap< QString, BundleObservationQsp > m_observationNumberToObservationMap
Map between observation number and pointer to observation.
bool initializeExteriorOrientation()
Initializes the exterior orientations for the contained BundleObservations.
int numberPositionParameters()
Accesses the number of position parameters for the contained BundleObservations.
This class is used to modify and manage solve settings for 1 to many BundleObservations.
Isis exception class.
Definition: IException.h:107
bool initializeBodyRotation()
Initializes the body rotations for the contained BundleObservations.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
BundleObservationVector()
Constructs an empty BundleObservationVector.