10 #include <QMessageBox>
14 #include <QStackedWidget>
16 #include <QTableWidget>
19 #include "QnetDeletePointDialog.h"
20 #include "QnetNewMeasureDialog.h"
21 #include "QnetNewPointDialog.h"
22 #include "QnetFixedPointDialog.h"
33 #include "ControlPointEdit.h"
39 #include "MainWindow.h"
44 #include "PvlEditDialog.h"
52 #include "ViewportMainWindow.h"
71 m_serialNumberList = NULL;
72 m_templateModified =
false;
77 if (qobject_cast<Workspace *>(parent)) {
78 m_workspace = qobject_cast<
Workspace *>(parent);
80 else if (qobject_cast<ViewportMainWindow *>(parent)) {
85 tr(
"Could not find the workspace with the given parent, expected a Workspace or "
86 "ViewportMainWindow."),
94 QnetTool::~QnetTool () {
99 delete m_rightMeasure;
100 delete m_measureTable;
101 delete m_measureWindow;
133 m_qnetTool =
new MainWindow(
"Qnet Tool", parent);
134 m_qnetTool->setObjectName(
"QnetTool");
143 connect(
this, SIGNAL(newControlNetwork(
ControlNet *)),
144 m_pointEditor, SIGNAL(newControlNetwork(
ControlNet *)));
150 connect(
this, SIGNAL(measureChanged()),
153 QPushButton *
addMeasure =
new QPushButton(
"Add Measure(s) to Point");
154 addMeasure->setShortcut(Qt::Key_A);
155 addMeasure->setToolTip(
"Add a new measure to the edit control point. "
156 "<strong>Shortcut: A</strong>");
157 addMeasure->setWhatsThis(
"This allows a new control measure to be added "
158 "to the currently edited control point. A selection "
159 "box with all cubes from the input list will be "
160 "displayed with those that intersect with the "
161 "control point highlighted.");
162 connect(addMeasure, SIGNAL(clicked()),
this, SLOT(
addMeasure()));
164 m_savePoint =
new QPushButton (
"Save Point");
165 m_savePoint->setShortcut(Qt::Key_P);
166 m_savePoint->setToolTip(
"Save the edit control point to the control network. "
167 "<strong>Shortcut: P</strong>");
168 m_savePoint->setWhatsThis(
"Save the edit control point to the control "
169 "network which is loaded into memory in its entirety. "
170 "When a control point is selected for editing, "
171 "a copy of the point is made so that the original control "
172 "point remains in the network.");
173 m_saveDefaultPalette = m_savePoint->palette();
174 connect (m_savePoint,SIGNAL(clicked()),
this,SLOT(
savePoint()));
176 QHBoxLayout * addMeasureLayout =
new QHBoxLayout;
177 addMeasureLayout->addWidget(addMeasure);
178 addMeasureLayout->addWidget(m_savePoint);
181 m_templateFileNameLabel =
new QLabel(
"Template File: " +
182 m_pointEditor->templateFileName());
183 m_templateFileNameLabel->setToolTip(
"Sub-pixel registration template File.");
187 m_templateFileNameLabel->setWhatsThis(
"FileName of the sub-pixel "
188 "registration template. Refer to $ISISROOT/doc/documents/"
189 "PatternMatch/PatternMatch.html for a description of the "
190 "contents of this file.");
192 m_groundFileNameLabel =
new QLabel(
"Ground Source File: ");
193 m_groundFileNameLabel->setToolTip(
"Cube used to create ground control "
194 "points, either Fixed or Constrained.");
195 m_groundFileNameLabel->setWhatsThis(
"This cube is used to create ground "
196 "control points, Fixed or Constrained. This may "
197 "be a Dem, a shaded relief version of a Dem, "
198 "a projected basemap or an unprojected cube with "
199 "corrected camera pointing. This will be used "
200 "to set the apriori latitude, longitude.");
201 m_radiusFileNameLabel =
new QLabel(
"Radius Source: ");
202 m_radiusFileNameLabel->setToolTip(
"Dem used to set the radius of ground "
203 "control points, Fixed or Constrained. This must "
204 "be a Dem and is strictly used to set the apriori "
205 "radius for ground control points.");
207 QVBoxLayout * centralLayout =
new QVBoxLayout;
209 centralLayout->addWidget(m_templateFileNameLabel);
210 centralLayout->addWidget(m_groundFileNameLabel);
211 centralLayout->addWidget(m_radiusFileNameLabel);
213 centralLayout->addStretch();
214 centralLayout->addWidget(m_pointEditor);
215 centralLayout->addLayout(addMeasureLayout);
217 centralWidget->setLayout(centralLayout);
219 QScrollArea *scrollArea =
new QScrollArea();
220 scrollArea->setObjectName(
"QnetToolScroll");
221 scrollArea->setWidget(centralWidget);
222 scrollArea->setWidgetResizable(
true);
223 centralWidget->adjustSize();
224 m_qnetTool->setCentralWidget(scrollArea);
228 connect(
this, SIGNAL(editPointChanged(QString)),
238 QHBoxLayout * measureLayout =
new QHBoxLayout;
242 QVBoxLayout * groupBoxesLayout =
new QVBoxLayout;
244 groupBoxesLayout->addStretch();
245 groupBoxesLayout->addLayout(measureLayout);
248 groupBoxesWidget->setLayout(groupBoxesLayout);
252 QSplitter * topSplitter =
new QSplitter;
253 topSplitter->addWidget(groupBoxesWidget);
254 topSplitter->addWidget(m_templateEditorWidget);
255 topSplitter->setStretchFactor(0, 4);
256 topSplitter->setStretchFactor(1, 3);
258 m_templateEditorWidget->hide();
268 m_ptIdValue =
new QLabel;
270 for (
int i=0; i<ControlPoint::PointTypeCount; i++) {
274 QHBoxLayout *pointTypeLayout =
new QHBoxLayout;
275 QLabel *pointTypeLabel =
new QLabel(
"PointType:");
276 pointTypeLayout->addWidget(pointTypeLabel);
277 pointTypeLayout->addWidget(m_pointType);
278 connect(m_pointType, SIGNAL(activated(
int)),
280 m_numMeasures =
new QLabel;
281 m_pointAprioriLatitude =
new QLabel;
282 m_pointAprioriLongitude =
new QLabel;
283 m_pointAprioriRadius =
new QLabel;
284 m_pointAprioriLatitudeSigma =
new QLabel;
285 m_pointAprioriLongitudeSigma =
new QLabel;
286 m_pointAprioriRadiusSigma =
new QLabel;
287 QVBoxLayout * leftLayout =
new QVBoxLayout;
288 leftLayout->addWidget(m_ptIdValue);
289 leftLayout->addLayout(pointTypeLayout);
290 leftLayout->addWidget(m_pointAprioriLatitude);
291 leftLayout->addWidget(m_pointAprioriLongitude);
292 leftLayout->addWidget(m_pointAprioriRadius);
293 leftLayout->addWidget(m_pointAprioriLatitudeSigma);
294 leftLayout->addWidget(m_pointAprioriLongitudeSigma);
295 leftLayout->addWidget(m_pointAprioriRadiusSigma);
298 m_lockPoint =
new QCheckBox(
"Edit Lock Point");
299 connect(m_lockPoint, SIGNAL(clicked(
bool)),
this, SLOT(
setLockPoint(
bool)));
300 m_ignorePoint =
new QCheckBox(
"Ignore Point");
301 connect(m_ignorePoint, SIGNAL(clicked(
bool)),
303 connect(
this, SIGNAL(ignorePointChanged()), m_ignorePoint, SLOT(toggle()));
304 m_pointLatitude =
new QLabel;
305 m_pointLongitude =
new QLabel;
306 m_pointRadius =
new QLabel;
308 QVBoxLayout * rightLayout =
new QVBoxLayout;
309 rightLayout->addWidget(m_numMeasures);
310 rightLayout->addWidget(m_lockPoint);
311 rightLayout->addWidget(m_ignorePoint);
312 rightLayout->addWidget(m_pointLatitude);
313 rightLayout->addWidget(m_pointLongitude);
314 rightLayout->addWidget(m_pointRadius);
317 QHBoxLayout * mainLayout =
new QHBoxLayout;
318 mainLayout->addLayout(leftLayout);
319 mainLayout->addStretch();
320 mainLayout->addLayout(rightLayout);
323 QGroupBox * groupBox =
new QGroupBox(
"Control Point");
324 groupBox->setLayout(mainLayout);
334 m_leftCombo->view()->installEventFilter(
this);
335 m_leftCombo->setToolTip(
"Choose left control measure");
336 m_leftCombo->setWhatsThis(
"Choose left control measure identified by "
338 connect(m_leftCombo, SIGNAL(activated(
int)),
340 m_lockLeftMeasure =
new QCheckBox(
"Edit Lock Measure");
341 connect(m_lockLeftMeasure, SIGNAL(clicked(
bool)),
343 m_ignoreLeftMeasure =
new QCheckBox(
"Ignore Measure");
344 connect(m_ignoreLeftMeasure, SIGNAL(clicked(
bool)),
346 connect(
this, SIGNAL(ignoreLeftChanged()),
347 m_ignoreLeftMeasure, SLOT(toggle()));
348 m_leftReference =
new QLabel();
349 m_leftMeasureType =
new QLabel();
350 m_leftSampError =
new QLabel();
351 m_leftSampError->setToolTip(
"<strong>Jigsaw</strong> sample residual.");
352 m_leftSampError->setWhatsThis(
"This is the sample residual for the left "
353 "measure calculated by the application, "
354 "<strong>jigsaw</strong>.");
355 m_leftLineError =
new QLabel();
356 m_leftLineError->setToolTip(
"<strong>Jigsaw</strong> line residual.");
357 m_leftLineError->setWhatsThis(
"This is the line residual for the left "
358 "measure calculated by the application, "
359 "<strong>jigsaw</strong>.");
360 m_leftSampShift =
new QLabel();
361 m_leftSampShift->setToolTip(
"Sample shift between apriori and current");
362 m_leftSampShift->setWhatsThis(
"The shift between the apriori sample and "
363 "the current sample. The apriori sample is set "
364 "when creating a new measure.");
365 m_leftLineShift =
new QLabel();
366 m_leftLineShift->setToolTip(
"Line shift between apriori and current");
367 m_leftLineShift->setWhatsThis(
"The shift between the apriori line and "
368 "the current line. The apriori line is set "
369 "when creating a new measure.");
370 m_leftGoodness =
new QLabel();
371 m_leftGoodness->setToolTip(
"Goodness of Fit result from sub-pixel "
373 m_leftGoodness->setWhatsThis(
"Resulting Goodness of Fit from sub-pixel "
375 QVBoxLayout * leftLayout =
new QVBoxLayout;
376 leftLayout->addWidget(m_leftCombo);
377 leftLayout->addWidget(m_lockLeftMeasure);
378 leftLayout->addWidget(m_ignoreLeftMeasure);
379 leftLayout->addWidget(m_leftReference);
380 leftLayout->addWidget(m_leftMeasureType);
381 leftLayout->addWidget(m_leftSampError);
382 leftLayout->addWidget(m_leftLineError);
383 leftLayout->addWidget(m_leftSampShift);
384 leftLayout->addWidget(m_leftLineShift);
385 leftLayout->addWidget(m_leftGoodness);
387 QGroupBox * leftGroupBox =
new QGroupBox(
"Left Measure");
388 leftGroupBox->setLayout(leftLayout);
407 m_rightCombo->view()->installEventFilter(
this);
411 QShortcut *nextMeasure =
new QShortcut(Qt::Key_PageDown, m_qnetTool);
413 QShortcut *prevMeasure =
new QShortcut(Qt::Key_PageUp, m_qnetTool);
416 m_rightCombo->setToolTip(
"Choose right control measure. "
417 "<strong>Shortcuts: PageUp/PageDown</strong>");
418 m_rightCombo->setWhatsThis(
"Choose right control measure identified by "
420 "Note: PageUp selects previous measure; "
421 "PageDown selects next meausure.");
422 connect(m_rightCombo, SIGNAL(activated(
int)),
424 m_lockRightMeasure =
new QCheckBox(
"Edit Lock Measure");
425 connect(m_lockRightMeasure, SIGNAL(clicked(
bool)),
427 m_ignoreRightMeasure =
new QCheckBox(
"Ignore Measure");
428 connect(m_ignoreRightMeasure, SIGNAL(clicked(
bool)),
430 connect(
this, SIGNAL(ignoreRightChanged()),
431 m_ignoreRightMeasure, SLOT(toggle()));
432 m_rightReference =
new QLabel();
433 m_rightMeasureType =
new QLabel();
434 m_rightSampError =
new QLabel();
435 m_rightSampError->setToolTip(
"<strong>Jigsaw</strong> sample residual.");
436 m_rightSampError->setWhatsThis(
"This is the sample residual for the right "
437 "measure which was calculated by the application, "
438 "<strong>jigsaw</strong>.");
439 m_rightLineError =
new QLabel();
440 m_rightLineError->setToolTip(
"<strong>Jigsaw</strong> line residual.");
441 m_rightLineError->setWhatsThis(
"This is the line residual for the right "
442 "measure which was calculated by the application, "
443 "<strong>jigsaw</strong>.");
444 m_rightSampShift =
new QLabel();
445 m_rightSampShift->setToolTip(m_leftSampShift->toolTip());
446 m_rightSampShift->setWhatsThis(m_leftSampShift->whatsThis());
447 m_rightLineShift =
new QLabel();
448 m_rightLineShift->setToolTip(m_leftLineShift->toolTip());
449 m_rightLineShift->setWhatsThis(m_leftLineShift->whatsThis());
450 m_rightGoodness =
new QLabel();
451 m_rightGoodness->setToolTip(m_leftGoodness->toolTip());
452 m_rightGoodness->setWhatsThis(m_leftGoodness->whatsThis());
455 QVBoxLayout * rightLayout =
new QVBoxLayout;
456 rightLayout->addWidget(m_rightCombo);
457 rightLayout->addWidget(m_lockRightMeasure);
458 rightLayout->addWidget(m_ignoreRightMeasure);
459 rightLayout->addWidget(m_rightReference);
460 rightLayout->addWidget(m_rightMeasureType);
461 rightLayout->addWidget(m_rightSampError);
462 rightLayout->addWidget(m_rightLineError);
463 rightLayout->addWidget(m_rightSampShift);
464 rightLayout->addWidget(m_rightLineShift);
465 rightLayout->addWidget(m_rightGoodness);
467 QGroupBox * rightGroupBox =
new QGroupBox(
"Right Measure");
468 rightGroupBox->setLayout(rightLayout);
470 return rightGroupBox;
479 toolBar->addAction(m_openTemplateFile);
480 toolBar->addSeparator();
481 toolBar->addAction(m_saveTemplateFile);
482 toolBar->addAction(m_saveTemplateFileAs);
484 m_templateEditor =
new QTextEdit;
485 connect(m_templateEditor, SIGNAL(textChanged()),
this,
488 QVBoxLayout *mainLayout =
new QVBoxLayout;
489 mainLayout->addWidget(toolBar);
490 mainLayout->addWidget(m_templateEditor);
492 m_templateEditorWidget =
new QWidget;
493 m_templateEditorWidget->setLayout(mainLayout);
506 m_openGround =
new QAction(m_qnetTool);
507 m_openGround->setText(
"Open &Ground Source");
508 m_openGround->setToolTip(
"Open a ground source for choosing ground control "
510 m_openGround->setStatusTip(
"Open a ground source for choosing ground "
513 "<b>Function:</b> Open and display a ground source for choosing "
514 "ground control points, both Fixed and Constrained."
515 "This cube can be a level1, level2 or dem cube.";
516 m_openGround->setWhatsThis(whatsThis);
517 connect (m_openGround,SIGNAL(triggered()),
this,SLOT(
openGround()));
519 m_openDem =
new QAction(m_qnetTool);
520 m_openDem->setText(
"Open &Radius Source");
521 m_openDem->setToolTip(
"Open radius source file for ground control points");
522 m_openDem->setStatusTip(
"Open radius source file for ground control points");
524 "<b>Function:</b> Open a DEM for determining the radius when "
525 "choosing ground control points. This is not the file that will be "
526 "displayed for visually picking points. This is strictly used to "
527 "determine the radius value for ground control points.";
528 m_openDem->setWhatsThis(whatsThis);
529 connect (m_openDem,SIGNAL(triggered()),
this,SLOT(
openDem()));
531 m_saveNet =
new QAction(QIcon(
toolIconDir() +
"/filesave.png"),
"Save Control Network ...",
533 m_saveNet->setShortcut(Qt::CTRL + Qt::Key_S);
534 m_saveNet->setToolTip(
"Save current control network");
535 m_saveNet->setStatusTip(
"Save current control network");
536 whatsThis =
"<b>Function:</b> Saves the current <i>"
537 "control network</i>";
538 m_saveNet->setWhatsThis(whatsThis);
539 connect(m_saveNet, SIGNAL(triggered()),
this, SLOT(
saveNet()));
541 m_saveAsNet =
new QAction(QIcon(
toolIconDir() +
"/filesaveas.png"),
"Save Control Network &As...",
543 m_saveAsNet->setToolTip(
"Save current control network to chosen file");
544 m_saveAsNet->setStatusTip(
"Save current control network to chosen file");
545 whatsThis =
"<b>Function:</b> Saves the current <i>"
546 "control network</i> under chosen filename";
547 m_saveAsNet->setWhatsThis(whatsThis);
548 connect(m_saveAsNet, SIGNAL(triggered()),
this, SLOT(
saveAsNet()));
550 m_closeQnetTool =
new QAction(QIcon(
toolIconDir() +
"/fileclose.png"),
"&Close", m_qnetTool);
551 m_closeQnetTool->setToolTip(
"Close this window");
552 m_closeQnetTool->setStatusTip(
"Close this window");
553 m_closeQnetTool->setShortcut(Qt::ALT + Qt::Key_F4);
554 whatsThis =
"<b>Function:</b> Closes the Qnet Tool window for this point "
555 "<p><b>Shortcut:</b> Alt+F4 </p>";
556 m_closeQnetTool->setWhatsThis(whatsThis);
557 connect(m_closeQnetTool, SIGNAL(triggered()), m_qnetTool, SLOT(close()));
560 "&View/edit registration template", m_qnetTool);
561 m_showHideTemplateEditor->setCheckable(
true);
562 m_showHideTemplateEditor->setToolTip(
"View and/or edit the registration "
564 m_showHideTemplateEditor->setStatusTip(
"View and/or edit the registration "
566 whatsThis =
"<b>Function:</b> Displays the curent registration template. "
567 "The user may edit and save changes under a chosen filename.";
568 m_showHideTemplateEditor->setWhatsThis(whatsThis);
569 connect(m_showHideTemplateEditor, SIGNAL(triggered()),
this,
570 SLOT(showHideTemplateEditor()));
572 m_saveChips =
new QAction(QIcon(
toolIconDir() +
"/savechips.png"),
"Save registration chips",
574 m_saveChips->setToolTip(
"Save registration chips");
575 m_saveChips->setStatusTip(
"Save registration chips");
576 whatsThis =
"<b>Function:</b> Save registration chips to file. "
577 "Each chip: pattern, search, fit will be saved to a separate file.";
578 m_saveChips->setWhatsThis(whatsThis);
579 connect(m_saveChips, SIGNAL(triggered()),
this, SLOT(
saveChips()));
581 m_openTemplateFile =
new QAction(QIcon(
toolIconDir() +
"/fileopen.png"),
"&Open registration "
582 "template", m_qnetTool);
583 m_openTemplateFile->setToolTip(
"Set registration template");
584 m_openTemplateFile->setStatusTip(
"Set registration template");
585 whatsThis =
"<b>Function:</b> Allows user to select a new file to set as "
586 "the registration template";
587 m_openTemplateFile->setWhatsThis(whatsThis);
588 connect(m_openTemplateFile, SIGNAL(triggered()),
this, SLOT(
openTemplateFile()));
590 m_saveTemplateFile =
new QAction(QIcon(
toolIconDir() +
"/filesave.png"),
"&Save template file",
592 m_saveTemplateFile->setToolTip(
"Save the template file");
593 m_saveTemplateFile->setStatusTip(
"Save the template file");
594 m_saveTemplateFile->setWhatsThis(
"Save the registration template file");
595 connect(m_saveTemplateFile, SIGNAL(triggered()),
this,
598 m_saveTemplateFileAs =
new QAction(QIcon(
toolIconDir() +
"/filesaveas.png"),
"&Save template as...",
600 m_saveTemplateFileAs->setToolTip(
"Save the template file as");
601 m_saveTemplateFileAs->setStatusTip(
"Save the template file as");
602 m_saveTemplateFileAs->setWhatsThis(
"Save the registration template file as");
603 connect(m_saveTemplateFileAs, SIGNAL(triggered()),
this,
607 "$base/icons/contexthelp.png").expanded()),
"&Whats's This", m_qnetTool);
608 m_whatsThis->setShortcut(Qt::SHIFT | Qt::Key_F1);
609 m_whatsThis->setToolTip(
"Activate What's This and click on items on "
610 "user interface to see more information.");
611 connect(m_whatsThis, SIGNAL(triggered()),
this, SLOT(enterWhatsThisMode()));
628 QMenu *fileMenu = m_qnetTool->menuBar()->addMenu(
"&File");
629 fileMenu->addAction(m_openGround);
630 fileMenu->addAction(m_openDem);
631 fileMenu->addAction(m_saveNet);
632 fileMenu->addAction(m_saveAsNet);
633 fileMenu->addAction(m_closeQnetTool);
635 QMenu * regMenu = m_qnetTool->menuBar()->addMenu(
"&Registration");
636 regMenu->addAction(m_openTemplateFile);
637 regMenu->addAction(m_showHideTemplateEditor);
638 regMenu->addAction(m_saveChips);
640 QMenu *helpMenu = m_qnetTool->menuBar()->addMenu(
"&Help");
641 helpMenu->addAction(m_whatsThis);
645 void QnetTool::createToolBars() {
648 toolBar->setObjectName(
"TemplateEditorToolBar");
649 toolBar->setFloatable(
false);
650 toolBar->addAction(m_saveNet);
651 toolBar->addSeparator();
652 toolBar->addAction(m_showHideTemplateEditor);
653 toolBar->addAction(m_saveChips);
654 toolBar->addAction(m_whatsThis);
656 m_qnetTool->addToolBar(Qt::TopToolBarArea, toolBar);
728 m_editPoint->GetMeasure(m_leftMeasure->GetCubeSerialNumber());
730 m_editPoint->GetMeasure(m_rightMeasure->GetCubeSerialNumber());
732 if (m_editPoint->IsIgnored()) {
733 QString message =
"You are saving changes to a measure on an ignored ";
734 message +=
"point. Do you want to set Ignore = False on the point and ";
735 message +=
"both measures?";
736 switch (QMessageBox::question(m_qnetTool,
"Qnet Tool Save Measure",
737 message,
"&Yes",
"&No", 0, 0)) {
740 m_editPoint->SetIgnored(
false);
741 emit ignorePointChanged();
742 if (m_leftMeasure->IsIgnored()) {
743 m_leftMeasure->SetIgnored(
false);
744 emit ignoreLeftChanged();
746 if (m_rightMeasure->IsIgnored()) {
747 m_rightMeasure->SetIgnored(
false);
748 emit ignoreRightChanged();
756 if (origRightMeasure->IsIgnored() && m_rightMeasure->IsIgnored()) {
757 QString message =
"You are saving changes to an ignored measure. ";
758 message +=
"Do you want to set Ignore = False on the right measure?";
759 switch(QMessageBox::question(m_qnetTool,
"Qnet Tool Save Measure",
760 message,
"&Yes",
"&No", 0, 0)){
763 m_rightMeasure->SetIgnored(
false);
764 emit ignoreRightChanged();
773 if (m_editPoint->IsReferenceExplicit()) {
774 if (m_editPoint->IsEditLocked()) {
775 QString message =
"This control point is edit locked. The Apriori latitude, longitude and ";
776 message +=
"radius cannot be updated. You must first unlock the point by clicking the ";
777 message +=
"check box above labeled \"Edit Lock Point\".";
778 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
786 else if (m_leftMeasure->GetCubeSerialNumber() != m_groundSN) {
787 m_editPoint->SetRefMeasure(m_leftMeasure->GetCubeSerialNumber());
797 m_rightMeasure->GetCubeSerialNumber() == m_groundSN)) {
798 if (m_editPoint->IsEditLocked() && m_controlNet->ContainsPoint(m_editPoint->GetId())) {
799 QString message =
"This control point is edit locked. The Apriori latitude, longitude and ";
800 message +=
"radius cannot be updated. You must first unlock the point by clicking the ";
801 message +=
"check box above labeled \"Edit Lock Point\".";
802 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
805 if (m_leftMeasure->IsIgnored()) {
806 QString message =
"This is a Constrained or Fixed point and the reference measure is ";
807 message +=
"Ignored. Unset the Ignore flag on the reference measure before saving.";
808 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
811 updateGroundPosition();
818 *origRightMeasure = *m_rightMeasure;
821 if (m_leftMeasure->IsIgnored() != origLeftMeasure->IsIgnored() ||
822 m_leftMeasure->IsEditLocked() != origLeftMeasure->
IsEditLocked()) {
824 *origLeftMeasure = *m_leftMeasure;
828 if (m_leftMeasure->GetCubeSerialNumber() ==
829 m_rightMeasure->GetCubeSerialNumber()) {
830 *m_leftMeasure = *m_rightMeasure;
832 m_pointEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
833 m_editPoint->GetId());
839 editPointChanged(m_editPoint->GetId());
870 if ( (m_leftMeasure->GetCubeSerialNumber() != m_groundSN) &&
872 QString message =
"This point already contains a reference measure. ";
873 message +=
"Would you like to replace it with the measure on the left?";
874 int response = QMessageBox::question(m_qnetTool,
875 "Qnet Tool Save Measure", message,
876 QMessageBox::Yes | QMessageBox::No,
879 if (response == QMessageBox::Yes) {
882 QString file = m_serialNumberList->
fileName(m_leftMeasure->GetCubeSerialNumber());
883 QString fname =
FileName(file).name();
884 int iref = m_leftCombo->findText(fname);
887 QVariant font = m_leftCombo->itemData(iref,Qt::FontRole);
888 m_leftCombo->setItemData(iref,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
889 iref = m_rightCombo->findText(fname);
890 m_rightCombo->setItemData(iref,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
894 iref = m_leftCombo->findText(fname);
895 m_leftCombo->setItemData(iref,font,Qt::FontRole);
896 iref = m_rightCombo->findText(fname);
897 m_rightCombo->setItemData(iref,font,Qt::FontRole);
899 m_editPoint->SetRefMeasure(m_leftMeasure->GetCubeSerialNumber());
901 refMeasure = m_editPoint->GetRefMeasure();
909 QString message =
"You are making a change to the reference measure. You ";
910 message +=
"may need to move all of the other measures to match the new ";
911 message +=
" coordinate of the reference measure. Do you really want to ";
912 message +=
" change the reference measure? ";
913 switch(QMessageBox::question(m_qnetTool,
"Qnet Tool Save Measure",
914 message,
"&Yes",
"&No", 0, 0)){
938 void QnetTool::updateGroundPosition() {
946 if (!m_groundGmap->SetImage(groundMeasure->GetSample(),
947 groundMeasure->GetLine())) {
952 double lat = m_groundGmap->UniversalLatitude();
953 double lon = m_groundGmap->UniversalLongitude();
964 if (radius ==
Null) {
965 QString msg =
"Could not read radius from DEM, will default to "
966 "local radius of reference measure.";
967 QMessageBox::warning(m_qnetTool,
"Warning", msg);
968 if (m_editPoint->GetRefMeasure()->Camera()->SetGround(
971 m_editPoint->GetRefMeasure()->Camera()->LocalRadius().meters();
972 m_editPoint->SetAprioriRadiusSource(
973 ControlPoint::RadiusSource::None);
977 QString message =
"Error trying to get radius at this pt. "
978 "Lat/Lon does not fall on the reference measure. "
979 "Cannot save this measure.";
980 QMessageBox::critical(m_qnetTool,
"Error",message);
984 m_editPoint->SetAprioriRadiusSource(m_groundRadiusSource);
985 m_editPoint->SetAprioriRadiusSourceFile(m_radiusSourceFile);
989 if (m_editPoint->GetRefMeasure()->Camera()->SetGround(
992 m_editPoint->GetRefMeasure()->Camera()->LocalRadius().meters();
999 QString message =
"Error trying to get radius at this pt. "
1000 "Lat/Lon does not fall on the reference measure. "
1001 "Cannot save this measure.";
1002 QMessageBox::critical(m_qnetTool,
"Error",message);
1011 vector<Distance> targetRadii = m_controlNet->GetTargetRadii();
1012 if (m_editPoint->HasAprioriCoordinates()) {
1013 SurfacePoint aprioriPt = m_editPoint->GetAprioriSurfacePoint();
1014 aprioriPt.SetRadii(Distance(targetRadii[0]),
1015 Distance(targetRadii[1]),
1016 Distance(targetRadii[2]));
1017 Distance latSigma = aprioriPt.GetLatSigmaDistance();
1018 Distance lonSigma = aprioriPt.GetLonSigmaDistance();
1019 Distance radiusSigma = aprioriPt.GetLocalRadiusSigma();
1023 aprioriPt.SetSphericalSigmasDistance(latSigma, lonSigma, radiusSigma);
1024 m_editPoint->SetAprioriSurfacePoint(aprioriPt);
1027 m_editPoint->SetAprioriSurfacePoint(SurfacePoint(
1033 catch (IException &e) {
1034 QString message =
"Unable to set Apriori Surface Point.\n";
1035 message +=
"Latitude = " + QString::number(lat);
1036 message +=
" Longitude = " + QString::number(lon);
1037 message +=
" Radius = " + QString::number(radius) +
"\n";
1038 message += e.toString();
1039 QMessageBox::critical(m_qnetTool,
"Error",message);
1041 m_editPoint->SetAprioriSurfacePointSource(m_groundSurfacePointSource);
1042 m_editPoint->SetAprioriSurfacePointSourceFile(m_groundSourceFile);
1069 *updatePoint = *m_editPoint;
1077 updatePoint->
Delete(m_groundSN);
1082 if (m_controlNet->ContainsPoint(updatePoint->
GetId())) {
1084 p = m_controlNet->GetPoint(QString(updatePoint->
GetId()));
1090 m_controlNet->AddPoint(updatePoint);
1094 m_savePoint->setPalette(m_saveDefaultPalette);
1098 emit refreshNavList();
1100 emit editPointChanged(m_editPoint->GetId());
1104 m_pointEditor->refreshChips();
1124 if (m_editPoint == NULL)
return;
1127 if (m_editPoint->GetType() == pointType)
return;
1130 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
1131 QString message =
"The reference measure is Ignored. Unset the Ignore flag on the ";
1132 message +=
"reference measure before setting the point type to Constrained or Fixed.";
1133 QMessageBox::warning(m_qnetTool,
"Ignored Reference Measure", message);
1137 bool unloadGround =
false;
1139 unloadGround =
true;
1142 int temp = m_editPoint->GetType();
1146 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
1147 QString message =
"This control point is edit locked. The point type cannot be changed. You ";
1148 message +=
"must first unlock the point by clicking the check box above labeled ";
1149 message +=
"\"Edit Lock Point\".";
1150 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
1159 m_pointEditor->colorizeSaveButton();
1162 else if (unloadGround) {
1165 if (m_editPoint->HasSerialNumber(m_groundSN)) {
1166 m_editPoint->Delete(m_groundSN);
1170 m_pointEditor->colorizeSaveButton();
1191 if (!m_groundOpen)
return;
1199 QString tempFileName =
FileName(file).name();
1201 m_leftCombo->addItem(tempFileName);
1202 m_rightCombo->addItem(tempFileName);
1203 int rightIndex = m_rightCombo->findText((QString)m_groundFile);
1204 m_rightCombo->setCurrentIndex(rightIndex);
1225 if (m_editPoint == NULL)
return;
1227 m_editPoint->SetEditLock(lock);
1244 if (m_editPoint == NULL)
return;
1248 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
1249 QString message =
"This control point is edit locked. The Ignored status cannot be ";
1250 message +=
"changed. You must first unlock the point by clicking the check box above ";
1251 message +=
"labeled \"Edit Lock Point\".";
1252 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
1278 if (m_editPoint->IsEditLocked()) {
1279 m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1280 QMessageBox::warning(m_qnetTool,
"Point Locked",
"Point is Edit Locked. You must un-lock point"
1281 " before changing a measure.");
1282 m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1286 if (m_leftMeasure != NULL) m_leftMeasure->SetEditLock(lock);
1290 if (m_rightMeasure != NULL) {
1291 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1292 m_rightMeasure->SetEditLock(lock);
1293 m_lockRightMeasure->setChecked(lock);
1296 emit measureChanged();
1318 if (m_leftMeasure != NULL) m_leftMeasure->SetIgnored(ignore);
1322 if (m_rightMeasure != NULL) {
1323 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1324 m_rightMeasure->SetIgnored(ignore);
1325 m_ignoreRightMeasure->setChecked(ignore);
1328 emit measureChanged();
1349 if (m_editPoint->IsEditLocked()) {
1350 m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1351 QMessageBox::warning(m_qnetTool,
"Point Locked",
"Point is Edit Locked. You must un-lock point"
1352 " before changing a measure.");
1353 m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1357 if (m_rightMeasure != NULL) m_rightMeasure->SetEditLock(lock);
1360 if (m_leftMeasure != NULL) {
1361 if (m_leftMeasure->GetCubeSerialNumber() == m_rightMeasure->GetCubeSerialNumber()) {
1362 m_leftMeasure->SetEditLock(lock);
1363 m_lockLeftMeasure->setChecked(lock);
1366 emit measureChanged();
1388 if (m_rightMeasure != NULL) m_rightMeasure->SetIgnored(ignore);
1392 if (m_leftMeasure != NULL) {
1393 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1394 m_leftMeasure->SetIgnored(ignore);
1395 m_ignoreLeftMeasure->setChecked(ignore);
1398 emit measureChanged();
1409 if (m_cnetFileName.isEmpty()) {
1410 QString message =
"This is a new network, you must select "
1411 "\"Save As\" under the File Menu.";
1412 QMessageBox::critical(m_qnetTool,
"Error", message);
1415 emit qnetToolSave();
1425 emit qnetToolSaveAs();
1434 void QnetTool::updateList() {
1458 m_cnetFileName = cNetFileName;
1459 m_qnetTool->setWindowTitle(
"Qnet Tool - Control Network File: " +
1480 action->setIcon(QPixmap(
toolIconDir()+
"/stock_draw-connector-with-arrows.png"));
1481 action->setToolTip(
"Control Point Editor (T)");
1482 action->setShortcut(Qt::Key_T);
1483 QObject::connect(action,SIGNAL(triggered(
bool)),
this,SLOT(
showNavWindow(
bool)));
1525 if (cvp == NULL)
return;
1533 QString message =
"Cannot get serial number for " + file +
". Is file contained in the ";
1534 message +=
"cube list?\n";
1536 QMessageBox::critical(m_qnetTool,
"Error", message);
1545 if (s == Qt::LeftButton) {
1546 if (!m_controlNet || m_controlNet->GetNumPoints() == 0) {
1547 QString message =
"No points exist for editing. Create points ";
1548 message +=
"using the right mouse button.";
1549 QMessageBox::warning(m_qnetTool,
"Warning", message);
1553 if (sn == m_groundSN) {
1554 QString message =
"Cannot select point for editing on ground source. Select ";
1555 message +=
"point using un-projected images or the Navigator Window.";
1556 QMessageBox::critical(m_qnetTool,
"Error", message);
1565 ControlPoint *point = m_controlNet->FindClosest(sn, samp, line);
1569 QString message =
"No points exist for editing. Create points using the right mouse";
1570 message +=
" button.";
1571 QMessageBox::warning(m_qnetTool,
"Warning", message);
1576 else if (s == Qt::MidButton) {
1577 if (!m_controlNet || m_controlNet->GetNumPoints() == 0) {
1578 QString message =
"No points exist for deleting. Create points ";
1579 message +=
"using the right mouse button.";
1580 QMessageBox::warning(m_qnetTool,
"Warning", message);
1584 if (m_groundOpen && file == m_groundCube->fileName()) {
1585 QString message =
"Cannot select point for deleting on ground source. Select ";
1586 message +=
"point using un-projected images or the Navigator Window.";
1587 QMessageBox::critical(m_qnetTool,
"Error", message);
1593 point = m_controlNet->FindClosest(sn, samp, line);
1595 if (point == NULL) {
1596 QString message =
"No points exist for deleting. Create points ";
1597 message +=
"using the right mouse button.";
1598 QMessageBox::warning(m_qnetTool,
"Warning", message);
1603 QString message =
"Cannot find point on this image for deleting.";
1604 QMessageBox::critical(m_qnetTool,
"Error", message);
1610 else if (s == Qt::RightButton) {
1614 QString message =
"Invalid latitude or longitude at this point. ";
1615 QMessageBox::critical(m_qnetTool,
"Error", message);
1620 if (m_groundOpen && file == m_groundCube->fileName()) {
1684 for(
int i = 0; i < m_serialNumberList->
size(); i++) {
1685 if (m_serialNumberList->
serialNumber(i) == m_groundSN)
continue;
1686 cam = m_controlNet->Camera(i);
1689 double samp = cam->
Sample();
1690 double line = cam->
Line();
1691 if (samp >= 1 && samp <= cam->Samples() &&
1692 line >= 1 && line <= cam->Lines()) {
1693 pointFiles<<m_serialNumberList->
fileName(i);
1699 newPointDialog->
setFiles(pointFiles);
1700 if (newPointDialog->exec()) {
1701 m_lastUsedPointId = newPointDialog->pointId();
1707 if (m_controlNet->ContainsPoint(newPoint->
GetId())) {
1708 QString message =
"A ControlPoint with Point Id = [" + newPoint->
GetId();
1709 message +=
"] already exists. Re-enter Point Id for this ControlPoint.";
1710 QMessageBox::warning(m_qnetTool,
"New Point Id", message);
1720 QStringList selectedFiles = newPointDialog->selectedFiles();
1721 foreach (QString selectedFile, selectedFiles) {
1730 cam = m_controlNet->Camera(camIndex);
1733 m->SetAprioriSample(cam->
Sample());
1734 m->SetAprioriLine(cam->
Line());
1740 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1744 m_editPoint = newPoint;
1748 if (!m_leftFile.isEmpty()) {
1749 if (selectedFiles.indexOf(m_leftFile) == -1) {
1756 m_qnetTool->setVisible(
true);
1757 m_qnetTool->raise();
1760 m_pointEditor->templateFileName());
1764 emit refreshNavList();
1766 emit editPointChanged(m_editPoint->GetId());
1797 for (
int i=0; i<m_serialNumberList->
size(); i++) {
1798 if (m_serialNumberList->
serialNumber(i) == m_groundSN)
continue;
1799 cam = m_controlNet->Camera(i);
1802 double samp = cam->
Sample();
1803 double line = cam->
Line();
1804 if (samp >= 1 && samp <= cam->Samples() &&
1805 line >= 1 && line <= cam->Lines()) {
1806 pointFiles<<m_serialNumberList->
fileName(i);
1811 if (pointFiles.count() == 0) {
1812 QString message =
"Point does not intersect any images.";
1813 QMessageBox::critical(m_qnetTool,
"No intersection", message);
1818 fixedPointDialog->
setFiles(pointFiles);
1819 if (fixedPointDialog->exec()) {
1823 if (fixedPointDialog->isFixed()) {
1832 if (m_controlNet->ContainsPoint(fixedPoint->
GetId())) {
1833 QString message =
"A ControlPoint with Point Id = [" + fixedPoint->
GetId();
1834 message +=
"] already exists. Re-enter Point Id for this ControlPoint.";
1835 QMessageBox::warning(m_qnetTool,
"New Point Id", message);
1845 QStringList selectedFiles = fixedPointDialog->selectedFiles();
1846 foreach (QString selectedFile, selectedFiles) {
1854 if (sn == m_groundSN)
continue;
1859 cam = m_controlNet->Camera(camIndex);
1872 if (radius ==
Null) {
1873 QString msg =
"Could not read radius from DEM, will default to the "
1874 "local radius of the first measure in the control point. This "
1875 "will be updated to the local radius of the chosen reference "
1877 QMessageBox::warning(m_qnetTool,
"Warning", msg);
1878 if ((*fixedPoint)[0]->
Camera()->SetGround(
1880 radius = (*fixedPoint)[0]->Camera()->LocalRadius().meters();
1883 QString msg =
"Error trying to get radius at this pt. "
1884 "Lat/Lon does not fall on the reference measure. "
1885 "Cannot create this point.";
1886 QMessageBox::critical(m_qnetTool,
"Error", msg);
1889 delete fixedPointDialog;
1890 fixedPointDialog = NULL;
1896 if ((*fixedPoint)[0]->
Camera()->SetGround(
1898 radius = (*fixedPoint)[0]->Camera()->LocalRadius().meters();
1901 QString msg =
"Error trying to get radius at this pt. "
1902 "Lat/Lon does not fall on the reference measure. "
1903 "Cannot create this point.";
1904 QMessageBox::critical(m_qnetTool,
"Error", msg);
1907 delete fixedPointDialog;
1908 fixedPointDialog = NULL;
1918 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1922 m_editPoint = fixedPoint;
1926 m_qnetTool->setVisible(
true);
1927 m_qnetTool->raise();
1929 delete fixedPointDialog;
1930 fixedPointDialog = NULL;
1933 emit refreshNavList();
1935 emit editPointChanged(m_editPoint->GetId());
1966 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1971 *m_editPoint = *point;
1977 emit editPointChanged(m_editPoint->GetId());
1980 QString CPId = m_editPoint->GetId();
1981 deletePointDialog->pointIdValue->setText(CPId);
1984 for (
int i=0; i<m_editPoint->GetNumMeasures(); i++) {
1987 deletePointDialog->fileList->addItem(file);
1990 if (deletePointDialog->exec()) {
1992 int numDeleted = deletePointDialog->fileList->selectedItems().count();
1995 if (deletePointDialog->deleteAllCheckBox->isChecked() ||
1996 numDeleted == m_editPoint->GetNumMeasures()) {
1999 if (!deletePointDialog->deleteAllCheckBox->isChecked()) {
2000 QString message =
"You have selected all measures in this point to be deleted. This "
2001 "control point will be deleted. Do you want to delete this control point?";
2002 int response = QMessageBox::question(m_qnetTool,
2003 "Delete control point", message,
2004 QMessageBox::Yes | QMessageBox::No,
2007 if (response == QMessageBox::No) {
2016 m_qnetTool->setVisible(
false);
2018 if (m_controlNet->DeletePoint(m_editPoint->GetId()) ==
2020 QMessageBox::information(m_qnetTool,
"EditLocked Point",
2021 "This point is EditLocked and cannot be deleted.");
2024 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
2029 emit refreshNavList();
2035 int lockedMeasures = 0;
2036 for (
int i=0; i<deletePointDialog->fileList->count(); i++) {
2037 QListWidgetItem *item = deletePointDialog->fileList->item(i);
2038 if (!deletePointDialog->fileList->isItemSelected(item))
continue;
2041 if (m_editPoint->IsReferenceExplicit() &&
2042 (m_editPoint->GetRefMeasure()->GetCubeSerialNumber() ==
2043 (*m_editPoint)[i]->GetCubeSerialNumber())) {
2044 QString message =
"You are trying to delete the Reference measure."
2045 " Do you really want to delete the Reference measure?";
2046 switch (QMessageBox::question(m_qnetTool,
2047 "Delete Reference measure?", message,
2048 "&Yes",
"&No", 0, 0)) {
2056 if (numDeleted == 1) {
2063 if (m_editPoint->Delete(i) == ControlMeasure::MeasureLocked) {
2068 if (lockedMeasures > 0) {
2069 QMessageBox::information(m_qnetTool,
"EditLocked Measures",
2070 QString::number(lockedMeasures) +
" / "
2072 deletePointDialog->fileList->selectedItems().size()) +
2073 " measures are EditLocked and were not deleted.");
2077 m_qnetTool->setVisible(
true);
2078 m_qnetTool->raise();
2087 if (m_editPoint != NULL) {
2088 emit editPointChanged(m_editPoint->GetId());
2096 emit editPointChanged(
"");
2114 if (point->GetNumMeasures() == 0) {
2115 QString message =
"This point has no measures.";
2116 QMessageBox::warning(m_qnetTool,
"Warning", message);
2118 if (m_editPoint != NULL) {
2120 emit editPointChanged(m_editPoint->GetId());
2125 emit editPointChanged(
"");
2131 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
2136 *m_editPoint = *point;
2140 if (sender() !=
this) m_leftFile.clear();
2142 m_qnetTool->setVisible(
true);
2143 m_qnetTool->raise();
2147 emit editPointChanged(m_editPoint->GetId());
2150 m_savePoint->setPalette(m_saveDefaultPalette);
2164 bool located =
true;
2170 if (m_editPoint->HasAprioriCoordinates()) {
2171 SurfacePoint sPt = m_editPoint->GetAprioriSurfacePoint();
2179 cam = m_controlNet->Camera(camIndex);
2180 cam->
SetImage(m.GetSample(),m.GetLine());
2187 if (!m_groundGmap->SetUniversalGround(lat,lon)) {
2189 QString message =
"This point does not exist on the ground source.\n";
2190 message +=
"Latitude = " + QString::number(lat);
2191 message +=
" Longitude = " + QString::number(lon);
2192 message +=
"\n A ground measure will not be created.";
2193 QMessageBox::warning(m_qnetTool,
"Warning", message);
2216 groundMeasure->
SetCoordinate(m_groundGmap->Sample(),m_groundGmap->Line());
2217 m_editPoint->Add(groundMeasure);
2219 return groundMeasure;
2249 QString CPId = m_editPoint->GetId();
2250 QString ptId(
"Point ID: ");
2251 ptId += (QString) CPId;
2252 m_ptIdValue->setText(ptId);
2258 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
2261 QString ptsize =
"Number of Measures: " +
2262 QString::number(m_editPoint->GetNumMeasures());
2263 m_numMeasures->setText(ptsize);
2266 m_lockPoint->setChecked(m_editPoint->IsEditLocked());
2269 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
2272 m_leftCombo->clear();
2273 m_rightCombo->clear();
2274 m_pointFiles.clear();
2278 if (m_editPoint->HasSerialNumber(m_groundSN)) {
2279 m_editPoint->Delete(m_groundSN);
2296 if (m_groundOpen && !m_demOpen) {
2302 for (
int i=0; i<m_editPoint->GetNumMeasures(); i++) {
2306 QString tempFileName =
FileName(file).name();
2307 m_leftCombo->addItem(tempFileName);
2308 m_rightCombo->addItem(tempFileName);
2309 if (m_editPoint->IsReferenceExplicit() &&
2311 m_leftCombo->setItemData(i,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
2312 m_rightCombo->setItemData(i,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
2328 if (m_editPoint->IsReferenceExplicit()) {
2329 leftIndex = m_editPoint->IndexOfRefMeasure();
2333 QString baseFileName =
FileName(m_leftFile).name();
2334 leftIndex = m_leftCombo->findText(baseFileName);
2336 if (leftIndex < 0 ) leftIndex = 0;
2344 rightIndex = m_rightCombo->findText((QString)m_groundFile);
2346 if (rightIndex <= 0) {
2347 if (leftIndex == 0) {
2357 if (rightIndex > m_editPoint->GetNumMeasures()-1) rightIndex = 0;
2358 m_rightCombo->setCurrentIndex(rightIndex);
2359 m_leftCombo->setCurrentIndex(leftIndex);
2381 if (m_measureWindow == NULL) {
2383 m_measureTable =
new QTableWidget();
2384 m_measureTable->setMinimumWidth(1600);
2385 m_measureTable->setAlternatingRowColors(
true);
2386 m_measureWindow->setCentralWidget(m_measureTable);
2389 m_measureTable->clear();
2390 m_measureTable->setSortingEnabled(
false);
2392 m_measureTable->setRowCount(m_editPoint->GetNumMeasures());
2393 m_measureTable->setColumnCount(NUMCOLUMNS);
2396 for (
int i=0; i<NUMCOLUMNS; i++) {
2397 labels<<measureColumnToString((MeasureColumns)i);
2399 m_measureTable->setHorizontalHeaderLabels(labels);
2402 for (
int row=0; row<m_editPoint->GetNumMeasures(); row++) {
2407 QTableWidgetItem *tableItem =
new QTableWidgetItem(QString(file));
2408 m_measureTable->setItem(row,column++,tableItem);
2411 m_measureTable->setItem(row,column++,tableItem);
2413 tableItem =
new QTableWidgetItem();
2414 tableItem->setData(0,m.GetSample());
2415 m_measureTable->setItem(row,column++,tableItem);
2417 tableItem =
new QTableWidgetItem();
2418 tableItem->setData(0,m.GetLine());
2419 m_measureTable->setItem(row,column++,tableItem);
2421 if (m.GetAprioriSample() ==
Null) {
2422 tableItem =
new QTableWidgetItem(
"Null");
2425 tableItem =
new QTableWidgetItem();
2426 tableItem->setData(0,m.GetAprioriSample());
2428 m_measureTable->setItem(row,column++,tableItem);
2430 if (m.GetAprioriLine() ==
Null) {
2431 tableItem =
new QTableWidgetItem(
"Null");
2434 tableItem =
new QTableWidgetItem();
2435 tableItem->setData(0,m.GetAprioriLine());
2437 m_measureTable->setItem(row,column++,tableItem);
2439 if (m.GetSampleResidual() ==
Null) {
2440 tableItem =
new QTableWidgetItem(QString(
"Null"));
2443 tableItem =
new QTableWidgetItem();
2444 tableItem->setData(0,m.GetSampleResidual());
2446 m_measureTable->setItem(row,column++,tableItem);
2448 if (m.GetLineResidual() ==
Null) {
2449 tableItem =
new QTableWidgetItem(QString(
"Null"));
2452 tableItem =
new QTableWidgetItem();
2453 tableItem->setData(0,m.GetLineResidual());
2455 m_measureTable->setItem(row,column++,tableItem);
2458 tableItem =
new QTableWidgetItem(QString(
"Null"));
2461 tableItem =
new QTableWidgetItem();
2464 m_measureTable->setItem(row,column++,tableItem);
2466 double sampleShift = m.GetSampleShift();
2467 if (sampleShift ==
Null) {
2468 tableItem =
new QTableWidgetItem(QString(
"Null"));
2471 tableItem =
new QTableWidgetItem();
2472 tableItem->setData(0,sampleShift);
2474 m_measureTable->setItem(row,column++,tableItem);
2476 double lineShift = m.GetLineShift();
2477 if (lineShift ==
Null) {
2478 tableItem =
new QTableWidgetItem(QString(
"Null"));
2481 tableItem =
new QTableWidgetItem();
2482 tableItem->setData(0,lineShift);
2484 m_measureTable->setItem(row,column++,tableItem);
2486 double pixelShift = m.GetPixelShift();
2487 if (pixelShift ==
Null) {
2488 tableItem =
new QTableWidgetItem(QString(
"Null"));
2491 tableItem =
new QTableWidgetItem();
2492 tableItem->setData(0,pixelShift);
2494 m_measureTable->setItem(row,column++,tableItem);
2496 double goodnessOfFit = m.GetLogData(
2498 if (goodnessOfFit ==
Null) {
2499 tableItem =
new QTableWidgetItem(QString(
"Null"));
2502 tableItem =
new QTableWidgetItem();
2503 tableItem->setData(0,goodnessOfFit);
2505 m_measureTable->setItem(row,column++,tableItem);
2507 if (m.IsIgnored()) tableItem =
new QTableWidgetItem(
"True");
2508 if (!m.IsIgnored()) tableItem =
new QTableWidgetItem(
"False");
2509 m_measureTable->setItem(row,column++,tableItem);
2512 tableItem =
new QTableWidgetItem(
"True");
2514 tableItem =
new QTableWidgetItem(
"False");
2515 m_measureTable->setItem(row,column++,tableItem);
2517 tableItem =
new QTableWidgetItem(
2519 m_measureTable->setItem(row,column,tableItem);
2522 if (m_editPoint->IsReferenceExplicit() &&
2527 for (
int col=0; col<m_measureTable->columnCount(); col++)
2528 m_measureTable->item(row, col)->setFont(font);
2533 m_measureTable->resizeColumnsToContents();
2534 m_measureTable->resizeRowsToContents();
2535 m_measureTable->setSortingEnabled(
true);
2536 m_measureWindow->show();
2541 QString QnetTool::measureColumnToString(QnetTool::MeasureColumns column) {
2551 case SAMPLERESIDUAL:
2552 return "Sample Residual";
2554 return "Line Residual";
2555 case RESIDUALMAGNITUDE:
2556 return "Residual Magnitude";
2558 return "Sample Shift";
2560 return "Line Shift";
2562 return "Pixel Shift";
2564 return "Goodness of Fit";
2570 return "Measure Type";
2572 return "Apriori Sample";
2574 return "Apriori Line";
2577 "Invalid measure column passed to measureColumnToString",
_FILEINFO_);
2581 ControlNet *QnetTool::controlNet() {
2582 return m_controlNet;
2586 const ControlNet *QnetTool::controlNet()
const {
2587 return m_controlNet;
2591 SerialNumberList *QnetTool::serialNumberList() {
2592 return m_serialNumberList;
2596 const SerialNumberList *QnetTool::serialNumberList()
const {
2597 return m_serialNumberList;
2601 Workspace *QnetTool::workspace()
const {
2621 SurfacePoint aprioriPoint = m_editPoint->GetAprioriSurfacePoint();
2623 s =
"Apriori Latitude: Null";
2626 s =
"Apriori Latitude: " +
2629 m_pointAprioriLatitude->setText(s);
2631 s =
"Apriori Longitude: Null";
2634 s =
"Apriori Longitude: " +
2637 m_pointAprioriLongitude->setText(s);
2639 s =
"Apriori Radius: Null";
2642 s =
"Apriori Radius: " +
2646 m_pointAprioriRadius->setText(s);
2648 if (aprioriPoint.Valid()) {
2649 vector<Distance> targRadii = m_controlNet->GetTargetRadii();
2650 aprioriPoint.
SetRadii(targRadii[0],targRadii[1],targRadii[2]);
2653 s =
"Apriori Latitude Sigma: Null";
2656 s =
"Apriori Latitude Sigma: " +
2660 m_pointAprioriLatitudeSigma->setText(s);
2662 s =
"Apriori Longitude Sigma: Null";
2665 s =
"Apriori Longitude Sigma: " +
2669 m_pointAprioriLongitudeSigma->setText(s);
2670 if (aprioriPoint.GetLocalRadiusSigma().
meters() ==
Null) {
2671 s =
"Apriori Radius Sigma: Null";
2674 s =
"Apriori Radius Sigma: " +
2675 QString::number(aprioriPoint.GetLocalRadiusSigma().
meters()) +
2678 m_pointAprioriRadiusSigma->setText(s);
2681 s =
"Apriori Latitude Sigma: Null";
2682 m_pointAprioriLatitudeSigma->setText(s);
2683 s =
"Apriori Longitude Sigma: Null";
2684 m_pointAprioriLongitudeSigma->setText(s);
2685 s =
"Apriori Radius Sigma: Null";
2686 m_pointAprioriRadiusSigma->setText(s);
2690 SurfacePoint point = m_editPoint->GetAdjustedSurfacePoint();
2692 s =
"Adjusted Latitude: Null";
2697 m_pointLatitude->setText(s);
2699 s =
"Adjusted Longitude: Null";
2704 m_pointLongitude->setText(s);
2706 s =
"Adjusted Radius: Null";
2709 s =
"Adjusted Radius: " +
2712 m_pointRadius->setText(s);
2730 int curIndex = m_rightCombo->currentIndex();
2731 if (curIndex < m_rightCombo->count() - 1) {
2733 m_rightCombo->setCurrentIndex(curIndex + 1);
2749 int curIndex = m_rightCombo->currentIndex();
2752 m_rightCombo->setCurrentIndex(curIndex - 1);
2771 QString file = m_pointFiles[index];
2773 QString serial = m_serialNumberList->
serialNumber(file);
2777 if (m_leftMeasure != NULL) {
2778 delete m_leftMeasure;
2779 m_leftMeasure = NULL;
2783 *m_leftMeasure = *((*m_editPoint)[serial]);
2786 m_leftCube.reset(
new Cube(file,
"r"));
2789 m_pointEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
2790 m_editPoint->GetId());
2806 QString file = m_pointFiles[index];
2808 QString serial = m_serialNumberList->
serialNumber(file);
2812 if (m_rightMeasure != NULL) {
2813 delete m_rightMeasure;
2814 m_rightMeasure = NULL;
2818 *m_rightMeasure = *((*m_editPoint)[serial]);
2821 m_rightCube.reset(
new Cube(file,
"r"));
2824 m_pointEditor->setRightMeasure (m_rightMeasure, m_rightCube.data(),
2825 m_editPoint->GetId());
2852 m_leftMeasure->GetCubeSerialNumber()));
2854 m_ignoreLeftMeasure->setChecked(m_leftMeasure->IsIgnored());
2856 QString s =
"Reference: ";
2857 if (m_editPoint->IsReferenceExplicit() &&
2858 (QString(m_leftMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2864 m_leftReference->setText(s);
2866 s =
"Measure Type: ";
2871 m_leftMeasureType->setText(s);
2873 if (m_leftMeasure->GetSampleResidual() ==
Null) {
2874 s =
"Sample Residual: Null";
2877 s =
"Sample Residual: " + QString::number(m_leftMeasure->GetSampleResidual());
2879 m_leftSampError->setText(s);
2880 if (m_leftMeasure->GetLineResidual() ==
Null) {
2881 s =
"Line Residual: Null";
2884 s =
"Line Residual: " + QString::number(m_leftMeasure->GetLineResidual());
2886 m_leftLineError->setText(s);
2888 if (m_leftMeasure->GetSampleShift() ==
Null) {
2889 s =
"Sample Shift: Null";
2892 s =
"Sample Shift: " + QString::number(m_leftMeasure->GetSampleShift());
2894 m_leftSampShift->setText(s);
2896 if (m_leftMeasure->GetLineShift() ==
Null) {
2897 s =
"Line Shift: Null";
2900 s =
"Line Shift: " + QString::number(m_leftMeasure->GetLineShift());
2902 m_leftLineShift->setText(s);
2904 double goodnessOfFit = m_leftMeasure->GetLogData(
2906 if (goodnessOfFit ==
Null) {
2907 s =
"Goodness of Fit: Null";
2910 s =
"Goodness of Fit: " + QString::number(goodnessOfFit);
2912 m_leftGoodness->setText(s);
2940 m_rightMeasure->GetCubeSerialNumber()));
2942 m_ignoreRightMeasure->setChecked(m_rightMeasure->IsIgnored());
2944 QString s =
"Reference: ";
2945 if (m_editPoint->IsReferenceExplicit() &&
2946 (QString(m_rightMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2953 m_rightReference->setText(s);
2955 s =
"Measure Type: ";
2960 m_rightMeasureType->setText(s);
2962 if (m_rightMeasure->GetSampleResidual() ==
Null) {
2963 s =
"Sample Residual: Null";
2966 s =
"Sample Residual: " + QString::number(m_rightMeasure->GetSampleResidual());
2968 m_rightSampError->setText(s);
2969 if (m_rightMeasure->GetLineResidual() ==
Null) {
2970 s =
"Line Residual: Null";
2973 s =
"Line Residual: " + QString::number(m_rightMeasure->GetLineResidual());
2975 m_rightLineError->setText(s);
2977 if (m_rightMeasure->GetSampleShift() ==
Null) {
2978 s =
"Sample Shift: Null";
2981 s =
"Sample Shift: " + QString::number(m_rightMeasure->GetSampleShift());
2983 m_rightSampShift->setText(s);
2985 if (m_rightMeasure->GetLineShift() ==
Null) {
2986 s =
"Line Shift: Null";
2989 s =
"Line Shift: " + QString::number(m_rightMeasure->GetLineShift());
2991 m_rightLineShift->setText(s);
2993 double goodnessOfFit = m_rightMeasure->GetLogData(
2995 if (goodnessOfFit ==
Null) {
2996 s =
"Goodness of Fit: Null";
2999 s =
"Goodness of Fit: " + QString::number(goodnessOfFit);
3001 m_rightGoodness->setText(s);
3036 cam = m_controlNet->Camera(camIndex);
3038 cam->
SetImage(m.GetSample(),m.GetLine());
3042 for (
int i=0; i<m_serialNumberList->
size(); i++) {
3043 cam = m_controlNet->Camera(i);
3044 if (m_serialNumberList->
serialNumber(i) == m_groundSN)
continue;
3047 double samp = cam->
Sample();
3048 double line = cam->
Line();
3049 if (samp >= 1 && samp <= cam->Samples() &&
3050 line >= 1 && line <= cam->Lines()) {
3051 pointFiles<<m_serialNumberList->
fileName(i);
3057 newMeasureDialog->
setFiles(*m_editPoint,pointFiles);
3058 if (newMeasureDialog->exec()) {
3059 QStringList selectedFiles = newMeasureDialog->selectedFiles();
3060 foreach (QString selectedFile, selectedFiles) {
3064 QString sn = m_serialNumberList->
serialNumber(selectedFile);
3068 cam = m_controlNet->Camera(camIndex);
3071 m->SetAprioriSample(cam->
Sample());
3072 m->SetAprioriLine(cam->
Line());
3075 m_editPoint->Add(m);
3078 m_qnetTool->setVisible(
true);
3079 m_qnetTool->raise();
3082 m_pointEditor->templateFileName());
3086 emit editPointChanged(m_editPoint->GetId());
3103 if(e->type() != QEvent::Leave)
return false;
3104 if(o == m_leftCombo->view()) {
3106 m_leftCombo->hidePopup();
3108 if (o == m_rightCombo->view()) {
3110 m_rightCombo->hidePopup();
3150 vp->viewport()->update();
3178 if (m_controlNet == 0 || m_controlNet->GetNumPoints() == 0)
return;
3185 if (serialNumber == m_groundSN) {
3189 if (!m_controlNet->GetCubeSerials().contains(
3190 serialNumber))
return;
3193 m_controlNet->GetMeasuresInCube(serialNumber);
3195 for (
int i = 0; i < measures.count(); i++) {
3198 double samp = m->GetSample();
3199 double line = m->GetLine();
3203 if (m->Parent()->IsIgnored()) {
3204 painter->setPen(QColor(255, 255, 0));
3207 else if (m->IsIgnored()) {
3208 painter->setPen(QColor(255, 255, 0));
3212 painter->setPen(Qt::magenta);
3215 painter->setPen(Qt::green);
3218 painter->drawLine(x - 5, y, x + 5, y);
3219 painter->drawLine(x, y - 5, x, y + 5);
3222 if (m_editPoint != NULL) {
3224 if (m_editPoint->HasSerialNumber(serialNumber)) {
3226 double samp = (*m_editPoint)[serialNumber]->GetSample();
3227 double line = (*m_editPoint)[serialNumber]->GetLine();
3231 QBrush brush(Qt::red);
3235 painter->setPen(pen);
3236 painter->drawLine(x - 5, y, x + 5, y);
3237 painter->drawLine(x, y - 5, x, y + 5);
3257 for (
int i = 0; i < m_controlNet->GetNumPoints(); i++) {
3260 if (!p.HasAprioriCoordinates())
continue;
3263 if (m_groundGmap->SetGround(p.GetAprioriSurfacePoint().
GetLatitude(),
3265 double samp = m_groundGmap->Sample();
3266 double line = m_groundGmap->Line();
3270 if (p.IsIgnored()) {
3271 painter->setPen(QColor(255, 255, 0));
3274 painter->setPen(Qt::magenta);
3276 else if (&p == m_editPoint) {
3278 QBrush brush(Qt::red);
3283 painter->setPen(Qt::green);
3286 painter->drawLine(x - 5, y, x + 5, y);
3287 painter->drawLine(x, y - 5, x, y + 5);
3308 if (m_templateModified) {
3309 int r = QMessageBox::warning(m_qnetTool, tr(
"OK to continue?"),
3310 tr(
"The currently opened registration template has been modified.\n"
3312 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
3315 if (r == QMessageBox::Yes)
3317 else if (r == QMessageBox::Cancel)
3335 QString filename = QFileDialog::getOpenFileName(m_qnetTool,
3336 "Select a registration template",
".",
3337 "Registration template files (*.def *.pvl);;All files (*)");
3339 if (filename.isEmpty())
3342 if (m_pointEditor->setTemplateFile(filename)) {
3355 QFile file(
FileName(fn).expanded());
3356 if (!file.open(QIODevice::ReadOnly)) {
3357 QString msg =
"Failed to open template file \"" + fn +
"\"";
3358 QMessageBox::warning(m_qnetTool,
"IO Error", msg);
3362 QTextStream stream(&file);
3363 m_templateEditor->setText(stream.readAll());
3366 QScrollBar * sb = m_templateEditor->verticalScrollBar();
3367 sb->setValue(sb->minimum());
3369 m_templateModified =
false;
3370 m_saveTemplateFile->setEnabled(
false);
3371 m_templateFileNameLabel->setText(
"Template File: " + fn);
3377 m_templateModified =
true;
3378 m_saveTemplateFile->setEnabled(
true);
3385 if (!m_templateModified)
3388 QString filename = m_pointEditor->templateFileName();
3397 QString filename = QFileDialog::getSaveFileName(m_qnetTool,
3398 "Save registration template",
".",
3399 "Registration template files (*.def *.pvl);;All files (*)");
3401 if (filename.isEmpty())
3415 QString contents = m_templateEditor->toPlainText();
3426 QMessageBox::warning(m_qnetTool,
"Error", message);
3430 QString expandedFileName(
FileName(fn).expanded());
3432 QFile file(expandedFileName);
3434 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
3435 QString msg =
"Failed to save template file to \"" + fn +
"\"\nDo you "
3437 QMessageBox::warning(m_qnetTool,
"IO Error", msg);
3442 QTextStream stream(&file);
3446 if (m_pointEditor->setTemplateFile(fn)) {
3447 m_templateModified =
false;
3448 m_saveTemplateFile->setEnabled(
false);
3449 m_templateFileNameLabel->setText(
"Template File: " + fn);
3470 Pvl templatePvl(m_pointEditor->templateFileName());
3474 registrationDialog.setWindowTitle(
"View or Edit Template File: "
3475 + templatePvl.fileName());
3476 registrationDialog.resize(550,360);
3477 registrationDialog.exec();
3481 QMessageBox::information(m_qnetTool,
"Error", message);
3494 m_pointEditor->saveChips();
3498 void QnetTool::showHideTemplateEditor() {
3500 if (!m_templateEditorWidget)
3503 m_templateEditorWidget->setVisible(!m_templateEditorWidget->isVisible());
3521 if (m_editPoint == NULL)
return;
3522 if (pointId != m_editPoint->GetId())
return;
3527 ControlPoint *updatedPoint = m_controlNet->GetPoint(pointId);
3528 m_editPoint->SetEditLock(updatedPoint->IsEditLocked());
3529 m_editPoint->SetIgnored(updatedPoint->IsIgnored());
3530 m_editPoint->SetAprioriSurfacePoint(updatedPoint->GetAprioriSurfacePoint());
3533 m_lockPoint->setChecked(m_editPoint->IsEditLocked());
3536 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
3565 if (m_editPoint != NULL) {
3567 QString
id = m_ptIdValue->text().remove(
"Point ID: ");
3568 m_controlNet->GetPoint(
id);
3573 emit editPointChanged(
"");
3574 m_qnetTool->setVisible(
false);
3575 m_measureWindow->setVisible(
false);
3579 if (m_editPoint == NULL) {
3615 QToolButton *showNavToolButton =
new QToolButton();
3616 showNavToolButton->setText(
"Show Nav Tool");
3617 showNavToolButton->setToolTip(
"Shows the Navigation Tool Window");
3619 "<b>Function:</b> This button will bring up the Navigation Tool window that allows \
3620 the user to view, modify, ignore, delete, or filter points and cubes.";
3621 showNavToolButton->setWhatsThis(text);
3622 connect(showNavToolButton,SIGNAL(clicked(
bool)),
this,SLOT(
showNavWindow(
bool)));
3624 QHBoxLayout *layout =
new QHBoxLayout(hbox);
3625 layout->setMargin(0);
3626 layout->addWidget(showNavToolButton);
3627 layout->addStretch(1);
3628 hbox->setLayout(layout);
3655 QString filter =
"Isis cubes (*.cub *.cub.*);;";
3656 filter +=
"Detached labels (*.lbl);;";
3657 filter +=
"All (*)";
3659 QString ground = QFileDialog::getOpenFileName((
QWidget*)parent(),
3660 "Open ground source",
3663 if (ground.isEmpty())
return;
3669 if (m_groundOpen && m_groundFile ==
FileName(ground).name()) {
3676 m_workspace->mdiArea()->setActiveSubWindow(
3685 if (newGroundSN != m_groundSN && m_serialNumberList->
hasSerialNumber(newGroundSN)) {
3688 QString message =
"A cube in the cube list has the same serial number as this ground file. ";
3689 message +=
"If this ground source is a level 1, un-projected cube, it is probably included ";
3690 message +=
"in the cube list. If the ground source is a projected version of a cube in ";
3691 message +=
"the list and has the Instrument Group in the labels, the un-projected and ";
3692 message +=
"projected cube will have the same serial number. \n";
3693 message +=
"Because of duplicate serial numbers this cube cannot be used as a ground ";
3694 message +=
"source.\n\n";
3695 message +=
"NOTE: If this cube is the reference cube you can select points in ";
3696 message +=
"the Navigator window, then select the Set Apriori button to use this cube to ";
3697 message +=
"set the apriori latitude, longitude and radius.";
3698 QMessageBox::critical(m_qnetTool,
"Cannot set ground source", message);
3707 clearGroundSource ();
3710 QApplication::setOverrideCursor(Qt::WaitCursor);
3715 m_groundCube.reset(NULL);
3716 m_groundGmap.reset(NULL);
3719 QScopedPointer<Cube> newGroundCube(
new Cube(ground,
"r"));
3720 QScopedPointer<UniversalGroundMap> newGroundGmap(
new UniversalGroundMap(*newGroundCube));
3722 m_groundFile =
FileName(newGroundCube->fileName()).name();
3723 m_groundCube.reset(newGroundCube.take());
3724 m_groundGmap.reset(newGroundGmap.take());
3726 m_serialNumberList->
add(ground,
true);
3729 QApplication::restoreOverrideCursor();
3730 QMessageBox::critical(m_qnetTool,
"Error", e.
toString());
3732 m_groundFile.clear();
3739 emit refreshNavList();
3743 m_groundSN = newGroundSN;
3744 m_groundSourceFile = ground;
3745 m_groundOpen =
true;
3747 m_workspace->addCubeViewport(m_groundCube.data());
3762 if (m_editPoint != NULL) {
3768 else if (m_groundCube->hasTable(
"ShapeModelStatistics")) {
3769 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Basemap;
3771 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3772 m_radiusSourceFile = ground;
3779 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Basemap;
3781 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3782 m_radiusSourceFile =
"";
3788 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Reference;
3790 PvlGroup kernels = m_groundCube->group(
"Kernels");
3791 QString shapeFile = kernels [
"ShapeModel"];
3792 if (shapeFile.contains(
"dem")) {
3793 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3794 m_radiusSourceFile = shapeFile;
3797 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3799 m_radiusSourceFile = (QString) kernels[
"TargetAttitudeShape"];
3804 QString message =
"Cannot create either Camera or Projections ";
3805 message +=
"for the ground source file. Check the validity of the ";
3806 message +=
" cube labels. The cube must either be projected or ";
3807 message +=
" run through spiceinit.";
3808 QMessageBox::critical(m_qnetTool,
"Error", message);
3810 clearGroundSource ();
3811 QApplication::restoreOverrideCursor();
3812 emit refreshNavList();
3819 if (m_editPoint != NULL &&
3823 emit refreshNavList();
3824 QApplication::restoreOverrideCursor();
3837 if (m_groundFile.isEmpty()) {
3838 QString message =
"You must enter a ground source before opening a Dem.";
3839 QMessageBox::critical(m_qnetTool,
"Error", message);
3843 QString filter =
"Isis cubes (*.cub *.cub.*);;";
3844 filter +=
"Detached labels (*.lbl);;";
3845 filter +=
"All (*)";
3846 QString dem = QFileDialog::getOpenFileName((
QWidget*)parent(),
3850 if (dem.isEmpty())
return;
3865 QString referenceSN = m_editPoint->GetReferenceSN();
3866 QString referenceFileName = m_serialNumberList->
fileName(referenceSN);
3867 QScopedPointer<Cube> referenceCube(
new Cube(referenceFileName,
"r"));
3868 PvlGroup kernels = referenceCube->group(
"Kernels");
3869 QString shapeFile = kernels[
"ShapeModel"];
3874 if (shapeFile.contains(
".cub")) {
3875 if (shapeFile.contains(
"dem")) {
3876 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3879 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3882 m_radiusSourceFile = shapeFile;
3890 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3893 refSpice->
radii(refRadii);
3894 m_demFile = QString::number(refRadii[0].meters()) +
", " +
3895 QString::number(refRadii[1].meters()) +
", " +
3896 QString::number(refRadii[2].meters());
3898 m_radiusSourceFile =
"";
3901 m_groundFileNameLabel->setText(
"Ground Source File: " + m_groundFile);
3902 m_radiusFileNameLabel->setText(
"Radius Source: " + m_demFile);
3906 void QnetTool::initDem (QString demFile) {
3910 QApplication::setOverrideCursor(Qt::WaitCursor);
3912 if (m_demFile == demFile) {
3913 QApplication::restoreOverrideCursor();
3917 m_demCube.reset(NULL);
3922 QScopedPointer<Cube> newDemCube(
new Cube(demFile,
"r"));
3924 m_demFile = FileName(newDemCube->fileName()).name();
3925 m_demCube.reset(newDemCube.take());
3927 catch (IException &e) {
3928 QMessageBox::critical(m_qnetTool,
"Error", e.toString());
3929 QApplication::restoreOverrideCursor();
3935 if (!m_demCube->hasTable(
"ShapeModelStatistics")) {
3936 QString message = m_demFile +
" is not a DEM.";
3937 QMessageBox::critical(m_qnetTool,
"Error", message);
3938 m_demCube.reset(NULL);
3941 QApplication::restoreOverrideCursor();
3944 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3945 m_groundFileNameLabel->setText(
"Ground Source File: " + m_groundFile);
3946 m_radiusFileNameLabel->setText(
"Radius Source File: " + m_demFile);
3947 m_radiusSourceFile = demFile;
3949 QApplication::restoreOverrideCursor();
3964 clearGroundSource();
3969 void QnetTool::clearGroundSource () {
3971 m_leftCombo->removeItem(m_leftCombo->findText(m_groundFile));
3972 m_rightCombo->removeItem(m_rightCombo->findText(m_groundFile));
3978 if (vp->
cube() == m_groundCube.data()) {
3983 vp->parentWidget()->parentWidget()->close();
3984 QApplication::processEvents();
3990 m_groundOpen =
false;
3991 m_groundCube.take();
3992 m_groundFile.clear();
3993 m_groundGmap.reset(NULL);
3995 m_groundFileNameLabel->setText(
"Ground Source File: ");
3997 m_radiusFileNameLabel->setText(
"Radius Source File: " + m_demFile);
4001 m_serialNumberList->
Delete(m_groundSN);
4007 m_editPoint->HasSerialNumber(m_groundSN)) {
4008 m_editPoint->Delete(m_groundSN);
4030 if (!m_demOpen)
return Null;
4045 m_demCube->pixelType(),
4048 m_demCube->read(*portal);
4073 QColor qc = Qt::red;
4074 QPalette p = m_savePoint->palette();
4075 p.setColor(QPalette::ButtonText,qc);
4076 m_savePoint->setPalette(p);
4096 if (m_editPoint == NULL)
return false;
4099 if (m_editPoint->IsEditLocked() && m_editPoint->IsReferenceExplicit() &&
4100 (m_editPoint->GetReferenceSN() == serialNumber)) {
4105 return m_editPoint->GetMeasure(serialNumber)->IsEditLocked();
4118 FileName config(
"$HOME/.Isis/qnet/QnetTool.config");
4119 QSettings settings(config.expanded(), QSettings::NativeFormat);
4120 QPoint pos = settings.value(
"pos", QPoint(300, 100)).toPoint();
4121 QSize size = settings.value(
"size", QSize(900, 500)).toSize();
4122 m_qnetTool->resize(size);
4123 m_qnetTool->move(pos);
4136 if(!m_qnetTool->isVisible())
return;
4137 FileName config(
"$HOME/.Isis/qnet/QnetTool.config");
4138 QSettings settings(config.expanded(), QSettings::NativeFormat);
4139 settings.setValue(
"pos", m_qnetTool->pos());
4140 settings.setValue(
"size", m_qnetTool->size());
4145 void QnetTool::enterWhatsThisMode() {
4146 QWhatsThis::enterWhatsThisMode();
This class defines a body-fixed surface point.
Status SetType(MeasureType type)
Set how the coordinate was obtained.
Cube display widget for certain Isis MDI applications.
PointType GetType() const
double HotSample()
Returns the sample coordinate of the center pixel in the buffer for the interpolator.
int serialNumberIndex(const QString &sn)
Return a list index given a serial number.
UniversalGroundMap * universalGroundMap() const
Return the universal ground map associated with the cube (NULL implies none)
void Delete(const QString &sn)
Remove the specified serial number from the list.
const double Null
Value for an Isis Null pixel.
static Isis::Projection * CreateFromCube(Isis::Cube &cube)
This method is a helper method.
void Add(ControlMeasure *measure)
Add a measurement to the control point, taking ownership of the measure in the process.
(e.g., autoseed, interest) AKA predicted, unmeasured, unverified
bool hasSerialNumber(QString sn)
Determines whether or not the requested serial number exists in the list.
double Sample() const
Returns the current line value of the camera model or projection.
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
A Fixed point is a Control Point whose lat/lon is well established and should not be changed...
double degrees() const
Get the angle in units of Degrees.
double Interpolate(const double isamp, const double iline, const double buf[])
Performs an interpolation on the data according to the parameters set in the constructor.
File name manipulation and expansion.
Distance GetLocalRadius() const
Return the radius of the surface point.
void add(const QString &filename, bool def2filename=false)
Adds a new filename / serial number pair to the SerialNumberList.
int size() const
How many serial number / filename combos are in the list.
double GetResidualMagnitude() const
Return Residual magnitude.
Buffer for containing a two dimensional section of an image.
void radii(Distance r[3]) const
Returns the radii of the body in km.
QString serialNumber(const QString &filename)
Return a serial number given a filename.
PointType
These are the valid 'types' of point.
double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
This class is designed to encapsulate the concept of a Latitude.
void setFiles(QStringList pointFiles)
double * DoubleBuffer() const
Returns the value of the shape buffer.
double GetNumericalValue() const
Get the value associated with this log data.
int fileNameIndex(const QString &filename)
Return a list index given a filename.
Status SetChooserName(QString name)
Set the point's chooser name.
double UniversalLatitude() const
Returns the universal latitude of the camera model or projection.
Widget to display Isis cubes for qt apps.
Registered to whole pixel (e.g.,pointreg)
Registered to sub-pixel (e.g., pointreg)
double Line() const
Returns the current line value of the camera model or projection.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
This error is for when a programmer made an API call that was illegal.
Distance measurement, usually in meters.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
void SetRadii(const Distance &majorRadius, const Distance &minorRadius, const Distance &polarRadius)
Reset the radii of the surface body of the surface point.
A Free point is a Control Point that identifies common measurements between two or more cubes...
Distance GetLonSigmaDistance() const
Return the longiitude sigma in meters.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
bool HasSerialNumber(QString serialNumber) const
Return true if given serial number exists in point.
QString fileName(const QString &sn)
Return a filename given a serial number.
This was called the Qisis MainWindow.
bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
This class is designed to encapsulate the concept of a Longitude.
double HotLine()
Returns the line coordinate of the center pixel in the buffer for the interpolator.
double meters() const
Get the distance in meters.
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Cube * cube() const
Return the cube associated with viewport.
QString GetId() const
Return the Id of the control point.
Hand Measured (e.g., qnet)
Status SetCamera(Isis::Camera *camera)
Set pointer to camera associated with a measure.
int Samples()
Returns the number of samples needed by the interpolator.
void setFiles(ControlPoint point, QStringList pointFiles)
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
double Sample()
Returns the current sample number.
Status SetAprioriSurfacePoint(SurfacePoint aprioriSP)
This updates the apriori surface point.
double UniversalLongitude() const
Returns the universal longitude of the camera model or projection.
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
void viewportToCube(int x, int y, double &sample, double &line) const
Convert a viewport x/y to a cube sample/line (may be outside the cube)
Container for cube-like labels.
bool IsEditLocked() const
Return value for p_editLock or implicit lock on reference measure.
void SetPosition(const double sample, const double line, const int band)
Sets the line and sample position of the buffer.
Status SetType(PointType newType)
Updates the control point's type.
bool SetImage(double sample, double line)
Returns whether the sample/line postion was set successfully in the camera model or projection...
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Status
This is a return status for many of the mutating (setter) method calls.
GoodnessOfFit is pointreg information for reference measures.
int Lines()
Returns the number of lines needed by the interpolator.
void cubeToViewport(double sample, double line, int &x, int &y) const
Convert a cube sample/line to a viewport x/y (may be outside the viewport)
void setFiles(QStringList pointFiles)
Set files found containing selected point.
double Line()
Returns the current line number.
QString toString() const
Returns a string representation of this exception.
Distance GetLatSigmaDistance() const
Return the latitude sigma in meters.
static QString UserName()
Returns the user name.
Status SetChooserName()
Set chooser name to a user who last changed the coordinate.
bool SetUniversalGround(double lat, double lon)
Returns whether the lat/lon position was set successfully in the camera model or projection.
PvlEditDialog creates a QDialog window in which a QTextEdit box displays the contents of a pvl file...
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
Status SetCubeSerialNumber(QString newSerialNumber)
Set cube serial number.
Status SetCoordinate(double sample, double line)
Set the coordinate of the measurement.
Base class for the Qisis main windows.
QString fileName() const
Returns the opened cube's filename.
Obtain SPICE information for a spacecraft.
The distance is being specified in meters.
int Delete(ControlMeasure *measure)
Remove a measurement from the control point, deleting reference measure is allowed.
Serial Number list generator.
static QString PointTypeToString(PointType type)
Obtain a string representation of a given PointType.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
static QString MeasureTypeToString(MeasureType type)
Return the String Control Measure type.
This is returned when the operation requires Edit Lock to be false but it is currently true...
IO Handler for Isis Cubes.