Unverified Commit 1cd4a2ad authored by Kristin Berry's avatar Kristin Berry Committed by GitHub
Browse files

Update qview tools to better support RA/DEC measurements (#4125)

* jigsaw to app conversion and remove unnecessary tests

* Updated based on comments

* Updated spacing

* Adds apollo fixture for jigsaw tests

* Updated to use pvl control network

* Switch to using function to compare whole csv lines

* Updated to add more individual line comparisons

* Updated based on comments

* Remove accidentally re-added line

* removed ISISROOT path

* Remove incorrect comparison part of test

* Adds jigsaw BundleXYZ test

* Update qview MeasureTool to add an option to calculate distances using RA/DEC and update qview to show DEC/RA rather than LAT/LON in lower-right corner

* Add changelog
parent a39f4370
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ update the Unreleased link so that it compares against the latest release tag.


- Fixed so required files are reported instead of continuing without them. [#4038](https://github.com/USGS-Astrogeology/ISIS3/issues/4038)
- Update qview MeasureTool to add an option to calculate distances using RA/DEC and update qview to show DEC/RA rather than LAT/LON in lower-right corner [#3371](https://github.com/USGS-Astrogeology/ISIS3/issues/3371) 

## [4.3.0] - 2020-10-02

+82 −18
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include "TProjection.h"
#include "SurfacePoint.h"
#include "ToolPad.h"
#include "Constants.h"

namespace Isis {
  /**
@@ -65,6 +66,7 @@ namespace Isis {
    m_tableWin->addToTable(false, "Kilometer\nArea", "Kilometer Area");
    m_tableWin->addToTable(false, "Meter\nArea", "Meter Area");
    m_tableWin->addToTable(false, "Pixel\nArea", "Pixel Area");
    m_tableWin->addToTable(false, "Planar \nDistance", "Planar Kilometer Distance");
    m_tableWin->addToTable(false, "Segments Sum\nkm", "Segments Sum", -1, Qt::Horizontal, "Sum of Segment lengths in kilometers");
    m_tableWin->addToTable(false, "Segment Number", "Segment Number", -1, Qt::Horizontal, "Segment number of a segmented line");
    m_tableWin->addToTable(false, "Path", "Path");
@@ -136,6 +138,7 @@ namespace Isis {
      RubberBandComboBox::Polygon |
      RubberBandComboBox::SegmentedLine, // options
      RubberBandComboBox::Line // default
                                                
    );

    m_distLineEdit = new QLineEdit(hbox);
@@ -185,8 +188,17 @@ namespace Isis {
    m_unitsComboBox->clear();
    m_showAllSegments->setEnabled(false);

    if (rubberBandTool()->currentMode() == RubberBandTool::LineMode ||
        rubberBandTool()->currentMode() == RubberBandTool::SegmentedLineMode) {
    if (rubberBandTool()->currentMode() == RubberBandTool::LineMode) {
      m_unitsComboBox->addItem("km");
      m_unitsComboBox->addItem("m");
      m_unitsComboBox->addItem("pixels");
      m_unitsComboBox->addItem("planar km");

      if (miComboUnit < 0 || miComboUnit > 3) {   // default && error checking
        miComboUnit = 2;
      }
    }
    else if (rubberBandTool()->currentMode() == RubberBandTool::SegmentedLineMode) {

      if (rubberBandTool()->currentMode() == RubberBandTool::SegmentedLineMode) {
        m_showAllSegments->setEnabled(true);
@@ -411,6 +423,13 @@ namespace Isis {
      m_tableWin->table()->item(row, AreaMIndex)->setText("N/A");
    }

    if (m_kmPlanarDist != Null) {
      m_tableWin->table()->item(row, PlanarDistanceIndex)->setText(QString::number(m_kmPlanarDist));
    }
    else {
      m_tableWin->table()->item(row, PlanarDistanceIndex)->setText("N/A");
    }

    m_tableWin->table()->item(row, PathIndex)->setText(m_path);
    m_tableWin->table()->item(row, FileNameIndex)->setText(m_fname);
  }
@@ -533,6 +552,7 @@ namespace Isis {
    m_pixArea      = Null;
    m_kmArea       = Null;
    m_mArea        = Null;
    m_kmPlanarDist = Null;
  }


@@ -683,6 +703,7 @@ namespace Isis {

    m_mDist   = Null;
    m_kmDist  = Null;
    m_kmPlanarDist = Null;
    double radius = Null;
    TProjection *tproj = NULL;
    RingPlaneProjection *rproj = NULL;
@@ -704,6 +725,7 @@ namespace Isis {
        if (cvp->projection()->SetWorld(m_startSamp, m_startLine)) {
          // If our projection is sky, the lat & lons are switched
          if (cvp->projection()->IsSky()) {

            tproj = (TProjection *) cvp->projection();
            m_startLat = tproj->UniversalLatitude();
            m_startLon = tproj->UniversalLongitude();
@@ -786,6 +808,40 @@ namespace Isis {

    m_mDist = distance.meters();
    m_kmDist = distance.kilometers();

    if (cvp->camera() != NULL) {

      // Make sure start line or end line setimage succeeds, otherwise fail. 
      bool statusStart = cvp->camera()->SetImage(m_startSamp, m_startLine);
      double slantDist = 0;
      if (statusStart) {
        slantDist = cvp->camera()->SlantDistance();
      }

      double ra1 = cvp->camera()->RightAscension() * DEG2RAD;
      double dec1 = cvp->camera()->Declination()* DEG2RAD; 

      bool statusEnd = cvp->camera()->SetImage(m_endSamp, m_endLine);
      if ((!statusStart)&&statusEnd) {
        slantDist = cvp->camera()->SlantDistance();
      }
      
      // Cannot calculate a planar distance with no point on the target.       
      if (!(statusStart||statusEnd)) {
        return;
      }

      double ra2 = cvp->camera()->RightAscension() * DEG2RAD; 
      double dec2 = cvp->camera()->Declination()* DEG2RAD; 

      double dRA = (ra1 - ra2);

      double angle = acos(sin(dec1)*sin(dec2) + cos(dec1)*cos(dec2)*cos(dRA));
      double half_angle = angle/2.0;
      double length = slantDist * sin(half_angle) * 2.0;

      m_kmPlanarDist = length;
    }
  }


@@ -809,6 +865,14 @@ namespace Isis {
          m_distLineEdit->setText(QString::number(m_mDist));
        }
      }
      else if (m_unitsComboBox->currentIndex() == 3) {
        if (m_kmPlanarDist == Null) {
          m_distLineEdit->setText("N/A");
        }
        else {
          m_distLineEdit->setText(QString::number(m_kmPlanarDist));
        } 
      }
      else {
        m_distLineEdit->setText(QString::number(m_pixDist));
      }
+3 −0
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@ namespace Isis {
        AreaKmIndex,//!< Area in kilometers index
        AreaMIndex,//!< Area in meters index
        AreaPixIndex,//!< Area in pixels index
        PlanarDistanceIndex,//!< Planar distance in kilometers
        SegmentsSumIndex,//!< Segment lengths in kilometers
        SegmentNumberIndex, //!< Segment number
        PathIndex,//!< FileName path index
@@ -161,6 +162,8 @@ namespace Isis {
      double m_kmArea;//!< area in kilometers
      double m_mArea;//!< area in meters
      double m_pixArea;//!< area in pixels
      double m_kmPlanarDist; //!< distance estimate used when at least one point is on the body (km)


      QList<double> m_distanceSegments;
      QList<double> m_pixDistSegments;
+8 −2
Original line number Diff line number Diff line
@@ -180,9 +180,15 @@ namespace Isis {
          TProjection *tproj = (TProjection *) cvp->projection();
          double lat = tproj->Latitude();
          double lon = tproj->Longitude();
          if (cvp->projection()->IsSky()) {
            p_latLabel->setText(QString("DEC %1").arg(lat));
            p_lonLabel->setText(QString("RA %1").arg(lon));
          }
          else {
            p_latLabel->setText(QString("Lat %1").arg(lat));
            p_lonLabel->setText(QString("Lon %1").arg(lon));
          }
        }
        else { // RingPlane TODO write out radius azimuth instead of lat/lon
          RingPlaneProjection *rproj = (RingPlaneProjection *) cvp->projection();
          double rad = rproj->RingRadius();