10 #include <QMessageBox> 14 #include <QStackedWidget> 16 #include <QTableWidget> 19 #include "QnetDeletePointDialog.h" 20 #include "QnetNewMeasureDialog.h" 21 #include "NewControlPointDialog.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");
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.");
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;
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());
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 if (m_editPoint->HasAprioriCoordinates()) {
1012 SurfacePoint aprioriPt = m_editPoint->GetAprioriSurfacePoint();
1013 Distance latSigma = aprioriPt.GetLatSigmaDistance();
1014 Distance lonSigma = aprioriPt.GetLonSigmaDistance();
1015 Distance radiusSigma = aprioriPt.GetLocalRadiusSigma();
1019 aprioriPt.SetSphericalSigmasDistance(latSigma, lonSigma, radiusSigma);
1020 m_editPoint->SetAprioriSurfacePoint(aprioriPt);
1023 m_editPoint->SetAprioriSurfacePoint(SurfacePoint(
1029 catch (IException &e) {
1030 QString message =
"Unable to set Apriori Surface Point.\n";
1031 message +=
"Latitude = " + QString::number(lat);
1032 message +=
" Longitude = " + QString::number(lon);
1033 message +=
" Radius = " + QString::number(radius) +
"\n";
1034 message += e.toString();
1035 QMessageBox::critical(m_qnetTool,
"Error",message);
1037 m_editPoint->SetAprioriSurfacePointSource(m_groundSurfacePointSource);
1038 m_editPoint->SetAprioriSurfacePointSourceFile(m_groundSourceFile);
1065 *updatePoint = *m_editPoint;
1073 updatePoint->
Delete(m_groundSN);
1078 if (m_controlNet->ContainsPoint(updatePoint->
GetId())) {
1080 p = m_controlNet->GetPoint(QString(updatePoint->
GetId()));
1086 m_controlNet->AddPoint(updatePoint);
1090 m_savePoint->setPalette(m_saveDefaultPalette);
1094 emit refreshNavList();
1096 emit editPointChanged(m_editPoint->GetId());
1100 m_pointEditor->refreshChips();
1120 if (m_editPoint == NULL)
return;
1123 if (m_editPoint->GetType() == pointType)
return;
1126 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
1127 QString message =
"The reference measure is Ignored. Unset the Ignore flag on the ";
1128 message +=
"reference measure before setting the point type to Constrained or Fixed.";
1129 QMessageBox::warning(m_qnetTool,
"Ignored Reference Measure", message);
1133 bool unloadGround =
false;
1135 unloadGround =
true;
1138 int temp = m_editPoint->GetType();
1142 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
1143 QString message =
"This control point is edit locked. The point type cannot be changed. You ";
1144 message +=
"must first unlock the point by clicking the check box above labeled ";
1145 message +=
"\"Edit Lock Point\".";
1146 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
1155 m_pointEditor->colorizeSaveButton();
1158 else if (unloadGround) {
1161 if (m_editPoint->HasSerialNumber(m_groundSN)) {
1162 m_editPoint->Delete(m_groundSN);
1166 m_pointEditor->colorizeSaveButton();
1187 if (!m_groundOpen)
return;
1197 m_leftCombo->addItem(tempFileName);
1198 m_rightCombo->addItem(tempFileName);
1199 int rightIndex = m_rightCombo->findText((QString)m_groundFile);
1200 m_rightCombo->setCurrentIndex(rightIndex);
1221 if (m_editPoint == NULL)
return;
1223 m_editPoint->SetEditLock(lock);
1240 if (m_editPoint == NULL)
return;
1244 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
1245 QString message =
"This control point is edit locked. The Ignored status cannot be ";
1246 message +=
"changed. You must first unlock the point by clicking the check box above ";
1247 message +=
"labeled \"Edit Lock Point\".";
1248 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
1274 if (m_editPoint->IsEditLocked()) {
1275 m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1276 QMessageBox::warning(m_qnetTool,
"Point Locked",
"Point is Edit Locked. You must un-lock point" 1277 " before changing a measure.");
1278 m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1282 if (m_leftMeasure != NULL) m_leftMeasure->SetEditLock(lock);
1286 if (m_rightMeasure != NULL) {
1287 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1288 m_rightMeasure->SetEditLock(lock);
1289 m_lockRightMeasure->setChecked(lock);
1292 emit measureChanged();
1314 if (m_leftMeasure != NULL) m_leftMeasure->SetIgnored(ignore);
1318 if (m_rightMeasure != NULL) {
1319 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1320 m_rightMeasure->SetIgnored(ignore);
1321 m_ignoreRightMeasure->setChecked(ignore);
1324 emit measureChanged();
1345 if (m_editPoint->IsEditLocked()) {
1346 m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1347 QMessageBox::warning(m_qnetTool,
"Point Locked",
"Point is Edit Locked. You must un-lock point" 1348 " before changing a measure.");
1349 m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1353 if (m_rightMeasure != NULL) m_rightMeasure->SetEditLock(lock);
1356 if (m_leftMeasure != NULL) {
1357 if (m_leftMeasure->GetCubeSerialNumber() == m_rightMeasure->GetCubeSerialNumber()) {
1358 m_leftMeasure->SetEditLock(lock);
1359 m_lockLeftMeasure->setChecked(lock);
1362 emit measureChanged();
1384 if (m_rightMeasure != NULL) m_rightMeasure->SetIgnored(ignore);
1388 if (m_leftMeasure != NULL) {
1389 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1390 m_leftMeasure->SetIgnored(ignore);
1391 m_ignoreLeftMeasure->setChecked(ignore);
1394 emit measureChanged();
1405 if (m_cnetFileName.isEmpty()) {
1406 QString message =
"This is a new network, you must select " 1407 "\"Save As\" under the File Menu.";
1408 QMessageBox::critical(m_qnetTool,
"Error", message);
1411 emit qnetToolSave();
1421 emit qnetToolSaveAs();
1430 void QnetTool::updateList() {
1454 m_cnetFileName = cNetFileName;
1455 m_qnetTool->setWindowTitle(
"Qnet Tool - Control Network File: " +
1476 action->setIcon(QPixmap(
toolIconDir()+
"/stock_draw-connector-with-arrows.png"));
1477 action->setToolTip(
"Control Point Editor (T)");
1478 action->setShortcut(Qt::Key_T);
1479 QObject::connect(action,SIGNAL(triggered(
bool)),
this,SLOT(
showNavWindow(
bool)));
1521 if (cvp == NULL)
return;
1529 QString message =
"Cannot get serial number for " + file +
". Is file contained in the ";
1530 message +=
"cube list?\n";
1532 QMessageBox::critical(m_qnetTool,
"Error", message);
1541 if (s == Qt::LeftButton) {
1542 if (!m_controlNet || m_controlNet->GetNumPoints() == 0) {
1543 QString message =
"No points exist for editing. Create points ";
1544 message +=
"using the right mouse button.";
1545 QMessageBox::warning(m_qnetTool,
"Warning", message);
1549 if (sn == m_groundSN) {
1550 QString message =
"Cannot select point for editing on ground source. Select ";
1551 message +=
"point using un-projected images or the Navigator Window.";
1552 QMessageBox::critical(m_qnetTool,
"Error", message);
1561 ControlPoint *point = m_controlNet->FindClosest(sn, samp, line);
1565 QString message =
"No points exist for editing. Create points using the right mouse";
1566 message +=
" button.";
1567 QMessageBox::warning(m_qnetTool,
"Warning", message);
1572 else if (s == Qt::MidButton) {
1573 if (!m_controlNet || m_controlNet->GetNumPoints() == 0) {
1574 QString message =
"No points exist for deleting. Create points ";
1575 message +=
"using the right mouse button.";
1576 QMessageBox::warning(m_qnetTool,
"Warning", message);
1580 if (m_groundOpen && file == m_groundCube->fileName()) {
1581 QString message =
"Cannot select point for deleting on ground source. Select ";
1582 message +=
"point using un-projected images or the Navigator Window.";
1583 QMessageBox::critical(m_qnetTool,
"Error", message);
1589 point = m_controlNet->FindClosest(sn, samp, line);
1591 if (point == NULL) {
1592 QString message =
"No points exist for deleting. Create points ";
1593 message +=
"using the right mouse button.";
1594 QMessageBox::warning(m_qnetTool,
"Warning", message);
1599 QString message =
"Cannot find point on this image for deleting.";
1600 QMessageBox::critical(m_qnetTool,
"Error", message);
1606 else if (s == Qt::RightButton) {
1610 QString message =
"Invalid latitude or longitude at this point. ";
1611 QMessageBox::critical(m_qnetTool,
"Error", message);
1616 if (m_groundOpen && file == m_groundCube->fileName()) {
1680 for(
int i = 0; i < m_serialNumberList->
size(); i++) {
1681 if (m_serialNumberList->
serialNumber(i) == m_groundSN)
continue;
1682 cam = m_controlNet->Camera(i);
1685 double samp = cam->
Sample();
1686 double line = cam->
Line();
1687 if (samp >= 1 && samp <= cam->Samples() &&
1688 line >= 1 && line <= cam->Lines()) {
1689 pointFiles<<m_serialNumberList->
fileName(i);
1696 newPointDialog->
setFiles(pointFiles);
1697 if (newPointDialog->exec()) {
1698 m_lastUsedPointId = newPointDialog->pointId();
1704 if (m_controlNet->ContainsPoint(newPoint->
GetId())) {
1705 QString message =
"A ControlPoint with Point Id = [" + newPoint->
GetId();
1706 message +=
"] already exists. Re-enter Point Id for this ControlPoint.";
1707 QMessageBox::warning(m_qnetTool,
"New Point Id", message);
1717 QStringList selectedFiles = newPointDialog->selectedFiles();
1718 foreach (QString selectedFile, selectedFiles) {
1727 cam = m_controlNet->Camera(camIndex);
1730 m->SetAprioriSample(cam->
Sample());
1731 m->SetAprioriLine(cam->
Line());
1737 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1741 m_editPoint = newPoint;
1745 if (!m_leftFile.isEmpty()) {
1746 if (selectedFiles.indexOf(m_leftFile) == -1) {
1753 m_qnetTool->setVisible(
true);
1754 m_qnetTool->raise();
1757 m_pointEditor->templateFileName());
1761 emit refreshNavList();
1763 emit editPointChanged(m_editPoint->GetId());
1765 delete newPointDialog;
1795 for (
int i=0; i<m_serialNumberList->
size(); i++) {
1796 if (m_serialNumberList->
serialNumber(i) == m_groundSN)
continue;
1797 cam = m_controlNet->Camera(i);
1800 double samp = cam->
Sample();
1801 double line = cam->
Line();
1802 if (samp >= 1 && samp <= cam->Samples() &&
1803 line >= 1 && line <= cam->Lines()) {
1804 pointFiles<<m_serialNumberList->
fileName(i);
1809 if (pointFiles.count() == 0) {
1810 QString message =
"Point does not intersect any images.";
1811 QMessageBox::critical(m_qnetTool,
"No intersection", message);
1816 fixedPointDialog->
setFiles(pointFiles);
1817 if (fixedPointDialog->exec()) {
1821 if (fixedPointDialog->isFixed()) {
1830 if (m_controlNet->ContainsPoint(fixedPoint->
GetId())) {
1831 QString message =
"A ControlPoint with Point Id = [" + fixedPoint->
GetId();
1832 message +=
"] already exists. Re-enter Point Id for this ControlPoint.";
1833 QMessageBox::warning(m_qnetTool,
"New Point Id", message);
1843 QStringList selectedFiles = fixedPointDialog->selectedFiles();
1844 foreach (QString selectedFile, selectedFiles) {
1852 if (sn == m_groundSN)
continue;
1857 cam = m_controlNet->Camera(camIndex);
1870 if (radius ==
Null) {
1871 QString msg =
"Could not read radius from DEM, will default to the " 1872 "local radius of the first measure in the control point. This " 1873 "will be updated to the local radius of the chosen reference " 1875 QMessageBox::warning(m_qnetTool,
"Warning", msg);
1876 if ((*fixedPoint)[0]->
Camera()->SetGround(
1878 radius = (*fixedPoint)[0]->Camera()->LocalRadius().meters();
1881 QString msg =
"Error trying to get radius at this pt. " 1882 "Lat/Lon does not fall on the reference measure. " 1883 "Cannot create this point.";
1884 QMessageBox::critical(m_qnetTool,
"Error", msg);
1887 delete fixedPointDialog;
1888 fixedPointDialog = NULL;
1894 if ((*fixedPoint)[0]->
Camera()->SetGround(
1896 radius = (*fixedPoint)[0]->Camera()->LocalRadius().meters();
1899 QString msg =
"Error trying to get radius at this pt. " 1900 "Lat/Lon does not fall on the reference measure. " 1901 "Cannot create this point.";
1902 QMessageBox::critical(m_qnetTool,
"Error", msg);
1905 delete fixedPointDialog;
1906 fixedPointDialog = NULL;
1916 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1920 m_editPoint = fixedPoint;
1924 m_qnetTool->setVisible(
true);
1925 m_qnetTool->raise();
1927 delete fixedPointDialog;
1928 fixedPointDialog = NULL;
1931 emit refreshNavList();
1933 emit editPointChanged(m_editPoint->GetId());
1964 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1969 *m_editPoint = *point;
1975 emit editPointChanged(m_editPoint->GetId());
1977 QnetDeletePointDialog *deletePointDialog =
new QnetDeletePointDialog;
1978 QString CPId = m_editPoint->GetId();
1979 deletePointDialog->pointIdValue->setText(CPId);
1982 for (
int i=0; i<m_editPoint->GetNumMeasures(); i++) {
1985 deletePointDialog->fileList->addItem(file);
1988 if (deletePointDialog->exec()) {
1990 int numDeleted = deletePointDialog->fileList->selectedItems().count();
1993 if (deletePointDialog->deleteAllCheckBox->isChecked() ||
1994 numDeleted == m_editPoint->GetNumMeasures()) {
1997 if (!deletePointDialog->deleteAllCheckBox->isChecked()) {
1998 QString message =
"You have selected all measures in this point to be deleted. This " 1999 "control point will be deleted. Do you want to delete this control point?";
2000 int response = QMessageBox::question(m_qnetTool,
2001 "Delete control point", message,
2002 QMessageBox::Yes | QMessageBox::No,
2005 if (response == QMessageBox::No) {
2014 m_qnetTool->setVisible(
false);
2016 if (m_controlNet->DeletePoint(m_editPoint->GetId()) ==
2018 QMessageBox::information(m_qnetTool,
"EditLocked Point",
2019 "This point is EditLocked and cannot be deleted.");
2022 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
2027 emit refreshNavList();
2033 int lockedMeasures = 0;
2034 for (
int i=0; i<deletePointDialog->fileList->count(); i++) {
2035 QListWidgetItem *item = deletePointDialog->fileList->item(i);
2036 if (!deletePointDialog->fileList->isItemSelected(item))
continue;
2039 if (m_editPoint->IsReferenceExplicit() &&
2040 (m_editPoint->GetRefMeasure()->GetCubeSerialNumber() ==
2041 (*m_editPoint)[i]->GetCubeSerialNumber())) {
2042 QString message =
"You are trying to delete the Reference measure." 2043 " Do you really want to delete the Reference measure?";
2044 switch (QMessageBox::question(m_qnetTool,
2045 "Delete Reference measure?", message,
2046 "&Yes",
"&No", 0, 0)) {
2054 if (numDeleted == 1) {
2061 if (m_editPoint->Delete(i) == ControlMeasure::MeasureLocked) {
2066 if (lockedMeasures > 0) {
2067 QMessageBox::information(m_qnetTool,
"EditLocked Measures",
2068 QString::number(lockedMeasures) +
" / " 2070 deletePointDialog->fileList->selectedItems().size()) +
2071 " measures are EditLocked and were not deleted.");
2075 m_qnetTool->setVisible(
true);
2076 m_qnetTool->raise();
2085 if (m_editPoint != NULL) {
2086 emit editPointChanged(m_editPoint->GetId());
2094 emit editPointChanged(
"");
2112 if (point->GetNumMeasures() == 0) {
2113 QString message =
"This point has no measures.";
2114 QMessageBox::warning(m_qnetTool,
"Warning", message);
2116 if (m_editPoint != NULL) {
2118 emit editPointChanged(m_editPoint->GetId());
2123 emit editPointChanged(
"");
2129 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
2134 *m_editPoint = *point;
2138 if (sender() !=
this) m_leftFile.clear();
2140 m_qnetTool->setVisible(
true);
2141 m_qnetTool->raise();
2145 emit editPointChanged(m_editPoint->GetId());
2148 m_savePoint->setPalette(m_saveDefaultPalette);
2162 bool located =
true;
2168 if (m_editPoint->HasAprioriCoordinates()) {
2169 SurfacePoint sPt = m_editPoint->GetAprioriSurfacePoint();
2177 cam = m_controlNet->Camera(camIndex);
2178 cam->
SetImage(m.GetSample(),m.GetLine());
2185 if (!m_groundGmap->SetUniversalGround(lat,lon)) {
2187 QString message =
"This point does not exist on the ground source.\n";
2188 message +=
"Latitude = " + QString::number(lat);
2189 message +=
" Longitude = " + QString::number(lon);
2190 message +=
"\n A ground measure will not be created.";
2191 QMessageBox::warning(m_qnetTool,
"Warning", message);
2214 groundMeasure->
SetCoordinate(m_groundGmap->Sample(),m_groundGmap->Line());
2215 m_editPoint->Add(groundMeasure);
2217 return groundMeasure;
2247 QString CPId = m_editPoint->GetId();
2248 QString ptId(
"Point ID: ");
2249 ptId += (QString) CPId;
2250 m_ptIdValue->setText(ptId);
2256 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
2259 QString ptsize =
"Number of Measures: " +
2260 QString::number(m_editPoint->GetNumMeasures());
2261 m_numMeasures->setText(ptsize);
2264 m_lockPoint->setChecked(m_editPoint->IsEditLocked());
2267 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
2270 m_leftCombo->clear();
2271 m_rightCombo->clear();
2272 m_pointFiles.clear();
2276 if (m_editPoint->HasSerialNumber(m_groundSN)) {
2277 m_editPoint->Delete(m_groundSN);
2294 if (m_groundOpen && !m_demOpen) {
2300 for (
int i=0; i<m_editPoint->GetNumMeasures(); i++) {
2305 m_leftCombo->addItem(tempFileName);
2306 m_rightCombo->addItem(tempFileName);
2307 if (m_editPoint->IsReferenceExplicit() &&
2309 m_leftCombo->setItemData(i,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
2310 m_rightCombo->setItemData(i,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
2326 if (m_editPoint->IsReferenceExplicit()) {
2327 leftIndex = m_editPoint->IndexOfRefMeasure();
2332 leftIndex = m_leftCombo->findText(baseFileName);
2334 if (leftIndex < 0 ) leftIndex = 0;
2342 rightIndex = m_rightCombo->findText((QString)m_groundFile);
2344 if (rightIndex <= 0) {
2345 if (leftIndex == 0) {
2355 if (rightIndex > m_editPoint->GetNumMeasures()-1) rightIndex = 0;
2356 m_rightCombo->setCurrentIndex(rightIndex);
2357 m_leftCombo->setCurrentIndex(leftIndex);
2379 if (m_measureWindow == NULL) {
2381 m_measureTable =
new QTableWidget();
2382 m_measureTable->setMinimumWidth(1600);
2383 m_measureTable->setAlternatingRowColors(
true);
2384 m_measureWindow->setCentralWidget(m_measureTable);
2387 m_measureTable->clear();
2388 m_measureTable->setSortingEnabled(
false);
2390 m_measureTable->setRowCount(m_editPoint->GetNumMeasures());
2391 m_measureTable->setColumnCount(NUMCOLUMNS);
2394 for (
int i=0; i<NUMCOLUMNS; i++) {
2395 labels<<measureColumnToString((MeasureColumns)i);
2397 m_measureTable->setHorizontalHeaderLabels(labels);
2400 for (
int row=0; row<m_editPoint->GetNumMeasures(); row++) {
2405 QTableWidgetItem *tableItem =
new QTableWidgetItem(QString(file));
2406 m_measureTable->setItem(row,column++,tableItem);
2409 m_measureTable->setItem(row,column++,tableItem);
2411 tableItem =
new QTableWidgetItem();
2412 tableItem->setData(0,m.GetSample());
2413 m_measureTable->setItem(row,column++,tableItem);
2415 tableItem =
new QTableWidgetItem();
2416 tableItem->setData(0,m.GetLine());
2417 m_measureTable->setItem(row,column++,tableItem);
2419 if (m.GetAprioriSample() ==
Null) {
2420 tableItem =
new QTableWidgetItem(
"Null");
2423 tableItem =
new QTableWidgetItem();
2424 tableItem->setData(0,m.GetAprioriSample());
2426 m_measureTable->setItem(row,column++,tableItem);
2428 if (m.GetAprioriLine() ==
Null) {
2429 tableItem =
new QTableWidgetItem(
"Null");
2432 tableItem =
new QTableWidgetItem();
2433 tableItem->setData(0,m.GetAprioriLine());
2435 m_measureTable->setItem(row,column++,tableItem);
2437 if (m.GetSampleResidual() ==
Null) {
2438 tableItem =
new QTableWidgetItem(QString(
"Null"));
2441 tableItem =
new QTableWidgetItem();
2442 tableItem->setData(0,m.GetSampleResidual());
2444 m_measureTable->setItem(row,column++,tableItem);
2446 if (m.GetLineResidual() ==
Null) {
2447 tableItem =
new QTableWidgetItem(QString(
"Null"));
2450 tableItem =
new QTableWidgetItem();
2451 tableItem->setData(0,m.GetLineResidual());
2453 m_measureTable->setItem(row,column++,tableItem);
2456 tableItem =
new QTableWidgetItem(QString(
"Null"));
2459 tableItem =
new QTableWidgetItem();
2462 m_measureTable->setItem(row,column++,tableItem);
2464 double sampleShift = m.GetSampleShift();
2465 if (sampleShift ==
Null) {
2466 tableItem =
new QTableWidgetItem(QString(
"Null"));
2469 tableItem =
new QTableWidgetItem();
2470 tableItem->setData(0,sampleShift);
2472 m_measureTable->setItem(row,column++,tableItem);
2474 double lineShift = m.GetLineShift();
2475 if (lineShift ==
Null) {
2476 tableItem =
new QTableWidgetItem(QString(
"Null"));
2479 tableItem =
new QTableWidgetItem();
2480 tableItem->setData(0,lineShift);
2482 m_measureTable->setItem(row,column++,tableItem);
2484 double pixelShift = m.GetPixelShift();
2485 if (pixelShift ==
Null) {
2486 tableItem =
new QTableWidgetItem(QString(
"Null"));
2489 tableItem =
new QTableWidgetItem();
2490 tableItem->setData(0,pixelShift);
2492 m_measureTable->setItem(row,column++,tableItem);
2494 double goodnessOfFit = m.GetLogData(
2496 if (goodnessOfFit ==
Null) {
2497 tableItem =
new QTableWidgetItem(QString(
"Null"));
2500 tableItem =
new QTableWidgetItem();
2501 tableItem->setData(0,goodnessOfFit);
2503 m_measureTable->setItem(row,column++,tableItem);
2505 if (m.IsIgnored()) tableItem =
new QTableWidgetItem(
"True");
2506 if (!m.IsIgnored()) tableItem =
new QTableWidgetItem(
"False");
2507 m_measureTable->setItem(row,column++,tableItem);
2510 tableItem =
new QTableWidgetItem(
"True");
2512 tableItem =
new QTableWidgetItem(
"False");
2513 m_measureTable->setItem(row,column++,tableItem);
2515 tableItem =
new QTableWidgetItem(
2517 m_measureTable->setItem(row,column,tableItem);
2520 if (m_editPoint->IsReferenceExplicit() &&
2525 for (
int col=0; col<m_measureTable->columnCount(); col++)
2526 m_measureTable->item(row, col)->setFont(font);
2531 m_measureTable->resizeColumnsToContents();
2532 m_measureTable->resizeRowsToContents();
2533 m_measureTable->setSortingEnabled(
true);
2534 m_measureWindow->show();
2539 QString QnetTool::measureColumnToString(QnetTool::MeasureColumns column) {
2549 case SAMPLERESIDUAL:
2550 return "Sample Residual";
2552 return "Line Residual";
2553 case RESIDUALMAGNITUDE:
2554 return "Residual Magnitude";
2556 return "Sample Shift";
2558 return "Line Shift";
2560 return "Pixel Shift";
2562 return "Goodness of Fit";
2568 return "Measure Type";
2570 return "Apriori Sample";
2572 return "Apriori Line";
2575 "Invalid measure column passed to measureColumnToString",
_FILEINFO_);
2579 ControlNet *QnetTool::controlNet() {
2580 return m_controlNet;
2584 const ControlNet *QnetTool::controlNet()
const {
2585 return m_controlNet;
2589 SerialNumberList *QnetTool::serialNumberList() {
2590 return m_serialNumberList;
2594 const SerialNumberList *QnetTool::serialNumberList()
const {
2595 return m_serialNumberList;
2599 Workspace *QnetTool::workspace()
const {
2619 SurfacePoint aprioriPoint = m_editPoint->GetAprioriSurfacePoint();
2621 s =
"Apriori Latitude: Null";
2624 s =
"Apriori Latitude: " +
2627 m_pointAprioriLatitude->setText(s);
2629 s =
"Apriori Longitude: Null";
2632 s =
"Apriori Longitude: " +
2635 m_pointAprioriLongitude->setText(s);
2637 s =
"Apriori Radius: Null";
2640 s =
"Apriori Radius: " +
2644 m_pointAprioriRadius->setText(s);
2646 if (aprioriPoint.Valid()) {
2648 s =
"Apriori Latitude Sigma: Null";
2651 s =
"Apriori Latitude Sigma: " +
2655 m_pointAprioriLatitudeSigma->setText(s);
2657 s =
"Apriori Longitude Sigma: Null";
2660 s =
"Apriori Longitude Sigma: " +
2664 m_pointAprioriLongitudeSigma->setText(s);
2665 if (aprioriPoint.GetLocalRadiusSigma().
meters() ==
Null) {
2666 s =
"Apriori Radius Sigma: Null";
2669 s =
"Apriori Radius Sigma: " +
2670 QString::number(aprioriPoint.GetLocalRadiusSigma().
meters()) +
2673 m_pointAprioriRadiusSigma->setText(s);
2676 s =
"Apriori Latitude Sigma: Null";
2677 m_pointAprioriLatitudeSigma->setText(s);
2678 s =
"Apriori Longitude Sigma: Null";
2679 m_pointAprioriLongitudeSigma->setText(s);
2680 s =
"Apriori Radius Sigma: Null";
2681 m_pointAprioriRadiusSigma->setText(s);
2685 SurfacePoint point = m_editPoint->GetAdjustedSurfacePoint();
2687 s =
"Adjusted Latitude: Null";
2692 m_pointLatitude->setText(s);
2694 s =
"Adjusted Longitude: Null";
2699 m_pointLongitude->setText(s);
2701 s =
"Adjusted Radius: Null";
2704 s =
"Adjusted Radius: " +
2707 m_pointRadius->setText(s);
2725 int curIndex = m_rightCombo->currentIndex();
2726 if (curIndex < m_rightCombo->count() - 1) {
2728 m_rightCombo->setCurrentIndex(curIndex + 1);
2744 int curIndex = m_rightCombo->currentIndex();
2747 m_rightCombo->setCurrentIndex(curIndex - 1);
2766 QString file = m_pointFiles[index];
2768 QString serial = m_serialNumberList->
serialNumber(file);
2772 if (m_leftMeasure != NULL) {
2773 delete m_leftMeasure;
2774 m_leftMeasure = NULL;
2778 *m_leftMeasure = *((*m_editPoint)[serial]);
2781 m_leftCube.reset(
new Cube(file,
"r"));
2784 m_pointEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
2785 m_editPoint->GetId());
2801 QString file = m_pointFiles[index];
2803 QString serial = m_serialNumberList->
serialNumber(file);
2807 if (m_rightMeasure != NULL) {
2808 delete m_rightMeasure;
2809 m_rightMeasure = NULL;
2813 *m_rightMeasure = *((*m_editPoint)[serial]);
2816 m_rightCube.reset(
new Cube(file,
"r"));
2819 m_pointEditor->setRightMeasure (m_rightMeasure, m_rightCube.data(),
2820 m_editPoint->GetId());
2847 m_leftMeasure->GetCubeSerialNumber()));
2849 m_ignoreLeftMeasure->setChecked(m_leftMeasure->IsIgnored());
2851 QString s =
"Reference: ";
2852 if (m_editPoint->IsReferenceExplicit() &&
2853 (QString(m_leftMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2859 m_leftReference->setText(s);
2861 s =
"Measure Type: ";
2866 m_leftMeasureType->setText(s);
2868 if (m_leftMeasure->GetSampleResidual() ==
Null) {
2869 s =
"Sample Residual: Null";
2872 s =
"Sample Residual: " + QString::number(m_leftMeasure->GetSampleResidual());
2874 m_leftSampError->setText(s);
2875 if (m_leftMeasure->GetLineResidual() ==
Null) {
2876 s =
"Line Residual: Null";
2879 s =
"Line Residual: " + QString::number(m_leftMeasure->GetLineResidual());
2881 m_leftLineError->setText(s);
2883 if (m_leftMeasure->GetSampleShift() ==
Null) {
2884 s =
"Sample Shift: Null";
2887 s =
"Sample Shift: " + QString::number(m_leftMeasure->GetSampleShift());
2889 m_leftSampShift->setText(s);
2891 if (m_leftMeasure->GetLineShift() ==
Null) {
2892 s =
"Line Shift: Null";
2895 s =
"Line Shift: " + QString::number(m_leftMeasure->GetLineShift());
2897 m_leftLineShift->setText(s);
2899 double goodnessOfFit = m_leftMeasure->GetLogData(
2901 if (goodnessOfFit ==
Null) {
2902 s =
"Goodness of Fit: Null";
2905 s =
"Goodness of Fit: " + QString::number(goodnessOfFit);
2907 m_leftGoodness->setText(s);
2935 m_rightMeasure->GetCubeSerialNumber()));
2937 m_ignoreRightMeasure->setChecked(m_rightMeasure->IsIgnored());
2939 QString s =
"Reference: ";
2940 if (m_editPoint->IsReferenceExplicit() &&
2941 (QString(m_rightMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2948 m_rightReference->setText(s);
2950 s =
"Measure Type: ";
2955 m_rightMeasureType->setText(s);
2957 if (m_rightMeasure->GetSampleResidual() ==
Null) {
2958 s =
"Sample Residual: Null";
2961 s =
"Sample Residual: " + QString::number(m_rightMeasure->GetSampleResidual());
2963 m_rightSampError->setText(s);
2964 if (m_rightMeasure->GetLineResidual() ==
Null) {
2965 s =
"Line Residual: Null";
2968 s =
"Line Residual: " + QString::number(m_rightMeasure->GetLineResidual());
2970 m_rightLineError->setText(s);
2972 if (m_rightMeasure->GetSampleShift() ==
Null) {
2973 s =
"Sample Shift: Null";
2976 s =
"Sample Shift: " + QString::number(m_rightMeasure->GetSampleShift());
2978 m_rightSampShift->setText(s);
2980 if (m_rightMeasure->GetLineShift() ==
Null) {
2981 s =
"Line Shift: Null";
2984 s =
"Line Shift: " + QString::number(m_rightMeasure->GetLineShift());
2986 m_rightLineShift->setText(s);
2988 double goodnessOfFit = m_rightMeasure->GetLogData(
2990 if (goodnessOfFit ==
Null) {
2991 s =
"Goodness of Fit: Null";
2994 s =
"Goodness of Fit: " + QString::number(goodnessOfFit);
2996 m_rightGoodness->setText(s);
3031 cam = m_controlNet->Camera(camIndex);
3033 cam->
SetImage(m.GetSample(),m.GetLine());
3037 for (
int i=0; i<m_serialNumberList->
size(); i++) {
3038 cam = m_controlNet->Camera(i);
3039 if (m_serialNumberList->
serialNumber(i) == m_groundSN)
continue;
3042 double samp = cam->
Sample();
3043 double line = cam->
Line();
3044 if (samp >= 1 && samp <= cam->Samples() &&
3045 line >= 1 && line <= cam->Lines()) {
3046 pointFiles<<m_serialNumberList->
fileName(i);
3052 newMeasureDialog->
setFiles(*m_editPoint,pointFiles);
3053 if (newMeasureDialog->exec()) {
3054 QStringList selectedFiles = newMeasureDialog->selectedFiles();
3055 foreach (QString selectedFile, selectedFiles) {
3059 QString sn = m_serialNumberList->
serialNumber(selectedFile);
3063 cam = m_controlNet->Camera(camIndex);
3066 m->SetAprioriSample(cam->
Sample());
3067 m->SetAprioriLine(cam->
Line());
3070 m_editPoint->Add(m);
3073 m_qnetTool->setVisible(
true);
3074 m_qnetTool->raise();
3077 m_pointEditor->templateFileName());
3081 emit editPointChanged(m_editPoint->GetId());
3098 if(e->type() != QEvent::Leave)
return false;
3099 if(o == m_leftCombo->view()) {
3101 m_leftCombo->hidePopup();
3103 if (o == m_rightCombo->view()) {
3105 m_rightCombo->hidePopup();
3145 vp->viewport()->update();
3173 if (m_controlNet == 0 || m_controlNet->GetNumPoints() == 0)
return;
3180 if (serialNumber == m_groundSN) {
3184 if (!m_controlNet->GetCubeSerials().contains(
3185 serialNumber))
return;
3188 m_controlNet->GetMeasuresInCube(serialNumber);
3190 for (
int i = 0; i < measures.count(); i++) {
3193 double samp = m->GetSample();
3194 double line = m->GetLine();
3198 if (m->Parent()->IsIgnored()) {
3199 painter->setPen(QColor(255, 255, 0));
3202 else if (m->IsIgnored()) {
3203 painter->setPen(QColor(255, 255, 0));
3207 painter->setPen(Qt::magenta);
3210 painter->setPen(Qt::green);
3213 painter->drawLine(x - 5, y, x + 5, y);
3214 painter->drawLine(x, y - 5, x, y + 5);
3217 if (m_editPoint != NULL) {
3219 if (m_editPoint->HasSerialNumber(serialNumber)) {
3221 double samp = (*m_editPoint)[serialNumber]->GetSample();
3222 double line = (*m_editPoint)[serialNumber]->GetLine();
3226 QBrush brush(Qt::red);
3230 painter->setPen(pen);
3231 painter->drawLine(x - 5, y, x + 5, y);
3232 painter->drawLine(x, y - 5, x, y + 5);
3252 for (
int i = 0; i < m_controlNet->GetNumPoints(); i++) {
3255 if (!p.HasAprioriCoordinates())
continue;
3258 if (m_groundGmap->SetGround(p.GetAprioriSurfacePoint().
GetLatitude(),
3260 double samp = m_groundGmap->Sample();
3261 double line = m_groundGmap->Line();
3265 if (p.IsIgnored()) {
3266 painter->setPen(QColor(255, 255, 0));
3269 painter->setPen(Qt::magenta);
3271 else if (&p == m_editPoint) {
3273 QBrush brush(Qt::red);
3278 painter->setPen(Qt::green);
3281 painter->drawLine(x - 5, y, x + 5, y);
3282 painter->drawLine(x, y - 5, x, y + 5);
3303 if (m_templateModified) {
3304 int r = QMessageBox::warning(m_qnetTool, tr(
"OK to continue?"),
3305 tr(
"The currently opened registration template has been modified.\n" 3307 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
3310 if (r == QMessageBox::Yes)
3312 else if (r == QMessageBox::Cancel)
3330 QString filename = QFileDialog::getOpenFileName(m_qnetTool,
3331 "Select a registration template",
".",
3332 "Registration template files (*.def *.pvl);;All files (*)");
3334 if (filename.isEmpty())
3337 if (m_pointEditor->setTemplateFile(filename)) {
3350 QFile file(
FileName(fn).expanded());
3351 if (!file.open(QIODevice::ReadOnly)) {
3352 QString msg =
"Failed to open template file \"" + fn +
"\"";
3353 QMessageBox::warning(m_qnetTool,
"IO Error", msg);
3357 QTextStream stream(&file);
3358 m_templateEditor->setText(stream.readAll());
3361 QScrollBar * sb = m_templateEditor->verticalScrollBar();
3362 sb->setValue(sb->minimum());
3364 m_templateModified =
false;
3365 m_saveTemplateFile->setEnabled(
false);
3366 m_templateFileNameLabel->setText(
"Template File: " + fn);
3372 m_templateModified =
true;
3373 m_saveTemplateFile->setEnabled(
true);
3380 if (!m_templateModified)
3383 QString filename = m_pointEditor->templateFileName();
3392 QString filename = QFileDialog::getSaveFileName(m_qnetTool,
3393 "Save registration template",
".",
3394 "Registration template files (*.def *.pvl);;All files (*)");
3396 if (filename.isEmpty())
3410 QString contents = m_templateEditor->toPlainText();
3421 QMessageBox::warning(m_qnetTool,
"Error", message);
3425 QString expandedFileName(
FileName(fn).expanded());
3427 QFile file(expandedFileName);
3429 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
3430 QString msg =
"Failed to save template file to \"" + fn +
"\"\nDo you " 3432 QMessageBox::warning(m_qnetTool,
"IO Error", msg);
3437 QTextStream stream(&file);
3441 if (m_pointEditor->setTemplateFile(fn)) {
3442 m_templateModified =
false;
3443 m_saveTemplateFile->setEnabled(
false);
3444 m_templateFileNameLabel->setText(
"Template File: " + fn);
3465 Pvl templatePvl(m_pointEditor->templateFileName());
3469 registrationDialog.setWindowTitle(
"View or Edit Template File: " 3470 + templatePvl.fileName());
3471 registrationDialog.resize(550,360);
3472 registrationDialog.exec();
3476 QMessageBox::information(m_qnetTool,
"Error", message);
3489 m_pointEditor->saveChips();
3493 void QnetTool::showHideTemplateEditor() {
3495 if (!m_templateEditorWidget)
3498 m_templateEditorWidget->setVisible(!m_templateEditorWidget->isVisible());
3516 if (m_editPoint == NULL)
return;
3517 if (pointId != m_editPoint->GetId())
return;
3522 ControlPoint *updatedPoint = m_controlNet->GetPoint(pointId);
3523 m_editPoint->SetEditLock(updatedPoint->IsEditLocked());
3524 m_editPoint->SetIgnored(updatedPoint->IsIgnored());
3525 m_editPoint->SetAprioriSurfacePoint(updatedPoint->GetAprioriSurfacePoint());
3528 m_lockPoint->setChecked(m_editPoint->IsEditLocked());
3531 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
3560 if (m_editPoint != NULL) {
3562 QString
id = m_ptIdValue->text().remove(
"Point ID: ");
3563 m_controlNet->GetPoint(
id);
3568 emit editPointChanged(
"");
3569 m_qnetTool->setVisible(
false);
3570 m_measureWindow->setVisible(
false);
3574 if (m_editPoint == NULL) {
3610 QToolButton *showNavToolButton =
new QToolButton();
3611 showNavToolButton->setText(
"Show Nav Tool");
3612 showNavToolButton->setToolTip(
"Shows the Navigation Tool Window");
3614 "<b>Function:</b> This button will bring up the Navigation Tool window that allows \ 3615 the user to view, modify, ignore, delete, or filter points and cubes.";
3616 showNavToolButton->setWhatsThis(text);
3617 connect(showNavToolButton,SIGNAL(clicked(
bool)),
this,SLOT(
showNavWindow(
bool)));
3619 QHBoxLayout *layout =
new QHBoxLayout(hbox);
3620 layout->setMargin(0);
3621 layout->addWidget(showNavToolButton);
3622 layout->addStretch(1);
3623 hbox->setLayout(layout);
3650 QString filter =
"Isis cubes (*.cub *.cub.*);;";
3651 filter +=
"Detached labels (*.lbl);;";
3652 filter +=
"All (*)";
3654 QString ground = QFileDialog::getOpenFileName((
QWidget*)parent(),
3655 "Open ground source",
3658 if (ground.isEmpty())
return;
3664 if (m_groundOpen && m_groundFile ==
FileName(ground).name()) {
3671 m_workspace->mdiArea()->setActiveSubWindow(
3680 if (newGroundSN != m_groundSN && m_serialNumberList->
hasSerialNumber(newGroundSN)) {
3683 QString message =
"A cube in the cube list has the same serial number as this ground file. ";
3684 message +=
"If this ground source is a level 1, un-projected cube, it is probably included ";
3685 message +=
"in the cube list. If the ground source is a projected version of a cube in ";
3686 message +=
"the list and has the Instrument Group in the labels, the un-projected and ";
3687 message +=
"projected cube will have the same serial number. \n";
3688 message +=
"Because of duplicate serial numbers this cube cannot be used as a ground ";
3689 message +=
"source.\n\n";
3690 message +=
"NOTE: If this cube is the reference cube you can select points in ";
3691 message +=
"the Navigator window, then select the Set Apriori button to use this cube to ";
3692 message +=
"set the apriori latitude, longitude and radius.";
3693 QMessageBox::critical(m_qnetTool,
"Cannot set ground source", message);
3702 clearGroundSource ();
3705 QApplication::setOverrideCursor(Qt::WaitCursor);
3710 m_groundCube.reset(NULL);
3711 m_groundGmap.reset(NULL);
3714 QScopedPointer<Cube> newGroundCube(
new Cube(ground,
"r"));
3715 QScopedPointer<UniversalGroundMap> newGroundGmap(
new UniversalGroundMap(*newGroundCube));
3717 m_groundFile =
FileName(newGroundCube->fileName()).name();
3718 m_groundCube.reset(newGroundCube.take());
3719 m_groundGmap.reset(newGroundGmap.take());
3721 m_serialNumberList->
add(ground,
true);
3724 QApplication::restoreOverrideCursor();
3725 QMessageBox::critical(m_qnetTool,
"Error", e.
toString());
3727 m_groundFile.clear();
3734 emit refreshNavList();
3738 m_groundSN = newGroundSN;
3739 m_groundSourceFile = ground;
3740 m_groundOpen =
true;
3742 m_workspace->addCubeViewport(m_groundCube.data());
3757 if (m_editPoint != NULL) {
3763 else if (m_groundCube->hasTable(
"ShapeModelStatistics")) {
3764 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Basemap;
3766 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3767 m_radiusSourceFile = ground;
3774 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Basemap;
3776 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3777 m_radiusSourceFile =
"";
3783 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Reference;
3785 PvlGroup kernels = m_groundCube->group(
"Kernels");
3786 QString shapeFile = kernels [
"ShapeModel"];
3787 if (shapeFile.contains(
"dem")) {
3788 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3789 m_radiusSourceFile = shapeFile;
3792 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3794 m_radiusSourceFile = (QString) kernels[
"TargetAttitudeShape"];
3799 QString message =
"Cannot create either Camera or Projections ";
3800 message +=
"for the ground source file. Check the validity of the ";
3801 message +=
" cube labels. The cube must either be projected or ";
3802 message +=
" run through spiceinit.";
3803 QMessageBox::critical(m_qnetTool,
"Error", message);
3805 clearGroundSource ();
3806 QApplication::restoreOverrideCursor();
3807 emit refreshNavList();
3814 if (m_editPoint != NULL &&
3818 emit refreshNavList();
3819 QApplication::restoreOverrideCursor();
3832 if (m_groundFile.isEmpty()) {
3833 QString message =
"You must enter a ground source before opening a Dem.";
3834 QMessageBox::critical(m_qnetTool,
"Error", message);
3838 QString filter =
"Isis cubes (*.cub *.cub.*);;";
3839 filter +=
"Detached labels (*.lbl);;";
3840 filter +=
"All (*)";
3841 QString dem = QFileDialog::getOpenFileName((
QWidget*)parent(),
3845 if (dem.isEmpty())
return;
3860 QString referenceSN = m_editPoint->GetReferenceSN();
3861 QString referenceFileName = m_serialNumberList->
fileName(referenceSN);
3862 QScopedPointer<Cube> referenceCube(
new Cube(referenceFileName,
"r"));
3863 PvlGroup kernels = referenceCube->group(
"Kernels");
3864 QString shapeFile = kernels[
"ShapeModel"];
3869 if (shapeFile.contains(
".cub")) {
3870 if (shapeFile.contains(
"dem")) {
3871 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3874 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3877 m_radiusSourceFile = shapeFile;
3885 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3888 refSpice->
radii(refRadii);
3889 m_demFile = QString::number(refRadii[0].meters()) +
", " +
3890 QString::number(refRadii[1].meters()) +
", " +
3891 QString::number(refRadii[2].meters());
3893 m_radiusSourceFile =
"";
3896 m_groundFileNameLabel->setText(
"Ground Source File: " + m_groundFile);
3897 m_radiusFileNameLabel->setText(
"Radius Source: " + m_demFile);
3901 void QnetTool::initDem (QString demFile) {
3905 QApplication::setOverrideCursor(Qt::WaitCursor);
3907 if (m_demFile == demFile) {
3908 QApplication::restoreOverrideCursor();
3912 m_demCube.reset(NULL);
3917 QScopedPointer<Cube> newDemCube(
new Cube(demFile,
"r"));
3919 m_demFile = FileName(newDemCube->fileName()).name();
3920 m_demCube.reset(newDemCube.take());
3922 catch (IException &e) {
3923 QMessageBox::critical(m_qnetTool,
"Error", e.toString());
3924 QApplication::restoreOverrideCursor();
3930 if (!m_demCube->hasTable(
"ShapeModelStatistics")) {
3931 QString message = m_demFile +
" is not a DEM.";
3932 QMessageBox::critical(m_qnetTool,
"Error", message);
3933 m_demCube.reset(NULL);
3936 QApplication::restoreOverrideCursor();
3939 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3940 m_groundFileNameLabel->setText(
"Ground Source File: " + m_groundFile);
3941 m_radiusFileNameLabel->setText(
"Radius Source File: " + m_demFile);
3942 m_radiusSourceFile = demFile;
3944 QApplication::restoreOverrideCursor();
3959 clearGroundSource();
3964 void QnetTool::clearGroundSource () {
3966 m_leftCombo->removeItem(m_leftCombo->findText(m_groundFile));
3967 m_rightCombo->removeItem(m_rightCombo->findText(m_groundFile));
3973 if (vp->
cube() == m_groundCube.data()) {
3978 vp->parentWidget()->parentWidget()->close();
3979 QApplication::processEvents();
3985 m_groundOpen =
false;
3986 m_groundCube.take();
3987 m_groundFile.clear();
3988 m_groundGmap.reset(NULL);
3990 m_groundFileNameLabel->setText(
"Ground Source File: ");
3992 m_radiusFileNameLabel->setText(
"Radius Source File: " + m_demFile);
3996 m_serialNumberList->
remove(m_groundSN);
4002 m_editPoint->HasSerialNumber(m_groundSN)) {
4003 m_editPoint->Delete(m_groundSN);
4025 if (!m_demOpen)
return Null;
4040 m_demCube->pixelType(),
4043 m_demCube->read(*portal);
4068 QColor qc = Qt::red;
4069 QPalette p = m_savePoint->palette();
4070 p.setColor(QPalette::ButtonText,qc);
4071 m_savePoint->setPalette(p);
4091 if (m_editPoint == NULL)
return false;
4094 if (m_editPoint->IsEditLocked() && m_editPoint->IsReferenceExplicit() &&
4095 (m_editPoint->GetReferenceSN() == serialNumber)) {
4100 return m_editPoint->GetMeasure(serialNumber)->IsEditLocked();
4113 FileName config(
"$HOME/.Isis/qnet/QnetTool.config");
4114 QSettings settings(config.
expanded(), QSettings::NativeFormat);
4115 QPoint pos = settings.value(
"pos", QPoint(300, 100)).toPoint();
4116 QSize size = settings.value(
"size", QSize(900, 500)).toSize();
4117 m_qnetTool->resize(size);
4118 m_qnetTool->move(pos);
4131 if(!m_qnetTool->isVisible())
return;
4132 FileName config(
"$HOME/.Isis/qnet/QnetTool.config");
4133 QSettings settings(config.
expanded(), QSettings::NativeFormat);
4134 settings.setValue(
"pos", m_qnetTool->pos());
4135 settings.setValue(
"size", m_qnetTool->size());
4140 void QnetTool::enterWhatsThisMode() {
4141 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.
bool HasSerialNumber(QString serialNumber) const
Return true if given serial number exists in point.
double meters() const
Get the distance in meters.
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.
double * DoubleBuffer() const
Returns the value of the shape buffer.
double Line() const
Returns the current line value of the camera model or projection.
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.
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 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.
double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
void add(const QString &filename, bool def2filename=false)
Adds a new filename / serial number pair to the SerialNumberList.
Buffer for containing a two dimensional section of an image.
QString serialNumber(const QString &filename)
Return a serial number given a filename.
double GetResidualMagnitude() const
Return Residual magnitude.
PointType
These are the valid 'types' of point.
Namespace for the standard library.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
This class is designed to encapsulate the concept of a Latitude.
Distance GetLatSigmaDistance() const
Return the latitude sigma as a Distance.
int fileNameIndex(const QString &filename)
Return a list index given a filename.
Status SetChooserName(QString name)
Set the point's chooser name.
Widget to display Isis cubes for qt apps.
void cubeToViewport(double sample, double line, int &x, int &y) const
Turns a cube into a viewport.
Distance GetLonSigmaDistance() const
Return the longitude sigma in meters.
Registered to whole pixel (e.g.,pointreg)
Registered to sub-pixel (e.g., pointreg)
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.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
double degrees() const
Get the angle in units of Degrees.
A Free point is a Control Point that identifies common measurements between two or more cubes...
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
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.
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.
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Hand Measured (e.g., qnet)
QString GetId() const
Return the Id of the control point.
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)
Contains multiple PvlContainers.
UniversalGroundMap * universalGroundMap() const
#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 UniversalLatitude() const
Returns the universal latitude of the camera model or projection.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
void remove(const QString &sn)
Remove the specified serial number from the list.
Container for cube-like labels.
double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
void SetPosition(const double sample, const double line, const int band)
Sets the line and sample position of the buffer.
int size() const
How many serial number / filename combos are in the list.
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.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
QString toString() const
Returns a string representation of this exception.
int Lines()
Returns the number of lines needed by the interpolator.
virtual QString fileName() const
Returns the opened cube's filename.
void setFiles(QStringList pointFiles)
Set files found containing selected point.
double Line()
Returns the current line number.
static QString UserName()
Returns the user name.
Status SetChooserName()
Set chooser name to a user who last changed the coordinate.
Namespace for ISIS/Bullet specific routines.
bool IsEditLocked() const
Return value for p_editLock or implicit lock on reference measure.
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...
void setFiles(QStringList pointFiles)
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.
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.
double GetNumericalValue() const
Get the value associated with this log data.
double Sample() const
Returns the current line value of the camera model or projection.
PointType GetType() const
Serial Number list generator.
Distance GetLocalRadius() const
Return the radius of the surface point.
double UniversalLongitude() const
Returns the universal longitude of the camera model or projection.
void radii(Distance r[3]) const
Returns the radii of the body in km.
void viewportToCube(int x, int y, double &sample, double &line) const
Turns a viewport into a cube.
static QString PointTypeToString(PointType type)
Obtain a string representation of a given PointType.
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
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.