Commit 39bd6a1a authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Changed BundleObservation and BundleObservationVector's contained member types...

Changed BundleObservation and BundleObservationVector's contained member types from raw pointers to QSharedPointers.  Fixes #4150.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6949 41f8697f-d340-4b68-9986-7bafba869bb8
parent ddd43f7d
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -335,14 +335,14 @@ namespace Isis {

        // create a new BundleImage and add to new (or existing if observation mode is on)
        // BundleObservation
        BundleImage* image = new BundleImage(camera, serialNumber, fileName);
        BundleImageQsp image = BundleImageQsp(new BundleImage(camera, serialNumber, fileName));

        if (!image) {
          QString msg = "In BundleAdjust::init(): image " + fileName + "is null" + "\n";
          throw IException(IException::Programmer, msg, _FILEINFO_);
        }

        BundleObservation *observation =
        BundleObservationQsp observation =
            m_bundleObservations.addnew(image, observationNumber, instrumentId, m_bundleSettings);

        if (!observation) {
@@ -377,7 +377,7 @@ namespace Isis {
          BundleMeasure *measure = bundleControlPoint->at(j);
          QString cubeSerialNumber = measure->cubeSerialNumber();

          BundleObservation *observation =
          BundleObservationQsp observation =
              m_bundleObservations.observationByCubeSerialNumber(cubeSerialNumber);

          measure->setParentObservation(observation);
@@ -426,7 +426,7 @@ namespace Isis {
    for (int i = 0; i < nObservations; i++) {
      int nImages = m_bundleObservations.at(i)->size();
      for (int j = 0; j < nImages; j++) {
        BundleImage *bundleImage = m_bundleObservations.at(i)->at(j);
        BundleImageQsp bundleImage = m_bundleObservations.at(i)->at(j);
        int nMeasures = m_pCnet->GetNumberOfValidMeasuresInImage(bundleImage->serialNumber());

        if (nMeasures > 1)
@@ -1137,7 +1137,7 @@ namespace Isis {
    int t = 0;
    //testing
    for (int a = 0; a < observationIndex; a++) {
      BundleObservation *observation = m_bundleObservations.at(a);
      BundleObservationQsp observation = m_bundleObservations.at(a);
      t += observation->numberParameters();
    }
    // account for target parameters
@@ -1335,7 +1335,7 @@ namespace Isis {
        }
      }
      else {
        BundleObservation *observation;
        BundleObservationQsp observation;

        // get parameter weights for this observation
        if (m_bundleSettings->solveTargetBody())
@@ -1904,11 +1904,11 @@ namespace Isis {
          t += nTargetParameters;
        else {
          if (nTargetParameters > 0 ) {
            BundleObservation *observation = m_bundleObservations.at(a-1);
            BundleObservationQsp observation = m_bundleObservations.at(a-1);
            t += observation->numberParameters();
          }
          else {
            BundleObservation *observation = m_bundleObservations.at(a);
            BundleObservationQsp observation = m_bundleObservations.at(a);
           t += observation->numberParameters();
          }
        }
@@ -2601,9 +2601,9 @@ namespace Isis {

    // TODO - who do I get these from?
    // from this measures BundleObservation
    const BundleObservationSolveSettings *observationSolveSettings =
    const BundleObservationSolveSettingsQsp observationSolveSettings =
        measure.observationSolveSettings();
    BundleObservation *observation = measure.parentBundleObservation();
    BundleObservationQsp observation = measure.parentBundleObservation();

    int nImagePartials = observation->numberParameters();
    coeff_image.resize(2,nImagePartials);
@@ -2901,7 +2901,7 @@ namespace Isis {
    // Update spice for each BundleObservation
    int nobservations = m_bundleObservations.size();
    for (int i = 0; i < nobservations; i++) {
      BundleObservation *observation = m_bundleObservations.at(i);
      BundleObservationQsp observation = m_bundleObservations.at(i);

      int nParameters = observation->numberParameters();

@@ -3309,7 +3309,7 @@ namespace Isis {

    // add vtpv from constrained image parameters
    for (int i = 0; i < m_bundleObservations.size(); i++) {
      BundleObservation *observation = m_bundleObservations.at(i);
      BundleObservationQsp observation = m_bundleObservations.at(i);

      // get weight and correction vector for this observation
      const boost::numeric::ublas::vector<double> &weights = observation->parameterWeights();
@@ -3822,7 +3822,7 @@ namespace Isis {
      }
      // save adjusted image sigmas
      else {
        BundleObservation *observation;
        BundleObservationQsp observation;
        if (m_bundleSettings->solveTargetBody())
          observation = m_bundleObservations.at(i-1);
        else
@@ -4631,7 +4631,7 @@ namespace Isis {
    }

    char buf[1056];
    BundleObservation *observation = NULL;
    BundleObservationQsp observation;

    int nObservations = m_bundleObservations.size();

@@ -4678,7 +4678,7 @@ namespace Isis {

      int nImages = observation->size();
      for (int j = 0; j < nImages; j++) {
        BundleImage *image = observation->at(j);
        BundleImageQsp image = observation->at(j);
        sprintf(buf, "\nImage Full File Name: %s\n", image->fileName().toLatin1().data());
        fp_out << buf;
        sprintf(buf, "\nImage Serial Number: %s\n", image->serialNumber().toLatin1().data());
+2 −0
Original line number Diff line number Diff line
@@ -196,6 +196,8 @@ namespace Isis {
   *   @history 2016-07-11 Jesse Mapel - Changed m_bundleControlPoints to be a vector of
   *                           QSharedPointers to BundleControlPoints instead of a
   *                           BundleControlPointVector.  Fixes #4099.
   *   @history 2016-08-03 Jesse Mapel - Changed BundleObservationVector to a vector of
   *                           QSharedPointers.  Fixes #4150.
   */
  class BundleAdjust : public QObject {
      Q_OBJECT
+3 −3
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ namespace Isis {
   */
  BundleImage::BundleImage(Camera *camera, QString serialNumber, QString fileName) {
    m_camera = camera;
    m_parentObservation = NULL;
    m_serialNumber = serialNumber;
    m_fileName = fileName;    
  }
@@ -50,7 +49,8 @@ namespace Isis {



  void BundleImage::setParentObservation(BundleObservation *parentObservation) {
  void BundleImage::setParentObservation(QSharedPointer<BundleObservation> parentObservation) {

    m_parentObservation = parentObservation;
  }

@@ -62,7 +62,7 @@ namespace Isis {



  BundleObservation *BundleImage::parentObservation() {
  QSharedPointer<BundleObservation> BundleImage::parentObservation() {
    return m_parentObservation;
  }

+6 −4
Original line number Diff line number Diff line
@@ -44,9 +44,11 @@ namespace Isis {
   *   @history 2014-07-17 Kimberly Oyama - Updated to better meet coding standards.
   *   @history 2014-02-20 Jeannie Backer - Added assignment operator. Updated
   *                           to better meet coding standards.
   *   @history 2016-08-03 Jesse Mapel - Changed parent observation to a QSharedPointer.
   *                           Fixes #4150.
   *   
   */
  class BundleImage : QObject {
  class BundleImage : public QObject {

  Q_OBJECT

@@ -63,17 +65,17 @@ namespace Isis {
    BundleImage &operator=(const BundleImage &src);

    // mutators
    void setParentObservation(BundleObservation *parentObservation);
    void setParentObservation(QSharedPointer<BundleObservation> parentObservation);

    // accessors
    Camera *camera();
    BundleObservation *parentObservation();
    QSharedPointer<BundleObservation> parentObservation();
    QString serialNumber();
    QString fileName();

    private:
      Camera *m_camera;
      BundleObservation *m_parentObservation; //!< parent BundleObservation
      QSharedPointer<BundleObservation> m_parentObservation; //!< parent BundleObservation
      QString m_serialNumber;
      QString m_fileName;      
  };
+24 −8
Original line number Diff line number Diff line
#include "BundleMeasure.h"
#include "BundleObservation.h"
#include "BundleObservationSolveSettings.h"
#include "IException.h"

#include "ControlMeasure.h"

@@ -22,7 +23,6 @@ namespace Isis {
    m_parentControlPoint = bundleControlPoint;

    m_parentBundleImage = NULL;
    m_parentObservation = NULL;
  }


@@ -75,7 +75,7 @@ namespace Isis {
   *
   * @param observation Pointer to the parent BundleObservation  
   */
  void BundleMeasure::setParentObservation(BundleObservation *observation) {
  void BundleMeasure::setParentObservation(QSharedPointer<BundleObservation> observation) {
    m_parentObservation = observation;
  }

@@ -125,9 +125,9 @@ namespace Isis {
  /**
   * Accesses the parent BundleObservation for this bundle measure
   *
   * @return @b BundleObservation* Returns a pointer to the parent BundleObservation
   * @return @b QSharedPointer<BundleObservation> Returns a pointer to the parent BundleObservation
   */
  BundleObservation *BundleMeasure::parentBundleObservation() {
  QSharedPointer<BundleObservation> BundleMeasure::parentBundleObservation() {
    return m_parentObservation;
  }

@@ -137,10 +137,18 @@ namespace Isis {
   *
   * @see BundleObservation::solveSettings()
   *
   * @return @b const BundleObservationSolveSettings* Returns a const pointer to the 
   *     BundleObservationSolveSettings for the parent BundleObservation
   * @return @b const QSharedPointer<BundleObservationSolveSettings> Returns a const pointer to
   *     the BundleObservationSolveSettings for the parent BundleObservation
   * 
   * @throws IException::Programmer "In BundleMeasure::observationSolveSettings:
   *                                 parent observation has not been set."
   */
  const BundleObservationSolveSettings *BundleMeasure::observationSolveSettings() {
  const QSharedPointer<BundleObservationSolveSettings> BundleMeasure::observationSolveSettings() {
    if (!m_parentObservation) {
      QString msg = "In BundleMeasure::observationSolveSettings: "
                    "parent observation has not been set.\n";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    return m_parentObservation->solveSettings();
  }

@@ -210,8 +218,16 @@ namespace Isis {
   * @see BundleObservation::index()
   *
   * @return @b int Returns the observation index of the parent observation
   * 
   * @throws IException::Programmer "In BundleMeasure::observationIndex:
   *                                 parent observation has not been set."
   */
  int BundleMeasure::observationIndex() const {
    if (!m_parentObservation) {
      QString msg = "In BundleMeasure::observationIndex: "
                    "parent observation has not been set.\n";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    return m_parentObservation->index();
  }

Loading