Commit aa435ab1 authored by Marjorie Hahn's avatar Marjorie Hahn
Browse files

Error message in qview regarding AutoRegFactory creation should now only...

Error message in qview regarding AutoRegFactory creation should now only appear when the user is actually registering a point. Fixes #4590.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7612 41f8697f-d340-4b68-9986-7bafba869bb8
parent 960f0082
Loading
Loading
Loading
Loading
+81 −98
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ namespace Isis {
   *   @history 2008-15-2008 Jeannie Walldren - Added error
   *                           string to iException::Message before
   *                           creating QMessageBox
   *   @history 2017-04-21 Marjorie Hahn - Moved p_autoRegFact creation
   *                           from constructor to registerPoint() method.
   */
  ControlPointEdit::ControlPointEdit(ControlNet * cnet, QWidget *parent,
                                     bool allowLeftMouse, bool useGeometry) : QWidget(parent) {
@@ -66,27 +68,11 @@ namespace Isis {
    p_leftGroundMap = 0;
    p_rightGroundMap = 0;

    try {
      p_templateFileName = "$base/templates/autoreg/qnetReg.def";
      Pvl pvl(p_templateFileName);
      p_autoRegFact = AutoRegFactory::Create(pvl);
    }
    catch (IException &e) {
      p_autoRegFact = NULL;
      IException fullError(e, IException::Io,
                           "Cannot create AutoRegFactory. As a result, "
                           "sub-pixel registration will not work.",
                           _FILEINFO_);
      QString message = fullError.toString();
      QMessageBox::information((QWidget *)parent, "Error", message);
    }

    createPointEditor(parent);
    if (cnet != NULL) emit newControlNetwork(cnet);
  }



  ControlPointEdit::~ControlPointEdit() {

    delete p_leftChip;
@@ -96,7 +82,6 @@ namespace Isis {
  }



  /**
   * Design the PointEdit widget
   *
@@ -644,8 +629,6 @@ namespace Isis {
  }




  /**
   * Set the measure displayed in the left ChipViewport
   *
@@ -942,11 +925,29 @@ namespace Isis {
   *                           successful, change save button to red.
   *   @history 2011-10-21 Tracie Sucharski - Add try/catch around registration
   *                           to catch errors thrown from autoreg class.
   *   @history 2017-04-21 Marjorie Hahn - Added auto registration factory creation.
   *
   */

  void ControlPointEdit::registerPoint() {
    
    if (p_autoRegFact == NULL) {
      try {
        p_templateFileName = "$base/templates/autoreg/qnetReg.def";
        Pvl pvl(p_templateFileName);
        p_autoRegFact = AutoRegFactory::Create(pvl);
      }
      catch (IException &e) {
        p_autoRegFact = NULL;
        IException fullError(e, IException::Io,
                            "Cannot create AutoRegFactory. As a result, "
                            "sub-pixel registration will not work.",
                            _FILEINFO_);
        QString message = fullError.toString();
        QMessageBox::information((QWidget *)parent(), "Error", message);
        return;
      }
    }
        
    if (p_autoRegShown) {
      // Undo Registration
      p_autoRegShown = false;
@@ -962,16 +963,14 @@ namespace Isis {
      // Since un-doing registration, make sure save button not red
      p_saveMeasure->setPalette(p_saveDefaultPalette);
      return;

    }
    p_autoRegAttempted = true;

    try {
      p_autoRegFact->PatternChip()->TackCube(
                          p_leftMeasure->GetSample(), p_leftMeasure->GetLine());
      p_autoRegFact->PatternChip()->TackCube(p_leftMeasure->GetSample(), 
                                             p_leftMeasure->GetLine());
      p_autoRegFact->PatternChip()->Load(*p_leftCube);
      p_autoRegFact->SearchChip()->TackCube(
                          p_rightMeasure->GetSample(),
      p_autoRegFact->SearchChip()->TackCube(p_rightMeasure->GetSample(),
                                            p_rightMeasure->GetLine());
      if (p_useGeometry) {
        p_autoRegFact->SearchChip()->Load(*p_rightCube,
@@ -1047,8 +1046,6 @@ namespace Isis {
      return;
    }



    //  Load chip with new registered point
    emit updateRightView(p_autoRegFact->CubeSample(), p_autoRegFact->CubeLine());
    // If registered pt different from measure, colorize the save button
@@ -1236,7 +1233,6 @@ namespace Isis {
  }



///**
// * Slot to update the right ChipViewport for zoom
// * operations
@@ -1264,7 +1260,6 @@ namespace Isis {
//}



  /**
   * Slot to enable the rotate dial
   * @internal 
@@ -1300,7 +1295,6 @@ namespace Isis {
  }



  /**
   * Turn geom on
   *
@@ -1337,7 +1331,6 @@ namespace Isis {

    try {
      p_rightView->geomChip(p_leftChip, p_leftCube);

    }
    catch (IException &e) {
      IException fullError(e, IException::User, "Geom failed.", _FILEINFO_);
@@ -1386,8 +1379,6 @@ namespace Isis {
  }




  /**
   * Turn circle widgets on/off
   *
@@ -1415,11 +1406,9 @@ namespace Isis {
      p_rightView->setCircle(false);
    }


  }



  /**
   * Turn linking of zoom on or off
   *
@@ -1438,7 +1427,6 @@ namespace Isis {
  }



  //!  Slot to start blink function
  void ControlPointEdit::blinkStart() {
    if (p_timerOn) return;
@@ -1468,7 +1456,6 @@ namespace Isis {
  }



  /**
   * Set blink rate
   *
@@ -1488,8 +1475,6 @@ namespace Isis {
  }




  /**
   * Allows user to choose a new template file by opening a window
   * from which to select a filename.  This file is then
@@ -1578,14 +1563,12 @@ namespace Isis {
  }



  void ControlPointEdit::refreshChips() {
    p_leftView->update();
    p_rightView->update();
  }



  /**
   * Slot to save registration chips to files and fire off qview.
   *
+66 −63
Original line number Diff line number Diff line
@@ -136,6 +136,9 @@ namespace Isis {
    *                           ControlMeasure::SetLogData(). Fixes #2041.
    *   @history 2015-10-29 Ian Humphrey - Added shortcuts for Register (R), Save Measure (M),
    *                           Undo Registration (U), and Find (F). Fixes #2324.
    *   @history 2017-04-25 Marjorie Hahn - Moved AutoRegFactory creation from the constructor
    *                           to ControlPointEdit::registerPoint() so that AutoRegFactory is 
    *                           not created until it is needed. Fixes #4590.
    *  
    *   @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