Commit 52b0c225 authored by Christopher Combs's avatar Christopher Combs
Browse files

Combined QnetNewPointDialog into NewControlPointDialog. Fixes #4383.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@7868 41f8697f-d340-4b68-9986-7bafba869bb8
parent d3de806a
Loading
Loading
Loading
Loading
+53 −55
Original line number Diff line number Diff line
@@ -940,9 +940,8 @@ namespace Isis {
    shapeNames<<shapeNamesNoPoint;

    //m_directory->project()->shapes().count()<<"  1st shape= "<<m_directory->project()->shapes().at(0)->at(0)->fileName();

    NewControlPointDialog *newPointDialog =
        new NewControlPointDialog(m_controlNet, m_serialNumberList, m_lastUsedPointId, this);
    NewControlPointDialog *newPointDialog = new NewControlPointDialog(m_controlNet,
        m_serialNumberList, m_lastUsedPointId, this, true, true, true);
    newPointDialog->setFiles(pointFiles);
    newPointDialog->setGroundSource(shapeNames, numberShapesWithPoint);
    if (newPointDialog->exec()) {
@@ -2936,4 +2935,3 @@ namespace Isis {
  }
#endif
}
+3 −5
Original line number Diff line number Diff line
@@ -52,5 +52,3 @@ namespace Isis {
};

#endif

+7 −0
Original line number Diff line number Diff line
ifeq ($(ISISROOT), $(BLANK))
.SILENT:
error:
	echo "Please set ISISROOT";
else
	include $(ISISROOT)/make/isismake.objs
endif
 No newline at end of file
+103 −18
Original line number Diff line number Diff line
#include "QnetNewPointDialog.h"
#include "NewControlPointDialog.h"

#include <algorithm>

#include <QComboBox>

#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QListWidget>
#include <QPushButton>
#include <QtWidgets>
#include <QRadioButton>
#include <QString>
#include <QtDebug>

#include "ControlNet.h"
#include "ControlPoint.h"
#include "IString.h"
#include "QnetTool.h"
#include "SerialNumberList.h"

namespace Isis {
  /**
   * QnetNewPointDialog constructor
   * NewControlPointDialog constructor
   * @param parent The parent widget for the
   *               cube points filter
   *
@@ -31,16 +35,24 @@ namespace Isis {
   *                          creation if the point was never saved.
   *
   */
  QnetNewPointDialog::QnetNewPointDialog(QnetTool *qnetTool, QString defaultPointId,
                                         QWidget *parent) : QDialog(parent) {
  NewControlPointDialog::NewControlPointDialog(ControlNet *controlNet,
                                               SerialNumberList *serialNumberList,
                                               QString defaultPointId,
                                               QWidget *parent,
                                               bool pointType,
                                               bool groundSource,
                                               bool subpixelRegisterMeasures) : QDialog(parent) {

    m_controlNet = controlNet;
    m_serialNumberList = serialNumberList;

    m_ptIdEdit = NULL;

    m_subpixelRegisterButton = NULL;
    m_fileList = NULL;
    m_ptIdLabel = NULL;
    m_okButton = NULL;

    m_qnetTool = qnetTool;

    m_ptIdLabel = new QLabel("Point ID:");
    m_ptIdEdit = new QLineEdit;
    m_ptIdLabel->setBuddy(m_ptIdEdit);
@@ -49,6 +61,37 @@ namespace Isis {
    connect(m_ptIdEdit, SIGNAL(textChanged(const QString &)),
            this, SLOT(enableOkButton(const QString &)));

    QHBoxLayout *pointTypeLayout = new QHBoxLayout();
    if (pointType) {
      m_pointTypeCombo = new QComboBox;
      for (int i=0; i<ControlPoint::PointTypeCount; i++) {
        m_pointTypeCombo->insertItem(i, ControlPoint::PointTypeToString(
                                     (ControlPoint::PointType) i));
      }
      m_pointTypeCombo->setCurrentIndex(2);
      QLabel *pointTypeLabel = new QLabel("PointType:");
      pointTypeLayout->addWidget(pointTypeLabel);
      pointTypeLayout->addWidget(m_pointTypeCombo);
      connect(m_pointTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(pointTypeChanged(int)));
    }


    if (groundSource) {
      m_groundSourceLayout = new QHBoxLayout();
      m_groundSourceCombo = new QComboBox;
      QLabel *groundSourceLabel = new QLabel("Ground Source:");
      m_groundSourceLayout->addWidget(groundSourceLabel);
      m_groundSourceLayout->addWidget(m_groundSourceCombo);
      m_groundSourceCombo->setVisible(false);
    }

    if (subpixelRegisterMeasures) {
      m_subpixelRegisterButton = new QRadioButton("Subpixel Register Measures");
      m_subpixelRegisterButton->setChecked(true);
      m_subpixelRegisterButton->setToolTip("Each measure will be subpixel registered to the reference"
                                           " as it is created.");
    }

    QLabel *listLabel = new QLabel("Select Files:");

    m_fileList = new QListWidget;
@@ -73,7 +116,21 @@ namespace Isis {
    ptIdLayout->addWidget(m_ptIdEdit);

    QVBoxLayout *vLayout = new QVBoxLayout;

    vLayout->addLayout(ptIdLayout);

    if (pointType) {
      vLayout->addLayout(pointTypeLayout);
    }

    if (groundSource) {
      vLayout->addLayout(m_groundSourceLayout);
    }

    if (subpixelRegisterMeasures) {
      vLayout->addWidget(m_subpixelRegisterButton);
    }

    vLayout->addWidget(listLabel);
    vLayout->addWidget(m_fileList);
    vLayout->addLayout(buttonLayout);
@@ -84,12 +141,17 @@ namespace Isis {
  }


  QString QnetNewPointDialog::pointId() const {
  QString NewControlPointDialog::pointId() const {
    return m_ptIdEdit->text();
  }


  QStringList QnetNewPointDialog::selectedFiles() const {
  int NewControlPointDialog::pointType() const {
    return m_pointTypeCombo->currentIndex();
  }


  QStringList NewControlPointDialog::selectedFiles() const {
    QStringList result;

    foreach (QListWidgetItem *fileItem, m_fileList->selectedItems()) {
@@ -100,6 +162,32 @@ namespace Isis {
  }


  bool NewControlPointDialog::subpixelRegisterPoint() {
    return m_subpixelRegisterButton->isChecked();
  }


  QString NewControlPointDialog::groundSource() const {
    return m_groundSourceCombo->currentText();
  }


  void NewControlPointDialog::pointTypeChanged(int pointType) {
    if (pointType == ControlPoint::Constrained || pointType == ControlPoint::Fixed) {
      m_groundSourceCombo->setVisible(true);
    }
  }


  void NewControlPointDialog::setGroundSource(QStringList groundFiles, int numberShapesWithPoint) {
    m_groundSourceCombo->addItems(groundFiles);
    for (int i = 0; i < numberShapesWithPoint; i++) {
      m_groundSourceCombo->setItemData(i, QColor(Qt::red), Qt::ForegroundRole);
    }
    m_groundSourceCombo->insertSeparator(numberShapesWithPoint);
  }


  /**
   * @internal
   *   @history 2010-06-03 Jeannie Walldren - Removed "std::"
@@ -107,15 +195,14 @@ namespace Isis {
   *   @history 2010-10-29 Tracie Sucharski - Changed std::vector<std::string>
   *            to QSringList
   */
  void QnetNewPointDialog::setFiles(QStringList pointFiles) {
  void NewControlPointDialog::setFiles(QStringList pointFiles) {

    int bottomMostSelectedItemIndex = 0;

    SerialNumberList *snList = m_qnetTool->serialNumberList();
    for (int i = 0; i < snList->size(); i++) {
    for (int i = 0; i < m_serialNumberList->size(); i++) {

      // build new item...
      QString label = snList->fileName(i);
      QString label = m_serialNumberList->fileName(i);
      QListWidgetItem *item = new QListWidgetItem(label);

      // if this entry of the SerialNumberList is also in the pointFiles then
@@ -139,10 +226,8 @@ namespace Isis {
   *   @history 2008-11-26 Jeannie Walldren - Set lastPointIdValue
   *            to the ptIdValue
   */
  void QnetNewPointDialog::enableOkButton(const QString &) {
  void NewControlPointDialog::enableOkButton(const QString &) {
    m_okButton->setEnabled(!m_ptIdEdit->text().isEmpty() &&
                           !m_qnetTool->controlNet()->ContainsPoint(m_ptIdEdit->text()));
                           !m_controlNet->ContainsPoint(m_ptIdEdit->text()));
  }


}
+36 −9
Original line number Diff line number Diff line
#ifndef QnetNewPointDialog_h
#define QnetNewPointDialog_h
#ifndef NewControlPointDialog_h
#define NewControlPointDialog_h

#include <QDialog>

class QComboBox;
class QHBoxLayout;
class QLabel;
class QLineEdit;
class QListWidget;
class QPushButton;
class QRadioButton;
class QString;
class QStringList;

namespace Isis {
  class QnetTool;
  class ControlNet;
  class SerialNumberList;

  /**
   * @author ????-??-?? Unknown
   * @author ????-??-?? Tracie Sucharski
   * @internal
   *   @history 2008-11-26 Jeannie Walldren - Added functionality
   *                          to show the last Point ID entered
@@ -23,32 +27,55 @@ namespace Isis {
   *                          in constructor.  Removed "std::" in
   *                          header and .cpp files.
   *   @history 2010-12-03 Eric Hyer - Selected points now go to the top!
   *   @history 2016-09-16 Tracie Sucharski - Renamed to NewControlPointDialog in anticipation of
   *                          creating a parent class that QnetNewPointDialog and
   *                          MatchToolNewPointDialog can inherit.
   *   @history 2016-10-18 Tracie Sucharski - Added method to return value of the
   *                          subpixelRegister radio button.  If set, all measures in the control
   *                          point created will be subpixel registered.
   *   @history 2017-07-04 Christopher Combs - Added bools to toggle on specific elements of the
   *                          dialog to remove similar classes like QnetNewPointDialog. Fixes #4383.
   */
  class QnetNewPointDialog : public QDialog {
  class NewControlPointDialog : public QDialog {

      Q_OBJECT

    public:
      QnetNewPointDialog(QnetTool *qnetTool, QString defaultPointId, QWidget *parent = 0);
      NewControlPointDialog(ControlNet *controlNet,
                            SerialNumberList *serialNumberList,
                            QString defaultPointId,
                            QWidget *parent = 0,
                            bool pointType = false,
                            bool groundSource = false,
                            bool subpixelRegisterMeasures = false);

      QString pointId() const;
      int pointType() const;
      void setGroundSource(QStringList groundFiles, int numberShapesWithPoint);
      QString groundSource() const;
      QStringList selectedFiles() const;
      void setFiles(QStringList pointFiles);
      bool subpixelRegisterPoint();

    private slots:
      void pointTypeChanged(int pointType);
      void enableOkButton(const QString &text);

    private:
      ControlNet *m_controlNet;
      SerialNumberList *m_serialNumberList;

      QLabel *m_ptIdLabel;
      QComboBox *m_pointTypeCombo;
      QComboBox *m_groundSourceCombo;
      QHBoxLayout *m_groundSourceLayout;
      QRadioButton *m_subpixelRegisterButton;
      QPushButton *m_okButton;
      QLineEdit *m_ptIdEdit;
      QListWidget *m_fileList;
      QStringList *m_pointFiles;
      QnetTool *m_qnetTool;

  };
};

#endif

Loading