Commit a5add0dd authored by chrisryancombs's avatar chrisryancombs
Browse files

Merge branch 'ipceBundleWindow_tabs' of...

Merge branch 'ipceBundleWindow_tabs' of https://github.com/chrisryancombs/ISIS3 into ipceBundleWindow_run
parents f39a2c33 baa8a138
Loading
Loading
Loading
Loading
+101 −49
Original line number Diff line number Diff line
@@ -3,9 +3,12 @@
#include <vector>

#include <QDebug>
#include <QIdentityProxyModel>
#include <QMessageBox>
#include <QPushButton>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QItemSelection>

#include "BundleSolutionInfo.h"
#include "BundleSettings.h"
@@ -14,7 +17,10 @@
#include "IString.h"
#include "MaximumLikelihoodWFunctions.h"
#include "Project.h"
#include "ProjectItem.h"
#include "ProjectItemProxyModel.h"
#include "SpecialPixel.h"
#include "SubTreeProxyModel.h"
#include "ui_JigsawSetupDialog.h"

namespace Isis {
@@ -47,6 +53,11 @@ namespace Isis {
      makeReadOnly();
    }



    //connect( m_project->directory()->model(), SIGNAL(selectionChanged(QList<ProjectItem *> &)),
    //         this, SLOT(on_projectItemSelectionChanged(const QList<ProjectItem *> &) ) );

    // initializations for general tab

    // fill control net combo box from project
@@ -87,7 +98,9 @@ namespace Isis {
    // Update setup dialog with settings from any active (current) settings in jigsaw dialog.

    // initializations for observation solve settings tab
    // m_ui->spkSolveDegreeSpinsBox_2->setValue(-1);

    createObservationSolveSettingsTreeView();
    m_ui->spkSolveDegreeSpinBox->setValue(-1);

    QStringList tableHeaders;
    tableHeaders << "coefficients" << "a priori sigma" << "units";
@@ -215,6 +228,7 @@ namespace Isis {
  }



  JigsawSetupDialog::~JigsawSetupDialog() {
    // delete/null m_ui since we did "new" this pointers in the constructor
    if (m_ui) {
@@ -374,7 +388,6 @@ namespace Isis {
    // m_ui->positionComboBox->setCurrentIndex(observationSolveSettings.instrumentPositionSolveOption());
    m_ui->hermiteSplineCheckBox->setChecked(observationSolveSettings.solvePositionOverHermite());
    m_ui->spkDegreeSpinBox->setValue(observationSolveSettings.spkDegree());
    std::cout<<"observationSolveSettings.spkDegree(): " << observationSolveSettings.spkDegree() <<std::endl;
    m_ui->spkSolveDegreeSpinBox->setValue(observationSolveSettings.spkSolveDegree());


@@ -572,7 +585,6 @@ namespace Isis {
        }
      }
    }

    // target body
    // ensure user entered something to adjust
    if (m_ui->poleRaCheckBox->isChecked()              ||
@@ -688,7 +700,7 @@ namespace Isis {


  /**
   * Loads the passed bundle settings into the setup dialog. This is used by JigsawRunWidget to
   * Loads the passed bundle settings into the setup dialog. This is used by JigsawDialog to
   * load its current settings when not using the last (most recent) bundle settings in the project.
   *
   * @param const BundleSettingsQsp settings Shared pointer to the settings to load up.
@@ -1169,118 +1181,118 @@ namespace Isis {
  // general tab text validation
  // global apriori point sigmas
  void Isis::JigsawSetupDialog::on_pointLatitudeSigmaLineEdit_textChanged(const QString &arg1) {
    if (!m_ui->pointLatitudeSigmaLineEdit->hasAcceptableInput()) {
      m_ui->pointLatitudeSigmaLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    else {
    if (arg1 == "" || m_ui->pointLatitudeSigmaLineEdit->hasAcceptableInput()) {
      m_ui->pointLatitudeSigmaLineEdit->setStyleSheet("QLineEdit { background-color: white }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
    }
    else {
      m_ui->pointLatitudeSigmaLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    update();
  }

  void Isis::JigsawSetupDialog::on_pointLongitudeSigmaLineEdit_textChanged(const QString &arg1) {
    if (!m_ui->pointLongitudeSigmaLineEdit->hasAcceptableInput()) {
      m_ui->pointLongitudeSigmaLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    else {
    if (arg1 == "" || m_ui->pointLongitudeSigmaLineEdit->hasAcceptableInput()) {
      m_ui->pointLongitudeSigmaLineEdit->setStyleSheet("QLineEdit { background-color: white }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
    }
    else {
      m_ui->pointLongitudeSigmaLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    update();
  }


  void Isis::JigsawSetupDialog::on_pointRadiusSigmaLineEdit_textChanged(const QString &arg1) {
    if (!m_ui->pointRadiusSigmaLineEdit->hasAcceptableInput()) {
      m_ui->pointRadiusSigmaLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    else {
    if (arg1 == "" || m_ui->pointRadiusSigmaLineEdit->hasAcceptableInput()) {
      m_ui->pointRadiusSigmaLineEdit->setStyleSheet("QLineEdit { background-color: white }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
    }
    else {
      m_ui->pointRadiusSigmaLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    update();
  }

  // outlier rejection
  void Isis::JigsawSetupDialog::on_maximumLikelihoodModel1QuantileLineEdit_textChanged(const QString &arg1) {
    if (!m_ui->maximumLikelihoodModel1QuantileLineEdit->hasAcceptableInput()) {
      m_ui->maximumLikelihoodModel1QuantileLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    else {
    if (m_ui->maximumLikelihoodModel1QuantileLineEdit->hasAcceptableInput()) {
      m_ui->maximumLikelihoodModel1QuantileLineEdit->setStyleSheet("QLineEdit { background-color: white }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
    }
    else {
      m_ui->maximumLikelihoodModel1QuantileLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    update();
  }


  void Isis::JigsawSetupDialog::on_maximumLikelihoodModel2QuantileLineEdit_textChanged(const QString &arg1) {
    if (!m_ui->maximumLikelihoodModel2QuantileLineEdit->hasAcceptableInput()) {
      m_ui->maximumLikelihoodModel2QuantileLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    else {
    if (m_ui->maximumLikelihoodModel2QuantileLineEdit->hasAcceptableInput()) {
      m_ui->maximumLikelihoodModel2QuantileLineEdit->setStyleSheet("QLineEdit { background-color: white }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
    }
    else {
      m_ui->maximumLikelihoodModel2QuantileLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    update();
  }


  void Isis::JigsawSetupDialog::on_maximumLikelihoodModel3QuantileLineEdit_textChanged(const QString &arg1) {
    if (!m_ui->maximumLikelihoodModel3QuantileLineEdit->hasAcceptableInput()) {
      m_ui->maximumLikelihoodModel3QuantileLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    else {
    if (m_ui->maximumLikelihoodModel3QuantileLineEdit->hasAcceptableInput()) {
      m_ui->maximumLikelihoodModel3QuantileLineEdit->setStyleSheet("QLineEdit { background-color: white }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
    }
    else {
      m_ui->maximumLikelihoodModel3QuantileLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    update();
  }


  // convergence criteria
  void Isis::JigsawSetupDialog::on_outlierRejectionMultiplierLineEdit_textChanged(const QString &arg1) {
    if (!m_ui->outlierRejectionMultiplierLineEdit->hasAcceptableInput()) {
      m_ui->outlierRejectionMultiplierLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    else {
    if (m_ui->outlierRejectionMultiplierLineEdit->hasAcceptableInput()) {
      m_ui->outlierRejectionMultiplierLineEdit->setStyleSheet("QLineEdit { background-color: white }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
    }
    else {
      m_ui->outlierRejectionMultiplierLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    update();
  }


  void Isis::JigsawSetupDialog::on_sigma0ThresholdLineEdit_textChanged(const QString &arg1) {
    if (!m_ui->sigma0ThresholdLineEdit->hasAcceptableInput()) {
      m_ui->sigma0ThresholdLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    else {
    if (m_ui->sigma0ThresholdLineEdit->hasAcceptableInput()) {
      m_ui->sigma0ThresholdLineEdit->setStyleSheet("QLineEdit { background-color: white }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
    }
    else {
      m_ui->sigma0ThresholdLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    update();
  }


  void Isis::JigsawSetupDialog::on_maximumIterationsLineEdit_textChanged(const QString &arg1) {
    if (!m_ui->maximumIterationsLineEdit->hasAcceptableInput()) {
      m_ui->maximumIterationsLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    else {
    if (m_ui->maximumIterationsLineEdit->hasAcceptableInput()) {
      m_ui->maximumIterationsLineEdit->setStyleSheet("QLineEdit { background-color: white }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
    }
    else {
      m_ui->maximumIterationsLineEdit->setStyleSheet("QLineEdit { background-color: red }");
      m_ui->okCloseButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
    update();
  }

@@ -1298,4 +1310,44 @@ namespace Isis {
    FileName fname = arg1;
    m_ui->outputControlNetLineEdit->setText(fname.baseName() + "-out.net");
  }


  void JigsawSetupDialog::createObservationSolveSettingsTreeView() {
    // Proof-of-

    QList<ProjectItem *> selectedItems = m_project->directory()->model()->selectedItems();

    foreach(ProjectItem *item,selectedItems){
      qDebug() << "Selected Item:  " << item->text();
    }
    qDebug() << "JigsawSetupDialog::createObservationSolveSettingsTreeView()";

//    m_ui->treeView->setModel((QAbstractItemModel*)(m_project->directory()->model()));
    ProjectItemModel *model = m_project->directory()->model();

    SubTreeProxyModel *osspm = new SubTreeProxyModel;
    osspm->setSourceModel(model);


     //QModelIndex SubTreeProxyModel::mapFromSource(const QModelIndex &sourceIndex)
    // find the root "Images" and set it in the proxy
    //QStandardItem *item = model->invisibleRootItem()->child(0)->child(1);
    //qDebug() << "ITEM: " << item << ", " << item->text();
    //qDebug() << "PARENT: " << item->parent() << ", " << item->parent()->text();


    // i think source model tries to add top root item, which is invalid???

    m_ui->treeView->setModel(osspm);

    //Set the root index to display the subtree we are interested in.  This requires
    //computing the proxy index from the source model.
    if (selectedItems.count() > 0) {
      m_ui->treeView->setRootIndex(osspm->mapFromSource(selectedItems[0]->index() ));

    }



  }
}
+7 −0
Original line number Diff line number Diff line
@@ -9,8 +9,12 @@ namespace Ui {
  class JigsawSetupDialog;
}

class QItemSelection;


namespace Isis {
  class Project;
  class ProjectItem;
  class Control;

  /**
@@ -83,6 +87,7 @@ namespace Isis {
  private slots:

    void on_pointRadiusSigmaCheckBox_toggled(bool checked);
    //void on_projectItemSelectionChanged(const QList<ProjectItem *> selectedItems);
    //void on_outlierRejectionCheckBox_toggled(bool checked);

    // general tab
@@ -138,6 +143,8 @@ namespace Isis {
    void showTargetParametersGroupBox();
    void hideTargetParametersGroupBox();

    void createObservationSolveSettingsTreeView();

  private:
    Ui::JigsawSetupDialog *m_ui;
    Project *m_project;
+46 −12
Original line number Diff line number Diff line
@@ -311,7 +311,9 @@
                     </size>
                    </property>
                    <property name="toolTip">
                     <string>Image measures are flagged as rejected if their residuals are greater than the multiplier times the current standatd deviation (sigma)</string>
                     <string>Image measures are flagged as rejected if their residuals are greater 
than the multiplier times the current standard deviation (sigma). 
Valid Range: 1.0e-10 to 1.0e+10</string>
                    </property>
                    <property name="layoutDirection">
                     <enum>Qt::LeftToRight</enum>
@@ -388,6 +390,9 @@
                      <height>16777215</height>
                     </size>
                    </property>
                    <property name="toolTip">
                     <string>Valid Range: 1.0e-10 to 1.0</string>
                    </property>
                    <property name="text">
                     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Model 2&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                    </property>
@@ -455,6 +460,12 @@
                      <height>16777215</height>
                     </size>
                    </property>
                    <property name="acceptDrops">
                     <bool>false</bool>
                    </property>
                    <property name="toolTip">
                     <string>Valid Range: 1.0e-10 to 1.0</string>
                    </property>
                    <property name="text">
                     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Model 3&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                    </property>
@@ -546,6 +557,9 @@
                      <height>16777215</height>
                     </size>
                    </property>
                    <property name="toolTip">
                     <string>Valid Range: 1.0e-10 to 1.0</string>
                    </property>
                    <property name="text">
                     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Model 1&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                    </property>
@@ -716,6 +730,9 @@
                      <height>16777215</height>
                     </size>
                    </property>
                    <property name="toolTip">
                     <string>Valid Range: 1.0e-10 to 1.0e+10</string>
                    </property>
                    <property name="text">
                     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;right&quot;&gt;Sigma&amp;amp;0 Threshold&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                    </property>
@@ -782,6 +799,9 @@
                      <height>16777215</height>
                     </size>
                    </property>
                    <property name="toolTip">
                     <string>Valid Range: 1 to 10,000</string>
                    </property>
                    <property name="text">
                     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;right&quot;&gt;Ma&amp;amp;ximum Iterations&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                    </property>
@@ -933,6 +953,9 @@
                      <height>16777215</height>
                     </size>
                    </property>
                    <property name="toolTip">
                     <string>Valid Range: 0.0 to 360.0</string>
                    </property>
                    <property name="layoutDirection">
                     <enum>Qt::LeftToRight</enum>
                    </property>
@@ -1012,7 +1035,8 @@
                     </size>
                    </property>
                    <property name="toolTip">
                     <string>Solve for local point radii</string>
                     <string>Solve for local point radii. 
Valid Range: 1.0e-10 to 1.0e+10</string>
                    </property>
                    <property name="layoutDirection">
                     <enum>Qt::LeftToRight</enum>
@@ -1039,6 +1063,9 @@
                      <height>16777215</height>
                     </size>
                    </property>
                    <property name="toolTip">
                     <string>Valid Range: 0.0 to 360.0</string>
                    </property>
                    <property name="text">
                     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Latitude&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                    </property>
@@ -1451,18 +1478,25 @@
             <zorder>twistCheckBox</zorder>
            </widget>
           </item>
           <item row="0" column="0">
            <spacer name="horizontalSpacer">
             <property name="orientation">
              <enum>Qt::Horizontal</enum>
           <item row="2" column="1">
            <widget class="QPushButton" name="pushButton">
             <property name="text">
              <string>Apply Settings to Selected Images</string>
             </property>
             <property name="sizeHint" stdset="0">
              <size>
               <width>40</width>
               <height>20</height>
              </size>
            </widget>
           </item>
           <item row="0" column="0" rowspan="3">
            <widget class="QTreeView" name="treeView">
             <property name="editTriggers">
              <set>QAbstractItemView::NoEditTriggers</set>
             </property>
            </spacer>
             <property name="selectionMode">
              <enum>QAbstractItemView::ExtendedSelection</enum>
             </property>
             <property name="headerHidden">
              <bool>true</bool>
             </property>
            </widget>
           </item>
          </layout>
         </widget>
+33 −0
Original line number Diff line number Diff line
#include "ProjectItemImageProxyModel.h"

#include <QModelIndex>
#include <QObject>
#include <QSortFilterProxyModel>

#include "ProjectItem.h"

namespace Isis {

  ProjectItemImageProxyModel::ProjectItemImageProxyModel(QObject *parent)
    : QSortFilterProxyModel(parent) {
  }


  bool ProjectItemImageProxyModel::filterAcceptsColumn(int sourceColumn,
                                                       const QModelIndex &sourceParent) const {

  }


  bool ProjectItemImageProxyModel::filterAcceptsRow(int sourceRow,
                                                    const QModelIndex &sourceParent) const {
    ProjectItemModel *source = static_cast<ProjectItemModel *>(sourceModel());
    QModelIndex modelIndex = source->index(sourceRow, 0, sourceParent);
    ProjectItem *item = source->itemFromIndex(modelIndex);
    if (item->isImage() || item->isImageList()) {
        return true;
    }
    return false;
  }

}
+21 −0
Original line number Diff line number Diff line
#ifndef ProjectItemImageProxyModel_h
#define ProjectItemImageProxyModel_h

#include <QSortFilterProxyModel>

namespace Isis {

  class ProjectItemImageProxyModel : public QSortFilterProxyModel {
    public:
      ProjectItemImageProxyModel(QObject *parent = NULL);
      ~ProjectItemImageProxyModel();

    protected:
      virtual bool filterAcceptsColumn(int sourceColumn,
                                     const QModelIndex &sourceParent) const override;
      virtual bool filterAcceptsRow(int sourceRow,
                                  const QModelIndex &sourceParent) const override;
  };
}

#endif
Loading