14#include <QStackedWidget>
16#include <QTableWidget>
19#include "QnetDeletePointDialog.h"
20#include "QnetNewMeasureDialog.h"
21#include "NewControlPointDialog.h"
22#include "QnetFixedPointDialog.h"
25#include "Application.h"
28#include "CameraFactory.h"
29#include "ControlMeasure.h"
30#include "ControlMeasureLogData.h"
31#include "ControlNet.h"
32#include "ControlPoint.h"
33#include "ControlPointEdit.h"
36#include "IException.h"
39#include "MainWindow.h"
40#include "MdiCubeViewport.h"
41#include "Projection.h"
42#include "ProjectionFactory.h"
44#include "PvlEditDialog.h"
45#include "SerialNumber.h"
46#include "SpecialPixel.h"
48#include "SurfacePoint.h"
51#include "UniversalGroundMap.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)) {
81 m_workspace = qobject_cast<ViewportMainWindow *>(parent)->workspace();
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 https://astrogeology.usgs.gov/docs/concepts/control-networks/pattern-matching/ for a description of the "
189 "contents of this file.");
191 m_groundFileNameLabel =
new QLabel(
"Ground Source File: ");
192 m_groundFileNameLabel->setToolTip(
"Cube used to create ground control "
193 "points, either Fixed or Constrained.");
194 m_groundFileNameLabel->setWhatsThis(
"This cube is used to create ground "
195 "control points, Fixed or Constrained. This may "
196 "be a Dem, a shaded relief version of a Dem, "
197 "a projected basemap or an unprojected cube with "
198 "corrected camera pointing. This will be used "
199 "to set the apriori latitude, longitude.");
200 m_radiusFileNameLabel =
new QLabel(
"Radius Source: ");
201 m_radiusFileNameLabel->setToolTip(
"Dem used to set the radius of ground "
202 "control points, Fixed or Constrained. This must "
203 "be a Dem and is strictly used to set the apriori "
204 "radius for ground control points.");
206 QVBoxLayout * centralLayout =
new QVBoxLayout;
208 centralLayout->addWidget(m_templateFileNameLabel);
209 centralLayout->addWidget(m_groundFileNameLabel);
210 centralLayout->addWidget(m_radiusFileNameLabel);
212 centralLayout->addStretch();
213 centralLayout->addWidget(m_pointEditor);
214 centralLayout->addLayout(addMeasureLayout);
216 centralWidget->setLayout(centralLayout);
218 QScrollArea *scrollArea =
new QScrollArea();
219 scrollArea->setObjectName(
"QnetToolScroll");
220 scrollArea->setWidget(centralWidget);
221 scrollArea->setWidgetResizable(
true);
222 centralWidget->adjustSize();
223 m_qnetTool->setCentralWidget(scrollArea);
227 connect(
this, SIGNAL(editPointChanged(QString)),
237 QHBoxLayout * measureLayout =
new QHBoxLayout;
241 QVBoxLayout * groupBoxesLayout =
new QVBoxLayout;
243 groupBoxesLayout->addStretch();
244 groupBoxesLayout->addLayout(measureLayout);
247 groupBoxesWidget->setLayout(groupBoxesLayout);
251 QSplitter * topSplitter =
new QSplitter;
252 topSplitter->addWidget(groupBoxesWidget);
253 topSplitter->addWidget(m_templateEditorWidget);
254 topSplitter->setStretchFactor(0, 4);
255 topSplitter->setStretchFactor(1, 3);
257 m_templateEditorWidget->hide();
267 m_ptIdValue =
new QLabel;
269 for (
int i=0; i<ControlPoint::PointTypeCount; i++) {
273 QHBoxLayout *pointTypeLayout =
new QHBoxLayout;
274 QLabel *pointTypeLabel =
new QLabel(
"PointType:");
275 pointTypeLayout->addWidget(pointTypeLabel);
276 pointTypeLayout->addWidget(m_pointType);
277 connect(m_pointType, SIGNAL(activated(
int)),
279 m_numMeasures =
new QLabel;
280 m_pointAprioriLatitude =
new QLabel;
281 m_pointAprioriLongitude =
new QLabel;
282 m_pointAprioriRadius =
new QLabel;
283 m_pointAprioriLatitudeSigma =
new QLabel;
284 m_pointAprioriLongitudeSigma =
new QLabel;
285 m_pointAprioriRadiusSigma =
new QLabel;
286 QVBoxLayout * leftLayout =
new QVBoxLayout;
287 leftLayout->addWidget(m_ptIdValue);
288 leftLayout->addLayout(pointTypeLayout);
289 leftLayout->addWidget(m_pointAprioriLatitude);
290 leftLayout->addWidget(m_pointAprioriLongitude);
291 leftLayout->addWidget(m_pointAprioriRadius);
292 leftLayout->addWidget(m_pointAprioriLatitudeSigma);
293 leftLayout->addWidget(m_pointAprioriLongitudeSigma);
294 leftLayout->addWidget(m_pointAprioriRadiusSigma);
297 m_lockPoint =
new QCheckBox(
"Edit Lock Point");
298 connect(m_lockPoint, SIGNAL(clicked(
bool)),
this, SLOT(
setLockPoint(
bool)));
299 m_ignorePoint =
new QCheckBox(
"Ignore Point");
300 connect(m_ignorePoint, SIGNAL(clicked(
bool)),
302 connect(
this, SIGNAL(ignorePointChanged()), m_ignorePoint, SLOT(toggle()));
303 m_pointLatitude =
new QLabel;
304 m_pointLongitude =
new QLabel;
305 m_pointRadius =
new QLabel;
307 QVBoxLayout * rightLayout =
new QVBoxLayout;
308 rightLayout->addWidget(m_numMeasures);
309 rightLayout->addWidget(m_lockPoint);
310 rightLayout->addWidget(m_ignorePoint);
311 rightLayout->addWidget(m_pointLatitude);
312 rightLayout->addWidget(m_pointLongitude);
313 rightLayout->addWidget(m_pointRadius);
316 QHBoxLayout * mainLayout =
new QHBoxLayout;
317 mainLayout->addLayout(leftLayout);
318 mainLayout->addStretch();
319 mainLayout->addLayout(rightLayout);
322 QGroupBox * groupBox =
new QGroupBox(
"Control Point");
323 groupBox->setLayout(mainLayout);
333 m_leftCombo->setEditable(
true);
334 m_leftCombo->setInsertPolicy(QComboBox::NoInsert);
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->setEditable(
true);
408 m_rightCombo->setInsertPolicy(QComboBox::NoInsert);
412 QShortcut *nextMeasure =
new QShortcut(Qt::Key_PageDown, m_qnetTool);
414 QShortcut *prevMeasure =
new QShortcut(Qt::Key_PageUp, m_qnetTool);
417 m_rightCombo->setToolTip(
"Choose right control measure. "
418 "<strong>Shortcuts: PageUp/PageDown</strong>");
419 m_rightCombo->setWhatsThis(
"Choose right control measure identified by "
421 "Note: PageUp selects previous measure; "
422 "PageDown selects next meausure.");
423 connect(m_rightCombo, SIGNAL(activated(
int)),
425 m_lockRightMeasure =
new QCheckBox(
"Edit Lock Measure");
426 connect(m_lockRightMeasure, SIGNAL(clicked(
bool)),
428 m_ignoreRightMeasure =
new QCheckBox(
"Ignore Measure");
429 connect(m_ignoreRightMeasure, SIGNAL(clicked(
bool)),
431 connect(
this, SIGNAL(ignoreRightChanged()),
432 m_ignoreRightMeasure, SLOT(toggle()));
433 m_rightReference =
new QLabel();
434 m_rightMeasureType =
new QLabel();
435 m_rightSampError =
new QLabel();
436 m_rightSampError->setToolTip(
"<strong>Jigsaw</strong> sample residual.");
437 m_rightSampError->setWhatsThis(
"This is the sample residual for the right "
438 "measure which was calculated by the application, "
439 "<strong>jigsaw</strong>.");
440 m_rightLineError =
new QLabel();
441 m_rightLineError->setToolTip(
"<strong>Jigsaw</strong> line residual.");
442 m_rightLineError->setWhatsThis(
"This is the line residual for the right "
443 "measure which was calculated by the application, "
444 "<strong>jigsaw</strong>.");
445 m_rightSampShift =
new QLabel();
446 m_rightSampShift->setToolTip(m_leftSampShift->toolTip());
447 m_rightSampShift->setWhatsThis(m_leftSampShift->whatsThis());
448 m_rightLineShift =
new QLabel();
449 m_rightLineShift->setToolTip(m_leftLineShift->toolTip());
450 m_rightLineShift->setWhatsThis(m_leftLineShift->whatsThis());
451 m_rightGoodness =
new QLabel();
452 m_rightGoodness->setToolTip(m_leftGoodness->toolTip());
453 m_rightGoodness->setWhatsThis(m_leftGoodness->whatsThis());
456 QVBoxLayout * rightLayout =
new QVBoxLayout;
457 rightLayout->addWidget(m_rightCombo);
458 rightLayout->addWidget(m_lockRightMeasure);
459 rightLayout->addWidget(m_ignoreRightMeasure);
460 rightLayout->addWidget(m_rightReference);
461 rightLayout->addWidget(m_rightMeasureType);
462 rightLayout->addWidget(m_rightSampError);
463 rightLayout->addWidget(m_rightLineError);
464 rightLayout->addWidget(m_rightSampShift);
465 rightLayout->addWidget(m_rightLineShift);
466 rightLayout->addWidget(m_rightGoodness);
468 QGroupBox * rightGroupBox =
new QGroupBox(
"Right Measure");
469 rightGroupBox->setLayout(rightLayout);
471 return rightGroupBox;
480 toolBar->addAction(m_openTemplateFile);
481 toolBar->addSeparator();
482 toolBar->addAction(m_saveTemplateFile);
483 toolBar->addAction(m_saveTemplateFileAs);
485 m_templateEditor =
new QTextEdit;
486 connect(m_templateEditor, SIGNAL(textChanged()),
this,
489 QVBoxLayout *mainLayout =
new QVBoxLayout;
490 mainLayout->addWidget(toolBar);
491 mainLayout->addWidget(m_templateEditor);
493 m_templateEditorWidget =
new QWidget;
494 m_templateEditorWidget->setLayout(mainLayout);
507 m_openGround =
new QAction(m_qnetTool);
508 m_openGround->setText(
"Open &Ground Source");
509 m_openGround->setToolTip(
"Open a ground source for choosing ground control "
511 m_openGround->setStatusTip(
"Open a ground source for choosing ground "
514 "<b>Function:</b> Open and display a ground source for choosing "
515 "ground control points, both Fixed and Constrained."
516 "This cube can be a level1, level2 or dem cube.";
517 m_openGround->setWhatsThis(whatsThis);
518 connect (m_openGround,SIGNAL(triggered()),
this,SLOT(
openGround()));
520 m_openDem =
new QAction(m_qnetTool);
521 m_openDem->setText(
"Open &Radius Source");
522 m_openDem->setToolTip(
"Open radius source file for ground control points");
523 m_openDem->setStatusTip(
"Open radius source file for ground control points");
525 "<b>Function:</b> Open a DEM for determining the radius when "
526 "choosing ground control points. This is not the file that will be "
527 "displayed for visually picking points. This is strictly used to "
528 "determine the radius value for ground control points.";
529 m_openDem->setWhatsThis(whatsThis);
530 connect (m_openDem,SIGNAL(triggered()),
this,SLOT(
openDem()));
532 m_saveNet =
new QAction(QIcon(
toolIconDir() +
"/filesave.png"),
"Save Control Network ...",
534 m_saveNet->setShortcut(Qt::CTRL + Qt::Key_S);
535 m_saveNet->setToolTip(
"Save current control network");
536 m_saveNet->setStatusTip(
"Save current control network");
537 whatsThis =
"<b>Function:</b> Saves the current <i>"
538 "control network</i>";
539 m_saveNet->setWhatsThis(whatsThis);
540 connect(m_saveNet, SIGNAL(triggered()),
this, SLOT(
saveNet()));
542 m_saveAsNet =
new QAction(QIcon(
toolIconDir() +
"/filesaveas.png"),
"Save Control Network &As...",
544 m_saveAsNet->setToolTip(
"Save current control network to chosen file");
545 m_saveAsNet->setStatusTip(
"Save current control network to chosen file");
546 whatsThis =
"<b>Function:</b> Saves the current <i>"
547 "control network</i> under chosen filename";
548 m_saveAsNet->setWhatsThis(whatsThis);
549 connect(m_saveAsNet, SIGNAL(triggered()),
this, SLOT(
saveAsNet()));
551 m_closeQnetTool =
new QAction(QIcon(
toolIconDir() +
"/fileclose.png"),
"&Close", m_qnetTool);
552 m_closeQnetTool->setToolTip(
"Close this window");
553 m_closeQnetTool->setStatusTip(
"Close this window");
554 m_closeQnetTool->setShortcut(Qt::ALT + Qt::Key_F4);
555 whatsThis =
"<b>Function:</b> Closes the Qnet Tool window for this point "
556 "<p><b>Shortcut:</b> Alt+F4 </p>";
557 m_closeQnetTool->setWhatsThis(whatsThis);
558 connect(m_closeQnetTool, SIGNAL(triggered()), m_qnetTool, SLOT(close()));
561 "&View/edit registration template", m_qnetTool);
562 m_showHideTemplateEditor->setCheckable(
true);
563 m_showHideTemplateEditor->setToolTip(
"View and/or edit the registration "
565 m_showHideTemplateEditor->setStatusTip(
"View and/or edit the registration "
567 whatsThis =
"<b>Function:</b> Displays the curent registration template. "
568 "The user may edit and save changes under a chosen filename.";
569 m_showHideTemplateEditor->setWhatsThis(whatsThis);
570 connect(m_showHideTemplateEditor, SIGNAL(triggered()),
this,
571 SLOT(showHideTemplateEditor()));
573 m_saveChips =
new QAction(QIcon(
toolIconDir() +
"/savechips.png"),
"Save registration chips",
575 m_saveChips->setToolTip(
"Save registration chips");
576 m_saveChips->setStatusTip(
"Save registration chips");
577 whatsThis =
"<b>Function:</b> Save registration chips to file. "
578 "Each chip: pattern, search, fit will be saved to a separate file.";
579 m_saveChips->setWhatsThis(whatsThis);
580 connect(m_saveChips, SIGNAL(triggered()),
this, SLOT(
saveChips()));
582 m_openTemplateFile =
new QAction(QIcon(
toolIconDir() +
"/fileopen.png"),
"&Open registration "
583 "template", m_qnetTool);
584 m_openTemplateFile->setToolTip(
"Set registration template");
585 m_openTemplateFile->setStatusTip(
"Set registration template");
586 whatsThis =
"<b>Function:</b> Allows user to select a new file to set as "
587 "the registration template";
588 m_openTemplateFile->setWhatsThis(whatsThis);
589 connect(m_openTemplateFile, SIGNAL(triggered()),
this, SLOT(
openTemplateFile()));
591 m_saveTemplateFile =
new QAction(QIcon(
toolIconDir() +
"/filesave.png"),
"&Save template file",
593 m_saveTemplateFile->setToolTip(
"Save the template file");
594 m_saveTemplateFile->setStatusTip(
"Save the template file");
595 m_saveTemplateFile->setWhatsThis(
"Save the registration template file");
596 connect(m_saveTemplateFile, SIGNAL(triggered()),
this,
599 m_saveTemplateFileAs =
new QAction(QIcon(
toolIconDir() +
"/filesaveas.png"),
"&Save template as...",
601 m_saveTemplateFileAs->setToolTip(
"Save the template file as");
602 m_saveTemplateFileAs->setStatusTip(
"Save the template file as");
603 m_saveTemplateFileAs->setWhatsThis(
"Save the registration template file as");
604 connect(m_saveTemplateFileAs, SIGNAL(triggered()),
this,
608 "$ISISROOT/appdata/images/icons/contexthelp.png").expanded()),
"&Whats's This", m_qnetTool);
609 m_whatsThis->setShortcut(Qt::SHIFT | Qt::Key_F1);
610 m_whatsThis->setToolTip(
"Activate What's This and click on items on "
611 "user interface to see more information.");
612 connect(m_whatsThis, SIGNAL(triggered()),
this, SLOT(enterWhatsThisMode()));
629 QMenu *fileMenu = m_qnetTool->menuBar()->addMenu(
"&File");
630 fileMenu->addAction(m_openGround);
631 fileMenu->addAction(m_openDem);
632 fileMenu->addAction(m_saveNet);
633 fileMenu->addAction(m_saveAsNet);
634 fileMenu->addAction(m_closeQnetTool);
636 QMenu * regMenu = m_qnetTool->menuBar()->addMenu(
"&Registration");
637 regMenu->addAction(m_openTemplateFile);
638 regMenu->addAction(m_showHideTemplateEditor);
639 regMenu->addAction(m_saveChips);
641 QMenu *helpMenu = m_qnetTool->menuBar()->addMenu(
"&Help");
642 helpMenu->addAction(m_whatsThis);
646 void QnetTool::createToolBars() {
649 toolBar->setObjectName(
"TemplateEditorToolBar");
650 toolBar->setFloatable(
false);
651 toolBar->addAction(m_saveNet);
652 toolBar->addSeparator();
653 toolBar->addAction(m_showHideTemplateEditor);
654 toolBar->addAction(m_saveChips);
655 toolBar->addAction(m_whatsThis);
657 m_qnetTool->addToolBar(Qt::TopToolBarArea, toolBar);
729 m_editPoint->GetMeasure(m_leftMeasure->GetCubeSerialNumber());
731 m_editPoint->GetMeasure(m_rightMeasure->GetCubeSerialNumber());
733 if (m_editPoint->IsIgnored()) {
734 QString message =
"You are saving changes to a measure on an ignored ";
735 message +=
"point. Do you want to set Ignore = False on the point and ";
736 message +=
"both measures?";
737 switch (QMessageBox::question(m_qnetTool,
"Qnet Tool Save Measure",
738 message,
"&Yes",
"&No", 0, 0)) {
741 m_editPoint->SetIgnored(
false);
742 emit ignorePointChanged();
743 if (m_leftMeasure->IsIgnored()) {
744 m_leftMeasure->SetIgnored(
false);
745 emit ignoreLeftChanged();
747 if (m_rightMeasure->IsIgnored()) {
748 m_rightMeasure->SetIgnored(
false);
749 emit ignoreRightChanged();
757 if (origRightMeasure->IsIgnored() && m_rightMeasure->IsIgnored()) {
758 QString message =
"You are saving changes to an ignored measure. ";
759 message +=
"Do you want to set Ignore = False on the right measure?";
760 switch(QMessageBox::question(m_qnetTool,
"Qnet Tool Save Measure",
761 message,
"&Yes",
"&No", 0, 0)){
764 m_rightMeasure->SetIgnored(
false);
765 emit ignoreRightChanged();
774 if (m_editPoint->IsReferenceExplicit()) {
775 if (m_editPoint->IsEditLocked()) {
776 QString message =
"This control point is edit locked. The Apriori latitude, longitude and ";
777 message +=
"radius cannot be updated. You must first unlock the point by clicking the ";
778 message +=
"check box above labeled \"Edit Lock Point\".";
779 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
787 else if (m_leftMeasure->GetCubeSerialNumber() != m_groundSN) {
788 m_editPoint->SetRefMeasure(m_leftMeasure->GetCubeSerialNumber());
798 m_rightMeasure->GetCubeSerialNumber() == m_groundSN)) {
799 if (m_editPoint->IsEditLocked() && m_controlNet->ContainsPoint(m_editPoint->GetId())) {
800 QString message =
"This control point is edit locked. The Apriori latitude, longitude and ";
801 message +=
"radius cannot be updated. You must first unlock the point by clicking the ";
802 message +=
"check box above labeled \"Edit Lock Point\".";
803 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
806 if (m_leftMeasure->IsIgnored()) {
807 QString message =
"This is a Constrained or Fixed point and the reference measure is ";
808 message +=
"Ignored. Unset the Ignore flag on the reference measure before saving.";
809 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
812 updateGroundPosition();
819 *origRightMeasure = *m_rightMeasure;
822 if (m_leftMeasure->IsIgnored() != origLeftMeasure->IsIgnored() ||
823 m_leftMeasure->IsEditLocked() != origLeftMeasure->
IsEditLocked()) {
825 *origLeftMeasure = *m_leftMeasure;
829 if (m_leftMeasure->GetCubeSerialNumber() ==
830 m_rightMeasure->GetCubeSerialNumber()) {
831 *m_leftMeasure = *m_rightMeasure;
833 m_pointEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
834 m_editPoint->GetId());
840 editPointChanged(m_editPoint->GetId());
871 if ( (m_leftMeasure->GetCubeSerialNumber() != m_groundSN) &&
873 QString message =
"This point already contains a reference measure. ";
874 message +=
"Would you like to replace it with the measure on the left?";
875 int response = QMessageBox::question(m_qnetTool,
876 "Qnet Tool Save Measure", message,
877 QMessageBox::Yes | QMessageBox::No,
880 if (response == QMessageBox::Yes) {
883 QString file = m_serialNumberList->fileName(m_leftMeasure->GetCubeSerialNumber());
885 int iref = m_leftCombo->findText(fname);
888 QVariant font = m_leftCombo->itemData(iref,Qt::FontRole);
889 m_leftCombo->setItemData(iref,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
890 iref = m_rightCombo->findText(fname);
891 m_rightCombo->setItemData(iref,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
895 iref = m_leftCombo->findText(fname);
896 m_leftCombo->setItemData(iref,font,Qt::FontRole);
897 iref = m_rightCombo->findText(fname);
898 m_rightCombo->setItemData(iref,font,Qt::FontRole);
900 m_editPoint->SetRefMeasure(m_leftMeasure->GetCubeSerialNumber());
902 refMeasure = m_editPoint->GetRefMeasure();
910 QString message =
"You are making a change to the reference measure. You ";
911 message +=
"may need to move all of the other measures to match the new ";
912 message +=
" coordinate of the reference measure. Do you really want to ";
913 message +=
" change the reference measure? ";
914 switch(QMessageBox::question(m_qnetTool,
"Qnet Tool Save Measure",
915 message,
"&Yes",
"&No", 0, 0)){
939 void QnetTool::updateGroundPosition() {
947 if (!m_groundGmap->SetImage(groundMeasure->GetSample(),
948 groundMeasure->GetLine())) {
953 double lat = m_groundGmap->UniversalLatitude();
954 double lon = m_groundGmap->UniversalLongitude();
965 if (radius ==
Null) {
966 QString msg =
"Could not read radius from DEM, will default to "
967 "local radius of reference measure.";
968 QMessageBox::warning(m_qnetTool,
"Warning", msg);
969 if (m_editPoint->GetRefMeasure()->Camera()->SetGround(
972 m_editPoint->GetRefMeasure()->Camera()->LocalRadius().meters();
973 m_editPoint->SetAprioriRadiusSource(
974 ControlPoint::RadiusSource::None);
978 QString message =
"Error trying to get radius at this pt. "
979 "Lat/Lon does not fall on the reference measure. "
980 "Cannot save this measure.";
981 QMessageBox::critical(m_qnetTool,
"Error",message);
985 m_editPoint->SetAprioriRadiusSource(m_groundRadiusSource);
986 m_editPoint->SetAprioriRadiusSourceFile(m_radiusSourceFile);
990 if (m_editPoint->GetRefMeasure()->Camera()->SetGround(
993 m_editPoint->GetRefMeasure()->Camera()->LocalRadius().meters();
1000 QString message =
"Error trying to get radius at this pt. "
1001 "Lat/Lon does not fall on the reference measure. "
1002 "Cannot save this measure.";
1003 QMessageBox::critical(m_qnetTool,
"Error",message);
1012 if (m_editPoint->HasAprioriCoordinates()) {
1013 SurfacePoint aprioriPt = m_editPoint->GetAprioriSurfacePoint();
1014 Distance latSigma = aprioriPt.GetLatSigmaDistance();
1015 Distance lonSigma = aprioriPt.GetLonSigmaDistance();
1016 Distance radiusSigma = aprioriPt.GetLocalRadiusSigma();
1020 aprioriPt.SetSphericalSigmasDistance(latSigma, lonSigma, radiusSigma);
1021 m_editPoint->SetAprioriSurfacePoint(aprioriPt);
1024 m_editPoint->SetAprioriSurfacePoint(SurfacePoint(
1030 catch (IException &e) {
1031 QString message =
"Unable to set Apriori Surface Point.\n";
1032 message +=
"Latitude = " + QString::number(lat);
1033 message +=
" Longitude = " + QString::number(lon);
1034 message +=
" Radius = " + QString::number(radius) +
"\n";
1035 message += e.toString();
1036 QMessageBox::critical(m_qnetTool,
"Error",message);
1038 m_editPoint->SetAprioriSurfacePointSource(m_groundSurfacePointSource);
1039 m_editPoint->SetAprioriSurfacePointSourceFile(m_groundSourceFile);
1066 *updatePoint = *m_editPoint;
1074 updatePoint->
Delete(m_groundSN);
1079 if (m_controlNet->ContainsPoint(updatePoint->
GetId())) {
1081 p = m_controlNet->GetPoint(QString(updatePoint->
GetId()));
1087 m_controlNet->AddPoint(updatePoint);
1091 m_savePoint->setPalette(m_saveDefaultPalette);
1095 emit refreshNavList();
1097 emit editPointChanged(m_editPoint->GetId());
1101 m_pointEditor->refreshChips();
1121 if (m_editPoint == NULL)
return;
1124 if (m_editPoint->GetType() == pointType)
return;
1127 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
1128 QString message =
"The reference measure is Ignored. Unset the Ignore flag on the ";
1129 message +=
"reference measure before setting the point type to Constrained or Fixed.";
1130 QMessageBox::warning(m_qnetTool,
"Ignored Reference Measure", message);
1134 bool unloadGround =
false;
1136 unloadGround =
true;
1139 int temp = m_editPoint->GetType();
1143 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
1144 QString message =
"This control point is edit locked. The point type cannot be changed. You ";
1145 message +=
"must first unlock the point by clicking the check box above labeled ";
1146 message +=
"\"Edit Lock Point\".";
1147 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
1156 m_pointEditor->colorizeSaveButton();
1159 else if (unloadGround) {
1162 if (m_editPoint->HasSerialNumber(m_groundSN)) {
1163 m_editPoint->Delete(m_groundSN);
1167 m_pointEditor->colorizeSaveButton();
1188 if (!m_groundOpen)
return;
1198 m_leftCombo->addItem(tempFileName);
1199 m_rightCombo->addItem(tempFileName);
1200 int rightIndex = m_rightCombo->findText((QString)m_groundFile);
1201 m_rightCombo->setCurrentIndex(rightIndex);
1222 if (m_editPoint == NULL)
return;
1224 m_editPoint->SetEditLock(lock);
1241 if (m_editPoint == NULL)
return;
1245 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
1246 QString message =
"This control point is edit locked. The Ignored status cannot be ";
1247 message +=
"changed. You must first unlock the point by clicking the check box above ";
1248 message +=
"labeled \"Edit Lock Point\".";
1249 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
1275 if (m_editPoint->IsEditLocked()) {
1276 m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1277 QMessageBox::warning(m_qnetTool,
"Point Locked",
"Point is Edit Locked. You must un-lock point"
1278 " before changing a measure.");
1279 m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1283 if (m_leftMeasure != NULL) m_leftMeasure->SetEditLock(lock);
1287 if (m_rightMeasure != NULL) {
1288 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1289 m_rightMeasure->SetEditLock(lock);
1290 m_lockRightMeasure->setChecked(lock);
1293 emit measureChanged();
1315 if (m_leftMeasure != NULL) m_leftMeasure->SetIgnored(ignore);
1319 if (m_rightMeasure != NULL) {
1320 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1321 m_rightMeasure->SetIgnored(ignore);
1322 m_ignoreRightMeasure->setChecked(ignore);
1325 emit measureChanged();
1346 if (m_editPoint->IsEditLocked()) {
1347 m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1348 QMessageBox::warning(m_qnetTool,
"Point Locked",
"Point is Edit Locked. You must un-lock point"
1349 " before changing a measure.");
1350 m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1354 if (m_rightMeasure != NULL) m_rightMeasure->SetEditLock(lock);
1357 if (m_leftMeasure != NULL) {
1358 if (m_leftMeasure->GetCubeSerialNumber() == m_rightMeasure->GetCubeSerialNumber()) {
1359 m_leftMeasure->SetEditLock(lock);
1360 m_lockLeftMeasure->setChecked(lock);
1363 emit measureChanged();
1385 if (m_rightMeasure != NULL) m_rightMeasure->SetIgnored(ignore);
1389 if (m_leftMeasure != NULL) {
1390 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1391 m_leftMeasure->SetIgnored(ignore);
1392 m_ignoreLeftMeasure->setChecked(ignore);
1395 emit measureChanged();
1406 if (m_cnetFileName.isEmpty()) {
1407 QString message =
"This is a new network, you must select "
1408 "\"Save As\" under the File Menu.";
1409 QMessageBox::critical(m_qnetTool,
"Error", message);
1412 emit qnetToolSave();
1422 emit qnetToolSaveAs();
1431 void QnetTool::updateList() {
1455 m_cnetFileName = cNetFileName;
1456 m_qnetTool->setWindowTitle(
"Qnet Tool - Control Network File: " +
1477 action->setIcon(QPixmap(
toolIconDir()+
"/stock_draw-connector-with-arrows.png"));
1478 action->setToolTip(
"Control Point Editor (T)");
1479 action->setShortcut(Qt::Key_T);
1480 QObject::connect(action,SIGNAL(triggered(
bool)),
this,SLOT(
showNavWindow(
bool)));
1522 if (cvp == NULL)
return;
1527 sn = m_serialNumberList->serialNumber(file);
1530 QString message =
"Cannot get serial number for " + file +
". Is file contained in the ";
1531 message +=
"cube list?\n";
1533 QMessageBox::critical(m_qnetTool,
"Error", message);
1542 if (s == Qt::LeftButton) {
1543 if (!m_controlNet || m_controlNet->GetNumPoints() == 0) {
1544 QString message =
"No points exist for editing. Create points ";
1545 message +=
"using the right mouse button.";
1546 QMessageBox::warning(m_qnetTool,
"Warning", message);
1550 if (sn == m_groundSN) {
1551 QString message =
"Cannot select point for editing on ground source. Select ";
1552 message +=
"point using un-projected images or the Navigator Window.";
1553 QMessageBox::critical(m_qnetTool,
"Error", message);
1558 QString sn = m_serialNumberList->serialNumber(file);
1562 ControlPoint *point = m_controlNet->FindClosest(sn, samp, line);
1566 QString message =
"No points exist for editing. Create points using the right mouse";
1567 message +=
" button.";
1568 QMessageBox::warning(m_qnetTool,
"Warning", message);
1573 else if (s == Qt::MiddleButton) {
1574 if (!m_controlNet || m_controlNet->GetNumPoints() == 0) {
1575 QString message =
"No points exist for deleting. Create points ";
1576 message +=
"using the right mouse button.";
1577 QMessageBox::warning(m_qnetTool,
"Warning", message);
1581 if (m_groundOpen && file == m_groundCube->fileName()) {
1582 QString message =
"Cannot select point for deleting on ground source. Select ";
1583 message +=
"point using un-projected images or the Navigator Window.";
1584 QMessageBox::critical(m_qnetTool,
"Error", message);
1590 point = m_controlNet->FindClosest(sn, samp, line);
1592 if (point == NULL) {
1593 QString message =
"No points exist for deleting. Create points ";
1594 message +=
"using the right mouse button.";
1595 QMessageBox::warning(m_qnetTool,
"Warning", message);
1600 QString message =
"Cannot find point on this image for deleting.";
1601 QMessageBox::critical(m_qnetTool,
"Error", message);
1607 else if (s == Qt::RightButton) {
1611 QString message =
"Invalid latitude or longitude at this point. ";
1612 QMessageBox::critical(m_qnetTool,
"Error", message);
1617 if (m_groundOpen && file == m_groundCube->fileName()) {
1681 for(
int i = 0; i < m_serialNumberList->size(); i++) {
1682 if (m_serialNumberList->serialNumber(i) == m_groundSN)
continue;
1683 cam = m_controlNet->
Camera(i);
1686 double samp = cam->
Sample();
1687 double line = cam->
Line();
1688 if (samp >= 1 && samp <= cam->Samples() &&
1689 line >= 1 && line <= cam->Lines()) {
1690 pointFiles<<m_serialNumberList->fileName(i);
1697 newPointDialog->
setFiles(pointFiles);
1698 if (newPointDialog->exec()) {
1699 m_lastUsedPointId = newPointDialog->pointId();
1705 if (m_controlNet->ContainsPoint(newPoint->
GetId())) {
1706 QString message =
"A ControlPoint with Point Id = [" + newPoint->
GetId();
1707 message +=
"] already exists. Re-enter Point Id for this ControlPoint.";
1708 QMessageBox::warning(m_qnetTool,
"New Point Id", message);
1718 QStringList selectedFiles = newPointDialog->selectedFiles();
1719 foreach (QString selectedFile, selectedFiles) {
1724 m_serialNumberList->serialNumber(selectedFile);
1727 m_serialNumberList->fileNameIndex(selectedFile);
1728 cam = m_controlNet->
Camera(camIndex);
1731 m->SetAprioriSample(cam->
Sample());
1732 m->SetAprioriLine(cam->
Line());
1738 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1742 m_editPoint = newPoint;
1746 if (!m_leftFile.isEmpty()) {
1747 if (selectedFiles.indexOf(m_leftFile) == -1) {
1754 m_qnetTool->setVisible(
true);
1755 m_qnetTool->raise();
1758 m_pointEditor->templateFileName());
1762 emit refreshNavList();
1764 emit editPointChanged(m_editPoint->GetId());
1766 delete newPointDialog;
1796 for (
int i=0; i<m_serialNumberList->size(); i++) {
1797 if (m_serialNumberList->serialNumber(i) == m_groundSN)
continue;
1798 cam = m_controlNet->
Camera(i);
1801 double samp = cam->
Sample();
1802 double line = cam->
Line();
1803 if (samp >= 1 && samp <= cam->Samples() &&
1804 line >= 1 && line <= cam->Lines()) {
1805 pointFiles<<m_serialNumberList->fileName(i);
1810 if (pointFiles.count() == 0) {
1811 QString message =
"Point does not intersect any images.";
1812 QMessageBox::critical(m_qnetTool,
"No intersection", message);
1817 fixedPointDialog->
setFiles(pointFiles);
1818 if (fixedPointDialog->exec()) {
1822 if (fixedPointDialog->isFixed()) {
1831 if (m_controlNet->ContainsPoint(fixedPoint->
GetId())) {
1832 QString message =
"A ControlPoint with Point Id = [" + fixedPoint->
GetId();
1833 message +=
"] already exists. Re-enter Point Id for this ControlPoint.";
1834 QMessageBox::warning(m_qnetTool,
"New Point Id", message);
1844 QStringList selectedFiles = fixedPointDialog->selectedFiles();
1845 foreach (QString selectedFile, selectedFiles) {
1850 m_serialNumberList->serialNumber(selectedFile);
1853 if (sn == m_groundSN)
continue;
1857 m_serialNumberList->fileNameIndex(selectedFile);
1858 cam = m_controlNet->
Camera(camIndex);
1871 if (radius ==
Null) {
1872 QString msg =
"Could not read radius from DEM, will default to the "
1873 "local radius of the first measure in the control point. This "
1874 "will be updated to the local radius of the chosen reference "
1876 QMessageBox::warning(m_qnetTool,
"Warning", msg);
1877 if ((*fixedPoint)[0]->
Camera()->SetGround(
1879 radius = (*fixedPoint)[0]->Camera()->LocalRadius().meters();
1882 QString msg =
"Error trying to get radius at this pt. "
1883 "Lat/Lon does not fall on the reference measure. "
1884 "Cannot create this point.";
1885 QMessageBox::critical(m_qnetTool,
"Error", msg);
1888 delete fixedPointDialog;
1889 fixedPointDialog = NULL;
1895 if ((*fixedPoint)[0]->
Camera()->SetGround(
1897 radius = (*fixedPoint)[0]->Camera()->LocalRadius().meters();
1900 QString msg =
"Error trying to get radius at this pt. "
1901 "Lat/Lon does not fall on the reference measure. "
1902 "Cannot create this point.";
1903 QMessageBox::critical(m_qnetTool,
"Error", msg);
1906 delete fixedPointDialog;
1907 fixedPointDialog = NULL;
1917 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1921 m_editPoint = fixedPoint;
1925 m_qnetTool->setVisible(
true);
1926 m_qnetTool->raise();
1928 delete fixedPointDialog;
1929 fixedPointDialog = NULL;
1932 emit refreshNavList();
1934 emit editPointChanged(m_editPoint->GetId());
1965 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1970 *m_editPoint = *point;
1976 emit editPointChanged(m_editPoint->GetId());
1979 QString CPId = m_editPoint->GetId();
1980 deletePointDialog->pointIdValue->setText(CPId);
1983 for (
int i=0; i<m_editPoint->GetNumMeasures(); i++) {
1986 deletePointDialog->fileList->addItem(file);
1989 if (deletePointDialog->exec()) {
1991 int numDeleted = deletePointDialog->fileList->selectedItems().count();
1994 if (deletePointDialog->deleteAllCheckBox->isChecked() ||
1995 numDeleted == m_editPoint->GetNumMeasures()) {
1998 if (!deletePointDialog->deleteAllCheckBox->isChecked()) {
1999 QString message =
"You have selected all measures in this point to be deleted. This "
2000 "control point will be deleted. Do you want to delete this control point?";
2001 int response = QMessageBox::question(m_qnetTool,
2002 "Delete control point", message,
2003 QMessageBox::Yes | QMessageBox::No,
2006 if (response == QMessageBox::No) {
2015 m_qnetTool->setVisible(
false);
2017 if (m_controlNet->DeletePoint(m_editPoint->GetId()) ==
2019 QMessageBox::information(m_qnetTool,
"EditLocked Point",
2020 "This point is EditLocked and cannot be deleted.");
2023 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
2028 emit refreshNavList();
2034 int lockedMeasures = 0;
2035 for (
int i=0; i<deletePointDialog->fileList->count(); i++) {
2036 QListWidgetItem *item = deletePointDialog->fileList->item(i);
2037 if (!item->isSelected())
continue;
2040 if (m_editPoint->IsReferenceExplicit() &&
2041 (m_editPoint->GetRefMeasure()->GetCubeSerialNumber() ==
2042 (*m_editPoint)[i]->GetCubeSerialNumber())) {
2043 QString message =
"You are trying to delete the Reference measure."
2044 " Do you really want to delete the Reference measure?";
2045 switch (QMessageBox::question(m_qnetTool,
2046 "Delete Reference measure?", message,
2047 "&Yes",
"&No", 0, 0)) {
2055 if (numDeleted == 1) {
2062 if (m_editPoint->Delete(i) == ControlMeasure::MeasureLocked) {
2067 if (lockedMeasures > 0) {
2068 QMessageBox::information(m_qnetTool,
"EditLocked Measures",
2069 QString::number(lockedMeasures) +
" / "
2071 deletePointDialog->fileList->selectedItems().size()) +
2072 " measures are EditLocked and were not deleted.");
2076 m_qnetTool->setVisible(
true);
2077 m_qnetTool->raise();
2086 if (m_editPoint != NULL) {
2087 emit editPointChanged(m_editPoint->GetId());
2095 emit editPointChanged(
"");
2113 if (point->GetNumMeasures() == 0) {
2114 QString message =
"This point has no measures.";
2115 QMessageBox::warning(m_qnetTool,
"Warning", message);
2117 if (m_editPoint != NULL) {
2119 emit editPointChanged(m_editPoint->GetId());
2124 emit editPointChanged(
"");
2130 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
2135 *m_editPoint = *point;
2139 if (sender() !=
this) m_leftFile.clear();
2141 m_qnetTool->setVisible(
true);
2142 m_qnetTool->raise();
2146 emit editPointChanged(m_editPoint->GetId());
2149 m_savePoint->setPalette(m_saveDefaultPalette);
2163 bool located =
true;
2169 if (m_editPoint->HasAprioriCoordinates()) {
2170 SurfacePoint sPt = m_editPoint->GetAprioriSurfacePoint();
2178 cam = m_controlNet->
Camera(camIndex);
2179 cam->
SetImage(m.GetSample(),m.GetLine());
2186 if (!m_groundGmap->SetUniversalGround(lat,lon)) {
2188 QString message =
"This point does not exist on the ground source.\n";
2189 message +=
"Latitude = " + QString::number(lat);
2190 message +=
" Longitude = " + QString::number(lon);
2191 message +=
"\n A ground measure will not be created.";
2192 QMessageBox::warning(m_qnetTool,
"Warning", message);
2215 groundMeasure->
SetCoordinate(m_groundGmap->Sample(),m_groundGmap->Line());
2216 m_editPoint->Add(groundMeasure);
2218 return groundMeasure;
2248 QString CPId = m_editPoint->GetId();
2249 QString ptId(
"Point ID: ");
2250 ptId += (QString) CPId;
2251 m_ptIdValue->setText(ptId);
2257 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
2260 QString ptsize =
"Number of Measures: " +
2261 QString::number(m_editPoint->GetNumMeasures());
2262 m_numMeasures->setText(ptsize);
2265 m_lockPoint->setChecked(m_editPoint->IsEditLocked());
2268 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
2271 m_leftCombo->clear();
2272 m_rightCombo->clear();
2273 m_pointFiles.clear();
2277 if (m_editPoint->HasSerialNumber(m_groundSN)) {
2278 m_editPoint->Delete(m_groundSN);
2295 if (m_groundOpen && !m_demOpen) {
2301 for (
int i=0; i<m_editPoint->GetNumMeasures(); i++) {
2306 m_leftCombo->addItem(tempFileName);
2307 m_rightCombo->addItem(tempFileName);
2308 if (m_editPoint->IsReferenceExplicit() &&
2310 m_leftCombo->setItemData(i,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
2311 m_rightCombo->setItemData(i,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
2327 if (m_editPoint->IsReferenceExplicit()) {
2328 leftIndex = m_editPoint->IndexOfRefMeasure();
2333 leftIndex = m_leftCombo->findText(baseFileName);
2335 if (leftIndex < 0 ) leftIndex = 0;
2343 rightIndex = m_rightCombo->findText((QString)m_groundFile);
2345 if (rightIndex <= 0) {
2346 if (leftIndex == 0) {
2356 if (rightIndex > m_editPoint->GetNumMeasures()-1) rightIndex = 0;
2357 m_rightCombo->setCurrentIndex(rightIndex);
2358 m_leftCombo->setCurrentIndex(leftIndex);
2380 if (m_measureWindow == NULL) {
2382 m_measureTable =
new QTableWidget();
2383 m_measureTable->setMinimumWidth(1600);
2384 m_measureTable->setAlternatingRowColors(
true);
2385 m_measureWindow->setCentralWidget(m_measureTable);
2388 m_measureTable->clear();
2389 m_measureTable->setSortingEnabled(
false);
2391 m_measureTable->setRowCount(m_editPoint->GetNumMeasures());
2392 m_measureTable->setColumnCount(NUMCOLUMNS);
2395 for (
int i=0; i<NUMCOLUMNS; i++) {
2396 labels<<measureColumnToString((MeasureColumns)i);
2398 m_measureTable->setHorizontalHeaderLabels(labels);
2401 for (
int row=0; row<m_editPoint->GetNumMeasures(); row++) {
2406 QTableWidgetItem *tableItem =
new QTableWidgetItem(QString(file));
2407 m_measureTable->setItem(row,column++,tableItem);
2410 m_measureTable->setItem(row,column++,tableItem);
2412 tableItem =
new QTableWidgetItem();
2413 tableItem->setData(0,m.GetSample());
2414 m_measureTable->setItem(row,column++,tableItem);
2416 tableItem =
new QTableWidgetItem();
2417 tableItem->setData(0,m.GetLine());
2418 m_measureTable->setItem(row,column++,tableItem);
2420 if (m.GetAprioriSample() ==
Null) {
2421 tableItem =
new QTableWidgetItem(
"Null");
2424 tableItem =
new QTableWidgetItem();
2425 tableItem->setData(0,m.GetAprioriSample());
2427 m_measureTable->setItem(row,column++,tableItem);
2429 if (m.GetAprioriLine() ==
Null) {
2430 tableItem =
new QTableWidgetItem(
"Null");
2433 tableItem =
new QTableWidgetItem();
2434 tableItem->setData(0,m.GetAprioriLine());
2436 m_measureTable->setItem(row,column++,tableItem);
2438 if (m.GetSampleResidual() ==
Null) {
2439 tableItem =
new QTableWidgetItem(QString(
"Null"));
2442 tableItem =
new QTableWidgetItem();
2443 tableItem->setData(0,m.GetSampleResidual());
2445 m_measureTable->setItem(row,column++,tableItem);
2447 if (m.GetLineResidual() ==
Null) {
2448 tableItem =
new QTableWidgetItem(QString(
"Null"));
2451 tableItem =
new QTableWidgetItem();
2452 tableItem->setData(0,m.GetLineResidual());
2454 m_measureTable->setItem(row,column++,tableItem);
2457 tableItem =
new QTableWidgetItem(QString(
"Null"));
2460 tableItem =
new QTableWidgetItem();
2463 m_measureTable->setItem(row,column++,tableItem);
2465 double sampleShift = m.GetSampleShift();
2466 if (sampleShift ==
Null) {
2467 tableItem =
new QTableWidgetItem(QString(
"Null"));
2470 tableItem =
new QTableWidgetItem();
2471 tableItem->setData(0,sampleShift);
2473 m_measureTable->setItem(row,column++,tableItem);
2475 double lineShift = m.GetLineShift();
2476 if (lineShift ==
Null) {
2477 tableItem =
new QTableWidgetItem(QString(
"Null"));
2480 tableItem =
new QTableWidgetItem();
2481 tableItem->setData(0,lineShift);
2483 m_measureTable->setItem(row,column++,tableItem);
2485 double pixelShift = m.GetPixelShift();
2486 if (pixelShift ==
Null) {
2487 tableItem =
new QTableWidgetItem(QString(
"Null"));
2490 tableItem =
new QTableWidgetItem();
2491 tableItem->setData(0,pixelShift);
2493 m_measureTable->setItem(row,column++,tableItem);
2495 double goodnessOfFit = m.GetLogData(
2497 if (goodnessOfFit ==
Null) {
2498 tableItem =
new QTableWidgetItem(QString(
"Null"));
2501 tableItem =
new QTableWidgetItem();
2502 tableItem->setData(0,goodnessOfFit);
2504 m_measureTable->setItem(row,column++,tableItem);
2506 if (m.IsIgnored()) tableItem =
new QTableWidgetItem(
"True");
2507 if (!m.IsIgnored()) tableItem =
new QTableWidgetItem(
"False");
2508 m_measureTable->setItem(row,column++,tableItem);
2511 tableItem =
new QTableWidgetItem(
"True");
2513 tableItem =
new QTableWidgetItem(
"False");
2514 m_measureTable->setItem(row,column++,tableItem);
2516 tableItem =
new QTableWidgetItem(
2518 m_measureTable->setItem(row,column,tableItem);
2521 if (m_editPoint->IsReferenceExplicit() &&
2526 for (
int col=0; col<m_measureTable->columnCount(); col++)
2527 m_measureTable->item(row, col)->setFont(font);
2532 m_measureTable->resizeColumnsToContents();
2533 m_measureTable->resizeRowsToContents();
2534 m_measureTable->setSortingEnabled(
true);
2535 m_measureWindow->show();
2540 QString QnetTool::measureColumnToString(QnetTool::MeasureColumns column) {
2550 case SAMPLERESIDUAL:
2551 return "Sample Residual";
2553 return "Line Residual";
2554 case RESIDUALMAGNITUDE:
2555 return "Residual Magnitude";
2557 return "Sample Shift";
2559 return "Line Shift";
2561 return "Pixel Shift";
2563 return "Goodness of Fit";
2569 return "Measure Type";
2571 return "Apriori Sample";
2573 return "Apriori Line";
2576 "Invalid measure column passed to measureColumnToString", _FILEINFO_);
2581 return m_controlNet;
2585 const ControlNet *QnetTool::controlNet()
const {
2586 return m_controlNet;
2591 return m_serialNumberList;
2596 return m_serialNumberList;
2600 Workspace *QnetTool::workspace()
const {
2620 SurfacePoint aprioriPoint = m_editPoint->GetAprioriSurfacePoint();
2622 s =
"Apriori Latitude: Null";
2625 s =
"Apriori Latitude: " +
2628 m_pointAprioriLatitude->setText(s);
2630 s =
"Apriori Longitude: Null";
2633 s =
"Apriori Longitude: " +
2636 m_pointAprioriLongitude->setText(s);
2638 s =
"Apriori Radius: Null";
2641 s =
"Apriori Radius: " +
2645 m_pointAprioriRadius->setText(s);
2647 if (aprioriPoint.Valid()) {
2649 s =
"Apriori Latitude Sigma: Null";
2652 s =
"Apriori Latitude Sigma: " +
2656 m_pointAprioriLatitudeSigma->setText(s);
2658 s =
"Apriori Longitude Sigma: Null";
2661 s =
"Apriori Longitude Sigma: " +
2665 m_pointAprioriLongitudeSigma->setText(s);
2666 if (aprioriPoint.GetLocalRadiusSigma().
meters() ==
Null) {
2667 s =
"Apriori Radius Sigma: Null";
2670 s =
"Apriori Radius Sigma: " +
2671 QString::number(aprioriPoint.GetLocalRadiusSigma().
meters()) +
2674 m_pointAprioriRadiusSigma->setText(s);
2677 s =
"Apriori Latitude Sigma: Null";
2678 m_pointAprioriLatitudeSigma->setText(s);
2679 s =
"Apriori Longitude Sigma: Null";
2680 m_pointAprioriLongitudeSigma->setText(s);
2681 s =
"Apriori Radius Sigma: Null";
2682 m_pointAprioriRadiusSigma->setText(s);
2686 SurfacePoint point = m_editPoint->GetAdjustedSurfacePoint();
2688 s =
"Adjusted Latitude: Null";
2693 m_pointLatitude->setText(s);
2695 s =
"Adjusted Longitude: Null";
2700 m_pointLongitude->setText(s);
2702 s =
"Adjusted Radius: Null";
2705 s =
"Adjusted Radius: " +
2708 m_pointRadius->setText(s);
2726 int curIndex = m_rightCombo->currentIndex();
2727 if (curIndex < m_rightCombo->count() - 1) {
2729 m_rightCombo->setCurrentIndex(curIndex + 1);
2745 int curIndex = m_rightCombo->currentIndex();
2748 m_rightCombo->setCurrentIndex(curIndex - 1);
2767 QString file = m_pointFiles[index];
2769 QString serial = m_serialNumberList->serialNumber(file);
2773 if (m_leftMeasure != NULL) {
2774 delete m_leftMeasure;
2775 m_leftMeasure = NULL;
2779 *m_leftMeasure = *((*m_editPoint)[serial]);
2782 m_leftCube.reset(
new Cube(file,
"r"));
2785 m_pointEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
2786 m_editPoint->GetId());
2802 QString file = m_pointFiles[index];
2804 QString serial = m_serialNumberList->serialNumber(file);
2808 if (m_rightMeasure != NULL) {
2809 delete m_rightMeasure;
2810 m_rightMeasure = NULL;
2814 *m_rightMeasure = *((*m_editPoint)[serial]);
2817 m_rightCube.reset(
new Cube(file,
"r"));
2820 m_pointEditor->setRightMeasure (m_rightMeasure, m_rightCube.data(),
2821 m_editPoint->GetId());
2848 m_leftMeasure->GetCubeSerialNumber()));
2850 m_ignoreLeftMeasure->setChecked(m_leftMeasure->IsIgnored());
2852 QString s =
"Reference: ";
2853 if (m_editPoint->IsReferenceExplicit() &&
2854 (QString(m_leftMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2860 m_leftReference->setText(s);
2862 s =
"Measure Type: ";
2867 m_leftMeasureType->setText(s);
2869 if (m_leftMeasure->GetSampleResidual() ==
Null) {
2870 s =
"Sample Residual: Null";
2873 s =
"Sample Residual: " + QString::number(m_leftMeasure->GetSampleResidual());
2875 m_leftSampError->setText(s);
2876 if (m_leftMeasure->GetLineResidual() ==
Null) {
2877 s =
"Line Residual: Null";
2880 s =
"Line Residual: " + QString::number(m_leftMeasure->GetLineResidual());
2882 m_leftLineError->setText(s);
2884 if (m_leftMeasure->GetSampleShift() ==
Null) {
2885 s =
"Sample Shift: Null";
2888 s =
"Sample Shift: " + QString::number(m_leftMeasure->GetSampleShift());
2890 m_leftSampShift->setText(s);
2892 if (m_leftMeasure->GetLineShift() ==
Null) {
2893 s =
"Line Shift: Null";
2896 s =
"Line Shift: " + QString::number(m_leftMeasure->GetLineShift());
2898 m_leftLineShift->setText(s);
2900 double goodnessOfFit = m_leftMeasure->GetLogData(
2902 if (goodnessOfFit ==
Null) {
2903 s =
"Goodness of Fit: Null";
2906 s =
"Goodness of Fit: " + QString::number(goodnessOfFit);
2908 m_leftGoodness->setText(s);
2936 m_rightMeasure->GetCubeSerialNumber()));
2938 m_ignoreRightMeasure->setChecked(m_rightMeasure->IsIgnored());
2940 QString s =
"Reference: ";
2941 if (m_editPoint->IsReferenceExplicit() &&
2942 (QString(m_rightMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2949 m_rightReference->setText(s);
2951 s =
"Measure Type: ";
2956 m_rightMeasureType->setText(s);
2958 if (m_rightMeasure->GetSampleResidual() ==
Null) {
2959 s =
"Sample Residual: Null";
2962 s =
"Sample Residual: " + QString::number(m_rightMeasure->GetSampleResidual());
2964 m_rightSampError->setText(s);
2965 if (m_rightMeasure->GetLineResidual() ==
Null) {
2966 s =
"Line Residual: Null";
2969 s =
"Line Residual: " + QString::number(m_rightMeasure->GetLineResidual());
2971 m_rightLineError->setText(s);
2973 if (m_rightMeasure->GetSampleShift() ==
Null) {
2974 s =
"Sample Shift: Null";
2977 s =
"Sample Shift: " + QString::number(m_rightMeasure->GetSampleShift());
2979 m_rightSampShift->setText(s);
2981 if (m_rightMeasure->GetLineShift() ==
Null) {
2982 s =
"Line Shift: Null";
2985 s =
"Line Shift: " + QString::number(m_rightMeasure->GetLineShift());
2987 m_rightLineShift->setText(s);
2989 double goodnessOfFit = m_rightMeasure->GetLogData(
2991 if (goodnessOfFit ==
Null) {
2992 s =
"Goodness of Fit: Null";
2995 s =
"Goodness of Fit: " + QString::number(goodnessOfFit);
2997 m_rightGoodness->setText(s);
3032 cam = m_controlNet->
Camera(camIndex);
3034 cam->
SetImage(m.GetSample(),m.GetLine());
3038 for (
int i=0; i<m_serialNumberList->size(); i++) {
3039 cam = m_controlNet->
Camera(i);
3040 if (m_serialNumberList->serialNumber(i) == m_groundSN)
continue;
3043 double samp = cam->
Sample();
3044 double line = cam->
Line();
3045 if (samp >= 1 && samp <= cam->Samples() &&
3046 line >= 1 && line <= cam->Lines()) {
3047 pointFiles<<m_serialNumberList->fileName(i);
3053 newMeasureDialog->
setFiles(*m_editPoint,pointFiles);
3054 if (newMeasureDialog->exec()) {
3055 QStringList selectedFiles = newMeasureDialog->selectedFiles();
3056 foreach (QString selectedFile, selectedFiles) {
3060 QString sn = m_serialNumberList->serialNumber(selectedFile);
3063 m_serialNumberList->fileNameIndex(selectedFile);
3064 cam = m_controlNet->
Camera(camIndex);
3067 m->SetAprioriSample(cam->
Sample());
3068 m->SetAprioriLine(cam->
Line());
3071 m_editPoint->Add(m);
3074 m_qnetTool->setVisible(
true);
3075 m_qnetTool->raise();
3078 m_pointEditor->templateFileName());
3082 emit editPointChanged(m_editPoint->GetId());
3099 if(e->type() != QEvent::Leave)
return false;
3100 if(o == m_leftCombo->view()) {
3102 m_leftCombo->hidePopup();
3104 if (o == m_rightCombo->view()) {
3106 m_rightCombo->hidePopup();
3146 vp->viewport()->update();
3174 if (m_controlNet == 0 || m_controlNet->GetNumPoints() == 0)
return;
3181 if (serialNumber == m_groundSN) {
3185 if (!m_controlNet->GetCubeSerials().contains(
3186 serialNumber))
return;
3187 if (!m_serialNumberList->hasSerialNumber(serialNumber))
return;
3189 m_controlNet->GetMeasuresInCube(serialNumber);
3191 for (
int i = 0; i < measures.count(); i++) {
3194 double samp = m->GetSample();
3195 double line = m->GetLine();
3199 if (m->Parent()->IsIgnored()) {
3200 painter->setPen(QColor(255, 255, 0));
3203 else if (m->IsIgnored()) {
3204 painter->setPen(QColor(255, 255, 0));
3208 painter->setPen(Qt::magenta);
3211 painter->setPen(Qt::green);
3214 painter->drawLine(x - 5, y, x + 5, y);
3215 painter->drawLine(x, y - 5, x, y + 5);
3218 if (m_editPoint != NULL) {
3220 if (m_editPoint->HasSerialNumber(serialNumber)) {
3222 double samp = (*m_editPoint)[serialNumber]->GetSample();
3223 double line = (*m_editPoint)[serialNumber]->GetLine();
3227 QBrush brush(Qt::red);
3231 painter->setPen(pen);
3232 painter->drawLine(x - 5, y, x + 5, y);
3233 painter->drawLine(x, y - 5, x, y + 5);
3253 for (
int i = 0; i < m_controlNet->GetNumPoints(); i++) {
3256 if (!p.HasAprioriCoordinates())
continue;
3259 if (m_groundGmap->SetGround(p.GetAprioriSurfacePoint().
GetLatitude(),
3261 double samp = m_groundGmap->Sample();
3262 double line = m_groundGmap->Line();
3266 if (p.IsIgnored()) {
3267 painter->setPen(QColor(255, 255, 0));
3270 painter->setPen(Qt::magenta);
3272 else if (&p == m_editPoint) {
3274 QBrush brush(Qt::red);
3279 painter->setPen(Qt::green);
3282 painter->drawLine(x - 5, y, x + 5, y);
3283 painter->drawLine(x, y - 5, x, y + 5);
3304 if (m_templateModified) {
3305 int r = QMessageBox::warning(m_qnetTool, tr(
"OK to continue?"),
3306 tr(
"The currently opened registration template has been modified.\n"
3308 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
3311 if (r == QMessageBox::Yes)
3313 else if (r == QMessageBox::Cancel)
3331 QString filename = QFileDialog::getOpenFileName(m_qnetTool,
3332 "Select a registration template",
".",
3333 "Registration template files (*.def *.pvl);;All files (*)");
3335 if (filename.isEmpty())
3338 if (m_pointEditor->setTemplateFile(filename)) {
3351 QFile file(
FileName(fn).expanded());
3352 if (!file.open(QIODevice::ReadOnly)) {
3353 QString msg =
"Failed to open template file \"" + fn +
"\"";
3354 QMessageBox::warning(m_qnetTool,
"IO Error", msg);
3358 QTextStream stream(&file);
3359 m_templateEditor->setText(stream.readAll());
3362 QScrollBar * sb = m_templateEditor->verticalScrollBar();
3363 sb->setValue(sb->minimum());
3365 m_templateModified =
false;
3366 m_saveTemplateFile->setEnabled(
false);
3367 m_templateFileNameLabel->setText(
"Template File: " + fn);
3373 m_templateModified =
true;
3374 m_saveTemplateFile->setEnabled(
true);
3381 if (!m_templateModified)
3384 QString filename = m_pointEditor->templateFileName();
3393 QString filename = QFileDialog::getSaveFileName(m_qnetTool,
3394 "Save registration template",
".",
3395 "Registration template files (*.def *.pvl);;All files (*)");
3397 if (filename.isEmpty())
3411 QString contents = m_templateEditor->toPlainText();
3422 QMessageBox::warning(m_qnetTool,
"Error", message);
3426 QString expandedFileName(
FileName(fn).expanded());
3428 QFile file(expandedFileName);
3430 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
3431 QString msg =
"Failed to save template file to \"" + fn +
"\"\nDo you "
3433 QMessageBox::warning(m_qnetTool,
"IO Error", msg);
3438 QTextStream stream(&file);
3442 if (m_pointEditor->setTemplateFile(fn)) {
3443 m_templateModified =
false;
3444 m_saveTemplateFile->setEnabled(
false);
3445 m_templateFileNameLabel->setText(
"Template File: " + fn);
3466 Pvl templatePvl(m_pointEditor->templateFileName());
3470 registrationDialog.setWindowTitle(
"View or Edit Template File: "
3472 registrationDialog.resize(550,360);
3473 registrationDialog.exec();
3477 QMessageBox::information(m_qnetTool,
"Error", message);
3490 m_pointEditor->saveChips();
3494 void QnetTool::showHideTemplateEditor() {
3496 if (!m_templateEditorWidget)
3499 m_templateEditorWidget->setVisible(!m_templateEditorWidget->isVisible());
3517 if (m_editPoint == NULL)
return;
3518 if (pointId != m_editPoint->GetId())
return;
3523 ControlPoint *updatedPoint = m_controlNet->GetPoint(pointId);
3524 m_editPoint->
SetEditLock(updatedPoint->IsEditLocked());
3525 m_editPoint->SetIgnored(updatedPoint->IsIgnored());
3526 m_editPoint->SetAprioriSurfacePoint(updatedPoint->GetAprioriSurfacePoint());
3529 m_lockPoint->setChecked(m_editPoint->IsEditLocked());
3532 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
3561 if (m_editPoint != NULL) {
3563 QString
id = m_ptIdValue->text().remove(
"Point ID: ");
3564 m_controlNet->GetPoint(
id);
3569 emit editPointChanged(
"");
3570 m_qnetTool->setVisible(
false);
3571 m_measureWindow->setVisible(
false);
3575 if (m_editPoint == NULL) {
3611 QToolButton *showNavToolButton =
new QToolButton();
3612 showNavToolButton->setText(
"Show Nav Tool");
3613 showNavToolButton->setToolTip(
"Shows the Navigation Tool Window");
3615 "<b>Function:</b> This button will bring up the Navigation Tool window that allows \
3616 the user to view, modify, ignore, delete, or filter points and cubes.";
3617 showNavToolButton->setWhatsThis(text);
3618 connect(showNavToolButton,SIGNAL(clicked(
bool)),
this,SLOT(
showNavWindow(
bool)));
3620 QHBoxLayout *layout =
new QHBoxLayout(hbox);
3621 layout->setMargin(0);
3622 layout->addWidget(showNavToolButton);
3623 layout->addStretch(1);
3624 hbox->setLayout(layout);
3651 QString filter =
"Isis cubes (*.cub *.cub.*);;";
3652 filter +=
"Detached labels (*.lbl);;";
3653 filter +=
"All (*)";
3655 QString ground = QFileDialog::getOpenFileName((
QWidget*)parent(),
3656 "Open ground source",
3659 if (ground.isEmpty())
return;
3665 if (m_groundOpen && m_groundFile ==
FileName(ground).name()) {
3672 m_workspace->mdiArea()->setActiveSubWindow(
3681 if (newGroundSN != m_groundSN && m_serialNumberList->hasSerialNumber(newGroundSN)) {
3684 QString message =
"A cube in the cube list has the same serial number as this ground file. ";
3685 message +=
"If this ground source is a level 1, un-projected cube, it is probably included ";
3686 message +=
"in the cube list. If the ground source is a projected version of a cube in ";
3687 message +=
"the list and has the Instrument Group in the labels, the un-projected and ";
3688 message +=
"projected cube will have the same serial number. \n";
3689 message +=
"Because of duplicate serial numbers this cube cannot be used as a ground ";
3690 message +=
"source.\n\n";
3691 message +=
"NOTE: If this cube is the reference cube you can select points in ";
3692 message +=
"the Navigator window, then select the Set Apriori button to use this cube to ";
3693 message +=
"set the apriori latitude, longitude and radius.";
3694 QMessageBox::critical(m_qnetTool,
"Cannot set ground source", message);
3703 clearGroundSource ();
3706 QApplication::setOverrideCursor(Qt::WaitCursor);
3711 m_groundCube.reset(NULL);
3712 m_groundGmap.reset(NULL);
3715 QScopedPointer<Cube> newGroundCube(
new Cube(ground,
"r"));
3716 QScopedPointer<UniversalGroundMap> newGroundGmap(
new UniversalGroundMap(*newGroundCube));
3718 m_groundFile =
FileName(newGroundCube->fileName()).
name();
3719 m_groundCube.reset(newGroundCube.take());
3720 m_groundGmap.reset(newGroundGmap.take());
3722 m_serialNumberList->add(ground,
true);
3725 QApplication::restoreOverrideCursor();
3726 QMessageBox::critical(m_qnetTool,
"Error", e.
toString());
3728 m_groundFile.clear();
3735 emit refreshNavList();
3739 m_groundSN = newGroundSN;
3740 m_groundSourceFile = ground;
3741 m_groundOpen =
true;
3743 m_workspace->addCubeViewport(m_groundCube.data());
3758 if (m_editPoint != NULL) {
3764 else if (m_groundCube->hasTable(
"ShapeModelStatistics")) {
3765 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Basemap;
3767 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3768 m_radiusSourceFile = ground;
3775 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Basemap;
3777 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3778 m_radiusSourceFile =
"";
3784 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Reference;
3786 PvlGroup kernels = m_groundCube->group(
"Kernels");
3787 QString shapeFile = kernels [
"ShapeModel"];
3788 if (shapeFile.contains(
"dem")) {
3789 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3790 m_radiusSourceFile = shapeFile;
3793 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3795 m_radiusSourceFile = (QString) kernels[
"TargetAttitudeShape"];
3800 QString message =
"Cannot create either Camera or Projections ";
3801 message +=
"for the ground source file. Check the validity of the ";
3802 message +=
" cube labels. The cube must either be projected or ";
3803 message +=
" run through spiceinit.";
3804 QMessageBox::critical(m_qnetTool,
"Error", message);
3806 clearGroundSource ();
3807 QApplication::restoreOverrideCursor();
3808 emit refreshNavList();
3815 if (m_editPoint != NULL &&
3819 emit refreshNavList();
3820 QApplication::restoreOverrideCursor();
3833 if (m_groundFile.isEmpty()) {
3834 QString message =
"You must enter a ground source before opening a Dem.";
3835 QMessageBox::critical(m_qnetTool,
"Error", message);
3839 QString filter =
"Isis cubes (*.cub *.cub.*);;";
3840 filter +=
"Detached labels (*.lbl);;";
3841 filter +=
"All (*)";
3842 QString dem = QFileDialog::getOpenFileName((
QWidget*)parent(),
3846 if (dem.isEmpty())
return;
3861 QString referenceSN = m_editPoint->GetReferenceSN();
3862 QString referenceFileName = m_serialNumberList->fileName(referenceSN);
3863 QScopedPointer<Cube> referenceCube(
new Cube(referenceFileName,
"r"));
3864 PvlGroup kernels = referenceCube->group(
"Kernels");
3865 QString shapeFile = kernels[
"ShapeModel"];
3870 if (shapeFile.contains(
".cub")) {
3871 if (shapeFile.contains(
"dem")) {
3872 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3875 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3878 m_radiusSourceFile = shapeFile;
3886 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3889 refSpice->
radii(refRadii);
3890 m_demFile = QString::number(refRadii[0].meters()) +
", " +
3891 QString::number(refRadii[1].meters()) +
", " +
3892 QString::number(refRadii[2].meters());
3894 m_radiusSourceFile =
"";
3897 m_groundFileNameLabel->setText(
"Ground Source File: " + m_groundFile);
3898 m_radiusFileNameLabel->setText(
"Radius Source: " + m_demFile);
3902 void QnetTool::initDem (QString demFile) {
3906 QApplication::setOverrideCursor(Qt::WaitCursor);
3908 if (m_demFile == demFile) {
3909 QApplication::restoreOverrideCursor();
3913 m_demCube.reset(NULL);
3918 QScopedPointer<Cube> newDemCube(
new Cube(demFile,
"r"));
3920 m_demFile = FileName(newDemCube->fileName()).name();
3921 m_demCube.reset(newDemCube.take());
3923 catch (IException &e) {
3924 QMessageBox::critical(m_qnetTool,
"Error", e.toString());
3925 QApplication::restoreOverrideCursor();
3931 if (!m_demCube->hasTable(
"ShapeModelStatistics")) {
3932 QString message = m_demFile +
" is not a DEM.";
3933 QMessageBox::critical(m_qnetTool,
"Error", message);
3934 m_demCube.reset(NULL);
3937 QApplication::restoreOverrideCursor();
3940 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3941 m_groundFileNameLabel->setText(
"Ground Source File: " + m_groundFile);
3942 m_radiusFileNameLabel->setText(
"Radius Source File: " + m_demFile);
3943 m_radiusSourceFile = demFile;
3945 QApplication::restoreOverrideCursor();
3960 clearGroundSource();
3965 void QnetTool::clearGroundSource () {
3967 m_leftCombo->removeItem(m_leftCombo->findText(m_groundFile));
3968 m_rightCombo->removeItem(m_rightCombo->findText(m_groundFile));
3974 if (vp->
cube() == m_groundCube.data()) {
3979 vp->parentWidget()->parentWidget()->close();
3980 QApplication::processEvents();
3986 m_groundOpen =
false;
3987 m_groundCube.take();
3988 m_groundFile.clear();
3989 m_groundGmap.reset(NULL);
3991 m_groundFileNameLabel->setText(
"Ground Source File: ");
3993 m_radiusFileNameLabel->setText(
"Radius Source File: " + m_demFile);
3997 m_serialNumberList->remove(m_groundSN);
4003 m_editPoint->HasSerialNumber(m_groundSN)) {
4004 m_editPoint->Delete(m_groundSN);
4026 if (!m_demOpen)
return Null;
4041 m_demCube->pixelType(),
4044 m_demCube->read(*portal);
4069 QColor qc = Qt::red;
4070 QPalette p = m_savePoint->palette();
4071 p.setColor(QPalette::ButtonText,qc);
4072 m_savePoint->setPalette(p);
4092 if (m_editPoint == NULL)
return false;
4095 if (m_editPoint->IsEditLocked() && m_editPoint->IsReferenceExplicit() &&
4096 (m_editPoint->GetReferenceSN() == serialNumber)) {
4101 return m_editPoint->GetMeasure(serialNumber)->IsEditLocked();
4114 FileName config(
"$HOME/.Isis/qnet/QnetTool.config");
4115 QSettings settings(config.
expanded(), QSettings::NativeFormat);
4116 QPoint pos = settings.value(
"pos", QPoint(300, 100)).toPoint();
4117 QSize size = settings.value(
"size", QSize(900, 500)).toSize();
4118 m_qnetTool->resize(size);
4119 m_qnetTool->move(pos);
4132 if(!m_qnetTool->isVisible())
return;
4133 FileName config(
"$HOME/.Isis/qnet/QnetTool.config");
4134 QSettings settings(config.
expanded(), QSettings::NativeFormat);
4135 settings.setValue(
"pos", m_qnetTool->pos());
4136 settings.setValue(
"size", m_qnetTool->size());
4141 void QnetTool::enterWhatsThisMode() {
4142 QWhatsThis::enterWhatsThisMode();
double degrees() const
Get the angle in units of Degrees.
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
static QString UserName()
Returns the user name.
double * DoubleBuffer() const
Returns the value of the shape buffer.
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
virtual double Line() const
Returns the current line number.
Camera(Cube &cube)
Constructs the Camera object.
virtual double Sample() const
Returns the current sample number.
virtual bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
virtual bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
bool IsEditLocked() const
Return value for p_editLock or implicit lock on reference measure.
Status SetCubeSerialNumber(QString newSerialNumber)
Set cube serial number.
static QString MeasureTypeToString(MeasureType type)
Return the String Control Measure type.
Status SetCoordinate(double sample, double line)
Set the coordinate of the measurement.
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
@ Manual
Hand Measured (e.g., qnet)
@ Candidate
(e.g., autoseed, interest) AKA predicted, unmeasured, unverified
@ RegisteredSubPixel
Registered to sub-pixel (e.g., pointreg)
@ RegisteredPixel
Registered to whole pixel (e.g.,pointreg)
Status SetType(MeasureType type)
Set how the coordinate was obtained.
Status SetCamera(Isis::Camera *camera)
Set pointer to camera associated with a measure.
Status SetChooserName()
Set chooser name to a user who last changed the coordinate.
double GetResidualMagnitude() const
Return Residual magnitude.
@ GoodnessOfFit
GoodnessOfFit is pointreg information for reference measures.
double GetNumericalValue() const
Get the value associated with this log data.
Status
This is a return status for many of the mutating (setter) method calls.
@ PointLocked
This is returned when the operation requires Edit Lock to be false but it is currently true.
Status SetEditLock(bool editLock)
Set the EditLock state.
Status SetAprioriSurfacePoint(SurfacePoint aprioriSP)
This updates the apriori surface point.
Status SetChooserName(QString name)
Set the point's chooser name.
int Delete(ControlMeasure *measure)
Remove a measurement from the control point, deleting reference measure is allowed.
void Add(ControlMeasure *measure)
Add a measurement to the control point, taking ownership of the measure in the process.
PointType GetType() const
PointType
These are the valid 'types' of point.
@ Constrained
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
@ Free
A Free point is a Control Point that identifies common measurements between two or more cubes.
@ Fixed
A Fixed point is a Control Point whose lat/lon is well established and should not be changed.
Status SetType(PointType newType)
Updates the control point's type.
static QString PointTypeToString(PointType type)
Obtain a string representation of a given PointType.
QString GetId() const
Return the Id of the control point.
bool HasSerialNumber(QString serialNumber) const
Return true if given serial number exists in point.
IO Handler for Isis Cubes.
virtual QString fileName() const
Returns the opened cube's filename.
Widget to display Isis cubes for qt apps.
void viewportToCube(int x, int y, double &sample, double &line) const
Turns a viewport into a cube.
void cubeToViewport(double sample, double line, int &x, int &y) const
Turns a cube into a viewport.
UniversalGroundMap * universalGroundMap() const
Distance measurement, usually in meters.
@ Meters
The distance is being specified in meters.
double meters() const
Get the distance in meters.
File name manipulation and expansion.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
@ Programmer
This error is for when a programmer made an API call that was illegal.
QString toString() const
Returns a string representation of this exception.
int Samples()
Returns the number of samples needed by the interpolator.
int Lines()
Returns the number of lines needed by the interpolator.
double HotSample()
Returns the sample coordinate of the center pixel in the buffer for the interpolator.
double HotLine()
Returns the line coordinate of the center pixel in the buffer for the interpolator.
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.
This class is designed to encapsulate the concept of a Latitude.
This class is designed to encapsulate the concept of a Longitude.
Base class for the Qisis main windows.
Cube display widget for certain Isis MDI applications.
void setFiles(QStringList pointFiles)
Buffer for containing a two dimensional section of an image.
void SetPosition(const double sample, const double line, const int band)
Sets the line and sample position of the buffer.
static Isis::Projection * CreateFromCube(Isis::Cube &cube)
This method is a helper method.
QString fileName() const
Returns the filename used to initialise the Pvl object.
PvlEditDialog creates a QDialog window in which a QTextEdit box displays the contents of a pvl file.
Contains multiple PvlContainers.
Container for cube-like labels.
void setFiles(QStringList pointFiles)
Set files found containing selected point.
void setFiles(ControlPoint point, QStringList pointFiles)
virtual double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
virtual double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
Serial Number list generator.
Obtain SPICE information for a spacecraft.
void radii(Distance r[3]) const
Returns the radii of the body in km.
This class defines a body-fixed surface point.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
Distance GetLonSigmaDistance() const
Return the longitude sigma in meters.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
Distance GetLatSigmaDistance() const
Return the latitude sigma as a Distance.
Distance GetLocalRadius() const
Return the radius of the surface point.
double Sample() const
Returns the current line value of the camera model or projection.
double UniversalLongitude() const
Returns the universal longitude of the camera model or projection.
bool SetImage(double sample, double line)
Returns whether the sample/line postion was set successfully in the camera model or projection.
double UniversalLatitude() const
Returns the universal latitude of the camera model or projection.
double Line() const
Returns the current line value of the camera model or projection.
bool SetUniversalGround(double lat, double lon)
Returns whether the lat/lon position was set successfully in the camera model or projection.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
const double Null
Value for an Isis Null pixel.
Namespace for the standard library.