Commit 5afd10e5 authored by Makayla Shepherd's avatar Makayla Shepherd
Browse files

When an invalid latitude is entered into the qview Find Tool, the error...

When an invalid latitude is entered into the qview Find Tool, the error message is closable. Fixes #2130.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6669 41f8697f-d340-4b68-9986-7bafba869bb8
parent bb826ebb
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -376,6 +376,13 @@ namespace Isis {
    if (p_tabWidget->tabText( p_tabWidget->currentIndex() ) == "Ground") {
      p_lat = p_groundTab->p_latLineEdit->text().toDouble();
      p_lon = p_groundTab->p_lonLineEdit->text().toDouble();
      if (p_lat > 90 || p_lat < -90) {
        QString mess = QString::number(p_lat) + " is an invalid latitude value. "
                         + "Please enter a latitude between -90 and 90.";
        QMessageBox::warning((QWidget *)parent(), "Warning", mess);
        p_lat = DBL_MAX;
        p_lon = DBL_MAX;
      }
    }
    else if (p_tabWidget->tabText( p_tabWidget->currentIndex() ) == "Image") {
      p_line = p_imageTab->p_lineLineEdit->text().toDouble();
@@ -609,10 +616,11 @@ namespace Isis {
   *         distance will be in a unit other than pixels.
   */
  Distance FindTool::distancePerPixel(MdiCubeViewport *viewport,
                                      double lat, double lon) const {
                                      double lat, double lon) {
    UniversalGroundMap *groundMap = viewport->universalGroundMap();
    Distance viewportResolution;

    try {
      if ( groundMap && !IsSpecial(lat) && !IsSpecial(lon) &&
           lat != DBL_MAX && lon != DBL_MAX &&
           groundMap->SetUniversalGround(lat, lon) ) {
@@ -645,6 +653,14 @@ namespace Isis {
          }
        }
      }
    }
    catch (IException &e) {
      p_samp = DBL_MAX;
      p_line = DBL_MAX;
      p_lat = DBL_MAX;
      p_lon = DBL_MAX;
      QMessageBox::warning((QWidget *)parent(), "Warning", e.toString());
    }

    return viewportResolution;
  }
+4 −1
Original line number Diff line number Diff line
@@ -121,6 +121,9 @@ namespace Isis {
   *                          Find Latitude/Longitude Coordinate dialog window. Added help text
   *                          to Find Tool menu option. Minor coding standards fixes. 
   *                          Fixes #2087.
   *  @history 2016-03-23 Makayla Shepherd - Added a check on the latitude
   *                          entered that caused an error message to pop up
   *                          continuously. Fixes #2130.
   */
  class FindTool : public Tool {
      Q_OBJECT
@@ -162,7 +165,7 @@ namespace Isis {
    private: // methods
      void centerLinkedViewports();
      Distance distancePerPixel(MdiCubeViewport *viewport,
                                double lat, double lon) const;
                                double lat, double lon);
      void refresh();

    private: