9 #include "QnetDeletePointDialog.h"
10 #include "QnetNewMeasureDialog.h"
11 #include "QnetNewPointDialog.h"
12 #include "QnetFixedPointDialog.h"
23 #include "ControlPointEdit.h"
29 #include "MainWindow.h"
34 #include "PvlEditDialog.h"
40 #include "ViewportMainWindow.h"
45 const int VIEWSIZE = 301;
46 const int CHIPVIEWPORT_WIDTH = 310;
62 m_serialNumberList = NULL;
63 m_templateModified =
false;
68 if (qobject_cast<Workspace *>(parent)) {
69 m_workspace = qobject_cast<
Workspace *>(parent);
71 else if (qobject_cast<ViewportMainWindow *>(parent)) {
76 tr(
"Could not find the workspace with the given parent, expected a Workspace or "
77 "ViewportMainWindow."),
85 QnetTool::~QnetTool () {
90 delete m_rightMeasure;
91 delete m_measureTable;
92 delete m_measureWindow;
122 m_qnetTool =
new MainWindow(
"Qnet Tool", parent);
123 m_qnetTool->setObjectName(
"QnetTool");
132 connect(
this, SIGNAL(newControlNetwork(
ControlNet *)),
133 m_pointEditor, SIGNAL(newControlNetwork(
ControlNet *)));
139 connect(
this, SIGNAL(measureChanged()),
142 QPushButton *
addMeasure =
new QPushButton(
"Add Measure(s) to Point");
143 addMeasure->setToolTip(
"Add a new measure to the edit control point.");
144 addMeasure->setWhatsThis(
"This allows a new control measure to be added "
145 "to the currently edited control point. A selection "
146 "box with all cubes from the input list will be "
147 "displayed with those that intersect with the "
148 "control point highlighted.");
149 connect(addMeasure, SIGNAL(clicked()),
this, SLOT(
addMeasure()));
151 m_savePoint =
new QPushButton (
"Save Point");
152 m_savePoint->setToolTip(
"Save the edit control point to the control "
154 m_savePoint->setWhatsThis(
"Save the edit control point to the control "
155 "network which is loaded into memory in its entirety. "
156 "When a control point is selected for editing, "
157 "a copy of the point is made so that the original control "
158 "point remains in the network.");
159 m_saveDefaultPalette = m_savePoint->palette();
160 connect (m_savePoint,SIGNAL(clicked()),
this,SLOT(
savePoint()));
162 QHBoxLayout * addMeasureLayout =
new QHBoxLayout;
163 addMeasureLayout->addWidget(addMeasure);
164 addMeasureLayout->addWidget(m_savePoint);
167 m_templateFileNameLabel =
new QLabel(
"Template File: " +
168 m_pointEditor->templateFileName());
169 m_templateFileNameLabel->setToolTip(
"Sub-pixel registration template File.");
173 m_templateFileNameLabel->setWhatsThis(
"FileName of the sub-pixel "
174 "registration template. Refer to $ISISROOT/doc/documents/"
175 "PatternMatch/PatternMatch.html for a description of the "
176 "contents of this file.");
178 m_groundFileNameLabel =
new QLabel(
"Ground Source File: ");
179 m_groundFileNameLabel->setToolTip(
"Cube used to create ground control "
180 "points, either Fixed or Constrained.");
181 m_groundFileNameLabel->setWhatsThis(
"This cube is used to create ground "
182 "control points, Fixed or Constrained. This may "
183 "be a Dem, a shaded relief version of a Dem, "
184 "a projected basemap or an unprojected cube with "
185 "corrected camera pointing. This will be used "
186 "to set the apriori latitude, longitude.");
187 m_radiusFileNameLabel =
new QLabel(
"Radius Source File: ");
188 m_radiusFileNameLabel->setToolTip(
"Dem used to set the radius of ground "
189 "control points, Fixed or Constrained. This must "
190 "be a Dem and is strictly used to set the apriori "
191 "radius for ground control points.");
193 QVBoxLayout * centralLayout =
new QVBoxLayout;
195 centralLayout->addWidget(m_templateFileNameLabel);
196 centralLayout->addWidget(m_groundFileNameLabel);
197 centralLayout->addWidget(m_radiusFileNameLabel);
199 centralLayout->addStretch();
200 centralLayout->addWidget(m_pointEditor);
201 centralLayout->addLayout(addMeasureLayout);
203 centralWidget->setLayout(centralLayout);
205 QScrollArea *scrollArea =
new QScrollArea();
206 scrollArea->setObjectName(
"QnetToolScroll");
207 scrollArea->setWidget(centralWidget);
208 scrollArea->setWidgetResizable(
true);
209 centralWidget->adjustSize();
210 m_qnetTool->setCentralWidget(scrollArea);
214 connect(
this, SIGNAL(editPointChanged(QString)),
224 QHBoxLayout * measureLayout =
new QHBoxLayout;
228 QVBoxLayout * groupBoxesLayout =
new QVBoxLayout;
230 groupBoxesLayout->addStretch();
231 groupBoxesLayout->addLayout(measureLayout);
234 groupBoxesWidget->setLayout(groupBoxesLayout);
238 QSplitter * topSplitter =
new QSplitter;
239 topSplitter->addWidget(groupBoxesWidget);
240 topSplitter->addWidget(m_templateEditorWidget);
241 topSplitter->setStretchFactor(0, 4);
242 topSplitter->setStretchFactor(1, 3);
244 m_templateEditorWidget->hide();
254 m_ptIdValue =
new QLabel;
256 for (
int i=0; i<ControlPoint::PointTypeCount; i++) {
260 QHBoxLayout *pointTypeLayout =
new QHBoxLayout;
261 QLabel *pointTypeLabel =
new QLabel(
"PointType:");
262 pointTypeLayout->addWidget(pointTypeLabel);
263 pointTypeLayout->addWidget(m_pointType);
264 connect(m_pointType, SIGNAL(activated(
int)),
266 m_numMeasures =
new QLabel;
267 m_pointAprioriLatitude =
new QLabel;
268 m_pointAprioriLongitude =
new QLabel;
269 m_pointAprioriRadius =
new QLabel;
270 m_pointAprioriLatitudeSigma =
new QLabel;
271 m_pointAprioriLongitudeSigma =
new QLabel;
272 m_pointAprioriRadiusSigma =
new QLabel;
273 QVBoxLayout * leftLayout =
new QVBoxLayout;
274 leftLayout->addWidget(m_ptIdValue);
275 leftLayout->addLayout(pointTypeLayout);
276 leftLayout->addWidget(m_pointAprioriLatitude);
277 leftLayout->addWidget(m_pointAprioriLongitude);
278 leftLayout->addWidget(m_pointAprioriRadius);
279 leftLayout->addWidget(m_pointAprioriLatitudeSigma);
280 leftLayout->addWidget(m_pointAprioriLongitudeSigma);
281 leftLayout->addWidget(m_pointAprioriRadiusSigma);
284 m_lockPoint =
new QCheckBox(
"Edit Lock Point");
285 connect(m_lockPoint, SIGNAL(clicked(
bool)),
this, SLOT(
setLockPoint(
bool)));
286 m_ignorePoint =
new QCheckBox(
"Ignore Point");
287 connect(m_ignorePoint, SIGNAL(clicked(
bool)),
289 connect(
this, SIGNAL(ignorePointChanged()), m_ignorePoint, SLOT(toggle()));
290 m_pointLatitude =
new QLabel;
291 m_pointLongitude =
new QLabel;
292 m_pointRadius =
new QLabel;
294 QVBoxLayout * rightLayout =
new QVBoxLayout;
295 rightLayout->addWidget(m_numMeasures);
296 rightLayout->addWidget(m_lockPoint);
297 rightLayout->addWidget(m_ignorePoint);
298 rightLayout->addWidget(m_pointLatitude);
299 rightLayout->addWidget(m_pointLongitude);
300 rightLayout->addWidget(m_pointRadius);
303 QHBoxLayout * mainLayout =
new QHBoxLayout;
304 mainLayout->addLayout(leftLayout);
305 mainLayout->addStretch();
306 mainLayout->addLayout(rightLayout);
309 QGroupBox * groupBox =
new QGroupBox(
"Control Point");
310 groupBox->setLayout(mainLayout);
320 m_leftCombo->view()->installEventFilter(
this);
321 m_leftCombo->setToolTip(
"Choose left control measure");
322 m_leftCombo->setWhatsThis(
"Choose left control measure identified by "
324 connect(m_leftCombo, SIGNAL(activated(
int)),
326 m_lockLeftMeasure =
new QCheckBox(
"Edit Lock Measure");
327 connect(m_lockLeftMeasure, SIGNAL(clicked(
bool)),
329 m_ignoreLeftMeasure =
new QCheckBox(
"Ignore Measure");
330 connect(m_ignoreLeftMeasure, SIGNAL(clicked(
bool)),
332 connect(
this, SIGNAL(ignoreLeftChanged()),
333 m_ignoreLeftMeasure, SLOT(toggle()));
334 m_leftReference =
new QLabel();
335 m_leftMeasureType =
new QLabel();
336 m_leftSampError =
new QLabel();
337 m_leftSampError->setToolTip(
"<strong>Jigsaw</strong> sample residual.");
338 m_leftSampError->setWhatsThis(
"This is the sample residual for the left "
339 "measure calculated by the application, "
340 "<strong>jigsaw</strong>.");
341 m_leftLineError =
new QLabel();
342 m_leftLineError->setToolTip(
"<strong>Jigsaw</strong> line residual.");
343 m_leftLineError->setWhatsThis(
"This is the line residual for the left "
344 "measure calculated by the application, "
345 "<strong>jigsaw</strong>.");
346 m_leftSampShift =
new QLabel();
347 m_leftSampShift->setToolTip(
"Sample shift between apriori and current");
348 m_leftSampShift->setWhatsThis(
"The shift between the apriori sample and "
349 "the current sample. The apriori sample is set "
350 "when creating a new measure.");
351 m_leftLineShift =
new QLabel();
352 m_leftLineShift->setToolTip(
"Line shift between apriori and current");
353 m_leftLineShift->setWhatsThis(
"The shift between the apriori line and "
354 "the current line. The apriori line is set "
355 "when creating a new measure.");
356 m_leftGoodness =
new QLabel();
357 m_leftGoodness->setToolTip(
"Goodness of Fit result from sub-pixel "
359 m_leftGoodness->setWhatsThis(
"Resulting Goodness of Fit from sub-pixel "
361 QVBoxLayout * leftLayout =
new QVBoxLayout;
362 leftLayout->addWidget(m_leftCombo);
363 leftLayout->addWidget(m_lockLeftMeasure);
364 leftLayout->addWidget(m_ignoreLeftMeasure);
365 leftLayout->addWidget(m_leftReference);
366 leftLayout->addWidget(m_leftMeasureType);
367 leftLayout->addWidget(m_leftSampError);
368 leftLayout->addWidget(m_leftLineError);
369 leftLayout->addWidget(m_leftSampShift);
370 leftLayout->addWidget(m_leftLineShift);
371 leftLayout->addWidget(m_leftGoodness);
373 QGroupBox * leftGroupBox =
new QGroupBox(
"Left Measure");
374 leftGroupBox->setLayout(leftLayout);
385 m_rightCombo->view()->installEventFilter(
this);
386 m_rightCombo->setToolTip(
"Choose right control measure");
387 m_rightCombo->setWhatsThis(
"Choose right control measure identified by "
389 connect(m_rightCombo, SIGNAL(activated(
int)),
391 m_lockRightMeasure =
new QCheckBox(
"Edit Lock Measure");
392 connect(m_lockRightMeasure, SIGNAL(clicked(
bool)),
394 m_ignoreRightMeasure =
new QCheckBox(
"Ignore Measure");
395 connect(m_ignoreRightMeasure, SIGNAL(clicked(
bool)),
397 connect(
this, SIGNAL(ignoreRightChanged()),
398 m_ignoreRightMeasure, SLOT(toggle()));
399 m_rightReference =
new QLabel();
400 m_rightMeasureType =
new QLabel();
401 m_rightSampError =
new QLabel();
402 m_rightSampError->setToolTip(
"<strong>Jigsaw</strong> sample residual.");
403 m_rightSampError->setWhatsThis(
"This is the sample residual for the right "
404 "measure which was calculated by the application, "
405 "<strong>jigsaw</strong>.");
406 m_rightLineError =
new QLabel();
407 m_rightLineError->setToolTip(
"<strong>Jigsaw</strong> line residual.");
408 m_rightLineError->setWhatsThis(
"This is the line residual for the right "
409 "measure which was calculated by the application, "
410 "<strong>jigsaw</strong>.");
411 m_rightSampShift =
new QLabel();
412 m_rightSampShift->setToolTip(m_leftSampShift->toolTip());
413 m_rightSampShift->setWhatsThis(m_leftSampShift->whatsThis());
414 m_rightLineShift =
new QLabel();
415 m_rightLineShift->setToolTip(m_leftLineShift->toolTip());
416 m_rightLineShift->setWhatsThis(m_leftLineShift->whatsThis());
417 m_rightGoodness =
new QLabel();
418 m_rightGoodness->setToolTip(m_leftGoodness->toolTip());
419 m_rightGoodness->setWhatsThis(m_leftGoodness->whatsThis());
422 QVBoxLayout * rightLayout =
new QVBoxLayout;
423 rightLayout->addWidget(m_rightCombo);
424 rightLayout->addWidget(m_lockRightMeasure);
425 rightLayout->addWidget(m_ignoreRightMeasure);
426 rightLayout->addWidget(m_rightReference);
427 rightLayout->addWidget(m_rightMeasureType);
428 rightLayout->addWidget(m_rightSampError);
429 rightLayout->addWidget(m_rightLineError);
430 rightLayout->addWidget(m_rightSampShift);
431 rightLayout->addWidget(m_rightLineShift);
432 rightLayout->addWidget(m_rightGoodness);
434 QGroupBox * rightGroupBox =
new QGroupBox(
"Right Measure");
435 rightGroupBox->setLayout(rightLayout);
437 return rightGroupBox;
446 toolBar->addAction(m_openTemplateFile);
447 toolBar->addSeparator();
448 toolBar->addAction(m_saveTemplateFile);
449 toolBar->addAction(m_saveTemplateFileAs);
451 m_templateEditor =
new QTextEdit;
452 connect(m_templateEditor, SIGNAL(textChanged()),
this,
455 QVBoxLayout *mainLayout =
new QVBoxLayout;
456 mainLayout->addWidget(toolBar);
457 mainLayout->addWidget(m_templateEditor);
459 m_templateEditorWidget =
new QWidget;
460 m_templateEditorWidget->setLayout(mainLayout);
465 void QnetTool::createActions() {
466 m_openGround =
new QAction(m_qnetTool);
467 m_openGround->setText(
"Open &Ground Source");
468 m_openGround->setToolTip(
"Open a ground source for choosing ground control "
470 m_openGround->setStatusTip(
"Open a ground source for choosing ground "
473 "<b>Function:</b> Open and display a ground source for choosing "
474 "ground control points, both Fixed and Constrained."
475 "This cube can be a level1, level2 or dem cube.";
476 m_openGround->setWhatsThis(whatsThis);
477 connect (m_openGround,SIGNAL(activated()),
this,SLOT(
openGround()));
479 m_openDem =
new QAction(m_qnetTool);
480 m_openDem->setText(
"Open &Radius Source");
481 m_openDem->setToolTip(
"Open radius source file for ground control points");
482 m_openDem->setStatusTip(
"Open radius source file for ground control points");
484 "<b>Function:</b> Open a DEM for determining the radius when "
485 "choosing ground control points. This is not the file that will be "
486 "displayed for visually picking points. This is strictly used to "
487 "determine the radius value for ground control points.";
488 m_openDem->setWhatsThis(whatsThis);
489 connect (m_openDem,SIGNAL(activated()),
this,SLOT(
openDem()));
491 m_saveNet =
new QAction(QIcon(
":save"),
"Save Control Network ...",
493 m_saveNet->setToolTip(
"Save current control network");
494 m_saveNet->setStatusTip(
"Save current control network");
495 whatsThis =
"<b>Function:</b> Saves the current <i>"
496 "control network</i>";
497 m_saveNet->setWhatsThis(whatsThis);
498 connect(m_saveNet, SIGNAL(activated()),
this, SLOT(
saveNet()));
500 m_saveAsNet =
new QAction(QIcon(
":saveAs"),
"Save Control Network &As...",
502 m_saveAsNet->setToolTip(
"Save current control network to chosen file");
503 m_saveAsNet->setStatusTip(
"Save current control network to chosen file");
504 whatsThis =
"<b>Function:</b> Saves the current <i>"
505 "control network</i> under chosen filename";
506 m_saveAsNet->setWhatsThis(whatsThis);
507 connect(m_saveAsNet, SIGNAL(activated()),
this, SLOT(
saveAsNet()));
509 m_closeQnetTool =
new QAction(QIcon(
":close"),
"&Close", m_qnetTool);
510 m_closeQnetTool->setToolTip(
"Close this window");
511 m_closeQnetTool->setStatusTip(
"Close this window");
512 m_closeQnetTool->setShortcut(Qt::ALT + Qt::Key_F4);
513 whatsThis =
"<b>Function:</b> Closes the Qnet Tool window for this point "
514 "<p><b>Shortcut:</b> Alt+F4 </p>";
515 m_closeQnetTool->setWhatsThis(whatsThis);
516 connect(m_closeQnetTool, SIGNAL(activated()), m_qnetTool, SLOT(close()));
518 m_showHideTemplateEditor =
new QAction(QIcon(
":view_edit"),
519 "&View/edit registration template", m_qnetTool);
520 m_showHideTemplateEditor->setCheckable(
true);
521 m_showHideTemplateEditor->setToolTip(
"View and/or edit the registration "
523 m_showHideTemplateEditor->setStatusTip(
"View and/or edit the registration "
525 whatsThis =
"<b>Function:</b> Displays the curent registration template. "
526 "The user may edit and save changes under a chosen filename.";
527 m_showHideTemplateEditor->setWhatsThis(whatsThis);
528 connect(m_showHideTemplateEditor, SIGNAL(activated()),
this,
529 SLOT(showHideTemplateEditor()));
531 m_saveChips =
new QAction(QIcon(
":window_new"),
"Save registration chips",
533 m_saveChips->setToolTip(
"Save registration chips");
534 m_saveChips->setStatusTip(
"Save registration chips");
535 whatsThis =
"<b>Function:</b> Save registration chips to file. "
536 "Each chip: pattern, search, fit will be saved to a separate file.";
537 m_saveChips->setWhatsThis(whatsThis);
538 connect(m_saveChips, SIGNAL(activated()),
this, SLOT(
saveChips()));
540 m_openTemplateFile =
new QAction(QIcon(
":open"),
"&Open registration "
541 "template", m_qnetTool);
542 m_openTemplateFile->setToolTip(
"Set registration template");
543 m_openTemplateFile->setStatusTip(
"Set registration template");
544 whatsThis =
"<b>Function:</b> Allows user to select a new file to set as "
545 "the registration template";
546 m_openTemplateFile->setWhatsThis(whatsThis);
547 connect(m_openTemplateFile, SIGNAL(activated()),
this, SLOT(
openTemplateFile()));
549 m_saveTemplateFile =
new QAction(QIcon(
":save"),
"&Save template file",
551 m_saveTemplateFile->setToolTip(
"Save the template file");
552 m_saveTemplateFile->setStatusTip(
"Save the template file");
553 m_saveTemplateFile->setWhatsThis(
"Save the registration template file");
554 connect(m_saveTemplateFile, SIGNAL(triggered()),
this,
557 m_saveTemplateFileAs =
new QAction(QIcon(
":saveAs"),
"&Save template as...",
559 m_saveTemplateFileAs->setToolTip(
"Save the template file");
560 m_saveTemplateFileAs->setStatusTip(
"Save the template file");
561 m_saveTemplateFileAs->setWhatsThis(
"Save the registration template file");
562 connect(m_saveTemplateFileAs, SIGNAL(triggered()),
this,
566 "$base/icons/contexthelp.png").expanded()),
"&Whats's This", m_qnetTool);
567 m_whatsThis->setShortcut(Qt::SHIFT | Qt::Key_F1);
568 m_whatsThis->setToolTip(
"Activate What's This and click on items on "
569 "user interface to see more information.");
570 connect(m_whatsThis, SIGNAL(activated()),
this, SLOT(enterWhatsThisMode()));
587 QMenu *fileMenu = m_qnetTool->menuBar()->addMenu(
"&File");
588 fileMenu->addAction(m_openGround);
589 fileMenu->addAction(m_openDem);
590 fileMenu->addAction(m_saveNet);
591 fileMenu->addAction(m_saveAsNet);
592 fileMenu->addAction(m_closeQnetTool);
594 QMenu * regMenu = m_qnetTool->menuBar()->addMenu(
"&Registration");
595 regMenu->addAction(m_openTemplateFile);
596 regMenu->addAction(m_showHideTemplateEditor);
597 regMenu->addAction(m_saveChips);
599 QMenu *helpMenu = m_qnetTool->menuBar()->addMenu(
"&Help");
600 helpMenu->addAction(m_whatsThis);
604 void QnetTool::createToolBars() {
607 toolBar->setObjectName(
"TemplateEditorToolBar");
608 toolBar->setFloatable(
false);
609 toolBar->addAction(m_saveNet);
610 toolBar->addSeparator();
611 toolBar->addAction(m_showHideTemplateEditor);
612 toolBar->addAction(m_saveChips);
613 toolBar->addAction(m_whatsThis);
615 m_qnetTool->addToolBar(Qt::TopToolBarArea, toolBar);
685 m_editPoint->GetMeasure(m_leftMeasure->GetCubeSerialNumber());
687 m_editPoint->GetMeasure(m_rightMeasure->GetCubeSerialNumber());
689 if (m_editPoint->IsIgnored()) {
690 QString message =
"You are saving changes to a measure on an ignored ";
691 message +=
"point. Do you want to set Ignore = False on the point and ";
692 message +=
"both measures?";
693 switch (QMessageBox::question(m_qnetTool,
"Qnet Tool Save Measure",
694 message,
"&Yes",
"&No", 0, 0)) {
697 m_editPoint->SetIgnored(
false);
698 emit ignorePointChanged();
699 if (m_leftMeasure->IsIgnored()) {
700 m_leftMeasure->SetIgnored(
false);
701 emit ignoreLeftChanged();
703 if (m_rightMeasure->IsIgnored()) {
704 m_rightMeasure->SetIgnored(
false);
705 emit ignoreRightChanged();
713 if (origRightMeasure->IsIgnored() && m_rightMeasure->IsIgnored()) {
714 QString message =
"You are saving changes to an ignored measure. ";
715 message +=
"Do you want to set Ignore = False on the right measure?";
716 switch(QMessageBox::question(m_qnetTool,
"Qnet Tool Save Measure",
717 message,
"&Yes",
"&No", 0, 0)){
720 m_rightMeasure->SetIgnored(
false);
721 emit ignoreRightChanged();
730 if (m_editPoint->IsReferenceExplicit()) {
731 if (m_editPoint->IsEditLocked()) {
732 QString message =
"This control point is edit locked. The Apriori latitude, longitude and ";
733 message +=
"radius cannot be updated. You must first unlock the point by clicking the ";
734 message +=
"check box above labeled \"Edit Lock Point\".";
735 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
740 else if (m_leftMeasure->GetCubeSerialNumber() != m_groundSN) {
741 m_editPoint->SetRefMeasure(m_leftMeasure->GetCubeSerialNumber());
751 m_rightMeasure->GetCubeSerialNumber() == m_groundSN)) {
752 if (m_editPoint->IsEditLocked() && m_controlNet->ContainsPoint(m_editPoint->GetId())) {
753 QString message =
"This control point is edit locked. The Apriori latitude, longitude and ";
754 message +=
"radius cannot be updated. You must first unlock the point by clicking the ";
755 message +=
"check box above labeled \"Edit Lock Point\".";
756 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
759 if (m_leftMeasure->IsIgnored()) {
760 QString message =
"This is a Constrained or Fixed point and the reference measure is ";
761 message +=
"Ignored. Unset the Ignore flag on the reference measure before saving.";
762 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
765 updateGroundPosition();
772 *origRightMeasure = *m_rightMeasure;
775 if (m_leftMeasure->IsIgnored() != origLeftMeasure->IsIgnored() ||
776 m_leftMeasure->IsEditLocked() != origLeftMeasure->
IsEditLocked()) {
778 *origLeftMeasure = *m_leftMeasure;
782 if (m_leftMeasure->GetCubeSerialNumber() ==
783 m_rightMeasure->GetCubeSerialNumber()) {
784 *m_leftMeasure = *m_rightMeasure;
786 m_pointEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
787 m_editPoint->GetId());
793 editPointChanged(m_editPoint->GetId());
812 void QnetTool::checkReference() {
818 if ( (m_leftMeasure->GetCubeSerialNumber() != m_groundSN) &&
820 QString message =
"This point already contains a reference measure. ";
821 message +=
"Would you like to replace it with the measure on the left?";
822 int response = QMessageBox::question(m_qnetTool,
823 "Qnet Tool Save Measure", message,
824 QMessageBox::Yes | QMessageBox::No,
827 if (response == QMessageBox::Yes) {
830 QString file = m_serialNumberList->
FileName(m_leftMeasure->GetCubeSerialNumber());
831 QString fname =
FileName(file).name();
832 int iref = m_leftCombo->findText(fname);
835 QVariant font = m_leftCombo->itemData(iref,Qt::FontRole);
836 m_leftCombo->setItemData(iref,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
837 iref = m_rightCombo->findText(fname);
838 m_rightCombo->setItemData(iref,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
842 iref = m_leftCombo->findText(fname);
843 m_leftCombo->setItemData(iref,font,Qt::FontRole);
844 iref = m_rightCombo->findText(fname);
845 m_rightCombo->setItemData(iref,font,Qt::FontRole);
847 m_editPoint->SetRefMeasure(m_leftMeasure->GetCubeSerialNumber());
849 refMeasure = m_editPoint->GetRefMeasure();
857 QString message =
"You are making a change to the reference measure. You ";
858 message +=
"may need to move all of the other measures to match the new ";
859 message +=
" coordinate of the reference measure. Do you really want to ";
860 message +=
" change the reference measure? ";
861 switch(QMessageBox::question(m_qnetTool,
"Qnet Tool Save Measure",
862 message,
"&Yes",
"&No", 0, 0)){
885 void QnetTool::updateGroundPosition() {
892 ControlMeasure *groundMeasure = m_rightMeasure;
893 if (!m_groundGmap->SetImage(groundMeasure->GetSample(),
894 groundMeasure->GetLine())) {
899 double lat = m_groundGmap->UniversalLatitude();
900 double lon = m_groundGmap->UniversalLongitude();
911 if (radius ==
Null) {
912 QString msg =
"Could not read radius from DEM, will default to "
913 "local radius of reference measure.";
914 QMessageBox::warning(m_qnetTool,
"Warning", msg);
915 if (m_editPoint->GetRefMeasure()->Camera()->SetGround(
918 m_editPoint->GetRefMeasure()->Camera()->LocalRadius().meters();
919 m_editPoint->SetAprioriRadiusSource(
920 ControlPoint::RadiusSource::None);
924 QString message =
"Error trying to get radius at this pt. "
925 "Lat/Lon does not fall on the reference measure. "
926 "Cannot save this measure.";
927 QMessageBox::critical(m_qnetTool,
"Error",message);
931 m_editPoint->SetAprioriRadiusSource(m_groundRadiusSource);
932 m_editPoint->SetAprioriRadiusSourceFile(m_radiusSourceFile);
936 if (m_editPoint->GetRefMeasure()->Camera()->SetGround(
939 m_editPoint->GetRefMeasure()->Camera()->LocalRadius().meters();
946 QString message =
"Error trying to get radius at this pt. "
947 "Lat/Lon does not fall on the reference measure. "
948 "Cannot save this measure.";
949 QMessageBox::critical(m_qnetTool,
"Error",message);
958 vector<Distance> targetRadii = m_controlNet->GetTargetRadii();
959 if (m_editPoint->HasAprioriCoordinates()) {
960 SurfacePoint aprioriPt = m_editPoint->GetAprioriSurfacePoint();
961 aprioriPt.SetRadii(Distance(targetRadii[0]),
962 Distance(targetRadii[1]),
963 Distance(targetRadii[2]));
964 Distance latSigma = aprioriPt.GetLatSigmaDistance();
965 Distance lonSigma = aprioriPt.GetLonSigmaDistance();
966 Distance radiusSigma = aprioriPt.GetLocalRadiusSigma();
970 aprioriPt.SetSphericalSigmasDistance(latSigma, lonSigma, radiusSigma);
971 m_editPoint->SetAprioriSurfacePoint(aprioriPt);
974 m_editPoint->SetAprioriSurfacePoint(SurfacePoint(
980 catch (IException &e) {
981 QString message =
"Unable to set Apriori Surface Point.\n";
982 message +=
"Latitude = " + QString::number(lat);
983 message +=
" Longitude = " + QString::number(lon);
984 message +=
" Radius = " + QString::number(radius) +
"\n";
985 message += e.toString();
986 QMessageBox::critical(m_qnetTool,
"Error",message);
988 m_editPoint->SetAprioriSurfacePointSource(m_groundSurfacePointSource);
989 m_editPoint->SetAprioriSurfacePointSourceFile(m_groundSourceFile);
1016 *updatePoint = *m_editPoint;
1024 updatePoint->
Delete(m_groundSN);
1029 if (m_controlNet->ContainsPoint(updatePoint->
GetId())) {
1031 p = m_controlNet->GetPoint(QString(updatePoint->
GetId()));
1037 m_controlNet->AddPoint(updatePoint);
1041 m_savePoint->setPalette(m_saveDefaultPalette);
1045 emit refreshNavList();
1047 emit editPointChanged(m_editPoint->GetId());
1051 m_pointEditor->refreshChips();
1068 if (m_editPoint == NULL)
return;
1071 if (m_editPoint->GetType() == pointType)
return;
1074 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
1075 QString message =
"The reference measure is Ignored. Unset the Ignore flag on the ";
1076 message +=
"reference measure before setting the point type to Constrained or Fixed.";
1077 QMessageBox::warning(m_qnetTool,
"Ignored Reference Measure", message);
1081 bool unloadGround =
false;
1083 unloadGround =
true;
1087 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
1088 QString message =
"This control point is edit locked. The point type cannot be changed. You ";
1089 message +=
"must first unlock the point by clicking the check box above labeled ";
1090 message +=
"\"Edit Lock Point\".";
1091 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
1098 m_pointEditor->colorizeSaveButton();
1101 else if (unloadGround) {
1104 if (m_editPoint->HasSerialNumber(m_groundSN)) {
1105 m_editPoint->Delete(m_groundSN);
1109 m_pointEditor->colorizeSaveButton();
1128 if (!m_groundOpen)
return;
1134 if (m_editPoint->HasAprioriCoordinates()) {
1135 SurfacePoint sPt = m_editPoint->GetAprioriSurfacePoint();
1143 cam = m_controlNet->Camera(camIndex);
1144 cam->
SetImage(m.GetSample(),m.GetLine());
1151 if (!m_groundGmap->SetUniversalGround(lat,lon)) {
1152 QString message =
"This point does not exist on the ground source.\n";
1153 message +=
"Latitude = " + QString::number(lat);
1154 message +=
" Longitude = " + QString::number(lon);
1155 message +=
"\n A ground measure will not be created.";
1156 QMessageBox::warning(m_qnetTool,
"Warning", message);
1165 groundMeasure->
SetCoordinate(m_groundGmap->Sample(),m_groundGmap->Line());
1166 m_editPoint->Add(groundMeasure);
1171 QString tempFileName =
FileName(file).name();
1172 m_leftCombo->addItem(tempFileName);
1173 m_rightCombo->addItem(tempFileName);
1174 int rightIndex = m_rightCombo->findText((QString)m_groundFile);
1175 m_rightCombo->setCurrentIndex(rightIndex);
1196 if (m_editPoint == NULL)
return;
1198 m_editPoint->SetEditLock(lock);
1215 if (m_editPoint == NULL)
return;
1219 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
1220 QString message =
"This control point is edit locked. The Ignored status cannot be ";
1221 message +=
"changed. You must first unlock the point by clicking the check box above ";
1222 message +=
"labeled \"Edit Lock Point\".";
1223 QMessageBox::warning(m_qnetTool,
"Point Locked", message);
1249 if (m_editPoint->IsEditLocked()) {
1250 m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1251 QMessageBox::warning(m_qnetTool,
"Point Locked",
"Point is Edit Locked. You must un-lock point"
1252 " before changing a measure.");
1253 m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1257 if (m_leftMeasure != NULL) m_leftMeasure->SetEditLock(lock);
1261 if (m_rightMeasure != NULL) {
1262 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1263 m_rightMeasure->SetEditLock(lock);
1264 m_lockRightMeasure->setChecked(lock);
1267 emit measureChanged();
1289 if (m_leftMeasure != NULL) m_leftMeasure->SetIgnored(ignore);
1293 if (m_rightMeasure != NULL) {
1294 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1295 m_rightMeasure->SetIgnored(ignore);
1296 m_ignoreRightMeasure->setChecked(ignore);
1299 emit measureChanged();
1320 if (m_editPoint->IsEditLocked()) {
1321 m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1322 QMessageBox::warning(m_qnetTool,
"Point Locked",
"Point is Edit Locked. You must un-lock point"
1323 " before changing a measure.");
1324 m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1328 if (m_rightMeasure != NULL) m_rightMeasure->SetEditLock(lock);
1331 if (m_leftMeasure != NULL) {
1332 if (m_leftMeasure->GetCubeSerialNumber() == m_rightMeasure->GetCubeSerialNumber()) {
1333 m_leftMeasure->SetEditLock(lock);
1334 m_lockLeftMeasure->setChecked(lock);
1337 emit measureChanged();
1359 if (m_rightMeasure != NULL) m_rightMeasure->SetIgnored(ignore);
1363 if (m_leftMeasure != NULL) {
1364 if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1365 m_leftMeasure->SetIgnored(ignore);
1366 m_ignoreLeftMeasure->setChecked(ignore);
1369 emit measureChanged();
1380 if (m_cnetFileName.isEmpty()) {
1381 QString message =
"This is a new network, you must select "
1382 "\"Save As\" under the File Menu.";
1383 QMessageBox::critical(m_qnetTool,
"Error", message);
1386 emit qnetToolSave();
1396 emit qnetToolSaveAs();
1405 void QnetTool::updateList() {
1429 m_cnetFileName = cNetFileName;
1430 m_qnetTool->setWindowTitle(
"Qnet Tool - Control Network File: " +
1451 action->setIcon(QPixmap(
toolIconDir()+
"/stock_draw-connector-with-arrows.png"));
1452 action->setToolTip(
"Control Point Editor (T)");
1453 action->setShortcut(Qt::Key_T);
1454 QObject::connect(action,SIGNAL(triggered(
bool)),
this,SLOT(
showNavWindow(
bool)));
1493 if (cvp == NULL)
return;
1501 QString message =
"Cannot get serial number for " + file +
". Is file contained in the ";
1502 message +=
"cube list?\n";
1504 QMessageBox::critical(m_qnetTool,
"Error", message);
1513 if (s == Qt::LeftButton) {
1514 if (!m_controlNet || m_controlNet->GetNumPoints() == 0) {
1515 QString message =
"No points exist for editing. Create points ";
1516 message +=
"using the right mouse button.";
1517 QMessageBox::warning(m_qnetTool,
"Warning", message);
1521 if (sn == m_groundSN) {
1522 QString message =
"Cannot select point for editing on ground source. Select ";
1523 message +=
"point using un-projected images or the Navigator Window.";
1524 QMessageBox::critical(m_qnetTool,
"Error", message);
1530 ControlPoint *point = m_controlNet->FindClosest(sn, samp, line);
1534 else if (s == Qt::MidButton) {
1535 if (!m_controlNet || m_controlNet->GetNumPoints() == 0) {
1536 QString message =
"No points exist for deleting. Create points ";
1537 message +=
"using the right mouse button.";
1538 QMessageBox::warning(m_qnetTool,
"Warning", message);
1542 if (m_groundOpen && file == m_groundCube->fileName()) {
1543 QString message =
"Cannot select point for deleting on ground source. Select ";
1544 message +=
"point using un-projected images or the Navigator Window.";
1545 QMessageBox::critical(m_qnetTool,
"Error", message);
1551 point = m_controlNet->FindClosest(sn, samp, line);
1553 if (point == NULL) {
1554 QString message =
"No points exist for deleting. Create points ";
1555 message +=
"using the right mouse button.";
1556 QMessageBox::warning(m_qnetTool,
"Warning", message);
1561 QString message =
"Cannot find point on this image for deleting.";
1562 QMessageBox::critical(m_qnetTool,
"Error", message);
1568 else if (s == Qt::RightButton) {
1572 QString message =
"Invalid latitude or longitude at this point. ";
1573 QMessageBox::critical(m_qnetTool,
"Error", message);
1578 if (m_groundOpen && file == m_groundCube->fileName()) {
1642 for(
int i = 0; i < m_serialNumberList->
Size(); i++) {
1643 if (m_serialNumberList->
SerialNumber(i) == m_groundSN)
continue;
1644 cam = m_controlNet->Camera(i);
1647 double samp = cam->
Sample();
1648 double line = cam->
Line();
1649 if (samp >= 1 && samp <= cam->Samples() &&
1650 line >= 1 && line <= cam->Lines()) {
1651 pointFiles<<m_serialNumberList->
FileName(i);
1657 newPointDialog->
setFiles(pointFiles);
1658 if (newPointDialog->exec()) {
1659 m_lastUsedPointId = newPointDialog->pointId();
1665 if (m_controlNet->ContainsPoint(newPoint->
GetId())) {
1666 QString message =
"A ControlPoint with Point Id = [" + newPoint->
GetId();
1667 message +=
"] already exists. Re-enter Point Id for this ControlPoint.";
1668 QMessageBox::warning(m_qnetTool,
"New Point Id", message);
1678 QStringList selectedFiles = newPointDialog->selectedFiles();
1679 foreach (QString selectedFile, selectedFiles) {
1688 cam = m_controlNet->Camera(camIndex);
1691 m->SetAprioriSample(cam->
Sample());
1692 m->SetAprioriLine(cam->
Line());
1698 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1702 m_editPoint = newPoint;
1706 if (!m_leftFile.isEmpty()) {
1707 if (selectedFiles.indexOf(m_leftFile) == -1) {
1714 m_qnetTool->setShown(
true);
1715 m_qnetTool->raise();
1718 m_pointEditor->templateFileName());
1722 emit refreshNavList();
1724 emit editPointChanged(m_editPoint->GetId());
1755 for (
int i=0; i<m_serialNumberList->
Size(); i++) {
1756 if (m_serialNumberList->
SerialNumber(i) == m_groundSN)
continue;
1757 cam = m_controlNet->Camera(i);
1760 double samp = cam->
Sample();
1761 double line = cam->
Line();
1762 if (samp >= 1 && samp <= cam->Samples() &&
1763 line >= 1 && line <= cam->Lines()) {
1764 pointFiles<<m_serialNumberList->
FileName(i);
1769 if (pointFiles.count() == 0) {
1770 QString message =
"Point does not intersect any images.";
1771 QMessageBox::critical(m_qnetTool,
"No intersection", message);
1776 fixedPointDialog->
setFiles(pointFiles);
1777 if (fixedPointDialog->exec()) {
1781 if (fixedPointDialog->isFixed()) {
1790 if (m_controlNet->ContainsPoint(fixedPoint->
GetId())) {
1791 QString message =
"A ControlPoint with Point Id = [" + fixedPoint->
GetId();
1792 message +=
"] already exists. Re-enter Point Id for this ControlPoint.";
1793 QMessageBox::warning(m_qnetTool,
"New Point Id", message);
1803 QStringList selectedFiles = fixedPointDialog->selectedFiles();
1804 foreach (QString selectedFile, selectedFiles) {
1812 if (sn == m_groundSN)
continue;
1817 cam = m_controlNet->Camera(camIndex);
1830 if (radius ==
Null) {
1831 QString msg =
"Could not read radius from DEM, will default to the "
1832 "local radius of the first measure in the control point. This "
1833 "will be updated to the local radius of the chosen reference "
1835 QMessageBox::warning(m_qnetTool,
"Warning", msg);
1836 if ((*fixedPoint)[0]->
Camera()->SetGround(
1838 radius = (*fixedPoint)[0]->Camera()->LocalRadius().meters();
1841 QString msg =
"Error trying to get radius at this pt. "
1842 "Lat/Lon does not fall on the reference measure. "
1843 "Cannot create this point.";
1844 QMessageBox::critical(m_qnetTool,
"Error", msg);
1847 delete fixedPointDialog;
1848 fixedPointDialog = NULL;
1854 if ((*fixedPoint)[0]->
Camera()->SetGround(
1856 radius = (*fixedPoint)[0]->Camera()->LocalRadius().meters();
1859 QString msg =
"Error trying to get radius at this pt. "
1860 "Lat/Lon does not fall on the reference measure. "
1861 "Cannot create this point.";
1862 QMessageBox::critical(m_qnetTool,
"Error", msg);
1865 delete fixedPointDialog;
1866 fixedPointDialog = NULL;
1876 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1880 m_editPoint = fixedPoint;
1884 m_qnetTool->setShown(
true);
1885 m_qnetTool->raise();
1887 delete fixedPointDialog;
1888 fixedPointDialog = NULL;
1891 emit refreshNavList();
1893 emit editPointChanged(m_editPoint->GetId());
1924 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1929 *m_editPoint = *point;
1935 emit editPointChanged(m_editPoint->GetId());
1938 QString CPId = m_editPoint->GetId();
1939 deletePointDialog->pointIdValue->setText(CPId);
1942 for (
int i=0; i<m_editPoint->GetNumMeasures(); i++) {
1945 deletePointDialog->fileList->addItem(file);
1948 if (deletePointDialog->exec()) {
1950 int numDeleted = deletePointDialog->fileList->selectedItems().count();
1953 if (deletePointDialog->deleteAllCheckBox->isChecked() ||
1954 numDeleted == m_editPoint->GetNumMeasures()) {
1957 if (!deletePointDialog->deleteAllCheckBox->isChecked()) {
1958 QString message =
"You have selected all measures in this point to be deleted. This "
1959 "control point will be deleted. Do you want to delete this control point?";
1960 int response = QMessageBox::question(m_qnetTool,
1961 "Delete control point", message,
1962 QMessageBox::Yes | QMessageBox::No,
1965 if (response == QMessageBox::No) {
1974 m_qnetTool->setShown(
false);
1976 if (m_controlNet->DeletePoint(m_editPoint->GetId()) ==
1978 QMessageBox::information(m_qnetTool,
"EditLocked Point",
1979 "This point is EditLocked and cannot be deleted.");
1982 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1987 emit refreshNavList();
1993 int lockedMeasures = 0;
1994 for (
int i=0; i<deletePointDialog->fileList->count(); i++) {
1995 QListWidgetItem *item = deletePointDialog->fileList->item(i);
1996 if (!deletePointDialog->fileList->isItemSelected(item))
continue;
1999 if (m_editPoint->IsReferenceExplicit() &&
2000 (m_editPoint->GetRefMeasure()->GetCubeSerialNumber() ==
2001 (*m_editPoint)[i]->GetCubeSerialNumber())) {
2002 QString message =
"You are trying to delete the Reference measure."
2003 " Do you really want to delete the Reference measure?";
2004 switch (QMessageBox::question(m_qnetTool,
2005 "Delete Reference measure?", message,
2006 "&Yes",
"&No", 0, 0)) {
2014 if (numDeleted == 1) {
2021 if (m_editPoint->Delete(i) == ControlMeasure::MeasureLocked) {
2026 if (lockedMeasures > 0) {
2027 QMessageBox::information(m_qnetTool,
"EditLocked Measures",
2028 QString::number(lockedMeasures) +
" / "
2030 deletePointDialog->fileList->selectedItems().size()) +
2031 " measures are EditLocked and were not deleted.");
2035 m_qnetTool->setShown(
true);
2036 m_qnetTool->raise();
2045 if (m_editPoint != NULL) {
2046 emit editPointChanged(m_editPoint->GetId());
2054 emit editPointChanged(
"");
2072 if (point->GetNumMeasures() == 0) {
2073 QString message =
"This point has no measures.";
2074 QMessageBox::warning(m_qnetTool,
"Warning", message);
2076 if (m_editPoint != NULL) {
2078 emit editPointChanged(m_editPoint->GetId());
2083 emit editPointChanged(
"");
2089 if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
2094 *m_editPoint = *point;
2098 if (sender() !=
this) m_leftFile.clear();
2100 m_qnetTool->setShown(
true);
2101 m_qnetTool->raise();
2105 emit editPointChanged(m_editPoint->GetId());
2108 m_savePoint->setPalette(m_saveDefaultPalette);
2133 QString CPId = m_editPoint->GetId();
2134 QString ptId(
"Point ID: ");
2135 ptId += (QString) CPId;
2136 m_ptIdValue->setText(ptId);
2142 m_pointType->setCurrentIndex((
int) m_editPoint->GetType());
2145 QString ptsize =
"Number of Measures: " +
2146 QString::number(m_editPoint->GetNumMeasures());
2147 m_numMeasures->setText(ptsize);
2150 m_lockPoint->setChecked(m_editPoint->IsEditLocked());
2153 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
2156 m_leftCombo->clear();
2157 m_rightCombo->clear();
2158 m_pointFiles.clear();
2162 if (m_editPoint->HasSerialNumber(m_groundSN)) {
2163 m_editPoint->Delete(m_groundSN);
2177 if (m_editPoint->HasAprioriCoordinates()) {
2178 SurfacePoint sPt = m_editPoint->GetAprioriSurfacePoint();
2186 cam = m_controlNet->Camera(camIndex);
2187 cam->
SetImage(m.GetSample(),m.GetLine());
2194 if (!m_groundGmap->SetUniversalGround(lat,lon)) {
2195 QString message =
"This point does not exist on the ground source.\n";
2196 message +=
"Latitude = " + QString::number(lat);
2197 message +=
" Longitude = " + QString::number(lon);
2198 message +=
"\n A ground measure will not be created.";
2199 QMessageBox::warning(m_qnetTool,
"Warning", message);
2208 groundMeasure->
SetCoordinate(m_groundGmap->Sample(),m_groundGmap->Line());
2209 m_editPoint->Add(groundMeasure);
2215 for (
int i=0; i<m_editPoint->GetNumMeasures(); i++) {
2219 QString tempFileName =
FileName(file).name();
2220 m_leftCombo->addItem(tempFileName);
2221 m_rightCombo->addItem(tempFileName);
2222 if (m_editPoint->IsReferenceExplicit() &&
2224 m_leftCombo->setItemData(i,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
2225 m_rightCombo->setItemData(i,QFont(
"DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
2241 if (m_editPoint->IsReferenceExplicit()) {
2242 leftIndex = m_editPoint->IndexOfRefMeasure();
2246 QString baseFileName =
FileName(m_leftFile).name();
2247 leftIndex = m_leftCombo->findText(baseFileName);
2249 if (leftIndex < 0 ) leftIndex = 0;
2257 rightIndex = m_rightCombo->findText((QString)m_groundFile);
2259 if (rightIndex <= 0) {
2260 if (leftIndex == 0) {
2270 if (rightIndex > m_editPoint->GetNumMeasures()-1) rightIndex = 0;
2271 m_rightCombo->setCurrentIndex(rightIndex);
2272 m_leftCombo->setCurrentIndex(leftIndex);
2294 if (m_measureWindow == NULL) {
2296 m_measureTable =
new QTableWidget();
2297 m_measureTable->setMinimumWidth(1600);
2298 m_measureTable->setAlternatingRowColors(
true);
2299 m_measureWindow->setCentralWidget(m_measureTable);
2302 m_measureTable->clear();
2303 m_measureTable->setSortingEnabled(
false);
2305 m_measureTable->setRowCount(m_editPoint->GetNumMeasures());
2306 m_measureTable->setColumnCount(NUMCOLUMNS);
2309 for (
int i=0; i<NUMCOLUMNS; i++) {
2310 labels<<measureColumnToString((MeasureColumns)i);
2312 m_measureTable->setHorizontalHeaderLabels(labels);
2315 for (
int row=0; row<m_editPoint->GetNumMeasures(); row++) {
2320 QTableWidgetItem *tableItem =
new QTableWidgetItem(QString(file));
2321 m_measureTable->setItem(row,column++,tableItem);
2324 m_measureTable->setItem(row,column++,tableItem);
2326 tableItem =
new QTableWidgetItem();
2327 tableItem->setData(0,m.GetSample());
2328 m_measureTable->setItem(row,column++,tableItem);
2330 tableItem =
new QTableWidgetItem();
2331 tableItem->setData(0,m.GetLine());
2332 m_measureTable->setItem(row,column++,tableItem);
2334 if (m.GetAprioriSample() ==
Null) {
2335 tableItem =
new QTableWidgetItem(
"Null");
2338 tableItem =
new QTableWidgetItem();
2339 tableItem->setData(0,m.GetAprioriSample());
2341 m_measureTable->setItem(row,column++,tableItem);
2343 if (m.GetAprioriLine() ==
Null) {
2344 tableItem =
new QTableWidgetItem(
"Null");
2347 tableItem =
new QTableWidgetItem();
2348 tableItem->setData(0,m.GetAprioriLine());
2350 m_measureTable->setItem(row,column++,tableItem);
2352 if (m.GetSampleResidual() ==
Null) {
2353 tableItem =
new QTableWidgetItem(QString(
"Null"));
2356 tableItem =
new QTableWidgetItem();
2357 tableItem->setData(0,m.GetSampleResidual());
2359 m_measureTable->setItem(row,column++,tableItem);
2361 if (m.GetLineResidual() ==
Null) {
2362 tableItem =
new QTableWidgetItem(QString(
"Null"));
2365 tableItem =
new QTableWidgetItem();
2366 tableItem->setData(0,m.GetLineResidual());
2368 m_measureTable->setItem(row,column++,tableItem);
2371 tableItem =
new QTableWidgetItem(QString(
"Null"));
2374 tableItem =
new QTableWidgetItem();
2377 m_measureTable->setItem(row,column++,tableItem);
2379 double sampleShift = m.GetSampleShift();
2380 if (sampleShift ==
Null) {
2381 tableItem =
new QTableWidgetItem(QString(
"Null"));
2384 tableItem =
new QTableWidgetItem();
2385 tableItem->setData(0,sampleShift);
2387 m_measureTable->setItem(row,column++,tableItem);
2389 double lineShift = m.GetLineShift();
2390 if (lineShift ==
Null) {
2391 tableItem =
new QTableWidgetItem(QString(
"Null"));
2394 tableItem =
new QTableWidgetItem();
2395 tableItem->setData(0,lineShift);
2397 m_measureTable->setItem(row,column++,tableItem);
2399 double pixelShift = m.GetPixelShift();
2400 if (pixelShift ==
Null) {
2401 tableItem =
new QTableWidgetItem(QString(
"Null"));
2404 tableItem =
new QTableWidgetItem();
2405 tableItem->setData(0,pixelShift);
2407 m_measureTable->setItem(row,column++,tableItem);
2409 double goodnessOfFit = m.GetLogData(
2411 if (goodnessOfFit ==
Null) {
2412 tableItem =
new QTableWidgetItem(QString(
"Null"));
2415 tableItem =
new QTableWidgetItem();
2416 tableItem->setData(0,goodnessOfFit);
2418 m_measureTable->setItem(row,column++,tableItem);
2420 if (m.IsIgnored()) tableItem =
new QTableWidgetItem(
"True");
2421 if (!m.IsIgnored()) tableItem =
new QTableWidgetItem(
"False");
2422 m_measureTable->setItem(row,column++,tableItem);
2425 tableItem =
new QTableWidgetItem(
"True");
2427 tableItem =
new QTableWidgetItem(
"False");
2428 m_measureTable->setItem(row,column++,tableItem);
2430 tableItem =
new QTableWidgetItem(
2432 m_measureTable->setItem(row,column,tableItem);
2435 if (m_editPoint->IsReferenceExplicit() &&
2440 for (
int col=0; col<m_measureTable->columnCount(); col++)
2441 m_measureTable->item(row, col)->setFont(font);
2446 m_measureTable->resizeColumnsToContents();
2447 m_measureTable->resizeRowsToContents();
2448 m_measureTable->setSortingEnabled(
true);
2449 m_measureWindow->show();
2454 QString QnetTool::measureColumnToString(QnetTool::MeasureColumns column) {
2464 case SAMPLERESIDUAL:
2465 return "Sample Residual";
2467 return "Line Residual";
2468 case RESIDUALMAGNITUDE:
2469 return "Residual Magnitude";
2471 return "Sample Shift";
2473 return "Line Shift";
2475 return "Pixel Shift";
2477 return "Goodness of Fit";
2483 return "Measure Type";
2485 return "Apriori Sample";
2487 return "Apriori Line";
2490 "Invalid measure column passed to measureColumnToString",
_FILEINFO_);
2494 ControlNet *QnetTool::controlNet() {
2495 return m_controlNet;
2499 const ControlNet *QnetTool::controlNet()
const {
2500 return m_controlNet;
2504 SerialNumberList *QnetTool::serialNumberList() {
2505 return m_serialNumberList;
2509 const SerialNumberList *QnetTool::serialNumberList()
const {
2510 return m_serialNumberList;
2514 Workspace *QnetTool::workspace()
const {
2534 SurfacePoint aprioriPoint = m_editPoint->GetAprioriSurfacePoint();
2536 s =
"AprioriLatitude: Null";
2539 s =
"Apriori Latitude: " +
2542 m_pointAprioriLatitude->setText(s);
2544 s =
"Apriori Longitude: Null";
2547 s =
"Apriori Longitude: " +
2550 m_pointAprioriLongitude->setText(s);
2552 s =
"Apriori Radius: Null";
2555 s =
"Apriori Radius: " +
2559 m_pointAprioriRadius->setText(s);
2561 if (aprioriPoint.Valid()) {
2562 vector<Distance> targRadii = m_controlNet->GetTargetRadii();
2563 aprioriPoint.
SetRadii(targRadii[0],targRadii[1],targRadii[2]);
2566 s =
"Apriori Latitude Sigma: Null";
2569 s =
"Apriori Latitude Sigma: " +
2573 m_pointAprioriLatitudeSigma->setText(s);
2575 s =
"Apriori Longitude Sigma: Null";
2578 s =
"Apriori Longitude Sigma: " +
2582 m_pointAprioriLongitudeSigma->setText(s);
2583 if (aprioriPoint.GetLocalRadiusSigma().
meters() ==
Null) {
2584 s =
"Apriori Radius Sigma: Null";
2587 s =
"Apriori Radius Sigma: " +
2588 QString::number(aprioriPoint.GetLocalRadiusSigma().
meters()) +
2591 m_pointAprioriRadiusSigma->setText(s);
2594 s =
"Apriori Latitude Sigma: Null";
2595 m_pointAprioriLatitudeSigma->setText(s);
2596 s =
"Apriori Longitude Sigma: Null";
2597 m_pointAprioriLongitudeSigma->setText(s);
2598 s =
"Apriori Radius Sigma: Null";
2599 m_pointAprioriRadiusSigma->setText(s);
2603 SurfacePoint point = m_editPoint->GetAdjustedSurfacePoint();
2605 s =
"Adjusted Latitude: Null";
2610 m_pointLatitude->setText(s);
2612 s =
"Adjusted Longitude: Null";
2617 m_pointLongitude->setText(s);
2619 s =
"Adjusted Radius: Null";
2622 s =
"Adjusted Radius: " +
2625 m_pointRadius->setText(s);
2646 QString file = m_pointFiles[index];
2648 QString serial = m_serialNumberList->
SerialNumber(file);
2652 if (m_leftMeasure != NULL) {
2653 delete m_leftMeasure;
2654 m_leftMeasure = NULL;
2658 *m_leftMeasure = *((*m_editPoint)[serial]);
2661 m_leftCube.reset(
new Cube(file,
"r"));
2664 m_pointEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
2665 m_editPoint->GetId());
2682 QString file = m_pointFiles[index];
2684 QString serial = m_serialNumberList->
SerialNumber(file);
2688 if (m_rightMeasure != NULL) {
2689 delete m_rightMeasure;
2690 m_rightMeasure = NULL;
2694 *m_rightMeasure = *((*m_editPoint)[serial]);
2697 m_rightCube.reset(
new Cube(file,
"r"));
2700 m_pointEditor->setRightMeasure (m_rightMeasure, m_rightCube.data(),
2701 m_editPoint->GetId());
2728 m_leftMeasure->GetCubeSerialNumber()));
2730 m_ignoreLeftMeasure->setChecked(m_leftMeasure->IsIgnored());
2732 QString s =
"Reference: ";
2733 if (m_editPoint->IsReferenceExplicit() &&
2734 (QString(m_leftMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2740 m_leftReference->setText(s);
2742 s =
"Measure Type: ";
2747 m_leftMeasureType->setText(s);
2749 if (m_leftMeasure->GetSampleResidual() ==
Null) {
2750 s =
"Sample Residual: Null";
2753 s =
"Sample Residual: " + QString::number(m_leftMeasure->GetSampleResidual());
2755 m_leftSampError->setText(s);
2756 if (m_leftMeasure->GetLineResidual() ==
Null) {
2757 s =
"Line Residual: Null";
2760 s =
"Line Residual: " + QString::number(m_leftMeasure->GetLineResidual());
2762 m_leftLineError->setText(s);
2764 if (m_leftMeasure->GetSampleShift() ==
Null) {
2765 s =
"Sample Shift: Null";
2768 s =
"Sample Shift: " + QString::number(m_leftMeasure->GetSampleShift());
2770 m_leftSampShift->setText(s);
2772 if (m_leftMeasure->GetLineShift() ==
Null) {
2773 s =
"Line Shift: Null";
2776 s =
"Line Shift: " + QString::number(m_leftMeasure->GetLineShift());
2778 m_leftLineShift->setText(s);
2780 double goodnessOfFit = m_leftMeasure->GetLogData(
2782 if (goodnessOfFit ==
Null) {
2783 s =
"Goodness of Fit: Null";
2786 s =
"Goodness of Fit: " + QString::number(goodnessOfFit);
2788 m_leftGoodness->setText(s);
2816 m_rightMeasure->GetCubeSerialNumber()));
2818 m_ignoreRightMeasure->setChecked(m_rightMeasure->IsIgnored());
2820 QString s =
"Reference: ";
2821 if (m_editPoint->IsReferenceExplicit() &&
2822 (QString(m_rightMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2829 m_rightReference->setText(s);
2831 s =
"Measure Type: ";
2836 m_rightMeasureType->setText(s);
2838 if (m_rightMeasure->GetSampleResidual() ==
Null) {
2839 s =
"Sample Residual: Null";
2842 s =
"Sample Residual: " + QString::number(m_rightMeasure->GetSampleResidual());
2844 m_rightSampError->setText(s);
2845 if (m_rightMeasure->GetLineResidual() ==
Null) {
2846 s =
"Line Residual: Null";
2849 s =
"Line Residual: " + QString::number(m_rightMeasure->GetLineResidual());
2851 m_rightLineError->setText(s);
2853 if (m_rightMeasure->GetSampleShift() ==
Null) {
2854 s =
"Sample Shift: Null";
2857 s =
"Sample Shift: " + QString::number(m_rightMeasure->GetSampleShift());
2859 m_rightSampShift->setText(s);
2861 if (m_rightMeasure->GetLineShift() ==
Null) {
2862 s =
"Line Shift: Null";
2865 s =
"Line Shift: " + QString::number(m_rightMeasure->GetLineShift());
2867 m_rightLineShift->setText(s);
2869 double goodnessOfFit = m_rightMeasure->GetLogData(
2871 if (goodnessOfFit ==
Null) {
2872 s =
"Goodness of Fit: Null";
2875 s =
"Goodness of Fit: " + QString::number(goodnessOfFit);
2877 m_rightGoodness->setText(s);
2904 double lat = m_editPoint->GetBestSurfacePoint().GetLatitude().degrees();
2905 double lon = m_editPoint->GetBestSurfacePoint().GetLongitude().degrees();
2909 cam = m_controlNet->Camera(camIndex);
2911 cam->
SetImage(m.GetSample(),m.GetLine());
2916 for (
int i=0; i<m_serialNumberList->
Size(); i++) {
2917 cam = m_controlNet->Camera(i);
2918 if (m_serialNumberList->
SerialNumber(i) == m_groundSN)
continue;
2921 double samp = cam->
Sample();
2922 double line = cam->
Line();
2923 if (samp >= 1 && samp <= cam->Samples() &&
2924 line >= 1 && line <= cam->Lines()) {
2925 pointFiles<<m_serialNumberList->
FileName(i);
2931 newMeasureDialog->
setFiles(*m_editPoint,pointFiles);
2932 if (newMeasureDialog->exec()) {
2933 QStringList selectedFiles = newMeasureDialog->selectedFiles();
2934 foreach (QString selectedFile, selectedFiles) {
2938 QString sn = m_serialNumberList->
SerialNumber(selectedFile);
2942 cam = m_controlNet->Camera(camIndex);
2945 m->SetAprioriSample(cam->
Sample());
2946 m->SetAprioriLine(cam->
Line());
2949 m_editPoint->Add(m);
2952 m_qnetTool->setShown(
true);
2953 m_qnetTool->raise();
2956 m_pointEditor->templateFileName());
2960 emit editPointChanged(m_editPoint->GetId());
2977 if(e->type() != QEvent::Leave)
return false;
2978 if(o == m_leftCombo->view()) {
2980 m_leftCombo->hidePopup();
2982 if (o == m_rightCombo->view()) {
2984 m_rightCombo->hidePopup();
3024 vp->viewport()->update();
3052 if (m_controlNet == 0 || m_controlNet->GetNumPoints() == 0)
return;
3059 if (serialNumber == m_groundSN) {
3063 if (!m_controlNet->GetCubeSerials().contains(
3064 serialNumber))
return;
3067 m_controlNet->GetMeasuresInCube(serialNumber);
3069 for (
int i = 0; i < measures.count(); i++) {
3072 double samp = m->GetSample();
3073 double line = m->GetLine();
3077 if (m->Parent()->IsIgnored()) {
3078 painter->setPen(QColor(255, 255, 0));
3081 else if (m->IsIgnored()) {
3082 painter->setPen(QColor(255, 255, 0));
3086 painter->setPen(Qt::magenta);
3089 painter->setPen(Qt::green);
3092 painter->drawLine(x - 5, y, x + 5, y);
3093 painter->drawLine(x, y - 5, x, y + 5);
3096 if (m_editPoint != NULL) {
3098 if (m_editPoint->HasSerialNumber(serialNumber)) {
3100 double samp = (*m_editPoint)[serialNumber]->GetSample();
3101 double line = (*m_editPoint)[serialNumber]->GetLine();
3105 QBrush brush(Qt::red);
3109 painter->setPen(pen);
3110 painter->drawLine(x - 5, y, x + 5, y);
3111 painter->drawLine(x, y - 5, x, y + 5);
3131 for (
int i = 0; i < m_controlNet->GetNumPoints(); i++) {
3134 if (!p.HasAprioriCoordinates())
continue;
3137 if (m_groundGmap->SetGround(p.GetAprioriSurfacePoint().
GetLatitude(),
3139 double samp = m_groundGmap->Sample();
3140 double line = m_groundGmap->Line();
3144 if (p.IsIgnored()) {
3145 painter->setPen(QColor(255, 255, 0));
3148 painter->setPen(Qt::magenta);
3150 else if (&p == m_editPoint) {
3152 QBrush brush(Qt::red);
3157 painter->setPen(Qt::green);
3160 painter->drawLine(x - 5, y, x + 5, y);
3161 painter->drawLine(x, y - 5, x, y + 5);
3182 if (m_templateModified) {
3183 int r = QMessageBox::warning(m_qnetTool, tr(
"OK to continue?"),
3184 tr(
"The currently opened registration template has been modified.\n"
3186 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
3189 if (r == QMessageBox::Yes)
3191 else if (r == QMessageBox::Cancel)
3209 QString filename = QFileDialog::getOpenFileName(m_qnetTool,
3210 "Select a registration template",
".",
3211 "Registration template files (*.def *.pvl);;All files (*)");
3213 if (filename.isEmpty())
3216 if (m_pointEditor->setTemplateFile(filename)) {
3229 QFile file(
FileName(fn).expanded());
3230 if (!file.open(QIODevice::ReadOnly)) {
3231 QString msg =
"Failed to open template file \"" + fn +
"\"";
3232 QMessageBox::warning(m_qnetTool,
"IO Error", msg);
3236 QTextStream stream(&file);
3237 m_templateEditor->setText(stream.readAll());
3240 QScrollBar * sb = m_templateEditor->verticalScrollBar();
3241 sb->setValue(sb->minimum());
3243 m_templateModified =
false;
3244 m_saveTemplateFile->setEnabled(
false);
3245 m_templateFileNameLabel->setText(
"Template File: " + fn);
3251 m_templateModified =
true;
3252 m_saveTemplateFile->setEnabled(
true);
3259 if (!m_templateModified)
3262 QString filename = m_pointEditor->templateFileName();
3271 QString filename = QFileDialog::getSaveFileName(m_qnetTool,
3272 "Save registration template",
".",
3273 "Registration template files (*.def *.pvl);;All files (*)");
3275 if (filename.isEmpty())
3289 QString contents = m_templateEditor->toPlainText();
3300 QMessageBox::warning(m_qnetTool,
"Error", message);
3304 QString expandedFileName(
FileName(fn).expanded());
3306 QFile file(expandedFileName);
3308 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
3309 QString msg =
"Failed to save template file to \"" + fn +
"\"\nDo you "
3311 QMessageBox::warning(m_qnetTool,
"IO Error", msg);
3316 QTextStream stream(&file);
3320 if (m_pointEditor->setTemplateFile(fn)) {
3321 m_templateModified =
false;
3322 m_saveTemplateFile->setEnabled(
false);
3323 m_templateFileNameLabel->setText(
"Template File: " + fn);
3344 Pvl templatePvl(m_pointEditor->templateFileName());
3348 registrationDialog.setWindowTitle(
"View or Edit Template File: "
3349 + templatePvl.fileName());
3350 registrationDialog.resize(550,360);
3351 registrationDialog.exec();
3355 QMessageBox::information(m_qnetTool,
"Error", message);
3368 m_pointEditor->saveChips();
3372 void QnetTool::showHideTemplateEditor() {
3374 if (!m_templateEditorWidget)
3377 m_templateEditorWidget->setVisible(!m_templateEditorWidget->isVisible());
3395 if (m_editPoint == NULL)
return;
3396 if (pointId != m_editPoint->GetId())
return;
3401 ControlPoint *updatedPoint = m_controlNet->GetPoint(pointId);
3402 m_editPoint->SetEditLock(updatedPoint->IsEditLocked());
3403 m_editPoint->SetIgnored(updatedPoint->IsIgnored());
3404 m_editPoint->SetAprioriSurfacePoint(updatedPoint->GetAprioriSurfacePoint());
3407 m_lockPoint->setChecked(m_editPoint->IsEditLocked());
3410 m_ignorePoint->setChecked(m_editPoint->IsIgnored());
3439 if (m_editPoint != NULL) {
3441 QString
id = m_ptIdValue->text().remove(
"Point ID: ");
3442 m_controlNet->GetPoint(
id);
3447 emit editPointChanged(
"");
3448 m_qnetTool->setShown(
false);
3449 m_measureWindow->setShown(
false);
3453 if (m_editPoint == NULL) {
3489 QToolButton *showNavToolButton =
new QToolButton();
3490 showNavToolButton->setText(
"Show Nav Tool");
3491 showNavToolButton->setToolTip(
"Shows the Navigation Tool Window");
3493 "<b>Function:</b> This button will bring up the Navigation Tool window that allows \
3494 the user to view, modify, ignore, delete, or filter points and cubes.";
3495 showNavToolButton->setWhatsThis(text);
3496 connect(showNavToolButton,SIGNAL(clicked(
bool)),
this,SLOT(
showNavWindow(
bool)));
3498 QHBoxLayout *layout =
new QHBoxLayout(hbox);
3499 layout->setMargin(0);
3500 layout->addWidget(showNavToolButton);
3501 layout->addStretch(1);
3502 hbox->setLayout(layout);
3527 QString filter =
"Isis cubes (*.cub *.cub.*);;";
3528 filter +=
"Detached labels (*.lbl);;";
3529 filter +=
"All (*)";
3530 QString ground = QFileDialog::getOpenFileName((
QWidget*)parent(),
3531 "Open ground source",
3534 if (ground.isEmpty())
return;
3540 if (m_groundOpen && m_groundFile ==
FileName(ground).name()) {
3547 m_workspace->mdiArea()->setActiveSubWindow(
3556 if (newGroundSN != m_groundSN && m_serialNumberList->
HasSerialNumber(newGroundSN)) {
3559 QString message =
"A cube in the cube list has the same serial number as this ground file. ";
3560 message +=
"If this ground source is a level 1, un-projected cube, it is probably included ";
3561 message +=
"in the cube list. If the ground source is a projected version of a cube in ";
3562 message +=
"the list and has the Instrument Group in the labels, the un-projected and ";
3563 message +=
"projected cube will have the same serial number. \n";
3564 message +=
"Because of duplicate serial numbers this cube cannot be used as a ground ";
3565 message +=
"source.\n\n";
3566 message +=
"NOTE: If this cube is the reference cube you can select points in ";
3567 message +=
"the Navigator window, then select the Set Apriori button to use this cube to ";
3568 message +=
"set the apriori latitude, longitude and radius.";
3569 QMessageBox::critical(m_qnetTool,
"Cannot set ground source", message);
3578 clearGroundSource ();
3581 QApplication::setOverrideCursor(Qt::WaitCursor);
3586 m_groundCube.reset(NULL);
3587 m_groundGmap.reset(NULL);
3590 QScopedPointer<Cube> newGroundCube(
new Cube(ground,
"r"));
3591 QScopedPointer<UniversalGroundMap> newGroundGmap(
new UniversalGroundMap(*newGroundCube));
3593 m_groundFile =
FileName(newGroundCube->fileName()).name();
3594 m_groundCube.reset(newGroundCube.take());
3595 m_groundGmap.reset(newGroundGmap.take());
3597 m_serialNumberList->
Add(ground,
true);
3600 QApplication::restoreOverrideCursor();
3601 QMessageBox::critical(m_qnetTool,
"Error", e.
toString());
3603 m_groundFile.clear();
3610 emit refreshNavList();
3614 m_groundSN = newGroundSN;
3615 m_groundSourceFile = ground;
3616 m_groundOpen =
true;
3618 m_workspace->addCubeViewport(m_groundCube.data());
3632 if (m_groundCube->hasTable(
"ShapeModelStatistics")) {
3633 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Basemap;
3635 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3636 m_radiusSourceFile = ground;
3643 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Basemap;
3647 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3648 PvlGroup mapping = m_groundCube->group(
"Mapping");
3649 m_demFile = mapping [
"EquatorialRadius"][0]
3650 +
", " + mapping [
"PolarRadius"][0];
3652 m_radiusSourceFile =
"";
3658 m_groundSurfacePointSource = ControlPoint::SurfacePointSource::Reference;
3661 PvlGroup kernels = m_groundCube->group(
"Kernels");
3662 QString shapeFile = kernels [
"ShapeModel"];
3663 if (shapeFile.contains(
"dem")) {
3664 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3665 m_radiusSourceFile = shapeFile;
3670 m_groundRadiusSource = ControlPoint::RadiusSource::Ellipsoid;
3671 m_demFile =
"Ellipsoid";
3673 m_radiusSourceFile = (QString) kernels[
"TargetAttitudeShape"];
3678 QString message =
"Cannot create either Camera or Projections ";
3679 message +=
"for the ground source file. Check the validity of the ";
3680 message +=
" cube labels. The cube must either be projected or ";
3681 message +=
" run through spiceinit.";
3682 QMessageBox::critical(m_qnetTool,
"Error", message);
3684 clearGroundSource ();
3685 QApplication::restoreOverrideCursor();
3686 emit refreshNavList();
3692 if (m_editPoint != NULL &&
3694 m_groundFileNameLabel->setText(
"Ground Source File: " + m_groundFile);
3695 m_radiusFileNameLabel->setText(
"Radius Source File: " + m_demFile);
3697 emit refreshNavList();
3698 QApplication::restoreOverrideCursor();
3711 if (m_groundFile.isEmpty()) {
3712 QString message =
"You must enter a ground source before opening a Dem.";
3713 QMessageBox::critical(m_qnetTool,
"Error", message);
3717 QString filter =
"Isis cubes (*.cub *.cub.*);;";
3718 filter +=
"Detached labels (*.lbl);;";
3719 filter +=
"All (*)";
3720 QString dem = QFileDialog::getOpenFileName((
QWidget*)parent(),
3724 if (dem.isEmpty())
return;
3731 void QnetTool::initDem (QString demFile) {
3735 QApplication::setOverrideCursor(Qt::WaitCursor);
3737 if (m_demFile == demFile) {
3738 QApplication::restoreOverrideCursor();
3742 m_demCube.reset(NULL);
3747 QScopedPointer<Cube> newDemCube(
new Cube(demFile,
"r"));
3749 m_demFile = FileName(newDemCube->fileName()).name();
3750 m_demCube.reset(newDemCube.take());
3752 catch (IException &e) {
3753 QMessageBox::critical(m_qnetTool,
"Error", e.toString());
3754 QApplication::restoreOverrideCursor();
3760 if (!m_demCube->hasTable(
"ShapeModelStatistics")) {
3761 QString message = m_demFile +
" is not a DEM.";
3762 QMessageBox::critical(m_qnetTool,
"Error", message);
3763 m_demCube.reset(NULL);
3766 QApplication::restoreOverrideCursor();
3769 m_groundRadiusSource = ControlPoint::RadiusSource::DEM;
3770 m_groundFileNameLabel->setText(
"Ground Source File: " + m_groundFile);
3771 m_radiusFileNameLabel->setText(
"Radius Source File: " + m_demFile);
3772 m_radiusSourceFile = demFile;
3774 QApplication::restoreOverrideCursor();
3789 clearGroundSource();
3794 void QnetTool::clearGroundSource () {
3796 m_leftCombo->removeItem(m_leftCombo->findText(m_groundFile));
3797 m_rightCombo->removeItem(m_rightCombo->findText(m_groundFile));
3803 if (vp->
cube() == m_groundCube.data()) {
3808 vp->parentWidget()->parentWidget()->close();
3809 QApplication::processEvents();
3815 m_groundOpen =
false;
3816 m_groundCube.take();
3817 m_groundFile.clear();
3818 m_groundGmap.reset(NULL);
3820 m_groundFileNameLabel->setText(
"Ground Source File: ");
3822 m_radiusFileNameLabel->setText(
"Radius Source File: " + m_demFile);
3826 m_serialNumberList->
Delete(m_groundSN);
3832 m_editPoint->HasSerialNumber(m_groundSN)) {
3833 m_editPoint->Delete(m_groundSN);
3855 if (!m_demOpen)
return Null;
3870 m_demCube->pixelType(),
3873 m_demCube->read(*portal);
3898 QColor qc = Qt::red;
3899 QPalette p = m_savePoint->palette();
3900 p.setColor(QPalette::ButtonText,qc);
3901 m_savePoint->setPalette(p);
3921 if (m_editPoint == NULL)
return false;
3924 if (m_editPoint->IsEditLocked() && m_editPoint->IsReferenceExplicit() &&
3925 (m_editPoint->GetReferenceSN() == serialNumber)) {
3930 return m_editPoint->GetMeasure(serialNumber)->IsEditLocked();
3943 FileName config(
"$HOME/.Isis/qnet/QnetTool.config");
3944 QSettings settings(config.expanded(), QSettings::NativeFormat);
3945 QPoint pos = settings.value(
"pos", QPoint(300, 100)).toPoint();
3946 QSize size = settings.value(
"size", QSize(900, 500)).toSize();
3947 m_qnetTool->resize(size);
3948 m_qnetTool->move(pos);
3961 if(!m_qnetTool->isVisible())
return;
3962 FileName config(
"$HOME/.Isis/qnet/QnetTool.config");
3963 QSettings settings(config.expanded(), QSettings::NativeFormat);
3964 settings.setValue(
"pos", m_qnetTool->pos());
3965 settings.setValue(
"size", m_qnetTool->size());
3970 void QnetTool::enterWhatsThisMode() {
3971 QWhatsThis::enterWhatsThisMode();