2 #include "SunShadowTool.h"
4 #include <QApplication>
10 #include <QMessageBox>
48 "Start\nLatitude:Start\nLongitude:End\nLatitude:End\nLongitude",
49 "Ground Range", -1, Qt::Horizontal,
50 "Start Latitude/Longitude to End Latitude/Longitude");
52 "Start\nSample:Start\nLine:End\nSample:End\nLine",
53 "Pixel Range", -1, Qt::Horizontal,
54 "Start Sample/Line to End Sample/Line");
60 "Incidence Angle (degrees)");
62 "Incidence Angle (radians)");
69 connect(
this, SIGNAL(viewportChanged()),
89 action->setIcon(QPixmap(
toolIconDir() +
"/sunshadow.png"));
90 action->setToolTip(
"Sun Shadow (U)");
91 action->setShortcut(Qt::Key_U);
94 "<b>Function:</b> Calculate heights or depths of features in the active "
95 "viewport given the measurement of a shadow. The shadow measurement "
96 "should originate from the top of the feature and end when the shadow "
98 "<p><b>Shortcut:</b> U</p> ";
99 action->setWhatsThis(text);
115 QToolButton *showTableButton =
new QToolButton(hbox);
116 showTableButton->setText(
"Table");
117 showTableButton->setToolTip(
"Record Measurement Data in Table");
119 "<b>Function:</b> This button will bring up a table that will record "
120 "the starting and ending points of the line, along with the calculated "
121 "values for the two points on the image. To measure a shadow, "
122 "click on the first point and releasing the mouse at the second point."
123 "\n<p><b>Shortcut:</b> CTRL+M</p>";
124 showTableButton->setWhatsThis(text);
125 showTableButton->setShortcut(Qt::CTRL + Qt::Key_M);
126 connect(showTableButton, SIGNAL(clicked()),
m_tableWin, SLOT(showTable()));
127 connect(showTableButton, SIGNAL(clicked()),
m_tableWin, SLOT(syncColumns()));
128 connect(showTableButton, SIGNAL(clicked()),
m_tableWin, SLOT(
raise()));
129 showTableButton->setEnabled(
true);
135 text =
"<b>Function: </b> Shows the height of the shadow drawn on "
151 QHBoxLayout *layout =
new QHBoxLayout(hbox);
152 layout->setMargin(0);
156 layout->addWidget(showTableButton);
157 layout->addStretch(1);
158 hbox->setLayout(layout);
194 painter->setPen(QPen(Qt::red));
195 painter->drawLine(QPoint(vpStartX, vpStartY), QPoint(vpEndX, vpEndY));
232 bool adjustLine =
true;
314 ASSERT(row < m_tableWin->table()->rowCount());
435 QTableWidgetItem *item =
new QTableWidgetItem(
"");
439 QAbstractItemView::PositionAtBottom);
488 QVector3D sunDirection;
492 double sunPosition[3];
496 cam->
radii(targetRadii);
498 double origin[3] = {0.0, 0.0, 0.0};
499 SpiceBoolean surfptSuccess;
501 double naifVectorFromSunToP1[3] = {0.0, 0.0, 0.0};
503 surfpt_c(origin, sunPosition, targetRadii[0].kilometers(),
504 targetRadii[1].kilometers(), targetRadii[2].kilometers(),
505 naifVectorFromSunToP1, &surfptSuccess);
506 success = surfptSuccess;
509 sunDirection = QVector3D(
510 naifVectorFromSunToP1[0] * 1000.0,
511 naifVectorFromSunToP1[1] * 1000.0,
512 naifVectorFromSunToP1[2] * 1000.0).normalized();
557 switch (displayUnits) {
586 bool hasCamera =
true;
588 hasCamera = activeViewport &&