Unverified Commit a6cbc6c9 authored by Christopher Ryan Combs Jr's avatar Christopher Ryan Combs Jr Committed by GitHub
Browse files

Merge pull request #270 from ihumphrey-usgs/ipceBundleWindow_obs_settings

Ipce bundle window obs settings
parents 09420558 dffb0ef9
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -259,6 +259,19 @@ namespace Isis {
  }


  /**
   * Removes an observation number from this solve settings. The observation is no longer
   * associated with this solve settings.
   *
   * @param QString observationNumber The observation number to remove from this solve settings.
   * @return bool Returns true if the observation number passed was actually removed; otherwise
   *              returns false.
   */
  bool BundleObservationSolveSettings::removeObservationNumber(QString observationNumber) {
    return m_observationNumbers.remove(observationNumber);
  }


  /**
   * Returns a list of observation numbers associated with these solve settings.
   *
+4 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@ namespace Isis {
   *                           with these settings. Removed the setFromPvl() method. When re-
   *                           implemented, it should be put in jigsaw. References #4293.
   *   @history 2017-04-24 Ian Humphrey - Removed pvlObject(). Fixes #4797.
   *   @history 2018-06-21 Ian Humphrey - Added removeObservationNumber() to be able to remove an
   *                           observation number from a BundleObservationSolveSettings.
   *                           References #497.
   *
   *
   *   @todo Figure out why solve degree and num coefficients does not match solve option.
@@ -99,6 +102,7 @@ class BundleObservationSolveSettings {
      void setInstrumentId(QString instrumentId);
      QString instrumentId() const;
      void addObservationNumber(QString observationNumber);
      bool removeObservationNumber(QString observationNumber);
      QSet<QString> observationNumbers() const;


+102 −0
Original line number Diff line number Diff line
@@ -1357,10 +1357,112 @@ namespace Isis {
    //computing the proxy index from the source model.
    if (selectedItems.count() > 0) {
      m_ui->treeView->setRootIndex(osspm->mapFromSource(selectedItems[0]->index() ));
    }

    // Generate observation numbers for the images
    QStringList observationNumbers;

    // Create default settings for all of the observations
    BundleObservationSolveSettings defaultObservationSettings;
    foreach (const QString &observationNumber, observationNumbers) {
      defaultObservationSettings.addObservationNumber(observationNumber); 
    }

    // Try to loop through the view here to add the "groups" so they aren't part of the model

    // Add apply button to the tab view
    // set the text to bold?

  }


// Commented out since it contains some unimplemented functions (i.e. pseudo-code)

  void JigsawSetupDialog::on_applySettingsPushButton_clicked() {}
#if 0
    // Get the current selected images
    QAbstractProxyModel *model = m_ui->treeView->model();
    // QItemSelectionModel *selectionModel = m_ui->treeView->selectionModel();
    QModelIndexList selectedIndexes = m_ui->treeView->selectedIndexes();
    QStringList selectedObservationNumbers;
    foreach (QModelIndex index, selectedIndexes) {
      QMap<int, QVariant> data = model->index(index);
      qDebug() << "selected data: " << data;
      // Cast the data to image (i think ProjectItem shows QVariant conversions)
      // Get the observation number from the image
      // Append the observation number to the selectedObservationNumbers
    }

    // check to see if all the images are selected

    // If not, 
    {  
      // We are going to need to reset the bundle observation solve settings list for bundle settings
      QList<BundleObservationSolveSettings> solveSettingsList;

      // Grab the bundle settings
      // (NOTE -- bundleSettings() needs to be changed so it can
      // give us just a m_bundleSettings member we have for this current run of jigsaw, and the
      // logic for filling the settings and bundle observation solve settings from the view needs
      // to be put into two methods, like updateSettings() and updateBundleObservationSolveSettings())
      BundleSettingsQsp bundleSettings = bundleSettings();

      //find the bundle observation solve settings for each of the selected observations and remove
      // the observation number from them 
      for (int i = 0; i < bundleSettings->numberSolveSettings(); i++) {
        foreach (observationNumber, selectedObservationNumbers) {
          bundleSettings->observationSolveSettings(i).removeObservationNumber(observationNumber);
        }
      }

      // Remove any existing solve settings that no longer have any observation numbers
      for (int i = 0; i < bundleSettings.numberSolveSettings(); i++) {
        if (! bundleSettings->observationSolveSettings(i).observationNumbers().isEmpty() ) {
          solveSettingsList.append(bundleSettings->observationSolveSettings(i));
        }
      }


      // Create a new bundle observation solve settings
      BundleObservationSolveSettings solveSettings;
      // Add the selected observation numbers to the new bundle observation solve settings
      foreach (observationNumber, selectedObservationNumbers) {
        solveSettings.addObservationNumber(observationNumber);
      }

      // Grab the data from the right hand side of the observation solve settings tab to set
      // up the new bundle observation solve settings
      updateBundleObservationSolveSettings(solveSettings);

      // Add the new solve settings to the solve settings list
      solveSettingsList.append(solveSettings);

      // Update bundle settings with the new list of bundle observation solve settings
      bundleSettings->setObservationSolveOptions(solveSettingsList);

    } 
 
    // Otherwise (if all images are selected)
    {
      // just create a new observation solve settings
      BundleObservationSolveSettings boss;
      // add all the observation numbers to it
      foreach (observationNumber, selectedObservationNumbers) {
        boss.addObservationNumber(observationNumber);
      }

      // update the solve settings from the observation solve settings tab
      updateBundleObservationSolveSettings(boss);

      bundleSettings()->setObservationSolveOptions(QList<BundleObservationSolveSettings>{boss});
    }

  }
#endif



  // void JigsawSetupDialog::generateObservationNumbers() {

  // }
}
+5 −0
Original line number Diff line number Diff line
@@ -63,6 +63,9 @@ namespace Isis {
   *                           net name to anything they choose.
   *   @history 2018-06-01 Christopher Combs - Added support for ui changes, exclusive options and 
   *                           input validators.
   *   @history 2018-06-21 Ian Humphrey - Added on_applySettingsPushButtonClicked() to listen for when
   *                           the apply button is clicked on the observation solve settings tab.
   *                           References #497.
   */

  class JigsawSetupDialog : public QDialog {
@@ -132,6 +135,8 @@ namespace Isis {
    void on_spinRateLineEdit_textChanged(const QString &arg1);
    void on_primeMeridianOffsetLineEdit_textChanged(const QString &arg1);
    
    void on_applySettingsPushButton_clicked();

    public slots:
    void slotTextChanged(const QString &text);
    void checkIsValid();
+1 −1
Original line number Diff line number Diff line
@@ -1474,7 +1474,7 @@ Valid Range: 1.0e-10 to 1.0e+10</string>
            </widget>
           </item>
           <item row="2" column="1">
            <widget class="QPushButton" name="pushButton">
            <widget class="QPushButton" name="applySettingsPushButton">
             <property name="text">
              <string>Apply Settings to Selected Images</string>
             </property>
Loading