Isis 3 Programmer Reference
QnetNavTool.cpp
1 #include "QnetNavTool.h"
2 
3 #include <QAction>
4 #include <QApplication>
5 #include <QComboBox>
6 #include <QDialog>
7 #include <QGridLayout>
8 #include <QHBoxLayout>
9 #include <QLabel>
10 #include <QListWidget>
11 #include <QListWidgetItem>
12 #include <QMessageBox>
13 #include <QPushButton>
14 #include <QScrollArea>
15 #include <QSettings>
16 #include <QStackedWidget>
17 #include <QString>
18 #include <QTabWidget>
19 #include <QVBoxLayout>
20 #include <QWidget>
21 
22 #include "QnetCubeDistanceFilter.h"
23 #include "QnetCubeNameFilter.h"
24 #include "QnetCubePointsFilter.h"
26 #include "QnetPointDistanceFilter.h"
29 #include "QnetPointGoodnessFilter.h"
30 #include "QnetPointIdFilter.h"
31 #include "QnetPointImagesFilter.h"
32 #include "QnetPointMeasureFilter.h"
33 #include "QnetPointRangeFilter.h"
34 #include "QnetPointTypeFilter.h"
35 #include "QnetSetAprioriDialog.h"
36 #include "QnetTool.h"
37 
38 #include "Angle.h"
39 #include "Camera.h"
40 #include "ControlMeasure.h"
41 #include "ControlNet.h"
42 #include "ControlPoint.h"
43 #include "Distance.h"
44 #include "FileName.h"
45 #include "IException.h"
46 #include "Latitude.h"
47 #include "Longitude.h"
48 #include "SerialNumberList.h"
49 #include "SpecialPixel.h"
50 #include "SurfacePoint.h"
51 
52 using namespace std;
53 
54 namespace Isis {
67  QnetNavTool::QnetNavTool(QnetTool *qnetTool, QWidget *parent) : Tool(parent) {
68  m_navDialog = NULL;
69  m_filter = NULL;
70  m_tie = NULL;
71  m_multiIgnore = NULL;
72  m_multiDelete = NULL;
73  m_setApriori = NULL;
74  m_filterStack = NULL;
75  m_listCombo = NULL;
76  m_listBox = NULL;
77  m_filterCountLabel = NULL;
78  m_aprioriDialog = NULL;
79  m_qnetTool = qnetTool;
80  m_filtered = false;
81 
82  createNavigationDialog(parent);
83  connect(this, SIGNAL(deletedPoints()), this, SLOT(refreshList()));
84  connect(this, SIGNAL( activityUpdate(QString) ),
85  this, SLOT( updateActivityHistory(QString) ) );
86  }
87 
101  // Create the combo box selector
102  m_listCombo = new QComboBox();
103  m_listCombo->addItem("Points");
104  m_listCombo->addItem("Cubes");
105 
106  m_listBox = new QListWidget();
107  m_listBox->setSelectionMode(QAbstractItemView::ExtendedSelection);
108 
109  // Create the filter area
110  QLabel *filterLabel = new QLabel("Filters");
111  filterLabel->setAlignment(Qt::AlignHCenter);
112  m_filterStack = new QStackedWidget();
113 
114  connect(m_listCombo, SIGNAL(activated(int)),
115  m_filterStack, SLOT(setCurrentIndex(int)));
116  connect(m_listCombo, SIGNAL(activated(int)),
117  this, SLOT(filterList()));
118  connect(m_listCombo, SIGNAL(activated(int)),
119  this, SLOT(enableButtons()));
120 
121  // Create filter count label
122  m_filterCountLabel = new QLabel("Filter Count: ");
123 
124  // Create action options
125  QPushButton *load = new QPushButton("&View Cube(s)");
126  load->setAutoDefault(false);
127  load->setToolTip("Open Selected Images");
128  load->setWhatsThis("<b>Function: </b> Opens all selected images, or images \
129  that are associated with the given point or overlap. \
130  <p><b>Hint: </b> You can select more than one item in \
131  the list by using the shift or control key.</p>");
132  connect(load, SIGNAL(clicked()),
133  this, SLOT(load()));
134  m_tie = new QPushButton("&Modify Point");
135  m_tie->setAutoDefault(true);
136  m_tie->setToolTip("Modify Selected Point");
137  m_tie->setWhatsThis("<b>Function: </b> Opens the tie tool to modify the \
138  selected point from the list. This option is only \
139  available when the nav tool is in point mode");
140  connect(m_tie, SIGNAL(clicked()),
141  this, SLOT(tie()));
142 
143  m_multiIgnore = new QPushButton("&Ignore Points");
144  m_multiIgnore->setAutoDefault(false);
145  m_multiIgnore->setToolTip("Set selected points to Ignore");
146  m_multiIgnore->setWhatsThis("<b>Function: </b> Sets the selected points \
147  Ignore = True. You will not be able to preview \
148  in the Point Editor before their Ignore switch \
149  is set to true. \
150  <p><b>Hint: </b> You can select more than one \
151  item in the list by using the shift or control \
152  key.</p>");
153  connect(m_multiIgnore, SIGNAL(clicked()),
154  this, SLOT(ignorePoints()));
155 
156  m_multiDelete = new QPushButton("&Delete Points");
157  m_multiDelete->setAutoDefault(false);
158  m_multiIgnore->setToolTip("Set selected points to Delete");
159  m_multiIgnore->setWhatsThis("<b>Function: </b> Delete the selected points \
160  from control network. You will not be able to \
161  preview in the Point Editor before they are \
162  deleted. \
163  <p><b>Hint: </b> You can select more than one \
164  item in the list by using the shift or control \
165  key.</p>");
166  connect(m_multiDelete, SIGNAL(clicked()),
167  this, SLOT(deletePoints()));
168 
169  m_setApriori = new QPushButton("&Set Apriori/Sigmas");
170  m_setApriori->setAutoDefault(false);
171  m_setApriori->setToolTip("Set selected points apriori/sigmas");
172  m_setApriori->setWhatsThis("<b>Function: </b> Set the apriori points \
173  and sigmas. \
174  <p><b>Hint: </b> You can select more than one \
175  item in the list by using the shift or control \
176  key.</p>");
177  connect(m_setApriori, SIGNAL(clicked()), this, SLOT(aprioriDialog()));
178 
179  m_filter = new QPushButton("&Filter");
180  m_filter->setAutoDefault(false);
181  m_filter->setToolTip("Filter Current List");
182  m_filter->setWhatsThis("<b>Function: </b> Filters the current list by user \
183  specifications made in the selected filter. \
184  <p><b>Note: </b> Any filter options selected in a \
185  filter that is not showing will be ignored.</p>");
186  connect(m_filter, SIGNAL(clicked()),
187  this, SLOT(filter()));
188 
189  QPushButton *reset = new QPushButton("&Show All");
190  reset->setAutoDefault(false);
191  reset->setToolTip("Reset the Current List to show all the values in the list");
192  reset->setWhatsThis("<b>Function: </b> Resets the list of points, \
193  overlaps, or images to the complete initial list. \
194  Any filtering that has been done will be lost.");
195  connect(reset, SIGNAL(clicked()),
196  this, SLOT(resetList()));
197  connect(reset, SIGNAL(clicked()),
198  this, SLOT(resetFilter()));
199 
200  // Set up layout
201  QHBoxLayout *layout = new QHBoxLayout();
202  layout->addWidget(load);
203  layout->addWidget(m_tie);
204  layout->addWidget(m_multiIgnore);
205  layout->addWidget(m_multiDelete);
206  layout->addWidget(m_setApriori);
207  layout->addWidget(m_filter);
208  layout->addWidget(reset);
209 
210  // Create filter stacked widgets
211  createFilters();
212  m_filterStack->adjustSize();
213 
214  // Set up the main window
215  m_navDialog = new QDialog(parent);
216  m_navDialog->setWindowTitle("Control Network Navigator");
217 
218  // Layout everything in the dialog
219  QGridLayout *gridLayout = new QGridLayout();
220  gridLayout->addWidget(m_listCombo, 0, 0);
221  gridLayout->addWidget(filterLabel, 0, 1);
222  gridLayout->addWidget(m_listBox, 1, 0);
223  gridLayout->addWidget(m_filterStack, 1, 1);
224  gridLayout->addWidget(m_filterCountLabel, 2, 0);
225  gridLayout->addLayout(layout, 3, 0, 1, 2);
226  m_navDialog->setLayout(gridLayout);
227 
228  QString settingsFileName =
229  FileName("$HOME/.Isis/" + QApplication::applicationName() + "/NavTool.config").expanded();
230  QSettings settings(settingsFileName, QSettings::NativeFormat);
231  m_navDialog->resize(settings.value("size").toSize());
232 
233  // View the dialog - we need this to get the size of the dialog which we're using
234  // for positioning it.
235  m_navDialog->setVisible(true);
236 
237  QPoint defaultPos = parent->pos() +
238  QPoint(parent->size().width() / 2,
239  parent->size().height() / 2);
240  defaultPos -= QPoint(m_navDialog->size().width() / 2,
241  m_navDialog->size().height() / 2);
242  m_navDialog->move(settings.value("pos", defaultPos).toPoint());
243 
244  }
245 
246 
247  QnetNavTool::~QnetNavTool() {
248  QString settingsFileName =
249  FileName("$HOME/.Isis/" + QApplication::applicationName() + "/NavTool.config").expanded();
250  QSettings settings(settingsFileName, QSettings::NativeFormat);
251 
252  settings.setValue("size", m_navDialog->size());
253  settings.setValue("pos", m_navDialog->pos());
254  }
255 
256 
281  // Set up the point filters
282  QTabWidget *pointFilters = new QTabWidget();
283 
284  QWidget *jigsawErrorFilter = new QnetPointJigsawErrorFilter(this);
285  connect(jigsawErrorFilter, SIGNAL(filteredListModified()),
286  this, SLOT(filterList()));
287  pointFilters->insertTab(JigsawErrors, jigsawErrorFilter, "&Jigsaw Errors");
288  pointFilters->setTabToolTip(JigsawErrors, "Filter Points by Jigsaw Error");
289  pointFilters->setTabWhatsThis(JigsawErrors,
290  "<b>Function: </b> Filter points list by \
291  the bundle adjust error value at each \
292  point. You can filter for points that \
293  have an error greater than, or less than \
294  the entered value.");
295 
296  QWidget *registrationErrorFilter = new QnetPointRegistrationErrorFilter(this);
297  connect(registrationErrorFilter, SIGNAL(filteredListModified()),
298  this, SLOT(filterList()));
299  pointFilters->insertTab(RegistrationErrors, registrationErrorFilter,
300  "&Registration Errors");
301  pointFilters->setTabToolTip(RegistrationErrors,
302  "Filter Points by Registration Error");
303  pointFilters->setTabWhatsThis(RegistrationErrors,
304  "<b>Function: </b> Filter points list by \
305  the registration pixel shift value at each \
306  point. You can filter for points that \
307  have an error greater than, or less than \
308  the entered value. The maximum for all \
309  measures in the point is used");
310 
311  QWidget *ptIdFilter = new QnetPointIdFilter(this);
312  connect(ptIdFilter, SIGNAL(filteredListModified()),
313  this, SLOT(filterList()));
314  pointFilters->insertTab(Id, ptIdFilter, "&Point ID");
315  pointFilters->setTabToolTip(Id, "Filter Points by PointID");
316 
317  QWidget *ptImageFilter = new QnetPointImagesFilter(this);
318  connect(ptImageFilter, SIGNAL(filteredListModified()),
319  this, SLOT(filterList()));
320  pointFilters->insertTab(NumberImages, ptImageFilter, "&Number of Measures");
321  pointFilters->setTabToolTip(NumberImages, "Filter Points by Number of Images");
322  pointFilters->setTabWhatsThis(NumberImages, "<b>Function: </b> Filter points list \
323  by the number of images that are in \
324  each point. You can filter for \
325  points that have more than the given \
326  number of images, or less than the \
327  given number of images. Points with \
328  the exact number of images specified \
329  will not be included in the filtered \
330  list.");
331  QWidget *typeFilter = new QnetPointTypeFilter(this);
332  connect(typeFilter, SIGNAL(filteredListModified()),
333  this, SLOT(filterList()));
334  pointFilters->insertTab(Type, typeFilter, "Point Properties");
335  pointFilters->setTabToolTip(Type, "Filter Points by Listed Properties");
336  pointFilters->setTabWhatsThis(Type, "<b>Function: </b> Filter points list by \
337  their Point Type, Ignore status, or Held status properties");
338  QWidget *rangeFilter = new QnetPointRangeFilter(this);
339  connect(rangeFilter, SIGNAL(filteredListModified()),
340  this, SLOT(filterList()));
341  pointFilters->insertTab(LatLonRange, rangeFilter, "&Range");
342  pointFilters->setTabToolTip(LatLonRange, "Filter Points by Range");
343  pointFilters->setTabWhatsThis(LatLonRange, "<b>Function: </b> Filters out points \
344  that are within a user set range lat/lon \
345  range.");
346  QWidget *ptDistFilter = new QnetPointDistanceFilter(this);
347  connect(ptDistFilter, SIGNAL(filteredListModified()),
348  this, SLOT(filterList()));
349  pointFilters->insertTab(Distance, ptDistFilter, "Dist&ance");
350  pointFilters->setTabToolTip(Distance, "Filter Points by Distance");
351  pointFilters->setTabWhatsThis(Distance,
352  "<b>Function: </b> Filter points list by \
353  a user specified maximum distance from \
354  any other point.");
355  QWidget *measureFilter = new QnetPointMeasureFilter(this);
356  connect(measureFilter, SIGNAL(filteredListModified()),
357  this, SLOT(filterList()));
358  pointFilters->insertTab(MeasureType, measureFilter, "Measure Properties");
359  pointFilters->setTabToolTip(MeasureType, "Filter Points by Listed Measure Properties");
360  pointFilters->setTabWhatsThis(MeasureType,
361  "<b>Function: </b> Filter points list by \
362  the properties of their measures. User may \
363  filter by Measure Type or Ignore status. \
364  If one or more measure from a point is found to \
365  match a selected measure type, and that measure \
366  satisfies the ignore status selected, the point \
367  will be left in the filtered list. More \
368  than one measure type can be selected. \
369  Only one Ignore status may be selected.");
370 
371  QWidget *goodnessFilter = new QnetPointGoodnessFilter(this);
372  connect(goodnessFilter, SIGNAL(filteredListModified()),
373  this, SLOT(filterList()));
374  pointFilters->insertTab(GoodnessOfFit, goodnessFilter, "&Goodness of Fit");
375  pointFilters->setTabToolTip(GoodnessOfFit, "Filter Points by the Goodness of Fit of its measures");
376  pointFilters->setTabWhatsThis(GoodnessOfFit,
377  "<b>Function: </b> Filter points list by \
378  the goodness of fit.");
379  QWidget *cubeNamesFilter = new QnetPointCubeNameFilter(this);
380  connect(cubeNamesFilter, SIGNAL(filteredListModified()),
381  this, SLOT(filterList()));
382  connect(this, SIGNAL(serialListModified()),
383  cubeNamesFilter, SLOT(createCubeList()));
384 
385  pointFilters->insertTab(CubeName, cubeNamesFilter, "&Cube Name(s)");
386  pointFilters->setTabToolTip(CubeName, "Filter Points by Cube FileName(s)");
387  pointFilters->setTabWhatsThis(CubeName,
388  "<b>Function: </b> Filter points list by \
389  the filenames of cubes. This filter will \
390  show all points contained in a single \
391  image or all points contained in every \
392  cube selected.");
393  // Set up the cube filters
394  QTabWidget *cubeFilters = new QTabWidget();
395 
396  QWidget *cubeNameFilter = new QnetCubeNameFilter(this);
397  connect(cubeNameFilter, SIGNAL(filteredListModified()),
398  this, SLOT(filterList()));
399  cubeFilters->insertTab(Name, cubeNameFilter, "&Cube Name");
400  cubeFilters->setTabToolTip(Name, "Filter Images by Cube Name");
401 
402  QWidget *cubePtsFilter = new QnetCubePointsFilter(this);
403  connect(cubePtsFilter, SIGNAL(filteredListModified()),
404  this, SLOT(filterList()));
405  cubeFilters->insertTab(NumberPoints, cubePtsFilter, "&Number of Points");
406  cubeFilters->setTabToolTip(NumberPoints, "Filter Images by Number of Points");
407  cubeFilters->setTabWhatsThis(NumberPoints,
408  "<b>Function: </b> Filter images list by \
409  the number of points that are in each \
410  image. You can filter for images that have \
411  more than the given number of points, or \
412  less than the given number of point. \
413  Images with the exact number of points \
414  specified will not be included in the \
415  filtered list.");
416  QWidget *cubeDistFilter = new QnetCubeDistanceFilter(this);
417  connect(cubeDistFilter, SIGNAL(filteredListModified()),
418  this, SLOT(filterList()));
419  cubeFilters->insertTab(PointDistance, cubeDistFilter, "Dist&ance");
420  cubeFilters->setTabToolTip(PointDistance, "Filter Images by Distance between Points");
421  cubeFilters->setTabWhatsThis(PointDistance,
422  "<b>Function: </b> Filter images list by \
423  a user specified distance between points \
424  in the image. This may be calculated in \
425  meters or by pixel distance.");
426 
427  // Add widgets to the filter stack
428  m_filterStack->addWidget(pointFilters);
429  m_filterStack->addWidget(cubeFilters);
430 
431 
432  // Create the Activity History Tab
433  QScrollArea *scrollArea = new QScrollArea();
434 
435  QWidget *historyWidget = new QWidget();
436  QWidget *innerWidget = new QWidget();
437 
438  QVBoxLayout *innerLayout = new QVBoxLayout();
439  QLabel *title = new QLabel("<b>History</b>");
440  innerLayout->addWidget(title);
441  innerLayout->addWidget(scrollArea);
442 
443  m_historyLayout = new QVBoxLayout(scrollArea);
444  m_historyLayout->setAlignment(Qt::AlignTop);
445 
446  innerWidget->setLayout(innerLayout);
447  historyWidget->setLayout(m_historyLayout);
448  scrollArea->setWidget(historyWidget);
449  scrollArea->setWidgetResizable(true);
450 
451  pointFilters->addTab(innerWidget, QString("&Activity History") );
452 
453  }
454 
455 
456  QList<int> &QnetNavTool::filteredImages() {
457  return m_filteredImages;
458  }
459 
460 
461  const QList<int> &QnetNavTool::filteredImages() const {
462  return m_filteredImages;
463  }
464 
465 
466  QList<int> &QnetNavTool::filteredPoints() {
467  return m_filteredPoints;
468  }
469 
470 
471  const QList<int> &QnetNavTool::filteredPoints() const {
472  return m_filteredPoints;
473  }
474 
475 
476  ControlNet *QnetNavTool::controlNet() {
477  return m_qnetTool->controlNet();
478  }
479 
480 
481  const ControlNet *QnetNavTool::controlNet() const {
482  return m_qnetTool->controlNet();
483  }
484 
485 
486  SerialNumberList *QnetNavTool::serialNumberList() {
487  return m_qnetTool->serialNumberList();
488  }
489 
490 
491  const SerialNumberList *QnetNavTool::serialNumberList() const {
492  return m_qnetTool->serialNumberList();
493  }
494 
495 
518  m_filtered = false;
519  // Dont do anything if there are no cubes loaded
520  if (m_qnetTool->serialNumberList() == NULL)
521  return;
522 
523  // Clear the old list and filtered lists and update with the entire list
524  m_listBox->setCurrentRow(-1);
525  m_listBox->clear();
526  m_filteredPoints.clear();
527  m_filteredImages.clear();
528 
529  // copy the control net indices into the filtered points list
530  int numCp = controlNet()->GetNumPoints();
531  m_filteredPoints.reserve(numCp);
532  for (int i = 0; i < numCp; i++) {
533  m_filteredPoints.push_back(i);
534  }
535  // copy the serial number indices into the filtered images list
536  int numSns = m_qnetTool->serialNumberList()->size();
537  m_filteredImages.reserve(numSns);
538  for (int i = 0; i < numSns; i++) {
539  m_filteredImages.push_back(i);
540  }
541 
542  // We are dealing with points so output the point numbers
543  if (m_listCombo->currentIndex() == Points) {
544  // disconnect any old signals
545  disconnect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
546  this, SLOT(load(QListWidgetItem *)));
547  connect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
548  this, SLOT(editPoint(QListWidgetItem *)), Qt::UniqueConnection);
549  //m_listBox->setSelectionMode(QAbstractItemView::SingleSelection);
550  for (int i = 0; i < controlNet()->GetNumPoints(); i++) {
551  QString cNetId = (*controlNet())[i]->GetId();
552  QString itemString = cNetId;
553  m_listBox->insertItem(i, itemString);
554  int images = (*controlNet())[i]->GetNumMeasures();
555  m_listBox->item(i)->setToolTip(QString::number(images) + " image(s) in point");
556  }
557  // Make sure edit point is selected and in view.
558  updateEditPoint(m_editPointId);
559 
560  QString msg = "Filter Count: " + QString::number(m_listBox->count()) +
561  " / " + QString::number(controlNet()->GetNumPoints());
562  m_filterCountLabel->setText(msg);
563  }
564  // We are dealing with images so output the cube names
565  else if (m_listCombo->currentIndex() == Cubes) {
566  disconnect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
567  this, SLOT(editPoint(QListWidgetItem *)));
568  connect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
569  this, SLOT(load(QListWidgetItem *)), Qt::UniqueConnection);
570  //m_listBox->setSelectionMode(QAbstractItemView::ExtendedSelection);
571  for (int i = 0; i < serialNumberList()->size(); i++) {
572  FileName filename = FileName(serialNumberList()->fileName(i));
573  QString tempFileName = filename.name();
574  m_listBox->insertItem(i, tempFileName);
575  }
576  QString msg = "Filter Count: " + QString::number(m_listBox->count()) +
577  " / " + QString::number(serialNumberList()->size());
578  m_filterCountLabel->setText(msg);
579 
580  }
581  }
582 
583 
595  void QnetNavTool::updateEditPoint(QString pointId) {
596 
597  m_editPointId = pointId;
598  if (pointId == "")
599  return;
600 
601  QList<QListWidgetItem *> items = m_listBox->findItems(pointId, Qt::MatchExactly);
602  if (items.isEmpty()) {
603  m_listBox->clearSelection();
604  }
605  else {
606  m_listBox->setCurrentItem(items.at(0));
607  }
608  QString activityMessage("Point selected: " + pointId);
609  emit(activityUpdate(activityMessage));
610  return;
611  }
612 
620  void QnetNavTool::updateActivityHistory(QString activityMessage) {
621 
622  // Check to ensure duplicate entries aren't added back to back.
623  if (m_historyLayout->count() > 0) {
624  QWidget *firstEntry = m_historyLayout->layout()->itemAt(0)->widget();
625  QLabel *firstLabel = dynamic_cast<QLabel*>(firstEntry);
626  if (firstLabel->text() == activityMessage) {
627  return;
628  }
629  }
630 
631  QLabel *historyEntry = new QLabel(activityMessage);
632  m_historyLayout->insertWidget(0, historyEntry);
633  }
634 
642  if (m_filtered) {
643  filter();
644  }
645  else {
646  resetList();
647  }
648 
649  }
650 
655 
656  }
657 
670  // Don't do anything if there are no cubes loaded
671  if (serialNumberList() == NULL)
672  return;
673 
674  // Clears the old list and puts the filtered list in its place
675  m_listBox->setCurrentRow(-1);
676  m_listBox->clear();
677 
678  // We are dealing with points so output the point numbers
679  if (m_listCombo->currentIndex() == Points) {
680  disconnect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
681  this, SLOT(load(QListWidgetItem *)));
682  connect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
683  this, SLOT(editPoint(QListWidgetItem *)), Qt::UniqueConnection);
684 
685  for (int i = 0; i < m_filteredPoints.size(); i++) {
686  QString cNetId = (*controlNet())[m_filteredPoints[i]]->GetId();
687  QString itemString = cNetId;
688  m_listBox->insertItem(i, itemString);
689  int images = (*controlNet())[m_filteredPoints[i]]->GetNumMeasures();
690  m_listBox->item(i)->setToolTip(QString::number(images) + " image(s) in point");
691  }
692  QString msg = "Filter Count: " + QString::number(m_listBox->count()) +
693  " / " + QString::number(controlNet()->GetNumPoints());
694  m_filterCountLabel->setText(msg);
695  updateEditPoint(m_editPointId);
696  }
697  // We are dealing with images so write out the cube names
698  else if (m_listCombo->currentIndex() == Cubes) {
699  disconnect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
700  this, SLOT(editPoint(QListWidgetItem *)));
701  connect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
702  this, SLOT(load(QListWidgetItem *)), Qt::UniqueConnection);
703  for (int i = 0; i < m_filteredImages.size(); i++) {
704  FileName filename = FileName(serialNumberList()->fileName(m_filteredImages[i]));
705  QString tempFileName = filename.name();
706  m_listBox->insertItem(i, tempFileName);
707  }
708  QString msg = "Filter Count: " + QString::number(m_listBox->count()) +
709  " / " + QString::number(serialNumberList()->size());
710  m_filterCountLabel->setText(msg);
711  }
712  }
713 
714 
715 
733  // Dont do anything if no cubes are loaded
734  if (serialNumberList() == NULL)
735  return;
736 
737  // TODO: How do we handle them opening 2 overlaps or points that have the
738  // cube in them, open 2 of the same file or only open 1???
739  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
740  if (selected.size() < 1) {
741  QMessageBox::information((QWidget *)parent(),
742  "Error", "No file selected to load.");
743  return;
744  }
745 
746  QApplication::setOverrideCursor(Qt::WaitCursor);
747  for (int i = 0; i < selected.size(); i++) {
748  int index = m_listBox->row(selected[i]);
749  // Tell the filetool to load all images for the given point
750  if (m_listCombo->currentIndex() == Points) {
751  if (m_filteredPoints.size() == 0) {
752  emit loadPointImages((*controlNet())[index]);
753  }
754  else {
755  emit loadPointImages((*controlNet())[m_filteredPoints[index]]);
756  }
757  }
758  // Tell the filetool to load the given image
759  else if (m_listCombo->currentIndex() == Cubes) {
760  if (m_filteredImages.size() == 0) {
761  QString serialNumber = (*serialNumberList()).serialNumber(index);
762  QString sn = serialNumber;
763  emit loadImage(sn);
764  }
765  else {
766  QString serialNumber = (*serialNumberList()).serialNumber(m_filteredImages[index]);
767  QString sn = serialNumber;
768  emit loadImage(sn);
769  }
770  }
771  }
772  QApplication::restoreOverrideCursor();
773  return;
774  }
775 
776 
777 
778 
788  void QnetNavTool::load(QListWidgetItem *) {
789  load();
790  }
791 
797  void QnetNavTool::editPoint(QListWidgetItem *ptItem) {
798 
799  int index = m_listBox->row(ptItem);
800  if (m_filteredPoints.size() == 0) {
801  emit modifyPoint((*controlNet())[index]);
802  }
803  else {
804  emit modifyPoint((*controlNet())[m_filteredPoints[index]]);
805  }
806 
807  }
808 
817 
818  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
819  if (selected.size() > 1) {
820  QMessageBox::information((QWidget *)parent(),
821  "Error", "Only one point can be modified at a time");
822  return;
823  }
824  else if (selected.size() < 1) {
825  QMessageBox::information((QWidget *)parent(),
826  "Error", "No point selected to modify.");
827  return;
828  }
829  int index = m_listBox->row(selected[0]);
830  if (m_filteredPoints.size() == 0) {
831  emit modifyPoint((*controlNet())[index]);
832  }
833  else {
834  emit modifyPoint((*controlNet())[m_filteredPoints[index]]);
835  }
836  }
837 
838 
850  // do nothing if no cubes are loaded
851  if (serialNumberList() == NULL) return;
852 
853  int index = m_listBox->currentRow();
854  if (index < 0) {
855  QApplication::restoreOverrideCursor();
856  QMessageBox::information((QWidget *)parent(),
857  "Error", "No point selected to ignore");
858  return;
859  }
860  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
861  switch (QMessageBox::question((QWidget *)parent(),
862  "Control Network Navigator - Ignore Points",
863  "You have chosen to set "
864  + QString::number(selected.size())
865  + " point(s) to ignore. Do you want to continue?",
866  "&Yes", "&No", 0, 0)) {
867  case 0: // Yes was clicked or Enter was pressed, delete points
868  QApplication::setOverrideCursor(Qt::WaitCursor);
869  int lockedPoints = 0;
870  for (int i = 0; i < selected.size(); i++) {
871  int index = m_listBox->row(selected[i]);
872  if (m_filteredPoints.size() == 0) {
873  if ((*controlNet())[index]->SetIgnored(true) ==
874  ControlPoint::PointLocked) lockedPoints++;
875  }
876  else {
877  if ((*controlNet())[m_filteredPoints[index]]->SetIgnored(true)
878  == ControlPoint::PointLocked) lockedPoints++;
879  }
880  emit pointChanged((*controlNet())[m_filteredPoints[index]]->GetId());
881  }
882  // Print info about locked points if there are any
883  if (lockedPoints > 0) {
884  QMessageBox::information((QWidget *)parent(),"EditLocked Points",
885  QString::number(lockedPoints) + " / "
886  + QString::number(selected.size())
887  + " points are EditLocked and were not set to Ignored.");
888  }
889  QApplication::restoreOverrideCursor();
890  if (lockedPoints != selected.size()) emit netChanged();
891 
892  break;
893  // case 1: // No was clicked, close window and do nothing to points
894  }
895  return;
896  }
897 
898 
919  // do nothing if no cubes are loaded
920  if (serialNumberList() == NULL)
921  return;
922 
923  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
924 
925  if (selected.size() < 1) {
926  QApplication::restoreOverrideCursor();
927  QMessageBox::information((QWidget *)parent(),
928  "Error", "No point selected to delete");
929  return;
930  }
931  switch (QMessageBox::question((QWidget *)parent(),
932  "Control Network Navigator - Delete Points",
933  "You have chosen to delete "
934  + QString::number(selected.size())
935  + " point(s). Do you want to continue?",
936  "&Yes", "&No", 0, 0)) {
937  case 0: // Yes was clicked or Enter was pressed, delete points
938 
939 
940 #if 0 // If resetting filtered list, then re-filtering too slow, try code below
941 
942  // Keep track of rows to be deleted. They cannot be deleted until
943  // the end, or indices in list widget will be incorrect.
944  vector<int> deletedRows;
945  // Keep track of points deleted so far, to keep indices into network
946  // (stored in g_filteredPoints) accurate, they will need to be adjusted
947  // on the fly.
948  int deletedSoFar = 0;
949 
950  for (int i = 0; i < g_filteredPoints.size(); i++) {
951  if (m_listBox->item(i)->isSelected() {
952  QString id = m_listBox->item(i)->text();
953  if (g_controlNetwork->DeletePoint(id) == ControlPoint::PointLocked) {
954  lockedPoints++;
955  }
956  }
957  }
958 #endif
959  int lockedPoints = 0;
960  for (int i = 0; i < selected.size(); i++) {
961  QString id = selected.at(i)->text();
962  if (controlNet()->DeletePoint(id) == ControlPoint::PointLocked) {
963  lockedPoints++;
964  }
965  }
966 
967  // Print info about locked points if there are any
968  if (lockedPoints > 0) {
969  QMessageBox::information((QWidget *)parent(),"EditLocked Points",
970  QString::number(lockedPoints) + " / "
971  + QString::number(selected.size())
972  + " points are EditLocked and were not deleted.");
973  }
974 
975  // Reset filter list, if this becomes too slow, we might need to
976  // implement smarter algorithm, which would require adjusting indices
977  // as points get deleted. See commented out code above.
978  m_filteredPoints.clear();
979  // copy the control net indices into the filtered points list
980  for (int i = 0; i < controlNet()->GetNumPoints(); i++) {
981  m_filteredPoints.push_back(i);
982  }
983  emit deletedPoints();
984  emit netChanged();
985  break;
986  // case 1: // No was clicked, close window and do nothing to points
987  }
988  return;
989  }
990 
991 
1007  // If no cubes are loaded, simply return
1008  if (serialNumberList() == NULL)
1009  return;
1010 
1011  if (!m_aprioriDialog) {
1012  m_aprioriDialog = new QnetSetAprioriDialog(m_qnetTool);
1014  connect(m_listBox, SIGNAL(itemSelectionChanged()),
1015  this, SLOT(setAprioriDialogPoints()));
1016  connect(m_aprioriDialog, SIGNAL(pointChanged(QString)),
1017  this, SIGNAL(pointChanged(QString)));
1018  connect(m_aprioriDialog, SIGNAL(netChanged()),
1019  this, SIGNAL(netChanged()));
1020  connect(m_aprioriDialog, SIGNAL(aprioriDialogClosed()),
1021  this, SLOT(disconnectAprioriDialog()));
1022  }
1023  m_aprioriDialog->setVisiblity();
1024  }
1025 
1026 
1035 
1036  if (m_aprioriDialog == NULL) return;
1037 
1038  // If cubes selected, return
1039  if (m_listCombo->currentIndex() == Cubes) return;
1040 
1041  int index = m_listBox->currentRow();
1042  if (index < 0) return;
1043 
1044  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
1045  m_aprioriDialog->setPoints(selected);
1046 
1047  }
1048 
1049 
1058  if (m_aprioriDialog) {
1059  disconnect(m_listBox, SIGNAL(itemSelectionChanged()),
1060  this, SLOT(setAprioriDialogPoints()));
1061  disconnect(m_aprioriDialog, 0, 0, 0);
1062  m_aprioriDialog = NULL;
1063  }
1064  }
1065 
1066 
1089 
1090  m_filtered = true;
1091  QApplication::setOverrideCursor(Qt::WaitCursor);
1092  m_filter->setEnabled(false);
1093 
1094  QTabWidget *tab = (QTabWidget *)(m_filterStack->currentWidget());
1095 
1096  // We're dealing with points
1097  if (m_listCombo->currentIndex() == Points) {
1098  PointFilterIndex pointIndex = (PointFilterIndex) tab->currentIndex();
1099  // We have a jigsaw errors filter
1100  if (pointIndex == JigsawErrors) {
1101  QnetPointJigsawErrorFilter *widget =
1102  (QnetPointJigsawErrorFilter *)(tab->currentWidget());
1103  widget->filter();
1104  }
1105  // We have a registration errors filter
1106  if (pointIndex == RegistrationErrors) {
1108  (QnetPointRegistrationErrorFilter *)(tab->currentWidget());
1109  widget->filter();
1110  }
1111  // We have a point id filter
1112  else if (pointIndex == Id) {
1113  QnetPointIdFilter *widget =
1114  (QnetPointIdFilter *)(tab->currentWidget());
1115  widget->filter();
1116  }
1117  // We have a number of images filter
1118  else if (pointIndex == NumberImages) {
1119  QnetPointImagesFilter *widget =
1120  (QnetPointImagesFilter *)(tab->currentWidget());
1121  widget->filter();
1122  }
1123  // We have a point type filter
1124  else if (pointIndex == Type) {
1125  QnetPointTypeFilter *widget =
1126  (QnetPointTypeFilter *)(tab->currentWidget());
1127  widget->filter();
1128  }
1129  // We have a lat/lon range filter
1130  else if (pointIndex == LatLonRange) {
1131  QnetPointRangeFilter *widget =
1132  (QnetPointRangeFilter *)(tab->currentWidget());
1133  widget->filter();
1134  }
1135  // We have a distance filter
1136  else if (pointIndex == Distance) {
1137  QnetPointDistanceFilter *widget =
1138  (QnetPointDistanceFilter *)(tab->currentWidget());
1139  widget->filter();
1140  }
1141  // We have a measure filter
1142  else if (pointIndex == MeasureType) {
1143  QnetPointMeasureFilter *widget =
1144  (QnetPointMeasureFilter *)(tab->currentWidget());
1145  widget->filter();
1146  }
1147  // We have a goodness of fit filter
1148  else if(pointIndex == GoodnessOfFit) {
1149  QnetPointGoodnessFilter *widget =
1150  (QnetPointGoodnessFilter *)(tab->currentWidget());
1151  widget->filter();
1152  }
1153  // We have a cube name filter
1154  else if (pointIndex == CubeName) {
1155  QnetPointCubeNameFilter *widget =
1156  (QnetPointCubeNameFilter *)(tab->currentWidget());
1157  widget->filter();
1158  }
1159  }
1160 
1161  // We're dealing with cubes
1162  else if (m_listCombo->currentIndex() == Cubes) {
1163  CubeFilterIndex cubeIndex = (CubeFilterIndex) tab->currentIndex();
1164  // We have a cube name filter
1165  if (cubeIndex == Name) {
1166  QnetCubeNameFilter *widget =
1167  (QnetCubeNameFilter *)(tab->currentWidget());
1168  widget->filter();
1169  }
1170  // We have a point filter
1171  else if (cubeIndex == NumberPoints) {
1172  QnetCubePointsFilter *widget =
1173  (QnetCubePointsFilter *)(tab->currentWidget());
1174  widget->filter();
1175  }
1176  // We have a distance filter
1177  else if (cubeIndex == PointDistance) {
1178  QnetCubeDistanceFilter *widget =
1179  (QnetCubeDistanceFilter *)(tab->currentWidget());
1180  widget->filter();
1181  }
1182  }
1183  m_filter->setEnabled(true);
1184  QApplication::restoreOverrideCursor();
1185  return;
1186  }
1187 
1196  if (m_listCombo->currentIndex() == Points) {
1197  m_tie->setEnabled(true);
1198  m_multiIgnore->setEnabled(true);
1199  m_multiDelete->setEnabled(true);
1200  m_setApriori->setEnabled(true);
1201  }
1202  else {
1203  m_tie->setEnabled(false);
1204  m_multiIgnore->setEnabled(false);
1205  m_multiDelete->setEnabled(false);
1206  m_setApriori->setEnabled(false);
1207  if (m_aprioriDialog != NULL) {
1208  m_aprioriDialog->close();
1209  }
1210  }
1211  }
1212 
1223  emit serialListModified();
1224  }
1225 
1234  m_navDialog->setVisible(true);
1235  }
1236 
1237 #if 0
1238 
1241  void QnetNavTool::listLockedPoints() {
1242 
1243  QDialog lockDialog = new QDialog();
1244  lockDialog.setWindowTitle("Un-lock Points");
1245  lockDialog.setModal(true);
1246 
1247  QListWidget editLockPointsListBox = new QListWidget(lockDialog);
1248  connect(editLockPointsListBox, SIGNAL(itemChanged(QListWidgetItem *)),
1249  this, SLOT(unlockPoint(QListWidgetItem *)));
1250 
1251  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
1252  QList<QListWidgetItem *> lockedPoints;
1253 
1254  // Fill editLock List Box
1255  for (int i=0; i<selected.size(); i++) {
1256  QString id = selected.at(i)->text();
1257  ControlPoint *pt = g_controlNetwork->GetPoint(id);
1258  if (pt->IsEditLocked()) {
1259  QListWidgetItem *item = new QListWidgetItem(*(selected[i]));
1260  item->setCheckState(Qt::Checked);
1261  editLockPointsListBox->addItem(item);
1262  }
1263  }
1264 
1265  if (lockDialog.exec()) {
1266 
1267  }
1268 
1269 
1270 
1271  switch (QMessageBox::question((QWidget *)parent(),
1272  "Control Network Navigator - Ignore Points",
1273  "You have chosen to set "
1274  + QString::number(selected.size())
1275  + " point(s) to ignore. Do you want to continue?",
1276  "&Yes", "&No", 0, 0)) {
1277  case 0: // Yes was clicked or Enter was pressed, delete points
1278  QApplication::setOverrideCursor(Qt::WaitCursor);
1279  emit pointChanged((*g_controlNetwork)[g_filteredPoints[index]]->GetId());
1280  }
1281 
1282 
1283  }
1284 
1285  void QnetNavTool::unlockPoint(QListWidgetItem *pointId) {
1286  ControlPoint *pt = g_controlNetwork->GetPoint(pointId->text());
1287  if (pt->IsEditLocked() && pointId->checkState() == Qt::Unchecked) {
1288  pt->SetEditLock(false);
1289  editLockPointsListBox->removeItemWidget(pointId);
1290  pointId->setHidden(true);
1291  editLockPointsListBox->repaint();
1292  this->repaint();
1293  emit netChanged();
1294  }
1295 
1296  }
1297 #endif
1298 }
Defines the Cube Name filter for the QnetNavTool&#39;s Points section.
Defines the Measure Properties filter for the QnetNavTool&#39;s Points section.
Defines the Distance filter for the QnetNavTool&#39;s Cubes section.
virtual void filter()
Method overwrites parent method.
void resetFilter()
Resets the visible filter to the default values.
Defines the Points filter for the QnetNavTool&#39;s Cubes section.
void aprioriDialog()
Bring up apriori dialog.
Filter for control point type.
void setVisiblity()
Shows the dialog box.
File name manipulation and expansion.
Definition: FileName.h:116
virtual void filter()
Method overwrites parent method.
void resetList()
Resets the list box with whatever is in the global lists.
Defines the Jigsaw Error filter for the QnetNavTool&#39;s Points section.
void filter()
Figures out what type of widget the filter was selected for and calls the filter method for that filt...
virtual void filter()
Filters a list of points for points that have less than or greater than the entered bundle adjust err...
virtual void filter()
Filters a list of points and keeps points that have the selected property or in the given range...
virtual void filter()
Filters a list of images looking for cube names using the regular expression entered.
virtual void filter()
Filters a list of images for images that have points that are less than the user entered distance fro...
void filterList()
Updates the list box in the nav window with a new list from one of the filters.
Namespace for the standard library.
void load()
Tells the filetool to load an image, slot for "View Cube(s)" button.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition: FileName.cpp:178
Defines the Distance filter for the QnetNavTool&#39;s Points section.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Status SetEditLock(bool editLock)
Set the EditLock state.
virtual void filter()
Filters a list of points for points that have less than or greater than the entered number of images...
Distance measurement, usually in meters.
Definition: Distance.h:47
void ignorePoints()
Set Ignored=True for selected Points.
void setPoints(QList< QListWidgetItem *> selectedPoints)
Set control points in the dialog.
void enableButtons()
Enable/disable buttons depending on whether Points or Cubes is chosen.
virtual void filter()
Filters a list of images for images that have more or less than the user entered number of points...
int GetNumPoints() const
Return the number of control points in the network.
Defines the Range filter for the QnetNavTool&#39;s Points section.
void tie()
Calls the qnet tool for the given control point.
virtual void filter()
Filters a list of points for points that are less than the user entered distance from another point i...
void createFilters()
Sets up the tabbed widgets for the different types of filters available.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:212
A single control point.
Definition: ControlPoint.h:369
Defines the Name filter for the QnetNavTool&#39;s Cubes section.
Defines the Point ID filter for the QnetNavTool&#39;s Points section.
int size() const
How many serial number / filename combos are in the list.
void resetCubeList()
This slot is connected to the file tool in qnet.cpp.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void setAprioriDialogPoints()
Slot to pass points selected in Nav List Widget to Apriori Dialog.
virtual void filter()
Filters a list of points for points that are of the selected Range or in the given range...
void refreshList()
Slot to refresh the listBox.
Defines the Goodness of Fit filter for the QnetNavTool&#39;s Points section.
Defines the Images filter for the QnetNavTool&#39;s Points section, i.e.
void updateEditPoint(QString pointId)
Update the list showing the new point highlighted.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Base class for the Qisis tools.
Definition: Tool.h:81
void updateActivityHistory(QString activityMessage)
Slot to update the history tab with current edits.
Qnet tool operations.
Definition: QnetTool.h:256
virtual void filter()
Filters a list of images looking for cube names using the regular expression entered.
void deletePoints()
Delete selected Points from control network.
virtual void filter()
Filters a list of points for points that have less than or greater than the entered registration erro...
void createNavigationDialog(QWidget *parent)
Creates and shows the dialog box for the navigation tool.
void showNavTool()
This method sets the Navigation Dialog window to shown=true.
Defines the Registration Error filter for the QnetNavTool&#39;s Points section.
virtual void filter()
Filters a list of points for points that have at least one measure of the selected type(s)...
void disconnectAprioriDialog()
Apriori dialog has been closed and needs to be disconnected and deleted so a new dialog can be brough...
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
This is returned when the operation requires Edit Lock to be false but it is currently true...
Definition: ControlPoint.h:423
void editPoint(QListWidgetItem *ptItem)
Emits a modifyPoint signal.