Commit d05113cb authored by Ken Edmundson's avatar Ken Edmundson
Browse files

PROG: Modified setupExecution method to append output control network filename...

PROG: Modified setupExecution method to append output control network filename to internalData. Modified execute method to look for input control network in BundleSolutionInfos if not found under main part of project tree.
parent 89df6e2c
Loading
Loading
Loading
Loading
+44 −4
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include <QInputDialog>
#include <QMessageBox>

#include "BundleSolutionInfo.h"
#include "Control.h"
#include "Directory.h"
#include "JigsawDialog.h"
@@ -114,12 +115,15 @@ namespace Isis {
    bool success = WorkOrder::setupExecution();

    if (success) {

      QStringList internalData;

      // Create a blocking setup dialog initially and check to make sure we get valid info
      JigsawSetupDialog setup(project());
      if (setup.exec() == QDialog::Accepted) {
        m_bundleSettings = setup.bundleSettings();
        if (setup.selectedControl()) {
          setInternalData(QStringList(setup.selectedControl()->id()));
          internalData.append(QStringList(setup.selectedControl()->id()));
        }
        // This else should not happen, the work order should be disabled if there are no controls.
        else {
@@ -127,12 +131,21 @@ namespace Isis {
          QMessageBox::critical(qobject_cast<QWidget *>(parent()), "Error", msg);
          success = false;
        }
        // set output control network file name
        if (!setup.outputControlName().isEmpty()) {
          internalData.append(setup.outputControlName());
        }
        else {
          QString msg = "You must set an output control network filename.";
          QMessageBox::critical(qobject_cast<QWidget *>(parent()), "Error", msg);
          success = false;
        }
      }

      else {
        success = false;
      }
      setInternalData(internalData);
    }

    return success;
  }
@@ -159,9 +172,36 @@ namespace Isis {
   * @see WorkOrder::execute()
   */
  void JigsawWorkOrder::execute() {

    Project *proj = project();

    // Get the selected control and bundle settings and give them to the JigsawDialog for now.
    Control *selectedControl = project()->control(internalData().first());
    JigsawDialog *runDialog = new JigsawDialog(project(), m_bundleSettings, selectedControl);
    Control *selectedControl = proj->control(internalData().first());

    // if selectedControl is NULL, maybe the Control we want is an output Control in a
    // BundleSolutionInfo, so let's look there (I think the project()->control() method above should
    // look in the results area for this automatically
    // this is a workaround because the BundleSolutionInfo's Control is not in the project's control
    // list
    if (!selectedControl) {
      int nBundles = proj->bundleSolutionInfo().size();
      for (int i = 0; i < nBundles; i++) {
        BundleSolutionInfo *bundleSolution = proj->bundleSolutionInfo().at(i);
        Control *bundleControl = bundleSolution->control();
        if (bundleControl->id() != internalData().first()) {
            continue;
        }
        else {
          selectedControl = bundleControl;
        }
      }
    }

    QString outputControlFileName = internalData().at(1);

//    JigsawDialog *runDialog = new JigsawDialog(project(), m_bundleSettings, selectedControl);
    JigsawDialog *runDialog = new JigsawDialog(project(), m_bundleSettings, selectedControl,
                                               outputControlFileName);
    runDialog->setAttribute(Qt::WA_DeleteOnClose);
    runDialog->show();
  }
+5 −1
Original line number Diff line number Diff line
@@ -49,6 +49,10 @@ namespace Isis {
   *   @history 2017-07-25 Cole Neubauer - Added project()->setClean call #4969
   *   @history 2017-07-25 Cole Neubauer - Moved project()->setClean call to JigsawDialog because
   *                           the workorder does not actually execute the bundle adjustment #4960
   *   @history 2018-03-22 Ken Edmundson - Modified setupExecution method to append output control
   *                           network filename to internalData. Modified execute method to look for
   *                           input control network in BundleSolutionInfos if not found under main
   *                           part of project tree.
   */
  class JigsawWorkOrder : public WorkOrder {
      Q_OBJECT