Commit f5bdcd44 authored by chrisryancombs's avatar chrisryancombs
Browse files

Merge branch 'ipceBundleWindow' of https://github.com/USGS-Astrogeology/ISIS3...

Merge branch 'ipceBundleWindow' of https://github.com/USGS-Astrogeology/ISIS3 into ipceBundleWindow_rhs
parents 3360edf1 153723d6
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include "ImageDisplayProperties.h"
#include "ImagePolygon.h"
#include "IString.h"
#include "ObservationNumber.h"
#include "PolygonTools.h"
#include "Project.h"
#include "SerialNumber.h"
@@ -311,6 +312,15 @@ namespace Isis {
  }


  /**
   * @brief Returns the observation number of the Cube
   * @return QString A string representation of the observation number of the cube.
   */
  QString Image::observationNumber() {
    return ObservationNumber::Compose(*(cube()));
  }


  /**
   * @brief Returns the serial number of the Cube
   * @return @b QString  A string representation of the serial number of the cube.
+4 −0
Original line number Diff line number Diff line
@@ -91,6 +91,9 @@ namespace Isis {
   *                           located outside of the import image directories such as the updated
   *                           Images from a bundle run.  To improve efficiency, return from method
   *                           if the project root has not changed. Fixes #4849.
   *   @history 2018-06-30 Ian Humphrey - Added observationNumber() method so anything that grabs
   *                           an Image ProjectItem can easily get both the serial number and
   *                           observation number now. References #497.
   */

  class Image : public QObject {
@@ -110,6 +113,7 @@ namespace Isis {
      ImageDisplayProperties *displayProperties();
      const ImageDisplayProperties *displayProperties() const;
      QString fileName() const;
      QString observationNumber();
      QString serialNumber();
      geos::geom::MultiPolygon *footprint();
      const geos::geom::MultiPolygon *footprint() const;
+90 −93
Original line number Diff line number Diff line
@@ -99,12 +99,12 @@ namespace Isis {
    if (!m_project->directory()->model()->selectedItems().isEmpty()) {
      foreach (ProjectItem * projItem, m_project->directory()->model()->selectedItems()) {
        if (projItem->isImage()) {
          defaultObservationSettings.addObservationNumber(projItem->image()->serialNumber());  
          defaultObservationSettings.addObservationNumber(projItem->image()->observationNumber());  
        }
        else if (projItem->isImageList()) {
          for (int i = 0; i < projItem->rowCount(); i++) {
            ProjectItem * childItem = projItem->child(i);
            defaultObservationSettings.addObservationNumber(childItem->image()->serialNumber());  
            defaultObservationSettings.addObservationNumber(childItem->image()->observationNumber());  
          }
        }
      }
@@ -119,7 +119,7 @@ namespace Isis {
          for (int j = 0; j < imglistItem->rowCount(); j++) {
            ProjectItem * imgItem = imglistItem->child(j);
            if (imgItem->isImage()) {
              defaultObservationSettings.addObservationNumber(imgItem->image()->serialNumber());  
              defaultObservationSettings.addObservationNumber(imgItem->image()->observationNumber());  
            }
          }
        } 
@@ -844,7 +844,7 @@ namespace Isis {

          if (projItem->isImage() ) {
            Image * img = projItem->data().value<Image *>();
            boss.addObservationNumber(img->serialNumber() );
            boss.addObservationNumber(img->observationNumber() );

          }
        }
@@ -1454,78 +1454,14 @@ namespace Isis {
   *
   * This slot populates the Instrument Position Solve Options table according to the value of the
   * SPK Solve Degree. Rows are added depending on the degree set, where number of rows added is
   * equal to the SPK Solve Degree + 1.
   * equal to the SPK Solve Degree + 1. Note that this relies on the updateSolveSettingsSigmaTables
   * slot, which uses the SPK Solve Degree if the ALL position option is selected.
   *
   * @param int Value the SPK Solve Degree spin box was changed to.
   */
  void JigsawSetupDialog::on_spkSolveDegreeSpinBox_valueChanged(int i) {
    // number of rows == spkSolveDegree value + 1 (i+1)
    QTableWidget *table = m_ui->positionAprioriSigmaTable;
    const int oldRowCount = table->rowCount();
    table->setRowCount(i + 1);
    const int newRowCount = table->rowCount();

    // Need to check if table is valid in case a row is removed (a row is removed implicitly when
    // the setRowCount() is called when newRowCount < oldRowCount
    validateSigmaTables();

    // Rows need to be added
    if (newRowCount > oldRowCount) {
      for (int row = oldRowCount; row < newRowCount; row++) {
        // Headers : coefficient, description, units, a priori sigma
        QTableWidgetItem *coefficient = new QTableWidgetItem();
        coefficient->setFlags(Qt::ItemIsEnabled);
        coefficient->setText(QString::number(row + 1));
        table->setItem(row, 0, coefficient);

        QTableWidgetItem *description = new QTableWidgetItem();
        description->setFlags(Qt::ItemIsEnabled);
        description->setText("N/A");
        table->setItem(row, 1, description);

        QTableWidgetItem *units = new QTableWidgetItem();
        units->setFlags(Qt::ItemIsEnabled);
        units->setText("m/s^" + QString::number(row));
        table->setItem(row, 2, units);

        QTableWidgetItem *sigma = new QTableWidgetItem();
        sigma->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
        sigma->setText("0.0");
        sigma->setData(Qt::UserRole, QVariant(true));
        table->setItem(row, 3, sigma);

        // Solve option: spk degree { NONE: -1, POSITION: 0, VELOCITY: 1, ACCELERATION: 2, ALL: 2 }
        // POSITION
        if (row == 0) { 
          QTableWidgetItem *description = table->item(0, 1);
          description->setText("POSITION");

          QTableWidgetItem *units = table->item(0, 2);
          units->setText("meters");
        }

        // VELOCITY
        else if (row == 1) {
          QTableWidgetItem *description = table->item(1, 1);
          description->setText("VELOCITY");

          QTableWidgetItem *units = table->item(1, 2);
          units->setText("m/s");
        }

        // ACCELERATION
        else if (row == 2) {
          QTableWidgetItem *description = table->item(2, 1);
          description->setText("ACCELERATION");

          QTableWidgetItem *units = table->item(2, 2);
          units->setText("m/s^2");
        }
      }
    }

    table->resizeColumnToContents(1);
    table->resizeColumnToContents(2);
    // Update the position apriori sigma table and use the position combo box solve option
    updateSolveSettingsSigmaTables(m_ui->positionComboBox, m_ui->positionAprioriSigmaTable);
  }


@@ -1534,21 +1470,70 @@ namespace Isis {
   *
   * This slot populates the Instrument Pointing Solve Options table according to the value of the
   * CK Solve Degree. Rows are added depending on the degree set, where number of rows added is
   * equal to the CK Solve Degree + 1.
   * equal to the CK Solve Degree + 1. Note that this relies on the updateSolveSettingsSigmaTables
   * slot, which uses the CK Solve Degree if the ALL pointing option is selected.
   *
   * @param int Value the CK Solve Degree spin box was changed to.
   */
  void JigsawSetupDialog::on_ckSolveDegreeSpinBox_valueChanged(int i) {
    // number of rows == ckSolveDegree value + 1 (i+1)
    QTableWidget *table = m_ui->pointingAprioriSigmaTable;
    // Update the pointing apriori sigma table and use the pointing combo box solve option
    updateSolveSettingsSigmaTables(m_ui->pointingComboBox, m_ui->pointingAprioriSigmaTable);
  }


  /**
   * Slot that updates the sigma tables based on the current solve option selection.
   *
   * This will add/remove rows based on the solve option selected, and if ALL, the current
   * solve degree value.
   *
   * @param const QComboBox * The solve option combo box to read the solve option from
   * @param QTableWidget * The a priori sigma table we are going to update rows for
   */
  void JigsawSetupDialog::updateSolveSettingsSigmaTables(const QComboBox *solveOptionComboBox,
                                                         QTableWidget *table) {
    int rowCount = solveOptionComboBox->currentIndex();

    // Position: { NONE, POSITION, VELOCITY, ACCELERATION, ALL }
    // Pointing: { NONE, ANGLES, ANGULAR VELOCITY, ANGULAR ACCELERATION, ALL }
    // Need to add to the solve degree value since number of rows == number of solve coefficients,
    // and for our polynomials the number of solve coefficients == solve degree + 1
    // When solve option is ALL (index 4), use the spk/ck solve degree value + 1 for number of rows
    if (rowCount == 4) {
      if (solveOptionComboBox == m_ui->positionComboBox) {
        rowCount = m_ui->spkSolveDegreeSpinBox->value() + 1;
      }
      else { // if (solveOptionComboBox == m_ui->pointingComboBox)
        rowCount = m_ui->ckSolveDegreeSpinBox->value() + 1;
      }
    }

    // number of rows == position solve option == SolveDegree value + 1 (i+1)
    const int oldRowCount = table->rowCount();
    table->setRowCount(i + 1);
    // if solving ALL, don't add extra row
    table->setRowCount(rowCount);
    const int newRowCount = table->rowCount();

    // Need to check if table is valid in case a row is removed (a row is removed implicitly when
    // the setRowCount() is called when newRowCount < oldRowCount
    validateSigmaTables();

    // Determine the units for either position or pointing
    QStringList solveOptions;
    QString longUnits("N/A");
    QString shortUnits("N/A");
    if (solveOptionComboBox == m_ui->positionComboBox) {
      longUnits = "meters";
      shortUnits = "m";
      solveOptions += {"POSITION", "VELOCITY", "ACCELERATION"};
    }
    else { // if (solveOptionComboBox == m_ui->pointingComboBox) {
      longUnits = "degrees";
      shortUnits = "deg";
      solveOptions += {"ANGLES", "ANGULAR VELOCITY", "ANGULAR ACCELERATION"};
    }

    // Rows need to be added
    if (newRowCount > oldRowCount) {
      for (int row = oldRowCount; row < newRowCount; row++) {
        // Headers : coefficient, description, units, a priori sigma
@@ -1564,7 +1549,7 @@ namespace Isis {

        QTableWidgetItem *units = new QTableWidgetItem();
        units->setFlags(Qt::ItemIsEnabled);
        units->setText("deg/s^" + QString::number(row));
        units->setText(shortUnits + "/s^" + QString::number(row));
        table->setItem(row, 2, units);

        QTableWidgetItem *sigma = new QTableWidgetItem();
@@ -1573,32 +1558,32 @@ namespace Isis {
        sigma->setData(Qt::UserRole, QVariant(true));
        table->setItem(row, 3, sigma);

        // { NONE: N/A, ANGLES: 0, ANGULAR VELOCITY: 1, ANGULAR ACCELERATION: 2, ALL: 2 }
        // ANGLES
        // Solve option: spk degree { NONE: -1, POSITION: 0, VELOCITY: 1, ACCELERATION: 2, ALL: 2 }
        // POSITION
        if (row == 0) { 
          QTableWidgetItem *description = table->item(0, 1);
          description->setText("ANGLES");
          description->setText(solveOptions.at(row));

          QTableWidgetItem *units = table->item(0, 2);
          units->setText("degrees");
          units->setText(longUnits);
        }

        // VELOCITY
        if (row == 1) {
        else if (row == 1) {
          QTableWidgetItem *description = table->item(1, 1);
          description->setText("ANGULAR VELOCITY");
          description->setText(solveOptions.at(row));

          QTableWidgetItem *units = table->item(1, 2);
          units->setText("deg/s");
          units->setText(shortUnits + "/s");
        }

        // ACCELERATION
        if (row == 2) {
        else if (row == 2) {
          QTableWidgetItem *description = table->item(2, 1);
          description->setText("ANGULAR ACCELERATION");
          description->setText(solveOptions.at(row));

          QTableWidgetItem *units = table->item(2, 2);
          units->setText("deg/s^2");
          units->setText(shortUnits + "/s^2");
        }
      }
    }
@@ -1629,10 +1614,14 @@ namespace Isis {
        spinBox->setEnabled(true);
      }
      else {
        spinBox->setValue(solveIndex - 1);
        // The default value for the spk solve degree and spk degree spinboxes is 2. This is
        // emulating jigsaw's defaults for position solve options that are not ALL.
        spinBox->setValue(2);
        spinBox->setEnabled(false);
      }
    }

    updateSolveSettingsSigmaTables(m_ui->positionComboBox, m_ui->positionAprioriSigmaTable);
  }


@@ -1657,10 +1646,14 @@ namespace Isis {
        spinBox->setEnabled(true);
      }
      else {
        spinBox->setValue(solveIndex - 1);
        // The default value for the ck solve degree and spk degree spinboxes is 2. This is
        // emulating jigsaw's defaults for pointing solve options that are not ALL.
        spinBox->setValue(2);
        spinBox->setEnabled(false);
      }
    }

    updateSolveSettingsSigmaTables(m_ui->pointingComboBox, m_ui->pointingAprioriSigmaTable);
  }


@@ -1784,9 +1777,13 @@ namespace Isis {

      if (projItem) {
        // Tree traversal is top down so we dont need to do this check for imagelists?
        if (projItem->isImage() && 
            !selectedObservationNumbers.contains(projItem->image()->serialNumber())) {
          selectedObservationNumbers.append(projItem->image()->serialNumber());
        if (projItem->isImage()) {
          // Grab the observation up front so we don't need to re-compose the observation number
          // more than once (@todo: this should not be necessary when 5026 is integrated)
          const QString observationNumber = projItem->image()->observationNumber();
          if (!selectedObservationNumbers.contains(observationNumber)) {
            selectedObservationNumbers.append(observationNumber);
          }
        }
        else if (projItem->isImageList()) {
          // Use the proxymodel's children as it might not include all of the sourcemodel's children 
@@ -1794,7 +1791,7 @@ namespace Isis {
            QModelIndex childProxyIndex = proxyModel->index(i, 0, index);
            QModelIndex childSourceIndex = proxyModel->mapToSource(childProxyIndex);
            ProjectItem * childItem = sourceModel->itemFromIndex(childSourceIndex);
            selectedObservationNumbers.append(childItem->image()->serialNumber());
            selectedObservationNumbers.append(childItem->image()->observationNumber());
          }
        }
      }
+8 −0
Original line number Diff line number Diff line
@@ -9,7 +9,9 @@ namespace Ui {
  class JigsawSetupDialog;
}

class QComboBox;
class QItemSelection;
class QTableWidget;
class QTableWidgetItem;

namespace Isis {
@@ -87,6 +89,10 @@ namespace Isis {
   *                           until all the a priori sigma values are valid again. References #497.
   *   @history 2018-06-28 Christopher Combs - Implemented pseudocode in on_applySettings... method.
   *                           Added selected images to default BOSS object. References #497.
   *   @history 2018-07-01 Ian Humphrey - Added updateSolveSettingsSigmaTables() to try to
   *                           generalize how the sigma tables are updated. Solve options have
   *                           their respective solve degree and degree combo boxes set to 2 unless
   *                           the solve option is ALL. References #497.
   */
  class JigsawSetupDialog : public QDialog {
    Q_OBJECT
@@ -161,6 +167,8 @@ namespace Isis {
    void on_positionComboBox_currentIndexChanged(const QString &arg1);
    void on_pointingComboBox_currentIndexChanged(const QString &arg1);

    void updateSolveSettingsSigmaTables(const QComboBox *solveOptionComboBox, 
                                        QTableWidget *table);
    void validateSigmaValue(QTableWidgetItem *);
    void validateSigmaTables();