1#include "SunShadowTool.h"
13#include <QStackedWidget>
14#include <QTableWidget>
23#include "MdiCubeViewport.h"
24#include "Projection.h"
25#include "SurfacePoint.h"
49 m_tableWin->addToTable(
false,
"Feature\nName",
"Feature Name");
50 m_tableWin->addToTable(
false,
"Feature\nType",
"Feature Type");
52 "Start\nLatitude:Start\nLongitude:End\nLatitude:End\nLongitude",
53 "Ground Range", -1, Qt::Horizontal,
54 "Start Latitude/Longitude to End Latitude/Longitude");
56 "Start\nSample:Start\nLine:End\nSample:End\nLine",
57 "Pixel Range", -1, Qt::Horizontal,
58 "Start Sample/Line to End Sample/Line");
59 m_tableWin->addToTable(
true,
"Shadow Length\n(km)",
"Shadow Length (km)");
60 m_tableWin->addToTable(
true,
"Shadow Length\n(m)",
"Shadow Length (m)");
61 m_tableWin->addToTable(
true,
"Shadow Height\n(km)",
"Shadow Height (km)");
62 m_tableWin->addToTable(
true,
"Shadow Height\n(m)",
"Shadow Height (m)");
63 m_tableWin->addToTable(
true,
"Incidence Angle\n(degrees)",
64 "Incidence Angle (degrees)");
65 m_tableWin->addToTable(
true,
"Incidence Angle\n(radians)",
66 "Incidence Angle (radians)");
68 m_tableWin->addToTable(
false,
"FileName",
"FileName");
69 m_tableWin->addToTable(
false,
"Notes",
"Notes");
71 m_tableWin->setStatusMessage(
"Click, Drag, and Release to Measure a Line");
73 connect(
this, SIGNAL(viewportChanged()),
93 action->setIcon(QPixmap(
toolIconDir() +
"/sunshadow.png"));
94 action->setToolTip(
"Sun Shadow (U)");
95 action->setShortcut(Qt::Key_U);
98 "<b>Function:</b> Calculate heights or depths of features in the active "
99 "viewport given the measurement of a shadow. The shadow measurement "
100 "should originate from the top of the feature and end when the shadow "
102 "<p><b>Shortcut:</b> U</p> ";
103 action->setWhatsThis(text);
119 QToolButton *showTableButton =
new QToolButton(hbox);
120 showTableButton->setText(
"Table");
121 showTableButton->setToolTip(
"Record Measurement Data in Table");
123 "<b>Function:</b> This button will bring up a table that will record "
124 "the starting and ending points of the line, along with the calculated "
125 "values for the two points on the image. To measure a shadow, "
126 "click on the first point and releasing the mouse at the second point."
127 "\n<p><b>Shortcut:</b> CTRL+M</p>";
128 showTableButton->setWhatsThis(text);
129 showTableButton->setShortcut(Qt::CTRL + Qt::Key_M);
130 connect(showTableButton, SIGNAL(clicked()),
m_tableWin, SLOT(showTable()));
131 connect(showTableButton, SIGNAL(clicked()),
m_tableWin, SLOT(syncColumns()));
132 connect(showTableButton, SIGNAL(clicked()),
m_tableWin, SLOT(raise()));
133 showTableButton->setEnabled(
true);
139 text =
"<b>Function: </b> Shows the height of the shadow drawn on "
155 QHBoxLayout *layout =
new QHBoxLayout(hbox);
156 layout->setMargin(0);
160 layout->addWidget(showTableButton);
161 layout->addStretch(1);
162 hbox->setLayout(layout);
198 painter->setPen(QPen(Qt::red));
199 painter->drawLine(QPoint(vpStartX, vpStartY), QPoint(vpEndX, vpEndY));
236 bool adjustLine =
true;
319 if (row >=
m_tableWin->table()->rowCount() || !
325 for (
int c = 0; c <
m_tableWin->table()->columnCount(); c++) {
326 m_tableWin->table()->item(row, c)->setText(
"");
435 int newRowPos =
m_tableWin->table()->rowCount();
437 for (
int c = 0; c <
m_tableWin->table()->columnCount(); c++) {
438 QTableWidgetItem *item =
new QTableWidgetItem(
"");
439 m_tableWin->table()->setItem(newRowPos, c, item);
442 QAbstractItemView::PositionAtBottom);
491 QVector3D sunDirection;
495 double sunPosition[3];
499 cam->
radii(targetRadii);
501 double origin[3] = {0.0, 0.0, 0.0};
502 SpiceBoolean surfptSuccess;
504 double naifVectorFromSunToP1[3] = {0.0, 0.0, 0.0};
506 surfpt_c(origin, sunPosition, targetRadii[0].kilometers(),
507 targetRadii[1].kilometers(), targetRadii[2].kilometers(),
508 naifVectorFromSunToP1, &surfptSuccess);
509 success = surfptSuccess;
512 sunDirection = QVector3D(
513 naifVectorFromSunToP1[0] * 1000.0,
514 naifVectorFromSunToP1[1] * 1000.0,
515 naifVectorFromSunToP1[2] * 1000.0).normalized();
560 switch (displayUnits) {
589 bool hasCamera =
true;
591 hasCamera = activeViewport &&
592 (activeViewport->
cube()->camera() != NULL);
Defines an angle and provides unit conversions.
double radians() const
Convert an angle to a double.
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
double SunAzimuth()
Returns the Sun Azimuth.
virtual bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
Camera * camera()
Return a camera associated with the cube.
void viewportToCube(int x, int y, double &sample, double &line) const
Turns a viewport into a cube.
void cubeToViewport(double sample, double line, int &x, int &y) const
Turns a cube into a viewport.
Displacement is a signed length, usually in meters.
double meters() const
Get the displacement in meters.
Distance measurement, usually in meters.
Units
This is a list of available units to access and store Distances in.
@ SolarRadii
"Solar radius is a unit of distance used to express the size of stars in astronomy equal to the curre...
@ Pixels
The distance is being specified in pixels.
@ Kilometers
The distance is being specified in kilometers.
@ Meters
The distance is being specified in meters.
File name manipulation and expansion.
QString path() const
Returns the path of the file name.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Cube display widget for certain Isis MDI applications.
virtual SurfacePoint GetSurfacePoint() const
Returns the surface point (most efficient accessor).
virtual double IncidenceAngle() const
Returns the incidence angle in degrees.
void radii(Distance r[3]) const
Returns the radii of the body in km.
virtual void sunPosition(double p[3]) const
Fills the input vector with sun position information, in either body-fixed or J2000 reference frame a...
This class defines a body-fixed surface point.
a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
const double Null
Value for an Isis Null pixel.