Skip to content

Commit

Permalink
Update qview tools to better support RA/DEC measurements (#4125)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
krlberry authored Nov 19, 2020
1 parent a39f437 commit 1cd4a2a
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
100 changes: 82 additions & 18 deletions isis/src/qisis/objs/MeasureTool/MeasureTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "TProjection.h"
#include "SurfacePoint.h"
#include "ToolPad.h"
#include "Constants.h"

namespace Isis {
/**
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -136,6 +138,7 @@ namespace Isis {
RubberBandComboBox::Polygon |
RubberBandComboBox::SegmentedLine, // options
RubberBandComboBox::Line // default

);

m_distLineEdit = new QLineEdit(hbox);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -517,22 +536,23 @@ namespace Isis {
*/
void MeasureTool::initData(void) {
// Initialize the class data
m_startSamp = Null;
m_endSamp = Null;
m_startLine = Null;
m_endLine = Null;
m_kmDist = Null;
m_mDist = Null;
m_pixDist = Null;
m_startLon = Null;
m_startLat = Null;
m_endLon = Null;
m_endLat = Null;
m_radAngle = Null;
m_degAngle = Null;
m_pixArea = Null;
m_kmArea = Null;
m_mArea = Null;
m_startSamp = Null;
m_endSamp = Null;
m_startLine = Null;
m_endLine = Null;
m_kmDist = Null;
m_mDist = Null;
m_pixDist = Null;
m_startLon = Null;
m_startLat = Null;
m_endLon = Null;
m_endLat = Null;
m_radAngle = Null;
m_degAngle = Null;
m_pixArea = Null;
m_kmArea = Null;
m_mArea = Null;
m_kmPlanarDist = Null;
}


Expand Down Expand Up @@ -683,6 +703,7 @@ namespace Isis {

m_mDist = Null;
m_kmDist = Null;
m_kmPlanarDist = Null;
double radius = Null;
TProjection *tproj = NULL;
RingPlaneProjection *rproj = NULL;
Expand All @@ -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();
Expand Down Expand Up @@ -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;
}
}


Expand All @@ -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));
}
Expand Down
3 changes: 3 additions & 0 deletions isis/src/qisis/objs/MeasureTool/MeasureTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions isis/src/qisis/objs/TrackTool/TrackTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,14 @@ namespace Isis {
TProjection *tproj = (TProjection *) cvp->projection();
double lat = tproj->Latitude();
double lon = tproj->Longitude();
p_latLabel->setText(QString("Lat %1").arg(lat));
p_lonLabel->setText(QString("Lon %1").arg(lon));
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();
Expand Down

0 comments on commit 1cd4a2a

Please sign in to comment.