3 #include <QApplication>
17 #include "TableMainWindow.h"
24 #define FLOAT_MIN -16777215
25 #define TABLE_MOSAIC_SRC "InputImages"
40 p_action->setShortcut(Qt::CTRL + Qt::Key_T);
41 p_action->setWhatsThis(
"<b>Function: </b> Opens the Advanced Tracking Tool \
42 window. This window will track sample/line positions,\
43 lat/lon positions, and many other pieces of \
44 information. All of the data in the window can be \
45 saved to a text file. <p><b>Shortcut: </b> Ctrl+T</p>");
54 Qt::Horizontal,
"Sample and Line");
64 Qt::Horizontal,
"X and Y values for a projected image");
67 "The X, Y, and Z of surface intersection in body-fixed coordinates");
69 "Right Ascension and Declination");
80 -1, Qt::Horizontal,
"The X, Y, and Z of the spacecraft position");
98 for(
int r = 0; r < 10; r++) {
101 QTableWidgetItem *item =
new QTableWidgetItem(
"");
108 recordAction->setShortcut(Qt::Key_R);
109 parent->addAction(recordAction);
110 connect(recordAction, SIGNAL(activated()),
this, SLOT(
record()));
112 " --- Double click on a cell to enable crtl+c (copy) and"
117 QMenu *helpMenu = menuBar->addMenu(
"&Help");
119 help->setText(
"&Tool Help");
120 help->setShortcut(Qt::CTRL + Qt::Key_H);
121 connect(help, SIGNAL(activated()),
this, SLOT(
helpDialog()));
122 helpMenu->addAction(help);
139 if(e->type() == QEvent::Show) {
147 else if(e->type() == QEvent::Hide) {
150 return Tool::eventFilter(o, e);
240 int isample = int (sample + 0.5);
241 int iline = int (line + 0.5);
258 QTableWidgetItem *item =
new QTableWidgetItem(
"");
270 if(sample < 0.5)
return;
271 if(line < 0.5)
return;
273 if(line > cvp->
cubeLines() + 0.5)
return;
290 QString fnamePath = fname.
path();
291 QString fnameName = fname.name();
297 if((sample < 0.5) || (line < 0.5) ||
306 QString p = grayPixel;
311 QString p = redPixel;
316 if(cvp->
camera() != NULL) {
333 while(lon < 0.0) lon += 360.0;
372 Angle phaseAngle, incidenceAngle, emissionAngle;
377 setText(QString::number(incidenceAngle.
degrees()));
379 setText(QString::number(emissionAngle.
degrees()));
429 QString time_utc = time.UTC();
452 while(wlon < 0.0) wlon += 360.0;
453 if (tproj->
IsSky()) {
461 setText(QString::number(lat,
'f', 15));
463 setText(QString::number(glat,
'f', 15));
465 setText(QString::number(lon,
'f', 15));
480 while(wlon < 0.0) wlon += 360.0;
485 setText(QString::number(lon,
'f', 15));
507 int iMosaicOrigin = -1;
508 QString sSrcFileName =
"";
509 QString sSrcSerialNum =
"";
510 TrackMosaicOrigin(cvp, iline, isample, iMosaicOrigin, sSrcFileName, sSrcSerialNum);
514 setText(QString(sSrcSerialNum));
535 int piSample,
int &piOrigin, QString &psSrcFileName,
536 QString &psSrcSerialNum) {
540 if(cCube->
hasTable(TABLE_MOSAIC_SRC)) {
544 for(
int i = 0; i < cGrpBandBin.
keywords(); i++) {
546 for(
int j = 0; j < cKeyTrackBand.
size(); j++) {
547 if(cKeyTrackBand[j] ==
"TRACKING") {
554 if(iTrackBand > 0 && iTrackBand <= cCube->bandCount()) {
557 cOrgPortal.
SetPosition(piSample, piLine, iTrackBand + 1);
558 cCube->
read(cOrgPortal);
560 piOrigin = (int)cOrgPortal[0];
563 piOrigin -= VALID_MIN1;
567 piOrigin -= VALID_MIN2;
571 piOrigin -= FLOAT_MIN;
576 Table cFileTable(TABLE_MOSAIC_SRC);
577 cCube->
read(cFileTable);
578 int iRecs = cFileTable.
Records();
579 if(piOrigin >= 0 && piOrigin < iRecs) {
580 psSrcFileName = QString(cFileTable[piOrigin][0]);
581 psSrcSerialNum = QString(cFileTable[piOrigin][1]);
597 QVBoxLayout *dialogLayout =
new QVBoxLayout;
598 helpDialog->setLayout(dialogLayout);
599 QLabel *dialogTitle =
new QLabel(
"<h3>Advanced Tracking Tool</h3>");
600 dialogLayout->addWidget(dialogTitle);
602 QTabWidget *tabArea =
new QTabWidget;
603 dialogLayout->addWidget(tabArea);
605 QScrollArea *recordTab =
new QScrollArea;
607 QVBoxLayout *recordLayout =
new QVBoxLayout;
608 recordContainer->setLayout(recordLayout);
609 QLabel *recordText =
new QLabel(
"To record, click on the viewport of interest and"
610 " press (r) while the mouse is hovering over the image.");
611 recordText->setWordWrap(
true);
612 recordLayout->addWidget(recordText);
613 recordTab->setWidget(recordContainer);
615 QScrollArea *helpTab =
new QScrollArea;
617 QVBoxLayout *helpLayout =
new QVBoxLayout;
618 helpContainer->setLayout(helpLayout);
619 QLabel *helpText =
new QLabel(
"In order to use <i>ctrl+c</i> to copy and <i>ctrl+v</i> to"
620 " paste, you need to double click on the cell you are copying"
621 " from (the text should be highlighted). Then double click on"
622 " the cell you are pasting to (you should see a cursor if the"
623 " cell is blank). When a cell is in this editing mode, most"
624 " keyboard shortcuts work.");
625 helpText->setWordWrap(
true);
626 recordText->setWordWrap(
true);
627 helpLayout->addWidget(helpText);
628 helpTab->setWidget(helpContainer);
630 tabArea->addTab(recordTab,
"Record");
631 tabArea->addTab(helpTab,
"Table Help");
633 QPushButton *okButton =
new QPushButton(
"OK");
634 dialogLayout->addStretch();
635 dialogLayout->addWidget(okButton);
637 connect(okButton, SIGNAL(clicked()), helpDialog, SLOT(accept()));
656 QTableWidgetItem *item =
new QTableWidgetItem(
"");
663 QAbstractItemView::PositionAtBottom);
737 if (QApplication::applicationName() ==
"") {
739 "application name before using the Isis::MainWindow class. Window "
740 "state and geometry can not be saved and restored",
_FILEINFO_);
743 FileName config(
FileName(
"$HOME/.Isis/" + QApplication::applicationName() +
"/").path() +
"/" +
744 "advancedTrackTool.config");
746 return config.expanded();