diff --git a/isis/src/control/objs/BundleAdjust/BundleAdjust.cpp b/isis/src/control/objs/BundleAdjust/BundleAdjust.cpp index ba1be2b26b..f8e631fa7f 100644 --- a/isis/src/control/objs/BundleAdjust/BundleAdjust.cpp +++ b/isis/src/control/objs/BundleAdjust/BundleAdjust.cpp @@ -425,6 +425,7 @@ namespace Isis { throw IException(IException::Programmer, msg, _FILEINFO_); } + // TODO ISIS vs. CSM (addNewIsisObservation?) AbstractBundleObservationQsp observation = m_bundleObservations.addNew(image, observationNumber, instrumentId, m_bundleSettings); @@ -436,9 +437,11 @@ namespace Isis { } // initialize exterior orientation (spice) for all BundleImages in all BundleObservations + // // TODO!!! - should these initializations just be done when we add the new observation above? m_bundleObservations.initializeExteriorOrientation(); + // TODO if (m_bundleSettings->solveTargetBody()) { m_bundleObservations.initializeBodyRotation(); } @@ -2164,8 +2167,10 @@ namespace Isis { observation->applyParameterCorrections(subrange(m_imageSolution,t,t+numParameters)); if (m_bundleSettings->solveTargetBody()) { - // TODO: needs to be updated for ISIS vs. CSM CSM has no updateBodyRotation -// observation->updateBodyRotation(); + // TODO: needs to be updated for ISIS vs. CSM CSM has no updateBodyRotation] + // TODO: this is no good. + QSharedPointer isisObservation = qSharedPointerDynamicCast(observation); + isisObservation->updateBodyRotation(); } t += numParameters; diff --git a/isis/src/control/objs/BundleUtilities/AbstractBundleObservation.cpp b/isis/src/control/objs/BundleUtilities/AbstractBundleObservation.cpp index b6baf93966..216461fcbf 100644 --- a/isis/src/control/objs/BundleUtilities/AbstractBundleObservation.cpp +++ b/isis/src/control/objs/BundleUtilities/AbstractBundleObservation.cpp @@ -220,6 +220,7 @@ namespace Isis { * settings for this AbstractBundleObservation */ const BundleObservationSolveSettingsQsp AbstractBundleObservation::solveSettings() { + // NEEDED for BundleMeasure return m_solveSettings; } diff --git a/isis/src/control/objs/BundleUtilities/AbstractBundleObservation.h b/isis/src/control/objs/BundleUtilities/AbstractBundleObservation.h index 4f1830f915..3ee3785266 100644 --- a/isis/src/control/objs/BundleUtilities/AbstractBundleObservation.h +++ b/isis/src/control/objs/BundleUtilities/AbstractBundleObservation.h @@ -55,15 +55,16 @@ namespace Isis { QString instrumentId(); - LinearAlgebra::Vector ¶meterWeights(); - LinearAlgebra::Vector ¶meterCorrections(); - LinearAlgebra::Vector &aprioriSigmas(); - LinearAlgebra::Vector &adjustedSigmas(); + virtual LinearAlgebra::Vector ¶meterWeights(); + virtual LinearAlgebra::Vector ¶meterCorrections(); + virtual LinearAlgebra::Vector &aprioriSigmas(); + virtual LinearAlgebra::Vector &adjustedSigmas(); - virtual const BundleObservationSolveSettingsQsp solveSettings(); - int numberParameters(); - virtual bool applyParameterCorrections(LinearAlgebra::Vector corrections); + // TODO: remove later + virtual const BundleObservationSolveSettingsQsp solveSettings(); + virtual int numberParameters(); + virtual bool applyParameterCorrections(LinearAlgebra::Vector corrections); virtual void bundleOutputString(std::ostream &fpOut,bool errorPropagation); virtual QString bundleOutputCSV(bool errorPropagation); @@ -87,17 +88,15 @@ namespace Isis { QStringList m_imageNames; //!< List of all cube names. QString m_instrumentId; //!< Spacecraft instrument id. - BundleObservationSolveSettingsQsp m_solveSettings; //!< Solve settings for this observation. - // TODO??? change these to LinearAlgebra vectors... LinearAlgebra::Vector m_weights; //!< Parameter weights. //! Cumulative parameter correction vector. LinearAlgebra::Vector m_corrections; - //LinearAlgebra::Vector m_solution; //!< parameter solution vector. //! A posteriori (adjusted) parameter sigmas. LinearAlgebra::Vector m_aprioriSigmas; //! A posteriori (adjusted) parameter sigmas. LinearAlgebra::Vector m_adjustedSigmas; + BundleObservationSolveSettingsQsp m_solveSettings; //!< Solve settings for this observation. }; //! Typdef for AbstractBundleObservation QSharedPointer. diff --git a/isis/src/control/objs/BundleUtilities/BundleObservation.cpp b/isis/src/control/objs/BundleUtilities/BundleObservation.cpp index 378f0dd36e..5e969fc74c 100644 --- a/isis/src/control/objs/BundleUtilities/BundleObservation.cpp +++ b/isis/src/control/objs/BundleUtilities/BundleObservation.cpp @@ -29,19 +29,16 @@ namespace Isis { * Constructs a BundleObservation initialized to a default state. */ BundleObservation::BundleObservation() { - m_serialNumbers.clear(); - m_imageNames.clear(); - m_parameterNamesList.clear(); - m_observationNumber = ""; - m_instrumentId = ""; - m_instrumentRotation = NULL; - m_instrumentPosition = NULL; - m_index = 0; m_weights.clear(); m_corrections.clear(); -// m_solution.clear(); m_aprioriSigmas.clear(); m_adjustedSigmas.clear(); + + m_parameterNamesList.clear(); + m_instrumentPosition = NULL; + m_instrumentRotation = NULL; + // m_solveSettings? + // m_bundleTargetBody ? } @@ -55,32 +52,18 @@ namespace Isis { * @param bundleTargetBody QSharedPointer to the target body of the observation */ BundleObservation::BundleObservation(BundleImageQsp image, QString observationNumber, - QString instrumentId, BundleTargetBodyQsp bundleTargetBody) { - m_serialNumbers.clear(); - m_imageNames.clear(); - m_parameterNamesList.clear(); - m_observationNumber = ""; - m_instrumentId = ""; - m_instrumentRotation = NULL; - m_instrumentPosition = NULL; - m_index = 0; + QString instrumentId, BundleTargetBodyQsp bundleTargetBody) : AbstractBundleObservation(image, observationNumber, instrumentId, bundleTargetBody) { m_weights.clear(); m_corrections.clear(); -// m_solution.clear(); m_aprioriSigmas.clear(); m_adjustedSigmas.clear(); - m_observationNumber = observationNumber; - m_instrumentId = instrumentId; - + m_parameterNamesList.clear(); m_bundleTargetBody = bundleTargetBody; + m_instrumentRotation = NULL; + m_instrumentPosition = NULL; if (image) { - append(image); - m_serialNumbers.append(image->serialNumber()); - m_imageNames.append(image->fileName()); - m_cubeSerialNumberToBundleImageMap.insert(image->serialNumber(), image); - // set the observations spice position and rotation objects from the primary image in the // observation (this is, by design at the moment, the first image added to the observation) // if the image, camera, or instrument position/orientation is null, then set to null @@ -96,10 +79,6 @@ namespace Isis { // set the observations target body spice rotation object from the primary image in the // observation (this is, by design at the moment, the first image added to the observation) // if the image, camera, or instrument position/orientation is null, then set to null -// m_bodyRotation = (image->camera() ? -// (image->camera()->bodyRotation() ? -// image->camera()->bodyRotation() : NULL) -// : NULL); } } @@ -109,19 +88,11 @@ namespace Isis { * * @param src Reference to the BundleObservation to copy */ - BundleObservation::BundleObservation(const BundleObservation &src) { - m_serialNumbers = src.m_serialNumbers; - m_cubeSerialNumberToBundleImageMap = src.m_cubeSerialNumberToBundleImageMap; - - m_observationNumber = src.m_observationNumber; - m_instrumentId = src.m_instrumentId; - + BundleObservation::BundleObservation(const BundleObservation &src) : AbstractBundleObservation(src) { m_instrumentPosition = src.m_instrumentPosition; m_instrumentRotation = src.m_instrumentRotation; - m_solveSettings = src.m_solveSettings; - - m_index = src.m_index; + // why not m_targetBody? } @@ -146,57 +117,16 @@ namespace Isis { */ BundleObservation &BundleObservation::operator=(const BundleObservation &src) { if (&src != this) { - m_serialNumbers = src.m_serialNumbers; - m_cubeSerialNumberToBundleImageMap = src.m_cubeSerialNumberToBundleImageMap; - - m_observationNumber = src.m_observationNumber; - m_instrumentId = src.m_instrumentId; - + AbstractBundleObservation::operator=(src); m_instrumentPosition = src.m_instrumentPosition; m_instrumentRotation = src.m_instrumentRotation; - m_solveSettings = src.m_solveSettings; + // why not m_targetBody? } return *this; } - /** - * Appends a BundleImage shared pointer to the BundleObservation. - * If the pointer is valid, then the BundleImage and its serial number will be inserted into - * the serial number to BundleImage map. - * - * @param value The BundleImage to be appended. - * - * @see QVector::append() - */ - void BundleObservation::append(const BundleImageQsp &value) { - if (value) { - m_cubeSerialNumberToBundleImageMap.insert(value->serialNumber(), value); - } - QVector::append(value); - } - - - /** - * Returns the BundleImage shared pointer associated with the given serial number. - * If no BundleImage with that serial number is contained a NULL pointer is returned. - * - * @param cubeSerialNumber The serial number of the cube to be returned. - * - * @return @b BundleImageQsp A shared pointer to the BundleImage (NULL if not found). - */ - BundleImageQsp BundleObservation::imageByCubeSerialNumber(QString cubeSerialNumber) { - BundleImageQsp bundleImage; - - if (m_cubeSerialNumberToBundleImageMap.contains(cubeSerialNumber)) { - bundleImage = m_cubeSerialNumberToBundleImageMap.value(cubeSerialNumber); - } - - return bundleImage; - } - - /** * Set solve parameters * @@ -225,8 +155,6 @@ namespace Isis { m_weights.clear(); m_corrections.resize(nParameters); m_corrections.clear(); -// m_solution.resize(nParameters); -// m_solution.clear(); m_adjustedSigmas.resize(nParameters); m_adjustedSigmas.clear(); m_aprioriSigmas.resize(nParameters); @@ -243,16 +171,6 @@ namespace Isis { } - /** - * Accesses the instrument id - * - * @return @b QString Returns the instrument id of the observation - */ - QString BundleObservation::instrumentId() { - return m_instrumentId; - } - - /** * Accesses the instrument's spice rotation * @@ -293,15 +211,6 @@ namespace Isis { } - /** - * @internal - * @todo - */ -// LinearAlgebra::Vector &BundleObservation::parameterSolution() { -// return m_solution; -// } - - /** * Accesses the a priori sigmas * @@ -342,81 +251,79 @@ namespace Isis { * @todo Should this always return true? */ bool BundleObservation::initializeExteriorOrientation() { - std::cout << "do something with states instead" << std::endl; -// if (m_solveSettings->instrumentPositionSolveOption() != -// BundleObservationSolveSettings::NoPositionFactors) { -// -// double positionBaseTime = 0.0; -// double positiontimeScale = 0.0; -// std::vector posPoly1, posPoly2, posPoly3; -// -// for (int i = 0; i < size(); i++) { -// BundleImageQsp image = at(i); -// SpicePosition *spicePosition = image->camera()->instrumentPosition(); -// -// if (i > 0) { -// spicePosition->SetPolynomialDegree(m_solveSettings->spkSolveDegree()); -// spicePosition->SetOverrideBaseTime(positionBaseTime, positiontimeScale); -// spicePosition->SetPolynomial(posPoly1, posPoly2, posPoly3, -// m_solveSettings->positionInterpolationType()); -// } -// else { -// // first, set the degree of the spk polynomial to be fit for a priori values -// spicePosition->SetPolynomialDegree(m_solveSettings->spkDegree()); -// -// // now, set what kind of interpolation to use (SPICE, memcache, hermitecache, polynomial -// // function, or polynomial function over constant hermite spline) -// // TODO: verify - I think this actually performs the a priori fit -// spicePosition->SetPolynomial(m_solveSettings->positionInterpolationType()); -// -// // finally, set the degree of the spk polynomial actually used in the bundle adjustment -// spicePosition->SetPolynomialDegree(m_solveSettings->spkSolveDegree()); -// -// if (m_instrumentPosition) { // ??? TODO: why is this different from rotation code below??? -// positionBaseTime = m_instrumentPosition->GetBaseTime(); -// positiontimeScale = m_instrumentPosition->GetTimeScale(); -// m_instrumentPosition->GetPolynomial(posPoly1, posPoly2, posPoly3); -// } -// } -// } -// } -// -// if (m_solveSettings->instrumentPointingSolveOption() != -// BundleObservationSolveSettings::NoPointingFactors) { -// -// double rotationBaseTime = 0.0; -// double rotationtimeScale = 0.0; -// std::vector anglePoly1, anglePoly2, anglePoly3; -// -// for (int i = 0; i < size(); i++) { -// BundleImageQsp image = at(i); -// SpiceRotation *spicerotation = image->camera()->instrumentRotation(); -// -// if (i > 0) { -// spicerotation->SetPolynomialDegree(m_solveSettings->ckSolveDegree()); -// spicerotation->SetOverrideBaseTime(rotationBaseTime, rotationtimeScale); -// spicerotation->SetPolynomial(anglePoly1, anglePoly2, anglePoly3, -// m_solveSettings->pointingInterpolationType()); -// } -// else { -// // first, set the degree of the spk polynomial to be fit for a priori values -// spicerotation->SetPolynomialDegree(m_solveSettings->ckDegree()); -// -// // now, set what kind of interpolation to use (SPICE, memcache, hermitecache, polynomial -// // function, or polynomial function over constant hermite spline) -// // TODO: verify - I think this actually performs the a priori fit -// spicerotation->SetPolynomial(m_solveSettings->pointingInterpolationType()); -// -// // finally, set the degree of the spk polynomial actually used in the bundle adjustment -// spicerotation->SetPolynomialDegree(m_solveSettings->ckSolveDegree()); -// -// rotationBaseTime = spicerotation->GetBaseTime(); -// rotationtimeScale = spicerotation->GetTimeScale(); -// spicerotation->GetPolynomial(anglePoly1, anglePoly2, anglePoly3); -// } -// } -// } -// + if (m_solveSettings->instrumentPositionSolveOption() != + BundleObservationSolveSettings::NoPositionFactors) { + + double positionBaseTime = 0.0; + double positiontimeScale = 0.0; + std::vector posPoly1, posPoly2, posPoly3; + + for (int i = 0; i < size(); i++) { + BundleImageQsp image = at(i); + SpicePosition *spicePosition = image->camera()->instrumentPosition(); + + if (i > 0) { + spicePosition->SetPolynomialDegree(m_solveSettings->spkSolveDegree()); + spicePosition->SetOverrideBaseTime(positionBaseTime, positiontimeScale); + spicePosition->SetPolynomial(posPoly1, posPoly2, posPoly3, + m_solveSettings->positionInterpolationType()); + } + else { + // first, set the degree of the spk polynomial to be fit for a priori values + spicePosition->SetPolynomialDegree(m_solveSettings->spkDegree()); + + // now, set what kind of interpolation to use (SPICE, memcache, hermitecache, polynomial + // function, or polynomial function over constant hermite spline) + // TODO: verify - I think this actually performs the a priori fit + spicePosition->SetPolynomial(m_solveSettings->positionInterpolationType()); + + // finally, set the degree of the spk polynomial actually used in the bundle adjustment + spicePosition->SetPolynomialDegree(m_solveSettings->spkSolveDegree()); + + if (m_instrumentPosition) { // ??? TODO: why is this different from rotation code below??? + positionBaseTime = m_instrumentPosition->GetBaseTime(); + positiontimeScale = m_instrumentPosition->GetTimeScale(); + m_instrumentPosition->GetPolynomial(posPoly1, posPoly2, posPoly3); + } + } + } + } + + if (m_solveSettings->instrumentPointingSolveOption() != + BundleObservationSolveSettings::NoPointingFactors) { + + double rotationBaseTime = 0.0; + double rotationtimeScale = 0.0; + std::vector anglePoly1, anglePoly2, anglePoly3; + + for (int i = 0; i < size(); i++) { + BundleImageQsp image = at(i); + SpiceRotation *spicerotation = image->camera()->instrumentRotation(); + + if (i > 0) { + spicerotation->SetPolynomialDegree(m_solveSettings->ckSolveDegree()); + spicerotation->SetOverrideBaseTime(rotationBaseTime, rotationtimeScale); + spicerotation->SetPolynomial(anglePoly1, anglePoly2, anglePoly3, + m_solveSettings->pointingInterpolationType()); + } + else { + // first, set the degree of the spk polynomial to be fit for a priori values + spicerotation->SetPolynomialDegree(m_solveSettings->ckDegree()); + + // now, set what kind of interpolation to use (SPICE, memcache, hermitecache, polynomial + // function, or polynomial function over constant hermite spline) + // TODO: verify - I think this actually performs the a priori fit + spicerotation->SetPolynomial(m_solveSettings->pointingInterpolationType()); + + // finally, set the degree of the spk polynomial actually used in the bundle adjustment + spicerotation->SetPolynomialDegree(m_solveSettings->ckSolveDegree()); + + rotationBaseTime = spicerotation->GetBaseTime(); + rotationtimeScale = spicerotation->GetTimeScale(); + spicerotation->GetPolynomial(anglePoly1, anglePoly2, anglePoly3); + } + } + } return true; } @@ -456,54 +363,6 @@ namespace Isis { } -/* - bool BundleObservation::initializeExteriorOrientation() { - - if (m_solveSettings->instrumentPositionSolveOption() != - BundleObservationSolveSettings::NoPositionFactors) { - - for (int i = 0; i < size(); i++) { - BundleImageQsp image = at(i); - SpicePosition *spiceposition = image->camera()->instrumentPosition(); - - // first, set the degree of the spk polynomial to be fit for a priori values - spiceposition->SetPolynomialDegree(m_solveSettings->spkDegree()); - - // now, set what kind of interpolation to use (SPICE, memcache, hermitecache, polynomial - // function, or polynomial function over constant hermite spline) - // TODO: verify - I think this actually performs the a priori fit - spiceposition->SetPolynomial(m_solveSettings->positionInterpolationType()); - - // finally, set the degree of the spk polynomial actually used in the bundle adjustment - spiceposition->SetPolynomialDegree(m_solveSettings->spkSolveDegree()); - } - } - - if (m_solveSettings->instrumentPointingSolveOption() != - BundleObservationSolveSettings::NoPointingFactors) { - - for (int i = 0; i < size(); i++) { - BundleImageQsp image = at(i); - SpiceRotation *spicerotation = image->camera()->instrumentRotation(); - - // first, set the degree of the spk polynomial to be fit for a priori values - spicerotation->SetPolynomialDegree(m_solveSettings->ckDegree()); - - // now, set what kind of interpolation to use (SPICE, memcache, hermitecache, polynomial - // function, or polynomial function over constant hermite spline) - // TODO: verify - I think this actually performs the a priori fit - spicerotation->SetPolynomial(m_solveSettings->pointingInterpolationType()); - - // finally, set the degree of the spk polynomial actually used in the bundle adjustment - spicerotation->SetPolynomialDegree(m_solveSettings->ckSolveDegree()); - } - } - - return true; - } -*/ - - /** * Initializes the paramater weights for solving * @@ -601,9 +460,6 @@ namespace Isis { } } -// for ( int i = 0; i < (int)m_weights.size(); i++ ) -// std::cout << m_weights[i] << std::endl; - return true; } @@ -772,25 +628,6 @@ namespace Isis { } - /** - * Sets the index for the observation - * - * @param n Value to set the index of the observation to - */ - void BundleObservation::setIndex(int n) { - m_index = n; - } - - - /** - * Accesses the observation's index - * - * @return @b int Returns the observation's index - */ - int BundleObservation::index() { - return m_index; - } - /** * @brief Creates and returns a formatted QString representing the bundle coefficients and * parameters @@ -1574,24 +1411,4 @@ QString BundleObservation::formatBundleOutputString(bool errorPropagation, bool return finalqStr; } - - - /** - * Access to parameters for CorrelationMatrix to use. - * - * @return @b QStringList Returns a QStringList of the names of the parameters - */ - QStringList BundleObservation::parameterList() { - return m_parameterNamesList; - } - - - /** - * Access to image names for CorrelationMatrix to use. - * - * @return @b QStringList Returns a QStringList of the image names - */ - QStringList BundleObservation::imageNames() { - return m_imageNames; - } } diff --git a/isis/src/control/objs/BundleUtilities/BundleObservation.h b/isis/src/control/objs/BundleUtilities/BundleObservation.h index 28d23b2111..771b5b8efc 100644 --- a/isis/src/control/objs/BundleUtilities/BundleObservation.h +++ b/isis/src/control/objs/BundleUtilities/BundleObservation.h @@ -104,21 +104,12 @@ namespace Isis { // copy method void copy(const BundleObservation &src); - void append(const BundleImageQsp &value); - - BundleImageQsp imageByCubeSerialNumber(QString cubeSerialNumber); - bool setSolveSettings(BundleObservationSolveSettings solveSettings); - void setIndex(int n); - int index(); - int numberPositionParameters(); int numberPointingParameters(); int numberParameters(); - QString instrumentId(); - SpiceRotation *spiceRotation(); SpicePosition *spicePosition(); @@ -142,35 +133,15 @@ namespace Isis { QString bundleOutputCSV(bool errorPropagation); QString formatBundleOutputString(bool errorPropagation, bool imageCSV=false); - QStringList parameterList(); - QStringList imageNames(); - private: + private: bool initParameterWeights(); private: - QString m_observationNumber; /**< This is typically equivalent to serial number - except in the case of "observation mode" (e.g. - Lunar Orbiter) where for each image in the - observation, the observation number is the serial number - augmented with an additional integer. **/ - - int m_index; //!< Index of this observation. - - //! Map between cube serial number and BundleImage pointers. - QMap m_cubeSerialNumberToBundleImageMap; - - QStringList m_serialNumbers; //!< List of all cube serial numbers in observation. - QStringList m_parameterNamesList; //!< List of all cube parameters. - QStringList m_imageNames; //!< List of all cube names. - - QString m_instrumentId; //!< Spacecraft instrument id. - BundleObservationSolveSettingsQsp m_solveSettings; //!< Solve settings for this observation. SpiceRotation *m_instrumentRotation; //!< Instrument spice rotation (in primary image). SpicePosition *m_instrumentPosition; //!< Instrument spice position (in primary image). -// SpiceRotation *m_bodyRotation; //!< Instrument body rotation (in primary image). BundleTargetBodyQsp m_bundleTargetBody; //!< QShared pointer to BundleTargetBody. @@ -178,7 +149,6 @@ namespace Isis { LinearAlgebra::Vector m_weights; //!< Parameter weights. //! Cumulative parameter correction vector. LinearAlgebra::Vector m_corrections; - //LinearAlgebra::Vector m_solution; //!< parameter solution vector. //! A posteriori (adjusted) parameter sigmas. LinearAlgebra::Vector m_aprioriSigmas; //! A posteriori (adjusted) parameter sigmas. diff --git a/isis/src/control/objs/BundleUtilities/BundleObservationVector.cpp b/isis/src/control/objs/BundleUtilities/BundleObservationVector.cpp index ed41481e27..8866d4d2f1 100644 --- a/isis/src/control/objs/BundleUtilities/BundleObservationVector.cpp +++ b/isis/src/control/objs/BundleUtilities/BundleObservationVector.cpp @@ -112,7 +112,7 @@ namespace Isis { bundleImage->setParentObservation(bundleObservation); - // update observation number to observation ptr map + // updateo observation number to observation ptr map m_observationNumberToObservationMap.insertMulti(observationNumber,bundleObservation); // update image serial number to observation ptr map @@ -160,51 +160,54 @@ namespace Isis { // update image serial number to observation ptr map m_imageSerialToObservationMap.insertMulti(bundleImage->serialNumber(), bundleObservation); } - return bundleObservation; } - + // addnewIsis vs. CSM? // getCsmObservations() // getIsisObservations() - // FIXME: needs to go + // TODO: if we break API anyway just remove this /** - * Accesses the number of position parameters for the contained BundleObservations. + * Accesses the number of ISIS position parameters for the + * contained BundleObservations. * * @return @b int Returns the total number of position parameters for the BundleObservations */ int BundleObservationVector::numberPositionParameters() { int positionParameters = 0; + // loop over isis observations for (int i = 0; i < size(); i++) { - AbstractBundleObservationQsp observation = at(i); - // positionParameters += observation->numberPositionParameters(); + QSharedPointer observation = qSharedPointerDynamicCast( at(i) ); + positionParameters += observation->numberPositionParameters(); } return positionParameters; + // return 0 only CSM observations } - // FIXME: needs to go + // TODO: if we break API anyway just remove this /** - * Accesses the number of pointing parameters for the contained BundleObservations. + * Accesses the number of ISIS pointing parameters for the + * contained BundleObservations. * * @return @b int Returns the total number of pointing parameters for the BundleObservations */ int BundleObservationVector::numberPointingParameters() { int pointingParameters = 0; + // loop over just isis observations for (int i = 0; i < size(); i++) { - AbstractBundleObservationQsp observation = at(i); -// pointingParameters += observation->numberPointingParameters(); + QSharedPointer observation = qSharedPointerDynamicCast( at(i) ); + pointingParameters += observation->numberPointingParameters(); } - return pointingParameters; + // return 0 only CSM observations } - // FIXME: update so it makes sense /** * Returns the sum of the position parameters and pointing parameters for the contained * BundleObservations. @@ -212,6 +215,7 @@ namespace Isis { * @return @b int Returns the total number of parameters for the contained BundleObservations */ int BundleObservationVector::numberParameters() { + //TODO: change this to include CSM parameters return numberPositionParameters() + numberPointingParameters(); } @@ -237,24 +241,26 @@ namespace Isis { } - - // TODO: has to go /** - * Initializes the exterior orientations for the contained BundleObservations. + * Initializes the exterior orientations for the contained ISIS + * BundleObservations. * * @return @b bool Returns true upon successful initialization */ bool BundleObservationVector::initializeExteriorOrientation() { + // get isis observations + // get csm observations int nObservations = size(); + // just do it for ISIS observations for (int i = 0; i < nObservations; i++) { -// BundleObservationQsp observation = at(i); -// observation->initializeExteriorOrientation(); + // TODO: how to only do this if ISIS observations + QSharedPointer observation = qSharedPointerDynamicCast( at(i) ); + observation->initializeExteriorOrientation(); } return true; } - // TODO: has to go /** * Initializes the body rotations for the contained BundleObservations. * @@ -262,9 +268,10 @@ namespace Isis { */ bool BundleObservationVector::initializeBodyRotation() { int nObservations = size(); + //TODO: just do it for ISIS observations for (int i = 0; i < nObservations; i++) { -// BundleObservationQsp observation = at(i); -// observation->initializeBodyRotation(); + QSharedPointer observation = qSharedPointerDynamicCast( at(i) ); + observation->initializeBodyRotation(); } return true; diff --git a/isis/src/control/objs/BundleUtilities/BundleObservationVector.h b/isis/src/control/objs/BundleUtilities/BundleObservationVector.h index f98493a56e..b66db7caa7 100644 --- a/isis/src/control/objs/BundleUtilities/BundleObservationVector.h +++ b/isis/src/control/objs/BundleUtilities/BundleObservationVector.h @@ -16,6 +16,7 @@ find files of those names at the top level of this repository. **/ #include "BundleImage.h" #include "AbstractBundleObservation.h" +#include "BundleObservation.h" #include "BundleSettings.h" namespace Isis { @@ -73,6 +74,7 @@ namespace Isis { // To add: // getCsmObservations() // getIsisObservations() + // addNewIsis()? private: //! Map between observation number and pointer to observation.