Commit 9bb787ce authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

Fixed save measure, save point in the control point editor. Clear out editor...

Fixed save measure, save point in the control point editor. Clear out editor if a deleted point is loaded.  Added shortcuts to control point editor, update display of points on footprintview when point deleted.  Fixes #4982, #4984, #5073.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@8003 41f8697f-d340-4b68-9986-7bafba869bb8
parent 15071306
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -362,13 +362,10 @@ namespace Isis {

    connect(this, SIGNAL(newControlNetwork(ControlNet *)),
            m_rightView, SLOT(setControlNet(ControlNet *)));
    connect(this,
            SIGNAL(stretchChipViewport(Stretch *, CubeViewport *)),
            m_rightView,
            SLOT(stretchFromCubeViewport(Stretch *, CubeViewport *)));
    connect(this, SIGNAL(stretchChipViewport(Stretch *, CubeViewport *)),
            m_rightView, SLOT(stretchFromCubeViewport(Stretch *, CubeViewport *)));
    connect(rightLockStretch, SIGNAL(stateChanged(int)),
            m_rightView,
            SLOT(changeStretchLock(int)));
            m_rightView, SLOT(changeStretchLock(int)));
    rightLockStretch->setChecked(false);

    //  Connect the ChipViewport tackPointChanged signal to
