Commit 32e27d2e authored by Ian Humphrey's avatar Ian Humphrey
Browse files

update BOSS to remove obs #'s; update jigsaw setup with pseudo code to handle...

update BOSS to remove obs #'s; update jigsaw setup with pseudo code to handle updating solve settings.
parent aed28a16
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 removeObservationNumber(QString observationNumber) {
    return m_observationNumbers.remove(observationNumber);
  }


  /**
   * Returns a list of observation numbers associated with these solve settings.
   *
+94 −3
Original line number Diff line number Diff line
@@ -1155,19 +1155,110 @@ namespace Isis {
    //computing the proxy index from the source model.
     m_ui->treeView->setRootIndex(osspm->mapFromSource(item->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?

  }



    // Try to loop through the view here to add the "groups" so they aren't part of the model
  void JigsawSetupDialog::on_applySettingsPushButton_clicked() {

    // Add apply button to the tab view
    // set the text to bold?
    // 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});
    }

  }



  // void JigsawSetupDialog::generateObservationNumbers() {

  // }
}
+1 −1
Original line number Diff line number Diff line
@@ -955,7 +955,7 @@
            </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>