Isis 3.0 Programmer Reference
Back | Home
ControlPointEditWidget.cpp
1 #include "IsisDebug.h"
2 
3 #include "ControlPointEditWidget.h"
4 
5 #include <iomanip>
6 #include <sstream>
7 #include <vector>
8 
9 #include <QAction>
10 #include <QCheckBox>
11 #include <QComboBox>
12 #include <QFileDialog>
13 #include <QFormLayout>
14 #include <QGroupBox>
15 #include <QHBoxLayout>
16 #include <QLabel>
17 #include <QMainWindow>
18 #include <QMessageBox>
19 #include <QObject>
20 #include <QPushButton>
21 #include <QScrollBar>
22 #include <QShortcut>
23 #include <QSplitter>
24 #include <QTableWidget>
25 #include <QTextEdit>
26 #include <QVBoxLayout>
27 
28 #include "Application.h"
29 #include "Camera.h"
30 #include "Control.h"
31 #include "ControlMeasureEditWidget.h"
32 #include "ControlMeasure.h"
33 #include "ControlMeasureLogData.h"
34 #include "ControlNet.h"
35 #include "ControlPoint.h"
36 #include "DeleteControlPointDialog.h"
37 #include "Directory.h"
38 #include "FileName.h"
39 #include "IException.h"
40 #include "Latitude.h"
41 #include "Longitude.h"
42 #include "MainWindow.h"
43 #include "MdiCubeViewport.h"
44 #include "NewControlPointDialog.h"
45 #include "Project.h"
46 #include "Pvl.h"
47 #include "PvlEditDialog.h"
48 #include "SerialNumber.h"
49 #include "SerialNumberList.h"
50 #include "Shape.h"
51 #include "ShapeList.h"
52 #include "SpecialPixel.h"
53 #include "ToolPad.h"
54 #include "UniversalGroundMap.h"
55 #include "ViewportMainWindow.h"
56 #include "Workspace.h"
57 
58 using namespace std;
59 
60 namespace Isis {
68  ControlPointEditWidget::ControlPointEditWidget (Directory *directory, QWidget *parent,
69  bool addMeasures) : QWidget(parent) {
70 
71  m_directory = directory;
72  m_addMeasuresButton = addMeasures;
73  m_netChanged = false;
74  m_templateModified = false;
75  m_serialNumberList = NULL;
76 
77 // qDebug()<<"ControlPointEditWidget::ControlPointEditWidget #shapes = "<<m_directory->project()->shapes().count()<<" 1st shape= "<<m_directory->project()->shapes().at(0)->at(0)->fileName();
78 
79  m_parent = parent;
80 
82 
83  connect(this, SIGNAL(newControlNetwork(ControlNet *)),
84  m_measureEditor, SIGNAL(newControlNetwork(ControlNet *)));
85  }
86 
87 
88  ControlPointEditWidget::~ControlPointEditWidget () {
89 
90  // TODO: Don't write settings in destructor, must do this earlier in close event
91 // writeSettings();
92 
93  }
94 
95 
121  void ControlPointEditWidget::createPointEditor(QWidget *parent, bool addMeasures) {
122 
123  setWindowTitle("Control Point Editor");
124  setObjectName("ControlPointEditWidget");
125  connect(this, SIGNAL(destroyed(QObject *)), this, SLOT(clearEditPoint()));
126 
127  createActions();
128 
129  // create m_measureEditor first since we need to get its templateFileName
130  // later
131  m_measureEditor = new ControlMeasureEditWidget(parent, true, true);
132 
133  // TODO Does this need to be moved to ControlNetEditMainWindow???
134  connect(this, SIGNAL(newControlNetwork(ControlNet *)),
135  m_measureEditor, SIGNAL(newControlNetwork(ControlNet *)));
136 
137 
138  connect(this, SIGNAL(stretchChipViewport(Stretch *, CubeViewport *)),
139  m_measureEditor, SIGNAL(stretchChipViewport(Stretch *, CubeViewport *)));
140  connect(m_measureEditor, SIGNAL(measureSaved()), this, SLOT(measureSaved()));
141 // connect(this, SIGNAL(measureChanged()), m_measureEditor, SLOT(colorizeSavePointButton()));
142  connect(this, SIGNAL(netChanged()), this, SLOT(colorizeSaveNetButton()));
143 
144  QPushButton *addMeasure = NULL;
145  if (m_addMeasuresButton) {
146  addMeasure = new QPushButton("Add Measure(s) to Point");
147  addMeasure->setToolTip("Add a new measure to the edit control point.");
148  addMeasure->setWhatsThis("This allows a new control measure to be added "
149  "to the currently edited control point. A selection "
150  "box with all cubes from the input list will be "
151  "displayed with those that intersect with the "
152  "control point highlighted.");
153  //TODO addMeasure() slot is not implemented ???
154  connect(addMeasure, SIGNAL(clicked()), this, SLOT(addMeasure()));
155  }
156 
157  m_savePoint = new QPushButton ("Save Point");
158  m_savePoint->setToolTip("Save the edit control point to the control "
159  "network.");
160  m_savePoint->setWhatsThis("Save the edit control point to the control "
161  "network which is loaded into memory in its entirety. "
162  "When a control point is selected for editing, "
163  "a copy of the point is made so that the original control "
164  "point remains in the network.");
165  m_saveDefaultPalette = m_savePoint->palette();
166  connect (m_savePoint, SIGNAL(clicked()), this, SLOT(savePoint()));
167 
168  m_saveNet = new QPushButton ("Save Control Net");
169  m_saveNet->setToolTip("Save the control network.");
170  m_savePoint->setWhatsThis("Save the control network.");
171 // m_saveDefaultPalette = m_savePoint->palette();
172 // This slot is needed because we cannot directly emit a signal with a ControlNet
173 // argument after the "Save Net" push button is selected since the parameter list must match.
174 // The saveNet slot will simply emit a signal with the ControlNet as the argument.
175  connect (m_saveNet, SIGNAL(clicked()), this, SLOT(saveNet()));
176 
177  QHBoxLayout * saveMeasureLayout = new QHBoxLayout;
178  if (m_addMeasuresButton) {
179  saveMeasureLayout->addWidget(addMeasure);
180  }
181  else {
182  saveMeasureLayout->addStretch();
183  }
184  saveMeasureLayout->addWidget(m_savePoint);
185  saveMeasureLayout->addWidget(m_saveNet);
186 
187  m_cnetFileNameLabel = new QLabel("Control Network: " + m_cnetFileName);
188  m_cnetFileNameLabel->setToolTip("Name of opened control network file.");
189  m_cnetFileNameLabel->setWhatsThis("Name of opened control network file.");
190 
191  m_templateFileNameLabel = new QLabel("Template File: " +
192  m_measureEditor->templateFileName());
193  m_templateFileNameLabel->setToolTip("Sub-pixel registration template File.");
194 // QString patternMatchDoc =
195 // FileName("$ISISROOT/doc/documents/PatternMatch/PatternMatch.html").fileName();
196 // m_templateFileNameLabel->setOpenExternalLinks(true);
197  m_templateFileNameLabel->setWhatsThis("FileName of the sub-pixel "
198  "registration template. Refer to $ISISROOT/doc/documents/"
199  "PatternMatch/PatternMatch.html for a description of the "
200  "contents of this file.");
201 
202  QVBoxLayout * centralLayout = new QVBoxLayout;
203 
204  centralLayout->addWidget(m_cnetFileNameLabel);
205  centralLayout->addWidget(m_templateFileNameLabel);
206  centralLayout->addWidget(createTopSplitter());
207  centralLayout->addStretch();
208  centralLayout->addWidget(m_measureEditor);
209  centralLayout->addLayout(saveMeasureLayout);
210 
211  QWidget *centralWidget = new QWidget;
212  centralWidget->setLayout(centralLayout);
213 
214  QScrollArea *scrollArea = new QScrollArea();
215  scrollArea->setObjectName("ControlPointEditWidgetScroll");
216  scrollArea->setWidget(centralWidget);
217  scrollArea->setWidgetResizable(true);
218  centralWidget->adjustSize();
219 
220  QHBoxLayout *mainLayout = new QHBoxLayout;
221  mainLayout->addWidget(scrollArea);
222  setLayout(mainLayout);
223 
224 // connect(this, SIGNAL(controlPointChanged()), this, SLOT(paintAllViewports()));
225 
226 // readSettings();
227  }
228 
229 
236 
237  QHBoxLayout * measureLayout = new QHBoxLayout;
238  measureLayout->addWidget(createLeftMeasureGroupBox());
239  measureLayout->addWidget(createRightMeasureGroupBox());
240 
241  QVBoxLayout * groupBoxesLayout = new QVBoxLayout;
242  groupBoxesLayout->addWidget(createControlPointGroupBox());
243  groupBoxesLayout->addStretch();
244  groupBoxesLayout->addLayout(measureLayout);
245 
246  QWidget * groupBoxesWidget = new QWidget;
247  groupBoxesWidget->setLayout(groupBoxesLayout);
248 
250 
251  QSplitter * topSplitter = new QSplitter;
252  topSplitter->addWidget(groupBoxesWidget);
253  topSplitter->addWidget(m_templateEditorWidget);
254 // topSplitter->setStretchFactor(0, 4);
255 // topSplitter->setStretchFactor(1, 3);
256 
257  m_templateEditorWidget->hide();
258 
259  return topSplitter;
260  }
261 
262 
269 
270  // create left vertical layout
271  m_ptIdValue = new QLabel;
272 
273 //TODO 2014-07-22 TLS cnetsuite Handle ground control points SOON
274  m_numMeasures = new QLabel;
275 // QHBoxLayout *pointInfoLayout = new QHBoxLayout;
276 // pointInfoLayout->addWidget(m_ptIdValue);
277 // pointInfoLayout->addWidget(m_numMeasures);
278 
279  // create right vertical layout's top layout
280  m_lockPoint = new QCheckBox("Edit Lock Point");
281  connect(m_lockPoint, SIGNAL(clicked(bool)), this, SLOT(setLockPoint(bool)));
282  m_ignorePoint = new QCheckBox("Ignore Point");
283  connect(m_ignorePoint, SIGNAL(clicked(bool)),
284  this, SLOT(setIgnorePoint(bool)));
285  connect(this, SIGNAL(ignorePointChanged()), m_ignorePoint, SLOT(toggle()));
286 
287 // QHBoxLayout * pointStatusLayout = new QHBoxLayout;
288 // pointStatusLayout->addWidget(m_lockPoint);
289 // pointStatusLayout->addWidget(m_ignorePoint);
290 
291  m_pointType = new QComboBox;
292  for (int i=0; i<ControlPoint::PointTypeCount; i++) {
295  }
296  QFormLayout *pointTypeLayout = new QFormLayout;
297 // QLabel *pointTypeLabel = new QLabel("PointType:");
298  pointTypeLayout->addRow("PointType:", m_pointType);
299 // pointTypeLayout->addWidget(m_pointType);
300 // connect(m_pointType, SIGNAL(activated(int)),
301 // this, SLOT(setPointType(int)));
302 
303  QVBoxLayout * mainLayout = new QVBoxLayout;
304  mainLayout->addWidget(m_ptIdValue);
305  mainLayout->addWidget(m_numMeasures);
306  mainLayout->addWidget(m_lockPoint);
307  mainLayout->addWidget(m_ignorePoint);
308  mainLayout->addLayout(pointTypeLayout);
309 // mainLayout->addLayout(pointInfoLayout);
310 // mainLayout->addLayout(pointStatusLayout);
311 // mainLayout->addLayout(pointTypeLayout);
312 
313  // create the groupbox
314  QGroupBox * groupBox = new QGroupBox("Control Point");
315  groupBox->setLayout(mainLayout);
316 
317  return groupBox;
318  }
319 
320 
327 
328  m_leftCombo = new QComboBox;
329  m_leftCombo->view()->installEventFilter(this);
330  m_leftCombo->setToolTip("Choose left control measure");
331  m_leftCombo->setWhatsThis("Choose left control measure identified by "
332  "cube filename.");
333  connect(m_leftCombo, SIGNAL(activated(int)),
334  this, SLOT(selectLeftMeasure(int)));
335  m_lockLeftMeasure = new QCheckBox("Edit Lock Measure");
336  connect(m_lockLeftMeasure, SIGNAL(clicked(bool)),
337  this, SLOT(setLockLeftMeasure(bool)));
338  m_ignoreLeftMeasure = new QCheckBox("Ignore Measure");
339  connect(m_ignoreLeftMeasure, SIGNAL(clicked(bool)),
340  this, SLOT(setIgnoreLeftMeasure(bool)));
341  connect(this, SIGNAL(ignoreLeftChanged()),
342  m_ignoreLeftMeasure, SLOT(toggle()));
343  m_leftReference = new QLabel();
344  m_leftMeasureType = new QLabel();
345  QVBoxLayout * leftLayout = new QVBoxLayout;
346  leftLayout->addWidget(m_leftCombo);
347  leftLayout->addWidget(m_lockLeftMeasure);
348  leftLayout->addWidget(m_ignoreLeftMeasure);
349  leftLayout->addWidget(m_leftReference);
350  leftLayout->addWidget(m_leftMeasureType);
351 
352  QGroupBox * leftGroupBox = new QGroupBox("Left Measure");
353  leftGroupBox->setLayout(leftLayout);
354 
355  return leftGroupBox;
356  }
357 
358 
365 
366  // create widgets for the right groupbox
367  m_rightCombo = new QComboBox;
368  m_model = new QStandardItemModel();
369  m_rightCombo->setModel(m_model);
370  m_rightCombo->view()->installEventFilter(this);
371  m_rightCombo->setToolTip("Choose right control measure");
372  m_rightCombo->setWhatsThis("Choose right control measure identified by "
373  "cube filename.");
374 
375  m_rightCombo->view()->setSelectionMode(QAbstractItemView::SingleSelection);
376  m_rightCombo->view()->setDragEnabled(true);
377  m_rightCombo->view()->setAcceptDrops(true);
378  m_rightCombo->view()->setDropIndicatorShown(true);
379  m_rightCombo->view()->setDragDropMode(QAbstractItemView::InternalMove);
380 
381  // Attach shortcuts to Qnet Tool's window for selecting right measures
382  // Note: Qt handles this memory for us since m_qnetTool is the parent of these shortcuts
383  QShortcut *nextMeasure = new QShortcut(Qt::Key_PageDown, this);
384  connect(nextMeasure, SIGNAL(activated()), this, SLOT(nextRightMeasure()));
385  QShortcut *prevMeasure = new QShortcut(Qt::Key_PageUp, this);
386  connect(prevMeasure, SIGNAL(activated()), this, SLOT(previousRightMeasure()));
387 
388  connect(m_rightCombo, SIGNAL(activated(int)),
389  this, SLOT(selectRightMeasure(int)));
390  m_lockRightMeasure = new QCheckBox("Edit Lock Measure");
391  connect(m_lockRightMeasure, SIGNAL(clicked(bool)),
392  this, SLOT(setLockRightMeasure(bool)));
393  m_ignoreRightMeasure = new QCheckBox("Ignore Measure");
394  connect(m_ignoreRightMeasure, SIGNAL(clicked(bool)),
395  this, SLOT(setIgnoreRightMeasure(bool)));
396  connect(this, SIGNAL(ignoreRightChanged()),
397  m_ignoreRightMeasure, SLOT(toggle()));
398  m_rightReference = new QLabel();
399  m_rightMeasureType = new QLabel();
400 
401  // create right groupbox
402  QVBoxLayout * rightLayout = new QVBoxLayout;
403  rightLayout->addWidget(m_rightCombo);
404  rightLayout->addWidget(m_lockRightMeasure);
405  rightLayout->addWidget(m_ignoreRightMeasure);
406  rightLayout->addWidget(m_rightReference);
407  rightLayout->addWidget(m_rightMeasureType);
408 
409  QGroupBox * rightGroupBox = new QGroupBox("Right Measure");
410  rightGroupBox->setLayout(rightLayout);
411 
412  return rightGroupBox;
413  }
414 
415 
420 
421  QToolBar *toolBar = new QToolBar("Template Editor ToolBar");
422 
423  toolBar->addAction(m_openTemplateFile);
424  toolBar->addSeparator();
425  toolBar->addAction(m_saveTemplateFile);
426  toolBar->addAction(m_saveTemplateFileAs);
427 
428  m_templateEditor = new QTextEdit;
429  connect(m_templateEditor, SIGNAL(textChanged()), this,
430  SLOT(setTemplateModified()));
431 
432  QVBoxLayout *mainLayout = new QVBoxLayout;
433  mainLayout->addWidget(toolBar);
434  mainLayout->addWidget(m_templateEditor);
435 
437  m_templateEditorWidget->setLayout(mainLayout);
438  }
439 
440 
445 
446  m_closePointEditor = new QAction(QIcon(FileName("base/icons/fileclose.png").expanded()),
447  "&Close", this);
448  m_closePointEditor->setToolTip("Close this window");
449  m_closePointEditor->setStatusTip("Close this window");
450  m_closePointEditor->setShortcut(Qt::ALT + Qt::Key_F4);
451  QString whatsThis = "<b>Function:</b> Closes the Match Tool window for this point "
452  "<p><b>Shortcut:</b> Alt+F4 </p>";
453  m_closePointEditor->setWhatsThis(whatsThis);
454  connect(m_closePointEditor, SIGNAL(triggered()), this, SLOT(close()));
455 
456  m_showHideTemplateEditor = new QAction(QIcon(FileName("base/icons/view_text.png").expanded()),
457  "&View/edit registration template", this);
458  m_showHideTemplateEditor->setCheckable(true);
459  m_showHideTemplateEditor->setToolTip("View and/or edit the registration template");
460  m_showHideTemplateEditor->setStatusTip("View and/or edit the registration template");
461  whatsThis = "<b>Function:</b> Displays the curent registration template. "
462  "The user may edit and save changes under a chosen filename.";
463  m_showHideTemplateEditor->setWhatsThis(whatsThis);
464  connect(m_showHideTemplateEditor, SIGNAL(triggered()), this,
465  SLOT(showHideTemplateEditor()));
466 
467  m_saveChips = new QAction(QIcon(FileName("base/icons/window_new.png").expanded()),
468  "Save registration chips", this);
469  m_saveChips->setToolTip("Save registration chips");
470  m_saveChips->setStatusTip("Save registration chips");
471  whatsThis = "<b>Function:</b> Save registration chips to file. "
472  "Each chip: pattern, search, fit will be saved to a separate file.";
473  m_saveChips->setWhatsThis(whatsThis);
474  connect(m_saveChips, SIGNAL(triggered()), this, SLOT(saveChips()));
475 
476  m_openTemplateFile = new QAction(QIcon(FileName("base/icons/fileopen.png").expanded()),
477  "&Open registration template", this);
478  m_openTemplateFile->setToolTip("Set registration template");
479  m_openTemplateFile->setStatusTip("Set registration template");
480  whatsThis = "<b>Function:</b> Allows user to select a new file to set as "
481  "the registration template";
482  m_openTemplateFile->setWhatsThis(whatsThis);
483  connect(m_openTemplateFile, SIGNAL(triggered()), this, SLOT(openTemplateFile()));
484 
485  m_saveTemplateFile = new QAction(QIcon(FileName("base/icons/mActionFileSave.png").expanded()),
486  "&Save template file", this);
487  m_saveTemplateFile->setToolTip("Save the template file");
488  m_saveTemplateFile->setStatusTip("Save the template file");
489  m_saveTemplateFile->setWhatsThis("Save the registration template file");
490  connect(m_saveTemplateFile, SIGNAL(triggered()), this,
491  SLOT(saveTemplateFile()));
492 
493  m_saveTemplateFileAs = new QAction(QIcon(FileName("base/icons/mActionFileSaveAs.png").expanded()),
494  "&Save template as...", this);
495  m_saveTemplateFileAs->setToolTip("Save the template file as");
496  m_saveTemplateFileAs->setStatusTip("Save the template file as");
497  m_saveTemplateFileAs->setWhatsThis("Save the registration template file as");
498  connect(m_saveTemplateFileAs, SIGNAL(triggered()), this,
499  SLOT(saveTemplateFileAs()));
500  }
501 
502 
509 
510  // TODO If network & snList already exists do some error checking
511  // Make copy; we add ground source files to the list, and we don't want to cause problems for
512  // other cnetsuite entities that are using
513 // if (m_serialNumberList) {
514 // delete m_serialNumberList;
515 // m_serialNumberList = NULL;
516 // }
517 // m_serialNumberList = new SerialNumberList(snList);
518  m_serialNumberList = snList;
519  }
520 
521 
531  //qDebug()<<"ControlPointEditWidget::setControlNet cnet = "<<cnet<<" filename = "<<cnetFilename;
532  // TODO more error checking
533  m_controlNet = control->controlNet();
534  m_cnetFileName = control->fileName();
535  setWindowTitle("Control Point Editor- Control Network File: " + m_cnetFileName);
536 
537  emit newControlNetwork(m_controlNet);
538  }
539 
540 
554 
555  ControlMeasure *groundMeasure = NULL;
556  FileName groundFile(m_editPoint->GetAprioriSurfacePointSourceFile());
557  if (!groundFile.fileExists()) {
558  // simply print error for now, need to prompt
559  // for new location or new source, either a Shape in the project, or import a new shape,
560  // or simplay choose file?
561  QString message = "Ground Source file " + groundFile.expanded();
562  message += " doesn't exist";
563  QMessageBox::critical(this, "Warning", message);
564  }
565  else {
566 
567  // If ground file exists, open, create cube and ground map. If doesn't exist, prompt
568  // for new location or new source, either a Shape in the project, or import a new shape,
569  // or simplay choose file?
570  // THIS SHOULD BE MOVED TO ::LOADPOINT AND info needs to be saved
571  QScopedPointer<Cube> groundCube(new Cube(groundFile, "r"));
572  QScopedPointer<UniversalGroundMap> groundMap(new UniversalGroundMap(*groundCube));
573 
574  // Use apriori surface point to find location on ground source. If
575  // apriori surface point does not exist use reference measure
576  double lat = 0.;
577  double lon = 0.;
578  if (m_editPoint->HasAprioriCoordinates()) {
579  SurfacePoint sPt = m_editPoint->GetAprioriSurfacePoint();
580  lat = sPt.GetLatitude().degrees();
581  lon = sPt.GetLongitude().degrees();
582  }
583  else {
584  ControlMeasure m = *(m_editPoint->GetRefMeasure());
586  Camera *cam;
587  cam = m_controlNet->Camera(camIndex);
588  cam->SetImage(m.GetSample(),m.GetLine());
589  lat = cam->UniversalLatitude();
590  lon = cam->UniversalLongitude();
591  }
592 
593  // Try to locate point position on current ground source,
594  // TODO ???if doesn't exist,???
595  if (!groundMap->SetUniversalGround(lat,lon)) {
596  QString message = "This point does not exist on the ground source.\n";
597  message += "Latitude = " + QString::number(lat);
598  message += " Longitude = " + QString::number(lon);
599  message += "\n A ground measure will not be created.";
600  QMessageBox::warning(this, "Warning", message);
601  }
602  else {
603  // This measure will be deleted when the ControlPoint is saved to the
604  // ControlNet.
605  groundMeasure = new ControlMeasure;
606  QString groundSN = SerialNumber::Compose(*groundCube);
607  groundMeasure->SetCubeSerialNumber(groundSN);
608  groundMeasure->SetType(ControlMeasure::Candidate);
609  groundMeasure->SetCoordinate(groundMap->Sample(), groundMap->Line());
610  groundMeasure->SetChooserName("GroundMeasureTemporary");
611  // Add serial number to serial number list if not already there
612  if (!m_serialNumberList->hasSerialNumber(groundSN)) {
613  m_serialNumberList->add(groundFile.expanded(), true);
614  }
615  }
616  }
617 
618  return groundMeasure;
619  }
620 
621 
628  //qDebug()<<"ControlPointEditWidget::setEditPoint incoming ptId = "<<controlPoint->GetId();
629 
630  if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
631  delete m_editPoint;
632  m_editPoint = NULL;
633  }
634 
635  // Create copy of ControlPoint. It will not be saved to net until "Save Point" is selected
637  *m_editPoint = *controlPoint;
638  //qDebug()<<"ControlPointEditWidget::setEditPoint m_editPoint Id = "<<m_editPoint->GetId();
639 
640  loadPoint();
641  this->setVisible(true);
642  this->raise();
643  loadTemplateFile(m_measureEditor->templateFileName());
644 
645  // New point loaded, make sure Save Measure Button text is default
646  m_savePoint->setPalette(m_saveDefaultPalette);
647  }
648 
649 
669 
670  // Write pointId
671  QString CPId = m_editPoint->GetId();
672  QString ptId("Point ID: ");
673  ptId += (QString) CPId;
674  m_ptIdValue->setText(ptId);
675 
676  m_pointType->setCurrentIndex((int) m_editPoint->GetType());
677  QString groundFile;
678  if (m_editPoint->GetType() != ControlPoint::Free) {
679  groundFile = m_editPoint->GetAprioriSurfacePointSourceFile();
680  }
681 
682  // Write number of measures
683  QString ptsize = "Number of Measures: " +
684  QString::number(m_editPoint->GetNumMeasures());
685  m_numMeasures->setText(ptsize);
686 
687  // Set EditLock box correctly
688  m_lockPoint->setChecked(m_editPoint->IsEditLocked());
689 
690  // Set ignore box correctly
691  m_ignorePoint->setChecked(m_editPoint->IsIgnored());
692 
693  // Clear combo boxes
694  m_leftCombo->clear();
695  m_rightCombo->clear();
696  m_pointFiles.clear();
697 
698  m_pointCubes.clear();
699 
700 
701  // If fixed, add ground source file to combos, create a measure for
702  // the ground source, load reference on left, ground source on right
703  if (m_editPoint->GetType() != ControlPoint::Free) {
704  // Create a temporary measure to hold the ground point info for ground source
705  // This measure will be deleted when the ControlPoint is saved to the
706  // ControlNet.
707  // TODO: Does open ground source match point ground source
708  ControlMeasure *groundMeasure = createTemporaryGroundMeasure();
709  if (groundMeasure) {
710  m_editPoint->Add(groundMeasure);
711  }
712  else {
713  QString message = "Cannot create ground measure on ground source file ";
714  message += groundFile;
715  QMessageBox::warning(this, "Warning", message);
716  }
717  }
718 
719  // Need all files for this point
720  for (int i=0; i<m_editPoint->GetNumMeasures(); i++) {
721  ControlMeasure &m = *(*m_editPoint)[i];
722  QString file;
723  if (m.GetChooserName() == "GroundMeasureTemporary") {
724  file = groundFile;
725  }
726  else {
728  }
729  m_pointFiles<<file;
730  QString tempFileName = FileName(file).name();
731 
732  QStandardItem *item = new QStandardItem(tempFileName);
733 // qDebug()<<"before item flags = "<<item->flags();
734  item->setFlags(item->flags() & ~Qt::ItemIsDropEnabled);
735  m_model->appendRow(item);
736 
737  m_leftCombo->addItem(tempFileName);
738 // m_rightCombo->addItem(tempFileName);
739  if (m_editPoint->IsReferenceExplicit() &&
740  (QString)m.GetCubeSerialNumber() == m_editPoint->GetReferenceSN()) {
741  m_leftCombo->setItemData(i,QFont("DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
742  m_rightCombo->setItemData(i,QFont("DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
743  }
744  }
745 
746  //TODO IPCE 2016-06-08 TEMPORARY for prototype,
748 
749 
750 
751 
752 
753 
754 
755 
756  // TODO: WHAT HAPPENS IF THERE IS ONLY ONE MEASURE IN THIS CONTROLPOINT??
757  // Assuming combo loaded in same order as measures in the control point-is
758  // this a safe assumption???
759  //
760  // Find the file from the cubeViewport that was originally used to select
761  // the point, this will be displayed on the left ChipViewport, unless the
762  // point was selected on the ground source image. In this case, simply
763  // load the first measure on the left.
764  int leftIndex = 0;
765  int rightIndex = 0;
766  // Check for reference
767  if (m_editPoint->IsReferenceExplicit()) {
768  leftIndex = m_editPoint->IndexOfRefMeasure();
769  }
770  else {
771  if (!m_leftFile.isEmpty()) {
772  leftIndex = m_leftCombo->findText(FileName(m_leftFile).name());
773  // Sanity check
774  if (leftIndex < 0 ) leftIndex = 0;
775  m_leftFile.clear();
776  }
777  }
778 
779  if (leftIndex == 0) {
780  rightIndex = 1;
781  }
782  else {
783  rightIndex = 0;
784  }
785 
786  // Handle pts with a single measure, for now simply put measure on left/right
787  // Evenutally put on left with black on right??
788  if (rightIndex > m_editPoint->GetNumMeasures()-1) rightIndex = 0;
789  m_rightCombo->setCurrentIndex(rightIndex);
790  m_leftCombo->setCurrentIndex(leftIndex);
791  // Initialize pointEditor with measures
792  selectLeftMeasure(leftIndex);
793  selectRightMeasure(rightIndex);
794 
795 // loadMeasureTable();
796  }
797 
798 
799  void ControlPointEditWidget::createControlPoint(double latitude, double longitude, Cube *cube,
800  bool isGroundSource) {
801 // qDebug()<<"ControlPointEditWidget::createControlPoint cube = "<<cube->fileName()<<" isGroundSource = "<<isGroundSource;
802  // TODO: CHECK SUBPIXEL REGISTER RADIO BUTTON OPTION (CHECKBOX?)
803 
804  // Create list box of all files highlighting those that
805  // contain the point.
806  QStringList pointFiles;
807 
808  Camera *cam;
809  for (int i = 0; i < m_serialNumberList->size(); i++) {
810 // if (m_serialNumberList->serialNumber(i) == m_groundSN) continue;
811  cam = m_controlNet->Camera(i);
812  if (cam->SetUniversalGround(latitude, longitude)) {
813  // Make sure point is within image boundary
814  double samp = cam->Sample();
815  double line = cam->Line();
816  if (samp >= 1 && samp <= cam->Samples() &&
817  line >= 1 && line <= cam->Lines()) {
818  pointFiles<<m_serialNumberList->fileName(i);
819  }
820  }
821  }
822 
823  // Get shapes from project to fill dialog, changing the font for shapes the point is located in.
824  QStringList shapeNames;
825  QStringList shapeNamesNoPoint;
826  // Create map between the Shape display name & Shape
827  QMap<QString, Shape *> nameToShapeMap;
828  QList<ShapeList *> shapeLists = m_directory->project()->shapes();
829  foreach (ShapeList *shapeList, shapeLists) {
830  foreach (Shape *shape, *shapeList) {
831  UniversalGroundMap *gmap = new UniversalGroundMap(*(shape->cube()));
832  if (gmap->SetUniversalGround(latitude, longitude)) {
833  shapeNames<<shape->displayProperties()->displayName();
834  }
835  else {
836  shapeNamesNoPoint<<shape->displayProperties()->displayName();
837  }
838  nameToShapeMap[shape->displayProperties()->displayName()] = shape;
839  delete gmap;
840  }
841  }
842 
843  int numberShapesWithPoint = shapeNames.count();
844  shapeNames<<shapeNamesNoPoint;
845 
846  //m_directory->project()->shapes().count()<<" 1st shape= "<<m_directory->project()->shapes().at(0)->at(0)->fileName();
847 
848  NewControlPointDialog *newPointDialog =
849  new NewControlPointDialog(m_controlNet, m_serialNumberList, m_lastUsedPointId, this);
850  newPointDialog->setFiles(pointFiles);
851  newPointDialog->setGroundSource(shapeNames, numberShapesWithPoint);
852  if (newPointDialog->exec()) {
853  m_lastUsedPointId = newPointDialog->pointId();
854  ControlPoint *newPoint =
855  new ControlPoint(m_lastUsedPointId);
856 
857  // If this ControlPointId already exists, message box pops up and user is
858  // asked to enter a new value.
859  if (m_controlNet->ContainsPoint(newPoint->GetId())) {
860  QString message = "A ControlPoint with Point Id = [" + newPoint->GetId();
861  message += "] already exists. Re-enter Point Id for this ControlPoint.";
862  QMessageBox::warning(this, "New Point Id", message);
863  pointFiles.clear();
864  delete newPoint;
865  newPoint = NULL;
866  createControlPoint(latitude, longitude);
867  return;
868  }
869 
870  newPoint->SetChooserName(Application::UserName());
871 
872  QStringList selectedFiles = newPointDialog->selectedFiles();
873  foreach (QString selectedFile, selectedFiles) {
874  // Create measure for any file selected
875  ControlMeasure *m = new ControlMeasure;
876  // Find serial number for this file
877  QString sn = m_serialNumberList->serialNumber(selectedFile);
878  m->SetCubeSerialNumber(sn);
879  int camIndex = m_serialNumberList->fileNameIndex(selectedFile);
880  cam = m_controlNet->Camera(camIndex);
881  cam->SetUniversalGround(latitude, longitude);
882  m->SetCoordinate(cam->Sample(),cam->Line());
883  m->SetAprioriSample(cam->Sample());
884  m->SetAprioriLine(cam->Line());
885  m->SetType(ControlMeasure::Manual);
886  m->SetChooserName(Application::UserName());
887  m->SetCamera(cam);
888  newPoint->Add(m);
889  }
890 
891  // Get point type from dialog
892  bool isGroundPoint = (newPointDialog->pointType() != ControlPoint::Free);
893  newPoint->SetType((ControlPoint::PointType) newPointDialog->pointType());
894 
895  if (isGroundPoint) {
896  Shape *shape = nameToShapeMap[newPointDialog->groundSource()];
897  // Save ground source information in control point
898  if (shape->shapeType() == Shape::Dem ||
899  shape->shapeType() == Shape::Basemap) {
900  newPoint->SetAprioriSurfacePointSource(ControlPoint::SurfacePointSource::Basemap);
901  }
902  else if (shape->shapeType() == Shape::Unprojected) {
903  // TODO Determine if unprojected shape has been bundle adjusted or is simply ??
904 // newPoint->SetAprioriSurfacePointSource(ControlPoint::SurfacePointSource::???
905  }
906  newPoint->SetAprioriSurfacePointSourceFile(shape->fileName());
907  }
908 
909  setEditPoint(newPoint);
910 // if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
911 // delete m_editPoint;
912 // m_editPoint = NULL;
913 // }
914 // m_editPoint = newPoint;
915 //
916 // // If the image that the user clicked on to select the point is not
917 // // included, clear out the leftFile value.
918 // if (!m_leftFile.isEmpty()) {
919 // if (selectedFiles.indexOf(m_leftFile) == -1) {
920 // m_leftFile.clear();
921 // }
922 // }
923 //
924 // // Load new point in QnetTool
925 // loadPoint();
926 //
927 // // If cube valid, use as reference
928 // if (cube) {
929 //
930 // }
931 
932 
933  emit controlPointAdded(newPoint->GetId());
934  }
935  }
936 
937 
938  void ControlPointEditWidget::deletePoint(ControlPoint *controlPoint) {
939 
940  // TODO 2016-09-16 TLS IMPLEMENT!
941 // QString message = "Deleting control point not implemented yet";
942 // QMessageBox::critical(this, "NOT IMPLEMENTED YET", message);
943 
944  // Make a copy and make sure editPoint is a copy (which means it does not
945  // have a parent network.
946  if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
947  delete m_editPoint;
948  m_editPoint = NULL;
949  }
950  m_editPoint = new ControlPoint;
951  *m_editPoint = *controlPoint;
952  loadPoint();
953 
954  // Change point in viewport to red so user can see what point they are
955  // about to delete.
956  // the nav tool will update edit point
957  emit controlPointChanged(m_editPoint->GetId());
958 
959  DeleteControlPointDialog *deletePointDialog = new DeleteControlPointDialog;
960  QString CPId = m_editPoint->GetId();
961  deletePointDialog->pointIdValue->setText(CPId);
962 
963  // Need all files for this point
964  for (int i=0; i<m_editPoint->GetNumMeasures(); i++) {
965  ControlMeasure &m = *(*m_editPoint)[i];
966  QString file = m_serialNumberList->fileName(m.GetCubeSerialNumber());
967  deletePointDialog->fileList->addItem(file);
968  }
969 
970  if (deletePointDialog->exec()) {
971 
972  int numDeleted = deletePointDialog->fileList->selectedItems().count();
973 
974  // Delete entire control point, either through deleteAllCheckBox or all measures selected
975  if (deletePointDialog->deleteAllCheckBox->isChecked() ||
976  numDeleted == m_editPoint->GetNumMeasures()) {
977 
978  // If all measures being deleted, let user know and give them the option to quit operation
979  if (!deletePointDialog->deleteAllCheckBox->isChecked()) {
980  QString message = "You have selected all measures in this point to be deleted. This "
981  "control point will be deleted. Do you want to delete this control point?";
982  int response = QMessageBox::question(this,
983  "Delete control point", message,
984  QMessageBox::Yes | QMessageBox::No,
985  QMessageBox::Yes);
986  // If No, do nothing
987  if (response == QMessageBox::No) {
988  return;
989  }
990  }
991 
992  // First get rid of deleted point from m_filteredPoints list
993  // need index in control net for pt
994  //int i = m_controlNet->
995  //m_filteredPoints.
996  // remove this point from the control network
997  if (m_controlNet->DeletePoint(m_editPoint->GetId()) ==
999  QMessageBox::information(this, "EditLocked Point",
1000  "This point is EditLocked and cannot be deleted.");
1001  return;
1002  }
1003  if (m_editPoint != NULL && m_editPoint->Parent() == NULL) {
1004  delete m_editPoint;
1005  m_editPoint = NULL;
1006  }
1007  // emit signal so the nav tool refreshes the list
1008 // emit refreshNavList();
1009  }
1010 
1011  // Delete specific measures from control point
1012  else {
1013  // Keep track of editLocked measures for reporting
1014  int lockedMeasures = 0;
1015  for (int i=0; i<deletePointDialog->fileList->count(); i++) {
1016  QListWidgetItem *item = deletePointDialog->fileList->item(i);
1017  if (!deletePointDialog->fileList->isItemSelected(item)) continue;
1018 
1019  // Do not delete reference without asking user
1020  if (m_editPoint->IsReferenceExplicit() &&
1021  (m_editPoint->GetRefMeasure()->GetCubeSerialNumber() ==
1022  (*m_editPoint)[i]->GetCubeSerialNumber())) {
1023  QString message = "You are trying to delete the Reference measure."
1024  " Do you really want to delete the Reference measure?";
1025  switch (QMessageBox::question(this,
1026  "Delete Reference measure?", message,
1027  "&Yes", "&No", 0, 0)) {
1028  // Yes: skip to end of switch todelete the measure
1029  case 0:
1030  break;
1031  // No: continue to next measure in the loop
1032  case 1:
1033  // if only a single measure and it's reference and user chooses not to delete,
1034  // simply return. The point has not changed.
1035  if (numDeleted == 1) {
1036  return;
1037  }
1038  continue;
1039  }
1040  }
1041 
1042  if (m_editPoint->Delete(i) == ControlMeasure::MeasureLocked) {
1043  lockedMeasures++;
1044  }
1045  }
1046 
1047  if (lockedMeasures > 0) {
1048  QMessageBox::information(this,"EditLocked Measures",
1049  QString::number(lockedMeasures) + " / "
1050  + QString::number(
1051  deletePointDialog->fileList->selectedItems().size()) +
1052  " measures are EditLocked and were not deleted.");
1053  }
1054 
1055  loadPoint();
1056 
1057 // loadTemplateFile(m_pointEditor->templateFileName());
1058  }
1059 
1060  // emit a signal to alert user to save when exiting
1061  emit netChanged();
1062 
1063  // emit signal so the nav tool can update edit point
1064  if (m_editPoint != NULL) {
1065 // emit editPointChanged(m_editPoint->GetId());
1066  // Change Save Point button text to red
1068  }
1069  else {
1070  // if the entire point is deleted, update with point Id = ""
1071  // this signal is connected to QnetTool::paintAllViewports
1072  // and QnetNavTool::updateEditPoint
1073 // emit editPointChanged("");
1074  }
1075  }
1076 
1077  }
1078 
1079 
1139 
1140  // Read original measures from the network for comparison with measures
1141  // that have been edited
1142  ControlMeasure *origLeftMeasure =
1143  m_editPoint->GetMeasure(m_leftMeasure->GetCubeSerialNumber());
1144  ControlMeasure *origRightMeasure =
1145  m_editPoint->GetMeasure(m_rightMeasure->GetCubeSerialNumber());
1146  // Neither measure has changed, return
1147  if (*origLeftMeasure == *m_leftMeasure && *origRightMeasure == *m_rightMeasure) {
1148  return;
1149  }
1150 
1151  if (m_editPoint->IsIgnored()) {
1152  QString message = "You are saving changes to a measure on an ignored ";
1153  message += "point. Do you want to set Ignore = False on the point and ";
1154  message += "both measures?";
1155  switch (QMessageBox::question(this, "Match Tool Save Measure",
1156  message, "&Yes", "&No", 0, 0)) {
1157  // Yes: set Ignore=false for the point and measures and save point
1158  case 0:
1159  m_editPoint->SetIgnored(false);
1160  emit ignorePointChanged();
1161  if (m_leftMeasure->IsIgnored()) {
1162  m_leftMeasure->SetIgnored(false);
1163  emit ignoreLeftChanged();
1164  }
1165  if (m_rightMeasure->IsIgnored()) {
1166  m_rightMeasure->SetIgnored(false);
1167  emit ignoreRightChanged();
1168  }
1169  // No: keep Ignore=true and save measure
1170  case 1:
1171  break;
1172  }
1173  }
1174 
1175  bool savedAMeasure = false;
1176  // Error check both measures for edit lock, ignore status and reference
1177  bool leftChangeOk = validateMeasureChange(m_leftMeasure);
1178  if (leftChangeOk) {
1179  m_leftMeasure->SetChooserName(Application::UserName());
1180  *origLeftMeasure = *m_leftMeasure;
1181  savedAMeasure = true;
1182  }
1183  bool rightChangeOk = validateMeasureChange(m_rightMeasure);
1184  if (rightChangeOk) {
1185  m_rightMeasure->SetChooserName(Application::UserName());
1186  *origRightMeasure = *m_rightMeasure;
1187  savedAMeasure = true;
1188  }
1189 
1190  // If left measure == right measure, update left
1191  if (m_leftMeasure->GetCubeSerialNumber() == m_rightMeasure->GetCubeSerialNumber()) {
1193  // Update left measure of measureEditor
1194  m_measureEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
1195  m_editPoint->GetId());
1196  }
1197 
1198  // Change Save Point button text to red
1199  if (savedAMeasure) {
1201  }
1202 
1203  // TODO 7-31-14 Commented out. We renamed editPointChanged to controlPointChanged. However
1204  // do we still need a private signal, editPointChanged?
1205 // emit editPointChanged(m_editPoint->GetId());
1206 
1207  // Update measure info
1210  loadMeasureTable();
1211 
1212  }
1213 
1214 
1223 
1224  // Read original measures from the network for comparison with measures
1225  // that have been edited
1226  ControlMeasure *origMeasure =
1227  m_editPoint->GetMeasure(m->GetCubeSerialNumber());
1228 
1229  // If measure hasn't changed, return false, to keep original
1230 
1231  if (*m == *origMeasure) return false;
1232 
1233  // Is measure on Left or Right? This is needed to print correct information
1234  // to users in identifying the measure and for updating information widgets.
1235  QString side = "right";
1236  if (m->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1237  side = "left";
1238  }
1239 
1240  // Only print error if both original measure in network and the current
1241  // edit measure are both editLocked and measure has changed. If only the edit measure is
1242  // locked, then user just locked and it needs to be saved.
1243  // Do not use this classes IsMeasureLocked since we actually want to
1244  // check the original againsted the edit measure and we don't care
1245  // if this is a reference measure. The check for moving a reference is
1246  // done below.
1247  if (origMeasure->IsEditLocked() && m->IsEditLocked()) {
1248  QString message = "The " + side + " measure is editLocked ";
1249  message += "for editing. Do you want to set EditLock = False for this ";
1250  message += "measure?";
1251  int response = QMessageBox::question(this, "Match Tool Save Measure",
1252  message, QMessageBox::Yes | QMessageBox::No);
1253  // Yes: set EditLock=false for the right measure
1254  if (response == QMessageBox::Yes) {
1255  m->SetEditLock(false);
1256  if (side == "left") {
1257  m_lockLeftMeasure->setChecked(false);
1258  }
1259  else {
1260  m_lockRightMeasure->setChecked(false);
1261  }
1262  }
1263  // No: keep EditLock=true and do NOT save measure
1264  else {
1265  return false;
1266  }
1267  }
1268 
1269  if (origMeasure->IsIgnored() && m->IsIgnored()) {
1270  QString message = "The " + side + "measure is ignored. ";
1271  message += "Do you want to set Ignore = False on the measure?";
1272  switch(QMessageBox::question(this, "Match Tool Save Measure",
1273  message, "&Yes", "&No", 0, 0)){
1274  // Yes: set Ignore=false for the right measure and save point
1275  case 0:
1276  m->SetIgnored(false);
1277  if (side == "left") {
1278  emit ignoreLeftChanged();
1279  }
1280  else {
1281  emit ignoreRightChanged();
1282  }
1283  // No: keep Ignore=true and save point
1284  case 1:
1285  break;;
1286  }
1287  }
1288 
1289  // If measure is explicit reference and it has moved,warn user
1290  ControlMeasure *refMeasure = m_editPoint->GetRefMeasure();
1291  if (m_editPoint->IsReferenceExplicit()) {
1292  if (refMeasure->GetCubeSerialNumber() == m->GetCubeSerialNumber()) {
1293  if (m->GetSample() != origMeasure->GetSample() || m->GetLine() != origMeasure->GetLine()) {
1294  QString message = "You are making a change to the reference measure. You ";
1295  message += "may need to move all of the other measures to match the new ";
1296  message += " coordinate of the reference measure. Do you really want to ";
1297  message += " change the reference measure's location? ";
1298  switch(QMessageBox::question(this, "Match Tool Save Measure",
1299  message, "&Yes", "&No", 0, 0)){
1300  // Yes: Save measure
1301  case 0:
1302  break;
1303  // No: keep original reference, return without saving
1304  case 1:
1305  loadPoint();
1306  return false;
1307  }
1308  }
1309  }
1310  // New reference measure
1311  else if (side == "left" && (refMeasure->GetCubeSerialNumber() != m->GetCubeSerialNumber())) {
1312  QString message = "This point already contains a reference measure. ";
1313  message += "Would you like to replace it with the measure on the left?";
1314  int response = QMessageBox::question(this,
1315  "Match Tool Save Measure", message,
1316  QMessageBox::Yes | QMessageBox::No,
1317  QMessageBox::Yes);
1318  // Replace reference measure
1319  if (response == QMessageBox::Yes) {
1320  // Update measure file combo boxes: old reference normal font,
1321  // new reference bold font
1322  QString file = m_serialNumberList->fileName(m_leftMeasure->GetCubeSerialNumber());
1323  QString fname = FileName(file).name();
1324  int iref = m_leftCombo->findText(fname);
1325 
1326  // Save normal font from new reference measure
1327  QVariant font = m_leftCombo->itemData(iref,Qt::FontRole);
1328  m_leftCombo->setItemData(iref,QFont("DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
1329  iref = m_rightCombo->findText(fname);
1330  m_rightCombo->setItemData(iref,QFont("DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
1331 
1332  file = m_serialNumberList->fileName(refMeasure->GetCubeSerialNumber());
1333  fname = FileName(file).name();
1334  iref = m_leftCombo->findText(fname);
1335  m_leftCombo->setItemData(iref,font,Qt::FontRole);
1336  iref = m_rightCombo->findText(fname);
1337  m_rightCombo->setItemData(iref,font,Qt::FontRole);
1338 
1339  m_editPoint->SetRefMeasure(m->GetCubeSerialNumber());
1340  }
1341  }
1342  }
1343  else {
1344  // No explicit reference, If left, set explicit reference
1345  if (side == "left") {
1346  m_editPoint->SetRefMeasure(m->GetCubeSerialNumber());
1347  }
1348  }
1349 
1350  // All test pass, return true (ok to change measure)
1351  return true;
1352 
1353 
1354  }
1355 
1356 
1367 
1368  // Check if ControlPoint has reference measure, if reference Measure is
1369  // not the same measure that is on the left chip viewport, set left
1370  // measure as reference.
1371  ControlMeasure *refMeasure = m_editPoint->GetRefMeasure();
1372  if (refMeasure->GetCubeSerialNumber() != m_leftMeasure->GetCubeSerialNumber()) {
1373  QString message = "This point already contains a reference measure. ";
1374  message += "Would you like to replace it with the measure on the left?";
1375  int response = QMessageBox::question(this,
1376  "Match Tool Save Measure", message,
1377  QMessageBox::Yes | QMessageBox::No,
1378  QMessageBox::Yes);
1379  // Replace reference measure
1380  if (response == QMessageBox::Yes) {
1381  // Update measure file combo boxes: old reference normal font,
1382  // new reference bold font
1383  QString file = m_serialNumberList->fileName(m_leftMeasure->GetCubeSerialNumber());
1384  QString fname = FileName(file).name();
1385  int iref = m_leftCombo->findText(fname);
1386 
1387  // Save normal font from new reference measure
1388  QVariant font = m_leftCombo->itemData(iref,Qt::FontRole);
1389  m_leftCombo->setItemData(iref,QFont("DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
1390  iref = m_rightCombo->findText(fname);
1391  m_rightCombo->setItemData(iref,QFont("DejaVu Sans", 12, QFont::Bold), Qt::FontRole);
1392 
1393  file = m_serialNumberList->fileName(refMeasure->GetCubeSerialNumber());
1394  fname = FileName(file).name();
1395  iref = m_leftCombo->findText(fname);
1396  m_leftCombo->setItemData(iref,font,Qt::FontRole);
1397  iref = m_rightCombo->findText(fname);
1398  m_rightCombo->setItemData(iref,font,Qt::FontRole);
1399 
1400  m_editPoint->SetRefMeasure(m_leftMeasure->GetCubeSerialNumber());
1401  }
1402 
1403  // ??? Need to set rest of measures to Candiate and add more warning. ???//
1404  }
1405 
1406 
1407  }
1408 
1409 
1425 
1426  // Make a copy of edit point for updating the control net since the edit
1427  // point is still loaded in the point editor.
1428  ControlPoint *updatePoint = new ControlPoint;
1429  *updatePoint = *m_editPoint;
1430 
1431  // If this is a fixed or constrained point, see if there is a temporary
1432  // measure holding the coordinate information from the ground source.
1433  // If so, delete this measure before saving point. Clear out the
1434  // fixed Measure variable (memory deleted in ControlPoint::Delete).
1435  if (updatePoint->GetType() != ControlPoint::Free) {
1436  // Find measure with chooser name = GroundMeasureTemporary
1437  for (int i=0; i<m_editPoint->GetNumMeasures(); i++) {
1438  ControlMeasure &m = *(*m_editPoint)[i];
1439  QString file;
1440  if (m.GetChooserName() == "GroundMeasureTemporary") {
1441  updatePoint->Delete(&m);
1442  }
1443  }
1444  }
1445 
1446  // If edit point exists in the network, save the updated point. If it
1447  // does not exist, add it.
1448  if (m_controlNet->ContainsPoint(updatePoint->GetId())) {
1449  ControlPoint *p;
1450  p = m_controlNet->GetPoint(QString(updatePoint->GetId()));
1451  *p = *updatePoint;
1452  delete updatePoint;
1453  updatePoint = NULL;
1454  //qDebug()<<"ControlPOintEditWidget::savePoint before point Changed signal";
1455  emit controlPointChanged(m_editPoint->GetId());
1456  }
1457  else {
1458  m_controlNet->AddPoint(updatePoint);
1459 // qDebug()<<"ControlPOintEditWidget::savePoint before point added signal ptId = "<<m_editPoint->GetId();
1460  emit controlPointAdded(m_editPoint->GetId());
1461  }
1462 
1463  // Change Save Measure button text back to default
1464  m_savePoint->setPalette(m_saveDefaultPalette);
1465 
1466  // At exit, or when opening new net, use for prompting user for a save
1467  m_netChanged = true;
1468  emit netChanged();
1469  // Refresh chipViewports to show new positions of controlPoints
1470  m_measureEditor->refreshChips();
1471  }
1472 
1473 
1485 #if 0 //TODO 2014-07-22 TLS cnetsuite Handle ground control points SOON
1486  void ControlPointEditWidget::setPointType (int pointType) {
1487  if (m_editPoint == NULL) return;
1488 
1489  // If pointType is equal to current type, nothing to do
1490  if (m_editPoint->GetType() == pointType) return;
1491 
1492  if (pointType != ControlPoint::Free && m_leftMeasure->IsIgnored()) {
1493  m_pointType->setCurrentIndex((int) m_editPoint->GetType());
1494  QString message = "The reference measure is Ignored. Unset the Ignore flag on the ";
1495  message += "reference measure before setting the point type to Constrained or Fixed.";
1496  QMessageBox::warning(m_parent, "Ignored Reference Measure", message);
1497  return;
1498  }
1499 
1500 //TODO 07-07-2014 TLS cnetsuite This needs to be uncommented & handled correctly
1501  bool unloadGround = false;
1502 // if (m_editPoint->GetType() != ControlPoint::Free && pointType == ControlPoint::Free)
1503 // unloadGround = true;
1504 
1505  ControlPoint::Status status = m_editPoint->SetType((ControlPoint::PointType) pointType);
1506  if (status == ControlPoint::PointLocked) {
1507  m_pointType->setCurrentIndex((int) m_editPoint->GetType());
1508  QString message = "This control point is edit locked. The point type cannot be changed. You ";
1509  message += "must first unlock the point by clicking the check box above labeled ";
1510  message += "\"Edit Lock Point\".";
1511  QMessageBox::warning(m_parent, "Point Locked", message);
1512  return;
1513  }
1514 
1515 //TODO 07-07-2014 TLS cnetsuite This needs to be uncommented & handled correctly
1516  // If ground loaded, read temporary ground measure to the point
1517  if (pointType != ControlPoint::Free && m_groundOpen) {
1518 // loadGroundMeasure();
1519 // m_measureEditor->colorizeSaveNetButton();
1520  }
1521  // If going from constrained or fixed to free, unload the ground measure.
1522  else if (unloadGround) {
1523  // Find in point and delete, it will be re-created with current
1524  // ground source if this is a fixed point
1525  if (m_editPoint->HasSerialNumber(m_groundSN)) {
1526  m_editPoint->Delete(m_groundSN);
1527  }
1528 
1529  loadPoint();
1530  m_measureEditor->colorizeSaveNetButton();
1531  }
1532 
1533  }
1534 #endif
1535 
1536 
1547 
1548  if (m_editPoint == NULL) return;
1549 
1550  m_editPoint->SetEditLock(lock);
1552  }
1553 
1554 
1566 
1567  if (m_editPoint == NULL) return;
1568 
1569  ControlPoint::Status status = m_editPoint->SetIgnored(ignore);
1570  if (status == ControlPoint::PointLocked) {
1571  m_ignorePoint->setChecked(m_editPoint->IsIgnored());
1572  QString message = "Unable to change Ignored on point. Set EditLock ";
1573  message += " to False.";
1574  QMessageBox::critical(this, "Error", message);
1575  return;
1576  }
1578  }
1579 
1580 
1596 
1597  if (m_editPoint->IsEditLocked()) {
1598  m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1599  QMessageBox::warning(this, "Point Locked","Point is Edit Locked. You must un-lock point"
1600  " before changing a measure.");
1601  m_lockLeftMeasure->setChecked(m_leftMeasure->IsEditLocked());
1602  return;
1603  }
1604 
1605  if (m_leftMeasure != NULL) m_leftMeasure->SetEditLock(lock);
1606 
1607  // If the right chip is the same as the left chip , update the right editLock
1608  // box.
1609  if (m_rightMeasure != NULL) {
1610  if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1611  m_rightMeasure->SetEditLock(lock);
1612  m_lockRightMeasure->setChecked(lock);
1613  }
1614  }
1615  emit measureChanged();
1616  }
1617 
1618 
1636 
1637  if (m_leftMeasure != NULL) m_leftMeasure->SetIgnored(ignore);
1638 
1639  // If the right chip is the same as the left chip , update the right
1640  // ignore box.
1641  if (m_rightMeasure != NULL) {
1642  if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1643  m_rightMeasure->SetIgnored(ignore);
1644  m_ignoreRightMeasure->setChecked(ignore);
1645  }
1646  }
1647  emit measureChanged();
1648  }
1649 
1650 
1666 
1667  if (m_editPoint->IsEditLocked()) {
1668  m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1669  QMessageBox::warning(this, "Point Locked","Point is Edit Locked. You must un-lock point"
1670  " before changing a measure.");
1671  m_lockRightMeasure->setChecked(m_rightMeasure->IsEditLocked());
1672  return;
1673  }
1674 
1675  if (m_rightMeasure != NULL) m_rightMeasure->SetEditLock(lock);
1676 
1677  // If the left chip is the same as the right chip , update the left editLock box.
1678  if (m_leftMeasure != NULL) {
1679  if (m_leftMeasure->GetCubeSerialNumber() == m_rightMeasure->GetCubeSerialNumber()) {
1680  m_leftMeasure->SetEditLock(lock);
1681  m_lockLeftMeasure->setChecked(lock);
1682  }
1683  }
1684  emit measureChanged();
1685  }
1686 
1687 
1706 
1707  if (m_rightMeasure != NULL) m_rightMeasure->SetIgnored(ignore);
1708 
1709  // If the right chip is the same as the left chip , update the right
1710  // ignore blox.
1711  if (m_leftMeasure != NULL) {
1712  if (m_rightMeasure->GetCubeSerialNumber() == m_leftMeasure->GetCubeSerialNumber()) {
1713  m_leftMeasure->SetIgnored(ignore);
1714  m_ignoreLeftMeasure->setChecked(ignore);
1715  }
1716  }
1717  emit measureChanged();
1718  }
1719 
1720 
1729  if (m_measureWindow == NULL) {
1731  m_measureTable = new QTableWidget();
1732  m_measureTable->setMinimumWidth(1600);
1733  m_measureTable->setAlternatingRowColors(true);
1734  m_measureWindow->setCentralWidget(m_measureTable);
1735  }
1736  else {
1737  m_measureTable->clear();
1738  m_measureTable->setSortingEnabled(false);
1739  }
1740  m_measureTable->setRowCount(m_editPoint->GetNumMeasures());
1741  m_measureTable->setColumnCount(NUMCOLUMNS);
1742 
1743  QStringList labels;
1744  for (int i=0; i<NUMCOLUMNS; i++) {
1746  }
1747  m_measureTable->setHorizontalHeaderLabels(labels);
1748 
1749  // Fill in values
1750  for (int row=0; row<m_editPoint->GetNumMeasures(); row++) {
1751  int column = 0;
1752  ControlMeasure &m = *(*m_editPoint)[row];
1753 
1754  QString file = m_serialNumberList->fileName(m.GetCubeSerialNumber());
1755  QTableWidgetItem *tableItem = new QTableWidgetItem(QString(file));
1756  m_measureTable->setItem(row,column++,tableItem);
1757 
1758  tableItem = new QTableWidgetItem(QString(m.GetCubeSerialNumber()));
1759  m_measureTable->setItem(row,column++,tableItem);
1760 
1761  tableItem = new QTableWidgetItem();
1762  tableItem->setData(0,m.GetSample());
1763  m_measureTable->setItem(row,column++,tableItem);
1764 
1765  tableItem = new QTableWidgetItem();
1766  tableItem->setData(0,m.GetLine());
1767  m_measureTable->setItem(row,column++,tableItem);
1768 
1769  if (m.GetAprioriSample() == Null) {
1770  tableItem = new QTableWidgetItem("Null");
1771  }
1772  else {
1773  tableItem = new QTableWidgetItem();
1774  tableItem->setData(0,m.GetAprioriSample());
1775  }
1776  m_measureTable->setItem(row,column++,tableItem);
1777 
1778  if (m.GetAprioriLine() == Null) {
1779  tableItem = new QTableWidgetItem("Null");
1780  }
1781  else {
1782  tableItem = new QTableWidgetItem();
1783  tableItem->setData(0,m.GetAprioriLine());
1784  }
1785  m_measureTable->setItem(row,column++,tableItem);
1786 
1787  if (m.GetSampleResidual() == Null) {
1788  tableItem = new QTableWidgetItem(QString("Null"));
1789  }
1790  else {
1791  tableItem = new QTableWidgetItem();
1792  tableItem->setData(0,m.GetSampleResidual());
1793  }
1794  m_measureTable->setItem(row,column++,tableItem);
1795 
1796  if (m.GetLineResidual() == Null) {
1797  tableItem = new QTableWidgetItem(QString("Null"));
1798  }
1799  else {
1800  tableItem = new QTableWidgetItem();
1801  tableItem->setData(0,m.GetLineResidual());
1802  }
1803  m_measureTable->setItem(row,column++,tableItem);
1804 
1805  if (m.GetResidualMagnitude() == Null) {
1806  tableItem = new QTableWidgetItem(QString("Null"));
1807  }
1808  else {
1809  tableItem = new QTableWidgetItem();
1810  tableItem->setData(0,m.GetResidualMagnitude());
1811  }
1812  m_measureTable->setItem(row,column++,tableItem);
1813 
1814  double sampleShift = m.GetSampleShift();
1815  if (sampleShift == Null) {
1816  tableItem = new QTableWidgetItem(QString("Null"));
1817  }
1818  else {
1819  tableItem = new QTableWidgetItem();
1820  tableItem->setData(0,sampleShift);
1821  }
1822  m_measureTable->setItem(row,column++,tableItem);
1823 
1824  double lineShift = m.GetLineShift();
1825  if (lineShift == Null) {
1826  tableItem = new QTableWidgetItem(QString("Null"));
1827  }
1828  else {
1829  tableItem = new QTableWidgetItem();
1830  tableItem->setData(0,lineShift);
1831  }
1832  m_measureTable->setItem(row,column++,tableItem);
1833 
1834  double pixelShift = m.GetPixelShift();
1835  if (pixelShift == Null) {
1836  tableItem = new QTableWidgetItem(QString("Null"));
1837  }
1838  else {
1839  tableItem = new QTableWidgetItem();
1840  tableItem->setData(0,pixelShift);
1841  }
1842  m_measureTable->setItem(row,column++,tableItem);
1843 
1844  double goodnessOfFit = m.GetLogData(
1846  if (goodnessOfFit == Null) {
1847  tableItem = new QTableWidgetItem(QString("Null"));
1848  }
1849  else {
1850  tableItem = new QTableWidgetItem();
1851  tableItem->setData(0,goodnessOfFit);
1852  }
1853  m_measureTable->setItem(row,column++,tableItem);
1854 
1855  if (m.IsIgnored()) tableItem = new QTableWidgetItem("True");
1856  if (!m.IsIgnored()) tableItem = new QTableWidgetItem("False");
1857  m_measureTable->setItem(row,column++,tableItem);
1858 
1860  tableItem = new QTableWidgetItem("True");
1862  tableItem = new QTableWidgetItem("False");
1863  m_measureTable->setItem(row,column++,tableItem);
1864 
1865  tableItem = new QTableWidgetItem(
1867  m_measureTable->setItem(row,column,tableItem);
1868 
1869  // If reference measure set font on this row to bold
1870  if (m_editPoint->IsReferenceExplicit() &&
1871  (QString)m.GetCubeSerialNumber() == m_editPoint->GetReferenceSN()) {
1872  QFont font;
1873  font.setBold(true);
1874 
1875  for (int col=0; col<m_measureTable->columnCount(); col++)
1876  m_measureTable->item(row, col)->setFont(font);
1877  }
1878 
1879  }
1880 
1881  m_measureTable->resizeColumnsToContents();
1882  m_measureTable->resizeRowsToContents();
1883  m_measureTable->setSortingEnabled(true);
1884  m_measureWindow->show();
1885  }
1886 
1887 
1899 
1900  switch (column) {
1901  case FILENAME:
1902  return "FileName";
1903  case CUBESN:
1904  return "Serial #";
1905  case SAMPLE:
1906  return "Sample";
1907  case LINE:
1908  return "Line";
1909  case SAMPLERESIDUAL:
1910  return "Sample Residual";
1911  case LINERESIDUAL:
1912  return "Line Residual";
1913  case RESIDUALMAGNITUDE:
1914  return "Residual Magnitude";
1915  case SAMPLESHIFT:
1916  return "Sample Shift";
1917  case LINESHIFT:
1918  return "Line Shift";
1919  case PIXELSHIFT:
1920  return "Pixel Shift";
1921  case GOODNESSOFFIT:
1922  return "Goodness of Fit";
1923  case IGNORED:
1924  return "Ignored";
1925  case EDITLOCK:
1926  return "Edit Lock";
1927  case TYPE:
1928  return "Measure Type";
1929  case APRIORISAMPLE:
1930  return "Apriori Sample";
1931  case APRIORILINE:
1932  return "Apriori Line";
1933  }
1935  "Invalid measure column passed to measureColumnToString", _FILEINFO_);
1936  }
1937 
1938 
1949 
1950  int curIndex = m_rightCombo->currentIndex();
1951  if (curIndex < m_rightCombo->count() - 1) {
1952  // update the right measure list index and select that measure
1953  m_rightCombo->setCurrentIndex(curIndex + 1);
1954  selectRightMeasure(curIndex+1);
1955  }
1956  }
1957 
1958 
1969 
1970  int curIndex = m_rightCombo->currentIndex();
1971  if (curIndex > 0) {
1972  // update the right measure list index and select that measure
1973  m_rightCombo->setCurrentIndex(curIndex - 1);
1974  selectRightMeasure(curIndex-1);
1975  }
1976  }
1977 
1978 
1979 
1993 
1994  QString file = m_pointFiles[index];
1995 
1996  QString serial;
1997  try {
1998  serial = m_serialNumberList->serialNumber(file);
1999  }
2000  catch (IException &e) {
2001  QString message = "Make sure the correct cube is opened.\n\n";
2002  message += e.toString();
2003  QMessageBox::critical(this, "Error", message);
2004 
2005  // Set index of combo back to what it was before user selected new. Find the index
2006  // of current left measure.
2007  QString file = m_serialNumberList->fileName(m_leftMeasure->GetCubeSerialNumber());
2008  int i = m_leftCombo->findText(FileName(file).name());
2009  if (i < 0) i = 0;
2010  m_leftCombo->setCurrentIndex(i);
2011  return;
2012  }
2013 
2014  if (m_leftMeasure != NULL) {
2015  m_leftMeasure = NULL;
2016  }
2017  // Find measure for each file
2018  m_leftMeasure = (*m_editPoint)[serial];
2019 
2020  // If m_leftCube is not null, delete before creating new one
2021  m_leftCube.reset(new Cube(file, "r"));
2022 
2023  // Update left measure of pointEditor
2024  m_measureEditor->setLeftMeasure (m_leftMeasure, m_leftCube.data(),
2025  m_editPoint->GetId());
2027 
2028  }
2029 
2030 
2042 
2043  QString file = m_pointFiles[index];
2044 
2045  QString serial;
2046  try {
2047  serial = m_serialNumberList->serialNumber(file);
2048  }
2049  catch (IException &e) {
2050  QString message = "Make sure the correct cube is opened.\n\n";
2051  message += e.toString();
2052  QMessageBox::critical(this, "Error", message);
2053 
2054  // Set index of combo back to what it was before user selected new. Find the index
2055  // of current left measure.
2056  QString file = m_serialNumberList->fileName(m_rightMeasure->GetCubeSerialNumber());
2057  int i = m_rightCombo->findText(FileName(file).name());
2058  if (i < 0) i = 0;
2059  m_rightCombo->setCurrentIndex(i);
2060  return;
2061  }
2062 
2063  if (m_rightMeasure != NULL) {
2064  m_rightMeasure = NULL;
2065  }
2066 
2067  // Find measure for each file
2068  m_rightMeasure = (*m_editPoint)[serial];
2069 
2070  // If m_rightCube is not null, delete before creating new one
2071  m_rightCube.reset(new Cube(file, "r"));
2072 
2073  // Update left measure of pointEditor
2074  m_measureEditor->setRightMeasure (m_rightMeasure,m_rightCube.data(),
2075  m_editPoint->GetId());
2077 
2078  }
2079 
2080 
2099 
2100  // Set editLock measure box correctly
2101  m_lockLeftMeasure->setChecked(IsMeasureLocked(
2102  m_leftMeasure->GetCubeSerialNumber()));
2103  // Set ignore measure box correctly
2104  m_ignoreLeftMeasure->setChecked(m_leftMeasure->IsIgnored());
2105 
2106  QString s = "Reference: ";
2107  if (m_editPoint->IsReferenceExplicit() &&
2108  (QString(m_leftMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2109  s += "True";
2110  }
2111  else {
2112  s += "False";
2113  }
2114  m_leftReference->setText(s);
2115 
2116  s = "Measure Type: ";
2117  if (m_leftMeasure->GetType() == ControlMeasure::Candidate) s += "Candidate";
2118  if (m_leftMeasure->GetType() == ControlMeasure::Manual) s += "Manual";
2119  if (m_leftMeasure->GetType() == ControlMeasure::RegisteredPixel) s += "RegisteredPixel";
2120  if (m_leftMeasure->GetType() == ControlMeasure::RegisteredSubPixel) s += "RegisteredSubPixel";
2121  m_leftMeasureType->setText(s);
2122  }
2123 
2124 
2145 
2146  // Set editLock measure box correctly
2147  m_lockRightMeasure->setChecked(IsMeasureLocked(
2148  m_rightMeasure->GetCubeSerialNumber()));
2149  // Set ignore measure box correctly
2150  m_ignoreRightMeasure->setChecked(m_rightMeasure->IsIgnored());
2151 
2152  QString s = "Reference: ";
2153  if (m_editPoint->IsReferenceExplicit() &&
2154  (QString(m_rightMeasure->GetCubeSerialNumber()) == m_editPoint->GetReferenceSN())) {
2155  s += "True";
2156  }
2157  else {
2158  s += "False";
2159  }
2160 
2161  m_rightReference->setText(s);
2162 
2163  s = "Measure Type: ";
2164  if (m_rightMeasure->GetType() == ControlMeasure::Candidate) s+= "Candidate";
2165  if (m_rightMeasure->GetType() == ControlMeasure::Manual) s+= "Manual";
2166  if (m_rightMeasure->GetType() == ControlMeasure::RegisteredPixel) s+= "RegisteredPixel";
2167  if (m_rightMeasure->GetType() == ControlMeasure::RegisteredSubPixel) s+= "RegisteredSubPixel";
2168  m_rightMeasureType->setText(s);
2169  }
2170 
2171 
2172 
2184 
2185  if(e->type() != QEvent::Leave) return false;
2186  if(o == m_leftCombo->view()) {
2188  m_leftCombo->hidePopup();
2189  }
2190  if (o == m_rightCombo->view()) {
2192  m_rightCombo->hidePopup();
2193  }
2194  return true;
2195  }
2196 
2197 
2205 
2206  if (m_templateModified) {
2207  int r = QMessageBox::warning(this, tr("OK to continue?"),
2208  tr("The currently opened registration template has been modified.\n"
2209  "Save changes?"),
2210  QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
2211  QMessageBox::Yes);
2212 
2213  if (r == QMessageBox::Yes)
2215  else if (r == QMessageBox::Cancel)
2216  return false;
2217  }
2218 
2219  return true;
2220  }
2221 
2222 
2229 
2230  if (!okToContinue())
2231  return;
2232 
2233  QString filename = QFileDialog::getOpenFileName(this,
2234  "Select a registration template", ".",
2235  "Registration template files (*.def *.pvl);;All files (*)");
2236 
2237  if (filename.isEmpty())
2238  return;
2239 
2240  if (m_measureEditor->setTemplateFile(filename)) {
2241  loadTemplateFile(filename);
2242  }
2243  }
2244 
2245 
2252 
2253  QFile file(FileName((QString) fn).expanded());
2254  if (!file.open(QIODevice::ReadOnly)) {
2255  QString msg = "Failed to open template file \"" + fn + "\"";
2256  QMessageBox::warning(this, "IO Error", msg);
2257  return;
2258  }
2259 
2260  QTextStream stream(&file);
2261  m_templateEditor->setText(stream.readAll());
2262  file.close();
2263 
2264  QScrollBar * sb = m_templateEditor->verticalScrollBar();
2265  sb->setValue(sb->minimum());
2266 
2267  m_templateModified = false;
2268  m_saveTemplateFile->setEnabled(false);
2269  m_templateFileNameLabel->setText("Template File: " + fn);
2270  }
2271 
2272 
2277 
2278  m_templateModified = true;
2279  m_saveTemplateFile->setEnabled(true);
2280  }
2281 
2282 
2287 
2288  if (!m_templateModified)
2289  return;
2290 
2291  QString filename =
2292  m_measureEditor->templateFileName();
2293 
2294  writeTemplateFile(filename);
2295  }
2296 
2297 
2302 
2303  QString filename = QFileDialog::getSaveFileName(this,
2304  "Save registration template", ".",
2305  "Registration template files (*.def *.pvl);;All files (*)");
2306 
2307  if (filename.isEmpty())
2308  return;
2309 
2310  writeTemplateFile(filename);
2311  }
2312 
2313 
2320 
2321  QString contents = m_templateEditor->toPlainText();
2322 
2323  // catch errors in Pvl format when populating pvl object
2324  stringstream ss;
2325  ss << contents;
2326  try {
2327  Pvl pvl;
2328  ss >> pvl;
2329  }
2330  catch(IException &e) {
2331  QString message = e.toString();
2332  QMessageBox::warning(this, "Error", message);
2333  return;
2334  }
2335 
2336  QString expandedFileName(FileName((QString) fn).expanded());
2337 
2338  QFile file(expandedFileName);
2339 
2340  if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
2341  QString msg = "Failed to save template file to \"" + fn + "\"\nDo you "
2342  "have permission?";
2343  QMessageBox::warning(this, "IO Error", msg);
2344  return;
2345  }
2346 
2347  // now save contents
2348  QTextStream stream(&file);
2349  stream << contents;
2350  file.close();
2351 
2352  if (m_measureEditor->setTemplateFile(fn)) {
2353  m_templateModified = false;
2354  m_saveTemplateFile->setEnabled(false);
2355  m_templateFileNameLabel->setText("Template File: " + fn);
2356  }
2357  }
2358 
2359 
2373 
2374  try{
2375  // Get the template file from the ControlPointEditWidget object
2376  Pvl templatePvl(m_measureEditor->templateFileName());
2377  // Create registration dialog window using PvlEditDialog class
2378  // to view and/or edit the template
2379  PvlEditDialog registrationDialog(templatePvl);
2380  registrationDialog.setWindowTitle("View or Edit Template File: "
2381  + templatePvl.fileName());
2382  registrationDialog.resize(550,360);
2383  registrationDialog.exec();
2384  }
2385  catch (IException &e) {
2386  QString message = e.toString();
2387  QMessageBox::information(this, "Error", message);
2388  }
2389  }
2390 
2391 
2399 
2400  m_measureEditor->saveChips();
2401  }
2402 
2403 
2408 
2410  return;
2411 
2412  m_templateEditorWidget->setVisible(!m_templateEditorWidget->isVisible());
2413  }
2414 
2415 
2433  if (m_editPoint == NULL) return;
2434  if (updatedPoint.GetId() != m_editPoint->GetId()) return;
2435  // The edit point has been changed by SetApriori, so m_editPoint needs
2436  // to possibly update some values. Need to retain measures from m_editPoint
2437  // because they might have been updated, but not yet saved to the network
2438  // ("Save Point").
2439  m_editPoint->SetEditLock(updatedPoint.IsEditLocked());
2440  m_editPoint->SetIgnored(updatedPoint.IsIgnored());
2441 
2442  // Set EditLock box correctly
2443  m_lockPoint->setChecked(m_editPoint->IsEditLocked());
2444 
2445  // Set ignore box correctly
2446  m_ignorePoint->setChecked(m_editPoint->IsIgnored());
2447  }
2448 
2449 
2450 
2466 // TODO Is this needed?
2467 //
2468 // void ControlPointEditWidget::refresh() {
2469 //
2470 // // Check point being edited, make sure it still exists, if not ???
2471 // // Update ignored checkbox??
2472 // if (m_editPoint != NULL) {
2473 // try {
2474 // QString id = m_ptIdValue->text().remove("Point ID: ");
2475 // m_controlNet->GetPoint(id);
2476 // }
2477 // catch (IException &) {
2478 // delete m_editPoint;
2479 // m_editPoint = NULL;
2480 // emit controlPointChanged();
2483 // }
2484 // }
2485 // }
2486 
2487 
2494 
2495  QColor qc = Qt::red;
2496  QPalette p = m_savePoint->palette();
2497  p.setColor(QPalette::ButtonText,qc);
2498  m_savePoint->setPalette(p);
2499  }
2500 
2501 
2511 
2512  QColor qc = Qt::red;
2513  QPalette p = m_savePoint->palette();
2514  p.setColor(QPalette::ButtonText,qc);
2515  m_saveNet->setPalette(p);
2516 
2517  }
2518 
2519 
2531  bool ControlPointEditWidget::IsMeasureLocked (QString serialNumber) {
2532 
2533  if (m_editPoint == NULL) return false;
2534 
2535  // Reference implicitly editLocked
2536  if (m_editPoint->IsEditLocked() && m_editPoint->IsReferenceExplicit() &&
2537  (m_editPoint->GetReferenceSN() == serialNumber)) {
2538  return true;
2539  }
2540  // Return measures explicit editLocked value
2541  else {
2542  return m_editPoint->GetMeasure(serialNumber)->IsEditLocked();
2543  }
2544 
2545  }
2546 
2547 
2556 
2557  m_controlNet->Write(m_cnetFileName);
2558 
2559  // Change Save Measure button text back to default
2560  m_saveNet->setPalette(m_saveDefaultPalette);
2561 
2562  emit saveControlNet();
2563  }
2564 
2565 
2571 #if 0
2572  void ControlPointEditWidget::readSettings() {
2573  FileName config("$HOME/.Isis/qview/ControlPointEditWidget.config");
2574  QSettings settings(config.expanded(),
2575  QSettings::NativeFormat);
2576  QPoint pos = settings.value("pos", QPoint(300, 100)).toPoint();
2577  QSize size = settings.value("size", QSize(900, 500)).toSize();
2578  this->resize(size);
2579  this->move(pos);
2580  }
2581 
2582 
2589  void ControlPointEditWidget::writeSettings() const {
2590  /*We do not want to write the settings unless the window is
2591  visible at the time of closing the application*/
2592  if (!this->isVisible()) return;
2593  FileName config("$HOME/.Isis/qview/ControlPointEditWidget.config");
2594  QSettings settings(config.expanded(),
2595  QSettings::NativeFormat);
2596  settings.setValue("pos", this->pos());
2597  settings.setValue("size", this->size());
2598  }
2599 #endif
2600 
2601 
2606  delete m_editPoint;
2607  m_editPoint = NULL;
2608  }
2609 
2610 
2611  // 2014-07-21 TLS Cnetsuite This needs to be changed to return the help information or
2612  // widget?? to the calling program, so that it can be added to a menu or toolbar.
2613 #if 0
2614  void ControlPointEditWidget::showHelp() {
2615 
2616  QDialog *helpDialog = new QDialog(this);
2617  helpDialog->setWindowTitle("Match Tool Help");
2618 
2619  QVBoxLayout *mainLayout = new QVBoxLayout;
2620  helpDialog->setLayout(mainLayout);
2621 
2622  QLabel *matchTitle = new QLabel("<h2>Match Tool</h2>");
2623  mainLayout->addWidget(matchTitle);
2624 
2625  QLabel *matchSubtitle = new QLabel("A tool for interactively measuring and editing sample/line "
2626  "registration points between cubes. These "
2627  "points contain sample, line postions only, no latitude or "
2628  "longitude values are used or recorded.");
2629  matchSubtitle->setWordWrap(true);
2630  mainLayout->addWidget(matchSubtitle);
2631 
2632  QTabWidget *tabArea = new QTabWidget;
2633  tabArea->setDocumentMode(true);
2634  mainLayout->addWidget(tabArea);
2635 
2636  // TAB 1 - Overview
2637  QScrollArea *overviewTab = new QScrollArea;
2638  overviewTab->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
2639  overviewTab->setWidgetResizable(true);
2640  QWidget *overviewContainer = new QWidget;
2641  QVBoxLayout *overviewLayout = new QVBoxLayout;
2642  overviewContainer->setLayout(overviewLayout);
2643 
2644  QLabel *purposeTitle = new QLabel("<h2>Purpose</h2>");
2645  overviewLayout->addWidget(purposeTitle);
2646 
2647  QLabel *purposeText = new QLabel("<p>This tool is for recording and editing registration "
2648  "points measured between cubes displayed in the <i>qview</i> main window.</p> <p>The "
2649  "recorded registration points are sample and line pixel coordinates only. Therefore, this "
2650  "tool can be used on any images including ones that do not contain a camera model "
2651  "(i.e, The existence of the Isis Instrument Group on the image labels is not required). "
2652  "This also means that the tool differs from the <i>qnet</i> control point network "
2653  "application in that no latitude or longitude values are ever used or recorded "
2654  "(regardless if the image has a camera model in Isis).</p>"
2655  "<p>The output control point network that this tool generates is primarily used 1) as "
2656  "input for an image-wide sample/line translation to register one image to another by "
2657  "'moving' pixel locations - refer to the documentation for applications such as "
2658  "<i>translate</i> and <i>warp</i>, or 2) to export the file and use the recorded "
2659  "measurements in other spreadsheet or plotting packages to visualize magnitude "
2660  "and direction of varying translations of the images relative to one another.</p> "
2661  "<p>An automated version of this match tool is the <i>coreg</i> application. This tool "
2662  "can be used to visually evaluate and edit the control point network created by "
2663  "<i>coreg</i>.</p> "
2664  "<p>The format of the output point network file is binary. This tool uses the Isis control "
2665  " network framework to create, co-register and save all control points and pixel "
2666  "measurements. The application <i>cnetbin2pvl</i> can be used to convert from binary to "
2667  "a readable PVL format."
2668  "<p>The Mouse Button functions are: (same as <i>qnet</i>)<ul><li>Modify Point=Left</li> "
2669  "<li>Delete Point=Middle</li><li>Create New Point=Right</li></ul></p>"
2670  "<p>Control Points are drawn on the associated displayed cubes with the following colors: "
2671  "Green=Valid registration point; Yellow=Ignored point; Red=Active point being edited");
2672  purposeText->setWordWrap(true);
2673  overviewLayout->addWidget(purposeText);
2674 
2675  overviewTab->setWidget(overviewContainer);
2676 
2677  // TAB 2 - Quick Start
2678  QScrollArea *quickTab = new QScrollArea;
2679  quickTab->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
2680  quickTab->setWidgetResizable(true);
2681  QWidget *quickContainer = new QWidget;
2682  QVBoxLayout *quickLayout = new QVBoxLayout;
2683  quickContainer->setLayout(quickLayout);
2684 
2685  QLabel *quickTitle = new QLabel("<h2>Quick Start</h2>");
2686  quickLayout->addWidget(quickTitle);
2687 
2688  QLabel *quickSubTitle = new QLabel("<h3>Preparation:</h3>");
2689  quickLayout->addWidget(quickSubTitle);
2690 
2691  QString toolIconDir = FileName("$base/icons").expanded();
2692 
2693  QLabel *quickPrep = new QLabel("<p><ul>"
2694  "<li>Open the cubes with overlapping areas for choosing control points</li>"
2695  "<li>Choose the match tool <img src=\"" + toolIconDir +
2696  "/stock_draw-connector-with-arrows.png\" width=22 height=22> "
2697  "from the toolpad on the right side of the <i>qview</i> main window</li>");
2698  quickPrep->setWordWrap(true);
2699  quickLayout->addWidget(quickPrep);
2700 
2701  QLabel *morePrep = new QLabel("<p>Once the Match tool is activated the tool bar at the top "
2702  "of the main window contains file action buttons and a help button:");
2703  morePrep->setWordWrap(true);
2704  quickLayout->addWidget(morePrep);
2705 
2706  QLabel *fileButtons = new QLabel("<p><ul>"
2707  "<li><img src=\"" + toolIconDir + "/fileopen.png\" width=22 height=22> Open an existing "
2708  "control network <b>Note:</b> If you do not open an existing network, a new one will "
2709  "be created</li>"
2710  "<li><img src=\"" + toolIconDir + "/mActionFileSaveAs.png\" width=22 height=22> Save "
2711  "control network as ...</li>"
2712  "<li><img src=\"" + toolIconDir + "/mActionFileSave.png\" width=22 height=22> Save "
2713  "control network to current file</li>"
2714  "<li><img src=\"" + toolIconDir + "/help-contents.png\" width=22 height=22> Show Help "
2715  "</li></ul></p>");
2716  fileButtons->setWordWrap(true);
2717  quickLayout->addWidget(fileButtons);
2718 
2719  QLabel *quickFunctionTitle = new QLabel("<h3>Cube Viewport Functions:</h3>");
2720  quickLayout->addWidget(quickFunctionTitle);
2721 
2722  QLabel *quickFunction = new QLabel(
2723  "The match tool window will be shown once "
2724  "you click in a cube viewport window using one of the following "
2725  "mouse functions. <b>Note:</b> Existing control points are drawn on the cube viewports");
2726  quickFunction->setWordWrap(true);
2727  quickLayout->addWidget(quickFunction);
2728 
2729  QLabel *quickDesc = new QLabel("<p><ul>"
2730  "<li>Left Click - Modify the control point closest to the click <b>Note:</b> "
2731  "All cubes in the control point must be displayed before loading the point</li>"
2732  "<li>Middle Click - Delete the control point closest to the click</li>"
2733  "<li>Right Click - Create a new control point at the click location</li></ul></p>");
2734  quickDesc->setWordWrap(true);
2735  quickDesc->setOpenExternalLinks(true);
2736  quickLayout->addWidget(quickDesc);
2737 
2738  quickTab->setWidget(quickContainer);
2739 
2740  // TAB 3 - Control Point Editing
2741  QScrollArea *controlPointTab = new QScrollArea;
2742  controlPointTab->setWidgetResizable(true);
2743  controlPointTab->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
2744  QWidget *controlPointContainer = new QWidget;
2745  QVBoxLayout *controlPointLayout = new QVBoxLayout;
2746  controlPointContainer->setLayout(controlPointLayout);
2747 
2748  QLabel *controlPointTitle = new QLabel("<h2>Control Point Editing</h2>");
2749  controlPointLayout->addWidget(controlPointTitle);
2750 
2751  QLabel *mouseLabel = new QLabel("<p><h3>When the \"Match\" tool "
2752  "is activated, the mouse buttons have the following function in the "
2753  "cube viewports of the main qview window:</h3>");
2754  mouseLabel->setWordWrap(true);
2755  mouseLabel->setScaledContents(true);
2756  controlPointLayout->addWidget(mouseLabel);
2757 
2758  QLabel *controlPointDesc = new QLabel("<ul>"
2759  "<li>Left click - Edit the closest control point <b>Note:</b> "
2760  "All cubes in the control point must be displayed before loading the point</li>"
2761  "<li>Middle click - Delete the closest control point</li>"
2762  "<li>Right click - Create new control point at cursor location. This will bring up a new "
2763  "point dialog which allows you to enter a point id and will list all cube viewports, "
2764  "highlighting cubes where the point has been chosen by clicking on the cube's viewport. "
2765  "When the desired cubes have been chosen, select the \"Done\" button which will load the "
2766  "control point into the control point editor window which will allow the control measure "
2767  "positions to be refined.</li>");
2768  controlPointDesc->setWordWrap(true);
2769  controlPointLayout->addWidget(controlPointDesc);
2770 
2771  QLabel *controlPointEditing = new QLabel(
2772  "<h4>Changing Control Measure Locations</h4>"
2773  "<p>Both the left and right control measure positions can be adjusted by:"
2774  "<ul>"
2775  "<li>Move the cursor location under the crosshair by clicking the left mouse "
2776  "button</li>"
2777  "<li>Move 1 pixel at a time by using arrow keys on the keyboard</li>"
2778  "<li>Move 1 pixel at a time by using arrow buttons above the right and left views</li>"
2779  "</ul></p>"
2780  "<h4>Other Point Editor Functions</h4>"
2781  "<p>Along the right border of the window:</p>"
2782  "<ul>"
2783  "<li><strong>Link Zoom</strong> This will link the two small viewports together when "
2784  "zooming (ie. If this is checked, if the left view is zoomed, the right view will "
2785  "match the left view's zoom factor. "
2786  "<b>Note:</b> Zooming is controlled from the left view.</li>"
2787  "<li><strong>No Rotate:</strong> Turn off the rotation and bring right view back to "
2788  "its original orientation</li>"
2789  "<li><strong>Rotate:</strong> Rotate the right view using either the dial "
2790  "or entering degrees </li>"
2791  "<li><strong>Show control points:</strong> Draw crosshairs at all control "
2792  "point locations visible within the view</li>"
2793  "<li><strong>Show crosshair:</strong> Show a red crosshair across the entire "
2794  "view</li>"
2795  "<li><strong>Circle:</strong> Draw circle which may help center measure "
2796  "on a crater</li></ul"
2797  "<p>Below the left view:</p>"
2798  "<ul><li><strong>Blink controls:</strong> Blink the left and right view in the "
2799  "left view window using the \"Blink Start\" button <img src=\"" + toolIconDir +
2800  "/blinkStart.png\" width=22 height=22> and \"Blink Stop\" button <img src=\"" +
2801  toolIconDir + "/blinkStop.png\" width=22 height=22>. The arrow keys above the left "
2802  "and right views and the keyboard arrow keys may be used to move the both views while "
2803  "blinking.</li>"
2804  "<li><strong>Register:</strong> Sub-pixel register the right view to "
2805  "the left view. A default registration template is used for setting parameters "
2806  "passed to the sub-pixel registration tool. The user may load in a predefined "
2807  "template or edit the current loaded template to influence successful "
2808  "co-registration results. For more information regarding the pattern matching "
2809  "functionlity or how to create a parameter template, refer to the Isis PatternMatch "
2810  "document and the <i>autoregtemplate</i> application.</li>"
2811  "<li><strong>Save Measures:</strong> Save the two control measures using the sample, "
2812  "line positions under the crosshairs.</li>"
2813  "<li><strong>Save Point:</strong> Save the control point to the control network.</li>"
2814  "</ul>");
2815  controlPointEditing->setWordWrap(true);
2816  controlPointLayout->addWidget(controlPointEditing);
2817 
2818  controlPointTab->setWidget(controlPointContainer);
2819 
2820  tabArea->addTab(overviewTab, "&Overview");
2821  tabArea->addTab(quickTab, "&Quick Start");
2822  tabArea->addTab(controlPointTab, "&Control Point Editing");
2823 
2824  QHBoxLayout *buttonsLayout = new QHBoxLayout;
2825  // Flush the buttons to the right
2826  buttonsLayout->addStretch();
2827 
2828  QPushButton *closeButton = new QPushButton("&Close");
2829  closeButton->setIcon(QIcon(FileName("$base/icons/guiStop.png").expanded()));
2830  closeButton->setDefault(true);
2831  connect(closeButton, SIGNAL(clicked()),
2832  helpDialog, SLOT(close()));
2833  buttonsLayout->addWidget(closeButton);
2834 
2835  mainLayout->addLayout(buttonsLayout);
2836 
2837  helpDialog->show();
2838  }
2839 #endif
2840 }
2841 
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:86
This represents an ISIS control net in a project-based GUI interface.
Definition: Control.h:57
Status SetType(MeasureType type)
Set how the coordinate was obtained.
static const int NUMCOLUMNS
Number of entries (columns) in the measure table.
PointType GetType() const
void createActions()
Creates the actions for the widget.
int serialNumberIndex(const QString &sn)
Return a list index given a serial number.
void clearEditPoint()
This method is called from the constructor so that when the Main window is created, it know&#39;s it&#39;s size and location.
void updateLeftMeasureInfo()
Update the left measure information.
bool m_addMeasuresButton
Indicates whether or not to add &quot;Add Measures(s) to Point&quot;.
void setEditPoint(ControlPoint *controlPoint)
Slot called by Directory to set the control point for editing.
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:109
void setLockRightMeasure(bool ignore)
Set the &quot;EditLock&quot; keyword of the measure shown in the right viewport to the value of the input param...
void writeTemplateFile(QString)
Write the contents of the template editor to the file provided.
(e.g., autoseed, interest) AKA predicted, unmeasured, unverified
QPointer< QCheckBox > m_ignorePoint
Checkbox to ignore the current point.
bool hasSerialNumber(QString sn)
Determines whether or not the requested serial number exists in the list.
QPointer< QLabel > m_leftMeasureType
Label for the left measure&#39;s adjustment type.
double degrees() const
Get the angle in units of Degrees.
Definition: Angle.h:245
File name manipulation and expansion.
Definition: FileName.h:111
Universal Ground Map.
void updatePointInfo(ControlPoint &updatedPoint)
Update the current editPoint information in the Point Editor labels.
QString m_cnetFileName
Filename of the control network that is being modified.
bool validateMeasureChange(ControlMeasure *m)
Validates a change to a control measure.
void checkReference()
Change which measure is the reference.
bool eventFilter(QObject *o, QEvent *e)
Event filter for ControlPointEditWidget.
bool m_netChanged
Indicates if the control network has been modified.
void loadMeasureTable()
Load measure information into the measure table.
void add(const QString &filename, bool def2filename=false)
Adds a new filename / serial number pair to the SerialNumberList.
int size() const
How many serial number / filename combos are in the list.
double GetResidualMagnitude() const
Return Residual magnitude.
void setIgnorePoint(bool ignore)
Set point&#39;s &quot;Ignore&quot; keyword to the value of the input parameter.
QPointer< QPushButton > m_savePoint
Button to save current point being edited.
void selectLeftMeasure(int index)
Select left measure.
QPointer< QComboBox > m_pointType
Combobox to change the type of the current point.
QPointer< QCheckBox > m_ignoreRightMeasure
Checkbox to ignore the right measure.
QString serialNumber(const QString &filename)
Return a serial number given a filename.
QPalette m_saveDefaultPalette
Default color pallet of the &quot;Save Point&quot; button.
PointType
These are the valid &#39;types&#39; of point.
Definition: ControlPoint.h:349
double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
Definition: Sensor.cpp:225
QPointer< ControlPoint > m_editPoint
The control point being edited.
QPointer< ControlMeasure > m_leftMeasure
Left control measure.
void viewTemplateFile()
Allows the user to view the template file that is currently set.
void loadTemplateFile(QString)
Updates the current template file being used.
void saveChips()
Slot which calls ControlPointEditWidget slot to save chips.
double GetNumericalValue() const
Get the value associated with this log data.
int fileNameIndex(const QString &filename)
Return a list index given a filename.
ControlMeasure * createTemporaryGroundMeasure()
Create a temporary measure to hold the ground point info for ground source.
Widget to display Isis cubes for qt apps.
Definition: CubeViewport.h:121
QPointer< QCheckBox > m_lockLeftMeasure
Checkbox to edit lock/unlock the left measure.
Registered to whole pixel (e.g.,pointreg)
void nextRightMeasure()
Selects the next right measure when activated by key shortcut.
Registered to sub-pixel (e.g., pointreg)
QPointer< QComboBox > m_rightCombo
Combobox to load right measure into right chip viewport.
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:154
Project * project() const
Gets the Project for this directory.
Definition: Directory.cpp:923
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
QString measureColumnToString(MeasureColumns column)
Gets a string representation of a measure column.
QPointer< QCheckBox > m_ignoreLeftMeasure
Checkbox to ignore the left measure.
MeasureColumns
Measure column values for the measure table.
A Free point is a Control Point that identifies common measurements between two or more cubes...
Definition: ControlPoint.h:369
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
void createPointEditor(QWidget *parent, bool addMeasures)
Create the widget for editing control points.
void showHideTemplateEditor()
Toggles the visibility of the template editor widget.
QString fileName(const QString &sn)
Return a filename given a serial number.
QPointer< QAction > m_closePointEditor
Action to close the point editor.
bool okToContinue()
Checks the state of the template registration file and determines if it is safe to continue opening a...
bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
Definition: Camera.cpp:392
double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
Definition: Sensor.cpp:248
QPointer< QWidget > m_templateEditorWidget
Template editor widget.
void saveTemplateFileAs()
Save the contents of template editor to a file chosen by the user.
bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
Definition: Camera.cpp:166
QPointer< ControlNet > m_controlNet
Current control net.
void saveTemplateFile()
Save the file opened in the template editor.
void updateRightMeasureInfo()
Update the right measure information.
QPointer< QMainWindow > m_measureWindow
Main window for the the measure table widget.
a control network
Definition: ControlNet.h:207
QString GetId() const
Return the Id of the control point.
Hand Measured (e.g., qnet)
void setLockLeftMeasure(bool ignore)
Set the &quot;EditLock&quot; keyword of the measure shown in the left viewport to the value of the input parame...
QPointer< QAction > m_openTemplateFile
Action to open a registration template file to disk.
bool m_templateModified
Indicates if the registration template was edited.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
void previousRightMeasure()
Selects the previous right measure when activated by key shortcut.
Pixel value mapper.
Definition: Stretch.h:72
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
QSplitter * createTopSplitter()
Creates everything above the ControlPointEdit.
QPointer< QTextEdit > m_templateEditor
Text editor for editing the registration template.
double Sample()
Returns the current sample number.
Definition: Camera.cpp:2752
QPointer< QAction > m_saveTemplateFileAs
Action to save a new registration template.
void colorizeSaveNetButton()
Turn &quot;Save Net&quot; button text to red.
bool IsMeasureLocked(QString serialNumber)
Check for implicitly locked measure in m_editPoint.
void selectRightMeasure(int index)
Select right measure.
void loadPoint()
Load point into ControlPointEditWidget.
void setControl(Control *control)
New control network being edited.
A single control point.
Definition: ControlPoint.h:339
QGroupBox * createControlPointGroupBox()
Creates the &quot;Control Point&quot; groupbox.
QPointer< QPushButton > m_saveNet
Button to save the current control network.
void setTemplateModified()
Called when the template file is modified by the template editor.
QString fileName() const
Access the name of the control network file associated with this Control.
Definition: Control.cpp:171
Container for cube-like labels.
Definition: Pvl.h:135
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
Definition: Control.cpp:106
QString m_lastUsedPointId
Point id of the last used control point.
void setSerialNumberList(SerialNumberList *snList)
Set the serial number list.
QString m_leftFile
Filename of left measure.
bool IsEditLocked() const
Return value for p_editLock or implicit lock on reference measure.
QPointer< QLabel > m_cnetFileNameLabel
Label with name of the control network file.
QPointer< QAction > m_saveTemplateFile
Action to save a registration template file to disk.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Status
This is a return status for many of the mutating (setter) method calls.
Definition: ControlPoint.h:378
GoodnessOfFit is pointreg information for reference measures.
QScopedPointer< Cube > m_rightCube
Right cube.
void savePoint()
Save edit point to the Control Network.
QPointer< QWidget > m_parent
Parent widget.
double Line()
Returns the current line number.
Definition: Camera.cpp:2772
QString toString() const
Returns a string representation of this exception.
Definition: IException.cpp:553
QPointer< QLabel > m_rightMeasureType
Label for the right measure&#39;s adjustment type.
static QString UserName()
Returns the user name.
Isis exception class.
Definition: IException.h:99
Status SetChooserName()
Set chooser name to a user who last changed the coordinate.
QPointer< QLabel > m_ptIdValue
Label for the point id of the current point.
a control measurement
QGroupBox * createRightMeasureGroupBox()
Create the &quot;Right Measure&quot; groupbox.
QStringList m_pointFiles
Associated files for current control point.
PvlEditDialog creates a QDialog window in which a QTextEdit box displays the contents of a pvl file...
Definition: PvlEditDialog.h:39
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
Status SetCubeSerialNumber(QString newSerialNumber)
Set cube serial number.
Status SetCoordinate(double sample, double line)
Set the coordinate of the measurement.
QGroupBox * createLeftMeasureGroupBox()
Creates the &quot;Left Measure&quot; groupbox.
void setIgnoreLeftMeasure(bool ignore)
Set the &quot;Ignore&quot; keyword of the measure shown in the left viewport to the value of the input paramete...
int Delete(ControlMeasure *measure)
Remove a measurement from the control point, deleting reference measure is allowed.
QPointer< QLabel > m_templateFileNameLabel
Label for the template filename.
QPointer< QCheckBox > m_lockRightMeasure
Checkbox to edit lock/unlock the right measure.
QPointer< QLabel > m_leftReference
Label indicating if left measure is the reference.
Serial Number list generator.
void measureSaved()
This method is connected with the measureSaved() signal from ControlMeasureEditWidget.
void createTemplateEditorWidget()
Creates the Widget which contains the template editor and its toolbar.
void setIgnoreRightMeasure(bool ignore)
Set the &quot;Ignore&quot; keyword of the measure shown in the right viewport to the value of the input paramet...
QString GetChooserName() const
Return the chooser name.
QPointer< QLabel > m_rightReference
Label indicating if right measure is the reference.
static QString PointTypeToString(PointType type)
Obtain a string representation of a given PointType.
void setLockPoint(bool ignore)
Set the point type.
void colorizeSavePointButton()
Refresh all necessary widgets in ControlPointEditWidget including the PointEditor and CubeViewports...
QPointer< ControlMeasureEditWidget > m_measureEditor
Pointer to control measure editor widget.
void openTemplateFile()
Prompt user for a registration template file to open.
void saveNet()
This slot is needed because we cannot directly emit a signal with a ControlNet argument after the &quot;Sa...
SerialNumberList * m_serialNumberList
Serial number list for the loaded cubes.
QPointer< QTableWidget > m_measureTable
Table widget for the measures.
QPointer< ControlMeasure > m_rightMeasure
Right control measure.
QScopedPointer< Cube > m_leftCube
Left cube.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
static QString MeasureTypeToString(MeasureType type)
Return the String Control Measure type.
QPointer< QCheckBox > m_lockPoint
Checkbox that locks/unlocks the current point.
QPointer< QAction > m_saveChips
Action to save the registration chips Action to toggle visibility of the regis...
This is returned when the operation requires Edit Lock to be false but it is currently true...
Definition: ControlPoint.h:393
IO Handler for Isis Cubes.
Definition: Cube.h:158
QPointer< QComboBox > m_leftCombo
Combobox to load left measure into left chip viewport.

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:16:44