@@ -592,7 +589,9 @@ namespace Isis {

    if (m_useGeometry) {
      QPushButton *find = new QPushButton("Find");
      find->setToolTip("Move right measure to same Latitude/Longitude as left.");
      find->setShortcut(Qt::Key_F);
      find->setToolTip("Move right measure to same Latitude/Longitude as left. "
                       "<strong>Shortcut: F</strong>");
      find->setWhatsThis("Find the Latitude/Longitude under the crosshair in the "
                         "left measure and move the right measure to the same "
                         "latitude/longitude.");
@@ -605,6 +604,9 @@ namespace Isis {

    QHBoxLayout *rightLayout = new QHBoxLayout();
    m_autoReg = new QPushButton("Register");
    m_autoReg->setShortcut(Qt::Key_R);
    m_autoReg->setToolTip("Sub-pixel register the right measure to the left. "
                          "<strong>Shortcut: R</strong>");
    m_autoReg->setToolTip("Sub-pixel register the right measure to the left");
    m_autoReg->setWhatsThis("Sub-pixel register the right measure to the left "
                       "and move the result under the crosshair.  After "
@@ -615,6 +617,7 @@ namespace Isis {
      m_saveMeasure = new QPushButton("Save Measures");
      m_saveMeasure->setToolTip("Save the both the left and right measure to the edit control "
                                "point (control point currently being edited). "
                                "<strong>Shortcut: M</strong>. "
                                " <strong>Note: The edit control point "
                                "will not be saved to the network until you select "
                                "<strong>\"Save Point\"</strong>");
@@ -623,10 +626,12 @@ namespace Isis {
      m_saveMeasure = new QPushButton("Save Measure");
      m_saveMeasure->setToolTip("Save the right measure to the edit control "
                                "point (control point currently being edited). "
                                "<strong>Shortcut: M</strong>. "
                                " <strong>Note: The edit control point "
                                "will not be saved to the network until you select "
                                "<strong>\"Save Point\"</strong>");
    }
    m_saveMeasure->setShortcut(Qt::Key_M);
    m_saveDefaultPalette = m_saveMeasure->palette();

    m_blinkExtension = new QWidget;
@@ -744,6 +749,9 @@ namespace Isis {
      m_autoRegShown = false;
      m_autoRegExtension->hide();
      m_autoReg->setText("Register");
      m_autoReg->setToolTip("Sub-pixel register the right measure to the left."
                            "<strong>Shortcut: R</strong>");
      m_autoReg->setShortcut(Qt::Key_R);
    }

    m_leftMeasure = leftMeasure;
@@ -803,6 +811,7 @@ namespace Isis {
      m_autoRegShown = false;
      m_autoRegExtension->hide();
      m_autoReg->setText("Register");
      m_autoReg->setShortcut(Qt::Key_R);
    }
    m_autoRegAttempted = false;

@@ -841,11 +850,9 @@ namespace Isis {
    m_rightView->setChip(m_rightChip, m_rightCube);

    updateRightGeom();
    //m_rightView->geomChip(m_leftChip,m_leftCube);

    // New right measure, make sure Save Measure Button text is default
    m_saveMeasure->setPalette(m_saveDefaultPalette);

  }


@@ -1133,6 +1140,9 @@ namespace Isis {
    m_autoRegExtension->show();
    m_autoRegShown = true;
    m_autoReg->setText("Undo Registration");
    m_autoReg->setToolTip("Undo sub-pixel registration. "
                          "<strong>Shortcut: U</strong>");
    m_autoReg->setShortcut(Qt::Key_U);
  }


+5 −0
Original line number Diff line number Diff line
@@ -139,6 +139,11 @@ namespace Isis {
    *   @history 2016-06-27 Ian Humphrey - Updated documentation and coding standards. Fixes #4004.
    *   @history 2017-07-27  Christopher Combs - Added sample, line, lat, and lon labels.
    *                           Fixes #5067.
    *   @history 2017-08-11 Tracie Sucharski - Added shortcuts for find,
    *                           registration/undo-registration, save measure. Fixes #4982.
    *   @history 2017-08-11 Tracie Sucharski - Created a new ControlMeasure when editing points so
    *                           that the edit ControlPoint is no changed until user selects
    *                           "Save Measures", and colorize save buttons.  Fixes #4984.
    *
    *   @todo  Re-think design of the change made on 2012-07-26.  The linking was put into
    *                          ::updateLeftPositionLabel because it was the fastest solution, but
+62 −36
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ namespace Isis {
    connect(this, SIGNAL(stretchChipViewport(Stretch *, CubeViewport *)),
            m_measureEditor, SIGNAL(stretchChipViewport(Stretch *, CubeViewport *)));
    connect(m_measureEditor, SIGNAL(measureSaved()), this, SLOT(measureSaved()));
//  connect(this, SIGNAL(measureChanged()), m_measureEditor, SLOT(colorizeSavePointButton()));
    connect(m_measureEditor, SIGNAL(measureSaved()), this, SLOT(measureSaved()));
    connect(this, SIGNAL(cnetModified()), this, SLOT(colorizeSaveNetButton()));

    QPushButton *addMeasure = NULL;
@@ -178,14 +178,17 @@ namespace Isis {
    }

    m_reloadPoint = new QPushButton("Reload Point");
    m_reloadPoint->setShortcut(Qt::Key_R);
    m_reloadPoint->setToolTip("Reload the control point.");
    m_reloadPoint->setWhatsThis("Reload the measures for the control point"
                            " in the Chip Viewports to its saved values.");
                            " in the Chip Viewports to its saved values. "
                            "<strong>Shortcut: R</strong>");
    connect(m_reloadPoint, SIGNAL(clicked()), this, SLOT(reloadPoint()));

    m_savePoint = new QPushButton ("Save Point");
    m_savePoint->setToolTip("Save the edit control point to the control "
                            "network.");
    m_savePoint->setShortcut(Qt::Key_P);
    m_savePoint->setToolTip("Save the edit control point to the control network. "
                            "<strong>Shortcut: P</strong>");
    m_savePoint->setWhatsThis("Save the edit control point to the control "
                    "network which is loaded into memory in its entirety. "
                    "When a control point is selected for editing, "
@@ -195,7 +198,9 @@ namespace Isis {
    connect (m_savePoint, SIGNAL(clicked()), this, SLOT(savePoint()));

    m_saveNet = new QPushButton ("Save Control Net");
    m_saveNet->setToolTip("Save the control network.");
    m_saveNet->setShortcut(Qt::Key_S);
    m_saveNet->setToolTip("Save current control network. "
                          "<strong>Shortcut: S</strong>");
    m_savePoint->setWhatsThis("Save the control network.");
//    m_saveDefaultPalette = m_savePoint->palette();
//  This slot is needed because we cannot directly emit a signal with a ControlNet
@@ -220,9 +225,6 @@ namespace Isis {
    m_templateFileNameLabel = new QLabel("Template File: " +
        m_measureEditor->templateFileName());
    m_templateFileNameLabel->setToolTip("Sub-pixel registration template File.");
//  QString patternMatchDoc =
//          FileName("$ISISROOT/doc/documents/PatternMatch/PatternMatch.html").fileName();
//    m_templateFileNameLabel->setOpenExternalLinks(true);
    m_templateFileNameLabel->setWhatsThis("FileName of the sub-pixel "
                  "registration template.  Refer to $ISISROOT/doc/documents/"
                  "PatternMatch/PatternMatch.html for a description of the "
@@ -395,7 +397,11 @@ namespace Isis {
  /**
   * Create the "Right Measure" groupbox
   *
   * @return @b QGroupBox * The groupbox labeled "Right Measure"
   * @returns The groupbox labeled "Right Measure"
   *
   * @internal
   *   @history 2015-10-29 Ian Humphrey - Added shortcuts (PageUp/PageDown) for selecting previous
   *                           or next measure in right measures box. References #2324.
   */
  QGroupBox * ControlPointEditWidget::createRightMeasureGroupBox() {

@@ -404,9 +410,12 @@ namespace Isis {
    m_model = new QStandardItemModel();
    m_rightCombo->setModel(m_model);
    m_rightCombo->view()->installEventFilter(this);
    m_rightCombo->setToolTip("Choose right control measure");
    m_rightCombo->setToolTip("Choose right control measure. "
                             "<strong>Shortcuts: PageUp/PageDown</strong>");
    m_rightCombo->setWhatsThis("Choose right control measure identified by "
                               "cube filename.");
                               "cube filename. "
                               "Note: PageUp selects previous measure; "
                               "PageDown selects next meausure.");

    m_rightCombo->view()->setSelectionMode(QAbstractItemView::SingleSelection);
    m_rightCombo->view()->setDragEnabled(true);
@@ -667,6 +676,14 @@ namespace Isis {
  }


  /**
   *  Find the ground source location from ControlPoint parameter, AprioriXYZSourceFile.  If file
   *  does not exist, give option to look in another location and change location in the ControlNet
   *  for either this point and/or all points in net.
   * 
   * @return FileName The filename including full path of the ground source
   *  
   */
  FileName ControlPointEditWidget::findGroundFile() {

    FileName groundFile(m_editPoint->GetAprioriSurfacePointSourceFile());
@@ -724,6 +741,11 @@ namespace Isis {
  }


  /**
   * Change the location of all ground source locations in the ControlNet.  This changes the
   * ControlPoint parameter, AprioriXYZSourceFile.
   *
   */
  void ControlPointEditWidget::changeGroundLocationsInNet() {

    for (int i = 0; i < m_controlNet->GetNumPoints(); i++ ) {
@@ -743,7 +765,9 @@ namespace Isis {
  /**
   * Slot called by Directory to set the control point for editing
   *
   * @param controlPoint Pointer to the ControlPoint to edit
   * @param controlPoint (ControlPoint *) ControlPoint that will be loaded into editor 
   * @param serialNumber (QString) Optional parameter indicating the serial number of the cube that 
   *                                 the point was chosen from 
   */
  void ControlPointEditWidget::setEditPoint(ControlPoint *controlPoint, QString serialNumber) {

@@ -765,8 +789,6 @@ namespace Isis {
    }

    loadPoint(serialNumber);
    this->setVisible(true);
    this->raise();
    loadTemplateFile(m_measureEditor->templateFileName());

    // New point loaded, make sure Save Measure Button text is default
@@ -775,7 +797,9 @@ namespace Isis {


  /**
   * @brief Load point into ControlPointEditWidget.
   * Load point into ControlPointEditWidget.
   *  
   * @param serialNumber (QString) The serial number of cube point was chosen from.  This will
   *  
   * @internal
   *   @history 2008-11-26  Jeannie Walldren - Added "Number of Measures" to
@@ -964,6 +988,9 @@ namespace Isis {
    //  Initialize pointEditor with measures
    selectLeftMeasure(leftIndex);
    selectRightMeasure(rightIndex);

    this->setVisible(true);
    this->raise();
  }


@@ -1132,6 +1159,7 @@ namespace Isis {
          }
        }

        this->setVisible(false);
        // remove this point from the control network
        if (m_controlNet->DeletePoint(m_editPoint->GetId()) ==
                                          ControlPoint::PointLocked) {
@@ -1262,6 +1290,10 @@ namespace Isis {
   *                          if no ground is loaded the checkReference was not being called and
   *                          reference measure could not be changed and there was no warning
   *                          printed.
   *   @history 2013-12-05 Tracie Sucharski - If saving measure on fixed or constrained point and
   *                          reference measure is ignored, print warning and return.
   *   @history 2015-06-05 Makayla Shepherd and Ian Humphery - Modified to return out of the
   *                          method when checkReference returns false.
   */
  void ControlPointEditWidget::measureSaved() {

@@ -1280,8 +1312,7 @@ namespace Isis {
      QString message = "You are saving changes to a measure on an ignored ";
      message += "point.  Do you want to set Ignore = False on the point and ";
      message += "both measures?";
      switch (QMessageBox::question(this, "Match Tool Save Measure",
                                    message, "&Yes", "&No", 0, 0)) {
      switch (QMessageBox::question(this, "Save Measure", message, "&Yes", "&No", 0, 0)) {
        // Yes:  set Ignore=false for the point and measures and save point
        case 0:
          m_editPoint->SetIgnored(false);
@@ -1328,10 +1359,6 @@ namespace Isis {
      colorizeSavePointButton();
    }

    // TODO  7-31-14 Commented out.  We renamed editPointChanged to controlPointChanged.  However
    //                  do we still need a private signal, editPointChanged?
//  emit editPointChanged(m_editPoint->GetId());

    // Update measure info
    updateLeftMeasureInfo();
    updateRightMeasureInfo();
@@ -1341,7 +1368,7 @@ namespace Isis {
  /**
   * Validates a change to a control measure
   *
   * @param m Pointer to the ControlMeasure
   * @param m (ControlMeasure *) Pointer to the ControlMeasure
   *
   * @return @b bool True if the change to the measure is valid
   */
@@ -1353,7 +1380,6 @@ namespace Isis {
                m_editPoint->GetMeasure(m->GetCubeSerialNumber());

    //  If measure hasn't changed, return false, to keep original

    if (*m == *origMeasure) return false;

    // Is measure on Left or Right?  This is needed to print correct information
@@ -1374,7 +1400,7 @@ namespace Isis {
      QString message = "The " + side + " measure is editLocked ";
      message += "for editing.  Do you want to set EditLock = False for this ";
      message += "measure?";
      int response = QMessageBox::question(this, "Match Tool Save Measure",
      int response = QMessageBox::question(this, "Save Measure",
                                           message, QMessageBox::Yes | QMessageBox::No);
      // Yes:  set EditLock=false for the right measure
      if (response == QMessageBox::Yes) {
@@ -1395,8 +1421,7 @@ namespace Isis {
    if (origMeasure->IsIgnored() && m->IsIgnored()) {
      QString message = "The " + side + "measure is ignored.  ";
      message += "Do you want to set Ignore = False on the measure?";
      switch(QMessageBox::question(this, "Match Tool Save Measure",
                                   message, "&Yes", "&No", 0, 0)){
      switch (QMessageBox::question(this, "Save Measure", message, "&Yes", "&No", 0, 0)) {
        // Yes:  set Ignore=false for the right measure and save point
        case 0:
            m->SetIgnored(false);
@@ -1922,17 +1947,18 @@ namespace Isis {
    }

    if (m_leftMeasure != NULL) {
      delete m_leftMeasure;
      m_leftMeasure = NULL;
    }
    m_leftMeasure = new ControlMeasure();
    //  Find measure for each file    
    m_leftMeasure = (*m_editPoint)[serial];
    *m_leftMeasure = *((*m_editPoint)[serial]);

    //  If m_leftCube is not null, delete before creating new one
    m_leftCube.reset(new Cube(file, "r"));

    //  Update left measure of pointEditor
    m_measureEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
                                     m_editPoint->GetId());
    m_measureEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(), m_editPoint->GetId());
    updateLeftMeasureInfo ();

  }
@@ -1971,20 +1997,20 @@ namespace Isis {
    }

    if (m_rightMeasure != NULL) {
      delete m_rightMeasure;
      m_rightMeasure = NULL;
    }
    m_rightMeasure = new ControlMeasure();

    //  Find measure for each file
    m_rightMeasure = (*m_editPoint)[serial];
    *m_rightMeasure = *((*m_editPoint)[serial]);

    //  If m_rightCube is not null, delete before creating new one
    m_rightCube.reset(new Cube(file, "r"));

    //  Update left measure of pointEditor
    m_measureEditor->setRightMeasure (m_rightMeasure,m_rightCube.data(),
                                      m_editPoint->GetId());
    m_measureEditor->setRightMeasure (m_rightMeasure, m_rightCube.data(), m_editPoint->GetId());
    updateRightMeasureInfo ();

  }


+6 −0
Original line number Diff line number Diff line
@@ -70,6 +70,12 @@ namespace Isis {
   *                           measures in the ChipViewports. Fixes #5070.
   *   @history 2017-08-09 Christopher Combs - Added Apriori Latitude, Longitude, and Radius to
   *                           the dialog. Fixes #5066.
   *   @history 2017-08-11 Tracie Sucharski - Added shortcuts for Save Point, Save Net.
   *                           Fixes #4982.
   *   @history 2017-08-11 Tracie Sucharski - Fixed save point and colorization of buttons.
   *                           Fixes #4984.
   *   @history 2017-08-15 Tracie Sucharski - When ControlPoint is deleted, set the visibility of
   *                           this widget to false, then to true in loadPoint().  Fixes #5073.
   */
  class ControlPointEditWidget : public QWidget {
    Q_OBJECT
+61 −50
Original line number Diff line number Diff line
@@ -472,7 +472,6 @@ namespace Isis {
  }



  /**
   * @brief Public accessor for the list of recent projects.
   * @return @b QStringList List of recent projects.
@@ -608,9 +607,15 @@ namespace Isis {
    connect(mainWidget, SIGNAL(editControlPoint(ControlPoint *, QString)),
            this, SLOT(modifyControlPoint(ControlPoint *, QString)));

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // IMPORTANT TODO::  The following connections seem recursive
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // 
    // Connection between cneteditor view & other views
    connect(mainWidget, SIGNAL(cnetModified()), this, SIGNAL(cnetModified()));
    // Connection between other views & cneteditor
    
    // ControlPointEditWidget is only object that emits cnetModified when ControlPoint is
    // deleted or saved
    connect(this, SIGNAL(cnetModified()), mainWidget, SLOT(rebuildModels()));

    m_cnetEditorViewWidgets.append(mainWidget);
@@ -652,7 +657,8 @@ namespace Isis {
            this, SLOT(createControlPoint(double, double, Cube *, bool)));

    //  This signal is connected to the CubeDnView signal which connects to the slot,
    // IpceTool::paintAllViewports()
    //  ControlNetTool::paintAllViewports().  ControlNetTool always redraws all control points, so
    //  both signals go to the same slot.
    connect(this, SIGNAL(redrawMeasures()), result, SIGNAL(redrawMeasures()));
    connect(this, SIGNAL(cnetModified()), result, SIGNAL(redrawMeasures()));

@@ -689,7 +695,7 @@ namespace Isis {

    emit newWidgetAvailable(result);

    //  Connections between mouse button events from view and control point editing
    //  Connections between mouse button events from footprint2DView and control point editing
    connect(result, SIGNAL(modifyControlPoint(ControlPoint *)),
            this, SLOT(modifyControlPoint(ControlPoint *)));

@@ -699,10 +705,14 @@ namespace Isis {
    connect(result, SIGNAL(createControlPoint(double, double)),
            this, SLOT(createControlPoint(double, double)));

    // The ControlPointEditWidget is only object that emits cnetModified when ControlPoint is
    // deleted or saved.  This requires the footprint view ControlNetGraphicsItems to be re-built.
    connect(this, SIGNAL(cnetModified()), result->mosaicSceneWidget(), SIGNAL(cnetModified()));

    //  This signal is connected to the MosaicGraphicsScene::update(), which eventually calls
    //  ControlNetGraphicsItem::paint(), then ControlPointGraphicsItem::paint().
    //  ControlNetGraphicsItem::paint(), then ControlPointGraphicsItem::paint().  This should only
    //  be used if ControlNet has not changed.  Used to update the current edit point in the view
    //  to be drawn with different color/shape.
    connect(this, SIGNAL(redrawMeasures()), result, SIGNAL(redrawMeasures()));

    //  Control Net tool will only be active if the project has an active Control.  Note:  This
@@ -782,9 +792,6 @@ namespace Isis {

      connect(result->controlPointEditWidget(), SIGNAL(saveControlNet()),
              this, SLOT(makeBackupActiveControl()));

      //  TODO 2017-05-31 TLS create signal/slot for interaction between views
//    connect(result, SIGNAL(cnetModified()), this, SIGNAL(cnetModified()));
    }

    return controlPointEditView();
@@ -961,6 +968,7 @@ namespace Isis {
   * @brief Removes pointers to deleted CnetEditorWidget objects.
   */
  void Directory::cleanupCnetEditorViewWidgets(QObject *obj) {

    CnetEditorWidget *cnetEditorWidget = static_cast<CnetEditorWidget *>(obj);
    if (!cnetEditorWidget) {
      return;
@@ -1596,6 +1604,7 @@ namespace Isis {
   */
  void Directory::modifyControlPoint(ControlPoint *controlPoint, QString serialNumber) {

    if (controlPoint) {
      if (!controlPointEditView()) {
        if (!addControlPointEditView()) {
          return;
@@ -1606,6 +1615,7 @@ namespace Isis {

      controlPointEditView()->controlPointEditWidget()->setEditPoint(controlPoint, serialNumber);
    }
  }


  /**
@@ -1616,6 +1626,7 @@ namespace Isis {
   */
  void Directory::deleteControlPoint(ControlPoint *controlPoint) {

    if (controlPoint) {
      if (!controlPointEditView()) {
        if (!addControlPointEditView()) {
          return;
@@ -1628,6 +1639,7 @@ namespace Isis {

      controlPointEditView()->controlPointEditWidget()->deletePoint(controlPoint);
    }
  }


  /**
@@ -1666,7 +1678,6 @@ namespace Isis {
  void Directory::makeBackupActiveControl() {

    project()->activeControl()->controlNet()->Write(project()->activeControl()->fileName()+".bak");
    delete project()->activeControl()->controlNet();
  }


Loading