Isis 3.0 Programmer Reference
Back | Home
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 <QSettings>
15 #include <QStackedWidget>
16 #include <QString>
17 #include <QTabWidget>
18 #include <QWidget>
19 
20 #include "QnetCubeDistanceFilter.h"
21 #include "QnetCubeNameFilter.h"
22 #include "QnetCubePointsFilter.h"
24 #include "QnetPointDistanceFilter.h"
27 #include "QnetPointGoodnessFilter.h"
28 #include "QnetPointIdFilter.h"
29 #include "QnetPointImagesFilter.h"
30 #include "QnetPointMeasureFilter.h"
31 #include "QnetPointRangeFilter.h"
32 #include "QnetPointTypeFilter.h"
33 #include "QnetSetAprioriDialog.h"
34 #include "QnetTool.h"
35 
36 #include "Angle.h"
37 #include "Camera.h"
38 #include "ControlMeasure.h"
39 #include "ControlNet.h"
40 #include "ControlPoint.h"
41 #include "Distance.h"
42 #include "FileName.h"
43 #include "IException.h"
44 #include "Latitude.h"
45 #include "Longitude.h"
46 #include "SerialNumberList.h"
47 #include "SpecialPixel.h"
48 #include "SurfacePoint.h"
49 
50 using namespace std;
51 
52 namespace Isis {
65  QnetNavTool::QnetNavTool(QnetTool *qnetTool, QWidget *parent) : Tool(parent) {
66  m_navDialog = NULL;
67  m_filter = NULL;
68  m_tie = NULL;
69  m_multiIgnore = NULL;
70  m_multiDelete = NULL;
71  m_setApriori = NULL;
72  m_filterStack = NULL;
73  m_listCombo = NULL;
74  m_listBox = NULL;
75  m_filterCountLabel = NULL;
76  m_aprioriDialog = NULL;
77  m_qnetTool = qnetTool;
78  m_filtered = false;
79 
80  createNavigationDialog(parent);
81  connect(this, SIGNAL(deletedPoints()), this, SLOT(refreshList()));
82  }
83 
97  // Create the combo box selector
98  m_listCombo = new QComboBox();
99  m_listCombo->addItem("Points");
100  m_listCombo->addItem("Cubes");
101 
102  m_listBox = new QListWidget();
103  m_listBox->setSelectionMode(QAbstractItemView::ExtendedSelection);
104 
105  // Create the filter area
106  QLabel *filterLabel = new QLabel("Filters");
107  filterLabel->setAlignment(Qt::AlignHCenter);
108  m_filterStack = new QStackedWidget();
109 
110  connect(m_listCombo, SIGNAL(activated(int)),
111  m_filterStack, SLOT(setCurrentIndex(int)));
112  connect(m_listCombo, SIGNAL(activated(int)),
113  this, SLOT(filterList()));
114  connect(m_listCombo, SIGNAL(activated(int)),
115  this, SLOT(enableButtons()));
116 
117  // Create filter count label
118  m_filterCountLabel = new QLabel("Filter Count: ");
119 
120  // Create action options
121  QPushButton *load = new QPushButton("&View Cube(s)");
122  load->setAutoDefault(false);
123  load->setToolTip("Open Selected Images");
124  load->setWhatsThis("<b>Function: </b> Opens all selected images, or images \
125  that are associated with the given point or overlap. \
126  <p><b>Hint: </b> You can select more than one item in \
127  the list by using the shift or control key.</p>");
128  connect(load, SIGNAL(clicked()),
129  this, SLOT(load()));
130  m_tie = new QPushButton("&Modify Point");
131  m_tie->setAutoDefault(true);
132  m_tie->setToolTip("Modify Selected Point");
133  m_tie->setWhatsThis("<b>Function: </b> Opens the tie tool to modify the \
134  selected point from the list. This option is only \
135  available when the nav tool is in point mode");
136  connect(m_tie, SIGNAL(clicked()),
137  this, SLOT(tie()));
138 
139  m_multiIgnore = new QPushButton("&Ignore Points");
140  m_multiIgnore->setAutoDefault(false);
141  m_multiIgnore->setToolTip("Set selected points to Ignore");
142  m_multiIgnore->setWhatsThis("<b>Function: </b> Sets the selected points \
143  Ignore = True. You will not be able to preview \
144  in the Point Editor before their Ignore switch \
145  is set to true. \
146  <p><b>Hint: </b> You can select more than one \
147  item in the list by using the shift or control \
148  key.</p>");
149  connect(m_multiIgnore, SIGNAL(clicked()),
150  this, SLOT(ignorePoints()));
151 
152  m_multiDelete = new QPushButton("&Delete Points");
153  m_multiDelete->setAutoDefault(false);
154  m_multiIgnore->setToolTip("Set selected points to Delete");
155  m_multiIgnore->setWhatsThis("<b>Function: </b> Delete the selected points \
156  from control network. You will not be able to \
157  preview in the Point Editor before they are \
158  deleted. \
159  <p><b>Hint: </b> You can select more than one \
160  item in the list by using the shift or control \
161  key.</p>");
162  connect(m_multiDelete, SIGNAL(clicked()),
163  this, SLOT(deletePoints()));
164 
165  m_setApriori = new QPushButton("&Set Apriori/Sigmas");
166  m_setApriori->setAutoDefault(false);
167  m_setApriori->setToolTip("Set selected points apriori/sigmas");
168  m_setApriori->setWhatsThis("<b>Function: </b> Set the apriori points \
169  and sigmas. \
170  <p><b>Hint: </b> You can select more than one \
171  item in the list by using the shift or control \
172  key.</p>");
173  connect(m_setApriori, SIGNAL(clicked()), this, SLOT(aprioriDialog()));
174 
175  m_filter = new QPushButton("&Filter");
176  m_filter->setAutoDefault(false);
177  m_filter->setToolTip("Filter Current List");
178  m_filter->setWhatsThis("<b>Function: </b> Filters the current list by user \
179  specifications made in the selected filter. \
180  <p><b>Note: </b> Any filter options selected in a \
181  filter that is not showing will be ignored.</p>");
182  connect(m_filter, SIGNAL(clicked()),
183  this, SLOT(filter()));
184 
185  QPushButton *reset = new QPushButton("&Show All");
186  reset->setAutoDefault(false);
187  reset->setToolTip("Reset the Current List to show all the values in the list");
188  reset->setWhatsThis("<b>Function: </b> Resets the list of points, \
189  overlaps, or images to the complete initial list. \
190  Any filtering that has been done will be lost.");
191  connect(reset, SIGNAL(clicked()),
192  this, SLOT(resetList()));
193  connect(reset, SIGNAL(clicked()),
194  this, SLOT(resetFilter()));
195 
196  // Set up layout
197  QHBoxLayout *layout = new QHBoxLayout();
198  layout->addWidget(load);
199  layout->addWidget(m_tie);
200  layout->addWidget(m_multiIgnore);
201  layout->addWidget(m_multiDelete);
202  layout->addWidget(m_setApriori);
203  layout->addWidget(m_filter);
204  layout->addWidget(reset);
205 
206  // Create filter stacked widgets
207  createFilters();
208  m_filterStack->adjustSize();
209 
210  // Set up the main window
211  m_navDialog = new QDialog(parent);
212  m_navDialog->setWindowTitle("Control Network Navigator");
213 
214  // Layout everything in the dialog
215  QGridLayout *gridLayout = new QGridLayout();
216  gridLayout->addWidget(m_listCombo, 0, 0);
217  gridLayout->addWidget(filterLabel, 0, 1);
218  gridLayout->addWidget(m_listBox, 1, 0);
219  gridLayout->addWidget(m_filterStack, 1, 1);
220  gridLayout->addWidget(m_filterCountLabel, 2, 0);
221  gridLayout->addLayout(layout, 3, 0, 1, 2);
222  m_navDialog->setLayout(gridLayout);
223 
224  QString settingsFileName =
225  FileName("$HOME/.Isis/" + QApplication::applicationName() + "/NavTool.config").expanded();
226  QSettings settings(settingsFileName, QSettings::NativeFormat);
227  m_navDialog->resize(settings.value("size").toSize());
228 
229  // View the dialog - we need this to get the size of the dialog which we're using
230  // for positioning it.
231  m_navDialog->setVisible(true);
232 
233  QPoint defaultPos = parent->pos() +
234  QPoint(parent->size().width() / 2,
235  parent->size().height() / 2);
236  defaultPos -= QPoint(m_navDialog->size().width() / 2,
237  m_navDialog->size().height() / 2);
238  m_navDialog->move(settings.value("pos", defaultPos).toPoint());
239 
240  }
241 
242 
243  QnetNavTool::~QnetNavTool() {
244  QString settingsFileName =
245  FileName("$HOME/.Isis/" + QApplication::applicationName() + "/NavTool.config").expanded();
246  QSettings settings(settingsFileName, QSettings::NativeFormat);
247 
248  settings.setValue("size", m_navDialog->size());
249  settings.setValue("pos", m_navDialog->pos());
250  }
251 
252 
273  // Set up the point filters
274  QTabWidget *pointFilters = new QTabWidget();
275 
276  QWidget *jigsawErrorFilter = new QnetPointJigsawErrorFilter(this);
277  connect(jigsawErrorFilter, SIGNAL(filteredListModified()),
278  this, SLOT(filterList()));
279  pointFilters->insertTab(JigsawErrors, jigsawErrorFilter, "&Jigsaw Errors");
280  pointFilters->setTabToolTip(JigsawErrors, "Filter Points by Jigsaw Error");
281  pointFilters->setTabWhatsThis(JigsawErrors,
282  "<b>Function: </b> Filter points list by \
283  the bundle adjust error value at each \
284  point. You can filter for points that \
285  have an error greater than, or less than \
286  the entered value.");
287 
288  QWidget *registrationErrorFilter = new QnetPointRegistrationErrorFilter(this);
289  connect(registrationErrorFilter, SIGNAL(filteredListModified()),
290  this, SLOT(filterList()));
291  pointFilters->insertTab(RegistrationErrors, registrationErrorFilter,
292  "&Registration Errors");
293  pointFilters->setTabToolTip(RegistrationErrors,
294  "Filter Points by Registration Error");
295  pointFilters->setTabWhatsThis(RegistrationErrors,
296  "<b>Function: </b> Filter points list by \
297  the registration pixel shift value at each \
298  point. You can filter for points that \
299  have an error greater than, or less than \
300  the entered value. The maximum for all \
301  measures in the point is used");
302 
303  QWidget *ptIdFilter = new QnetPointIdFilter(this);
304  connect(ptIdFilter, SIGNAL(filteredListModified()),
305  this, SLOT(filterList()));
306  pointFilters->insertTab(Id, ptIdFilter, "&Point ID");
307  pointFilters->setTabToolTip(Id, "Filter Points by PointID");
308 
309  QWidget *ptImageFilter = new QnetPointImagesFilter(this);
310  connect(ptImageFilter, SIGNAL(filteredListModified()),
311  this, SLOT(filterList()));
312  pointFilters->insertTab(NumberImages, ptImageFilter, "&Number of Measures");
313  pointFilters->setTabToolTip(NumberImages, "Filter Points by Number of Images");
314  pointFilters->setTabWhatsThis(NumberImages, "<b>Function: </b> Filter points list \
315  by the number of images that are in \
316  each point. You can filter for \
317  points that have more than the given \
318  number of images, or less than the \
319  given number of images. Points with \
320  the exact number of images specified \
321  will not be included in the filtered \
322  list.");
323  QWidget *typeFilter = new QnetPointTypeFilter(this);
324  connect(typeFilter, SIGNAL(filteredListModified()),
325  this, SLOT(filterList()));
326  pointFilters->insertTab(Type, typeFilter, "Point Properties");
327  pointFilters->setTabToolTip(Type, "Filter Points by Listed Properties");
328  pointFilters->setTabWhatsThis(Type, "<b>Function: </b> Filter points list by \
329  their Point Type, Ignore status, or Held status properties");
330  QWidget *rangeFilter = new QnetPointRangeFilter(this);
331  connect(rangeFilter, SIGNAL(filteredListModified()),
332  this, SLOT(filterList()));
333  pointFilters->insertTab(LatLonRange, rangeFilter, "&Range");
334  pointFilters->setTabToolTip(LatLonRange, "Filter Points by Range");
335  pointFilters->setTabWhatsThis(LatLonRange, "<b>Function: </b> Filters out points \
336  that are within a user set range lat/lon \
337  range.");
338  QWidget *ptDistFilter = new QnetPointDistanceFilter(this);
339  connect(ptDistFilter, SIGNAL(filteredListModified()),
340  this, SLOT(filterList()));
341  pointFilters->insertTab(Distance, ptDistFilter, "Dist&ance");
342  pointFilters->setTabToolTip(Distance, "Filter Points by Distance");
343  pointFilters->setTabWhatsThis(Distance,
344  "<b>Function: </b> Filter points list by \
345  a user specified maximum distance from \
346  any other point.");
347  QWidget *measureFilter = new QnetPointMeasureFilter(this);
348  connect(measureFilter, SIGNAL(filteredListModified()),
349  this, SLOT(filterList()));
350  pointFilters->insertTab(MeasureType, measureFilter, "Measure Properties");
351  pointFilters->setTabToolTip(MeasureType, "Filter Points by Listed Measure Properties");
352  pointFilters->setTabWhatsThis(MeasureType,
353  "<b>Function: </b> Filter points list by \
354  the properties of their measures. User may \
355  filter by Measure Type or Ignore status. \
356  If one or more measure from a point is found to \
357  match a selected measure type, and that measure \
358  satisfies the ignore status selected, the point \
359  will be left in the filtered list. More \
360  than one measure type can be selected. \
361  Only one Ignore status may be selected.");
362 
363  QWidget *goodnessFilter = new QnetPointGoodnessFilter(this);
364  connect(goodnessFilter, SIGNAL(filteredListModified()),
365  this, SLOT(filterList()));
366  pointFilters->insertTab(GoodnessOfFit, goodnessFilter, "&Goodness of Fit");
367  pointFilters->setTabToolTip(GoodnessOfFit, "Filter Points by the Goodness of Fit of its measures");
368  pointFilters->setTabWhatsThis(GoodnessOfFit,
369  "<b>Function: </b> Filter points list by \
370  the goodness of fit.");
371  QWidget *cubeNamesFilter = new QnetPointCubeNameFilter(this);
372  connect(cubeNamesFilter, SIGNAL(filteredListModified()),
373  this, SLOT(filterList()));
374  connect(this, SIGNAL(serialListModified()),
375  cubeNamesFilter, SLOT(createCubeList()));
376 
377  pointFilters->insertTab(CubeName, cubeNamesFilter, "&Cube Name(s)");
378  pointFilters->setTabToolTip(CubeName, "Filter Points by Cube FileName(s)");
379  pointFilters->setTabWhatsThis(CubeName,
380  "<b>Function: </b> Filter points list by \
381  the filenames of cubes. This filter will \
382  show all points contained in a single \
383  image or all points contained in every \
384  cube selected.");
385  // Set up the cube filters
386  QTabWidget *cubeFilters = new QTabWidget();
387 
388  QWidget *cubeNameFilter = new QnetCubeNameFilter(this);
389  connect(cubeNameFilter, SIGNAL(filteredListModified()),
390  this, SLOT(filterList()));
391  cubeFilters->insertTab(Name, cubeNameFilter, "&Cube Name");
392  cubeFilters->setTabToolTip(Name, "Filter Images by Cube Name");
393 
394  QWidget *cubePtsFilter = new QnetCubePointsFilter(this);
395  connect(cubePtsFilter, SIGNAL(filteredListModified()),
396  this, SLOT(filterList()));
397  cubeFilters->insertTab(NumberPoints, cubePtsFilter, "&Number of Points");
398  cubeFilters->setTabToolTip(NumberPoints, "Filter Images by Number of Points");
399  cubeFilters->setTabWhatsThis(NumberPoints,
400  "<b>Function: </b> Filter images list by \
401  the number of points that are in each \
402  image. You can filter for images that have \
403  more than the given number of points, or \
404  less than the given number of point. \
405  Images with the exact number of points \
406  specified will not be included in the \
407  filtered list.");
408  QWidget *cubeDistFilter = new QnetCubeDistanceFilter(this);
409  connect(cubeDistFilter, SIGNAL(filteredListModified()),
410  this, SLOT(filterList()));
411  cubeFilters->insertTab(PointDistance, cubeDistFilter, "Dist&ance");
412  cubeFilters->setTabToolTip(PointDistance, "Filter Images by Distance between Points");
413  cubeFilters->setTabWhatsThis(PointDistance,
414  "<b>Function: </b> Filter images list by \
415  a user specified distance between points \
416  in the image. This may be calculated in \
417  meters or by pixel distance.");
418 
419  // Add widgets to the filter stack
420  m_filterStack->addWidget(pointFilters);
421  m_filterStack->addWidget(cubeFilters);
422  }
423 
424 
425  QList<int> &QnetNavTool::filteredImages() {
426  return m_filteredImages;
427  }
428 
429 
430  const QList<int> &QnetNavTool::filteredImages() const {
431  return m_filteredImages;
432  }
433 
434 
435  QList<int> &QnetNavTool::filteredPoints() {
436  return m_filteredPoints;
437  }
438 
439 
440  const QList<int> &QnetNavTool::filteredPoints() const {
441  return m_filteredPoints;
442  }
443 
444 
445  ControlNet *QnetNavTool::controlNet() {
446  return m_qnetTool->controlNet();
447  }
448 
449 
450  const ControlNet *QnetNavTool::controlNet() const {
451  return m_qnetTool->controlNet();
452  }
453 
454 
455  SerialNumberList *QnetNavTool::serialNumberList() {
456  return m_qnetTool->serialNumberList();
457  }
458 
459 
460  const SerialNumberList *QnetNavTool::serialNumberList() const {
461  return m_qnetTool->serialNumberList();
462  }
463 
464 
487  m_filtered = false;
488  // Dont do anything if there are no cubes loaded
489  if (m_qnetTool->serialNumberList() == NULL)
490  return;
491 
492  // Clear the old list and filtered lists and update with the entire list
493  m_listBox->setCurrentRow(-1);
494  m_listBox->clear();
495  m_filteredPoints.clear();
496  m_filteredImages.clear();
497 
498  // copy the control net indices into the filtered points list
499  int numCp = controlNet()->GetNumPoints();
500  m_filteredPoints.reserve(numCp);
501  for (int i = 0; i < numCp; i++) {
502  m_filteredPoints.push_back(i);
503  }
504  // copy the serial number indices into the filtered images list
505  int numSns = m_qnetTool->serialNumberList()->size();
506  m_filteredImages.reserve(numSns);
507  for (int i = 0; i < numSns; i++) {
508  m_filteredImages.push_back(i);
509  }
510 
511  // We are dealing with points so output the point numbers
512  if (m_listCombo->currentIndex() == Points) {
513  // disconnect any old signals
514  disconnect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
515  this, SLOT(load(QListWidgetItem *)));
516  connect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
517  this, SLOT(editPoint(QListWidgetItem *)), Qt::UniqueConnection);
518  //m_listBox->setSelectionMode(QAbstractItemView::SingleSelection);
519  for (int i = 0; i < controlNet()->GetNumPoints(); i++) {
520  QString cNetId = (*controlNet())[i]->GetId();
521  QString itemString = cNetId;
522  m_listBox->insertItem(i, itemString);
523  int images = (*controlNet())[i]->GetNumMeasures();
524  m_listBox->item(i)->setToolTip(QString::number(images) + " image(s) in point");
525  }
526  // Make sure edit point is selected and in view.
527  updateEditPoint(m_editPointId);
528 
529  QString msg = "Filter Count: " + QString::number(m_listBox->count()) +
530  " / " + QString::number(controlNet()->GetNumPoints());
531  m_filterCountLabel->setText(msg);
532  }
533  // We are dealing with images so output the cube names
534  else if (m_listCombo->currentIndex() == Cubes) {
535  disconnect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
536  this, SLOT(editPoint(QListWidgetItem *)));
537  connect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
538  this, SLOT(load(QListWidgetItem *)), Qt::UniqueConnection);
539  //m_listBox->setSelectionMode(QAbstractItemView::ExtendedSelection);
540  for (int i = 0; i < serialNumberList()->size(); i++) {
541  FileName filename = FileName(serialNumberList()->fileName(i));
542  QString tempFileName = filename.name();
543  m_listBox->insertItem(i, tempFileName);
544  }
545  QString msg = "Filter Count: " + QString::number(m_listBox->count()) +
546  " / " + QString::number(serialNumberList()->size());
547  m_filterCountLabel->setText(msg);
548 
549  }
550  }
551 
552 
564  void QnetNavTool::updateEditPoint(QString pointId) {
565 
566  m_editPointId = pointId;
567  if (pointId == "")
568  return;
569 
570  QList<QListWidgetItem *> items = m_listBox->findItems(pointId, Qt::MatchExactly);
571  if (items.isEmpty()) {
572  m_listBox->clearSelection();
573  }
574  else {
575  m_listBox->setCurrentItem(items.at(0));
576  }
577  return;
578  }
579 
580 
581 
589  if (m_filtered) {
590  filter();
591  }
592  else {
593  resetList();
594  }
595 
596  }
597 
602 
603  }
604 
617  // Don't do anything if there are no cubes loaded
618  if (serialNumberList() == NULL)
619  return;
620 
621  // Clears the old list and puts the filtered list in its place
622  m_listBox->setCurrentRow(-1);
623  m_listBox->clear();
624 
625  // We are dealing with points so output the point numbers
626  if (m_listCombo->currentIndex() == Points) {
627  disconnect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
628  this, SLOT(load(QListWidgetItem *)));
629  connect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
630  this, SLOT(editPoint(QListWidgetItem *)), Qt::UniqueConnection);
631 
632  for (int i = 0; i < m_filteredPoints.size(); i++) {
633  QString cNetId = (*controlNet())[m_filteredPoints[i]]->GetId();
634  QString itemString = cNetId;
635  m_listBox->insertItem(i, itemString);
636  int images = (*controlNet())[m_filteredPoints[i]]->GetNumMeasures();
637  m_listBox->item(i)->setToolTip(QString::number(images) + " image(s) in point");
638  }
639  QString msg = "Filter Count: " + QString::number(m_listBox->count()) +
640  " / " + QString::number(controlNet()->GetNumPoints());
641  m_filterCountLabel->setText(msg);
642  updateEditPoint(m_editPointId);
643  }
644  // We are dealing with images so write out the cube names
645  else if (m_listCombo->currentIndex() == Cubes) {
646  disconnect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
647  this, SLOT(editPoint(QListWidgetItem *)));
648  connect(m_listBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
649  this, SLOT(load(QListWidgetItem *)), Qt::UniqueConnection);
650  for (int i = 0; i < m_filteredImages.size(); i++) {
651  FileName filename = FileName(serialNumberList()->fileName(m_filteredImages[i]));
652  QString tempFileName = filename.name();
653  m_listBox->insertItem(i, tempFileName);
654  }
655  QString msg = "Filter Count: " + QString::number(m_listBox->count()) +
656  " / " + QString::number(serialNumberList()->size());
657  m_filterCountLabel->setText(msg);
658  }
659  }
660 
661 
662 
680  // Dont do anything if no cubes are loaded
681  if (serialNumberList() == NULL)
682  return;
683 
684  // TODO: How do we handle them opening 2 overlaps or points that have the
685  // cube in them, open 2 of the same file or only open 1???
686  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
687  if (selected.size() < 1) {
688  QMessageBox::information((QWidget *)parent(),
689  "Error", "No file selected to load.");
690  return;
691  }
692 
693  QApplication::setOverrideCursor(Qt::WaitCursor);
694  for (int i = 0; i < selected.size(); i++) {
695  int index = m_listBox->row(selected[i]);
696  // Tell the filetool to load all images for the given point
697  if (m_listCombo->currentIndex() == Points) {
698  if (m_filteredPoints.size() == 0) {
699  emit loadPointImages((*controlNet())[index]);
700  }
701  else {
702  emit loadPointImages((*controlNet())[m_filteredPoints[index]]);
703  }
704  }
705  // Tell the filetool to load the given image
706  else if (m_listCombo->currentIndex() == Cubes) {
707  if (m_filteredImages.size() == 0) {
708  QString serialNumber = (*serialNumberList()).serialNumber(index);
709  QString sn = serialNumber;
710  emit loadImage(sn);
711  }
712  else {
713  QString serialNumber = (*serialNumberList()).serialNumber(m_filteredImages[index]);
714  QString sn = serialNumber;
715  emit loadImage(sn);
716  }
717  }
718  }
719  QApplication::restoreOverrideCursor();
720  return;
721  }
722 
723 
724 
725 
735  void QnetNavTool::load(QListWidgetItem *) {
736  load();
737  }
738 
744  void QnetNavTool::editPoint(QListWidgetItem *ptItem) {
745 
746  int index = m_listBox->row(ptItem);
747  if (m_filteredPoints.size() == 0) {
748  emit modifyPoint((*controlNet())[index]);
749  }
750  else {
751  emit modifyPoint((*controlNet())[m_filteredPoints[index]]);
752  }
753 
754  }
755 
764 
765  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
766  if (selected.size() > 1) {
767  QMessageBox::information((QWidget *)parent(),
768  "Error", "Only one point can be modified at a time");
769  return;
770  }
771  else if (selected.size() < 1) {
772  QMessageBox::information((QWidget *)parent(),
773  "Error", "No point selected to modify.");
774  return;
775  }
776  int index = m_listBox->row(selected[0]);
777  if (m_filteredPoints.size() == 0) {
778  emit modifyPoint((*controlNet())[index]);
779  }
780  else {
781  emit modifyPoint((*controlNet())[m_filteredPoints[index]]);
782  }
783  }
784 
785 
797  // do nothing if no cubes are loaded
798  if (serialNumberList() == NULL) return;
799 
800  int index = m_listBox->currentRow();
801  if (index < 0) {
802  QApplication::restoreOverrideCursor();
803  QMessageBox::information((QWidget *)parent(),
804  "Error", "No point selected to ignore");
805  return;
806  }
807  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
808  switch (QMessageBox::question((QWidget *)parent(),
809  "Control Network Navigator - Ignore Points",
810  "You have chosen to set "
811  + QString::number(selected.size())
812  + " point(s) to ignore. Do you want to continue?",
813  "&Yes", "&No", 0, 0)) {
814  case 0: // Yes was clicked or Enter was pressed, delete points
815  QApplication::setOverrideCursor(Qt::WaitCursor);
816  int lockedPoints = 0;
817  for (int i = 0; i < selected.size(); i++) {
818  int index = m_listBox->row(selected[i]);
819  if (m_filteredPoints.size() == 0) {
820  if ((*controlNet())[index]->SetIgnored(true) ==
821  ControlPoint::PointLocked) lockedPoints++;
822  }
823  else {
824  if ((*controlNet())[m_filteredPoints[index]]->SetIgnored(true)
825  == ControlPoint::PointLocked) lockedPoints++;
826  }
827  emit pointChanged((*controlNet())[m_filteredPoints[index]]->GetId());
828  }
829  // Print info about locked points if there are any
830  if (lockedPoints > 0) {
831  QMessageBox::information((QWidget *)parent(),"EditLocked Points",
832  QString::number(lockedPoints) + " / "
833  + QString::number(selected.size())
834  + " points are EditLocked and were not set to Ignored.");
835  }
836  QApplication::restoreOverrideCursor();
837  if (lockedPoints != selected.size()) emit netChanged();
838 
839  break;
840  // case 1: // No was clicked, close window and do nothing to points
841  }
842  return;
843  }
844 
845 
866  // do nothing if no cubes are loaded
867  if (serialNumberList() == NULL)
868  return;
869 
870  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
871 
872  if (selected.size() < 1) {
873  QApplication::restoreOverrideCursor();
874  QMessageBox::information((QWidget *)parent(),
875  "Error", "No point selected to delete");
876  return;
877  }
878  switch (QMessageBox::question((QWidget *)parent(),
879  "Control Network Navigator - Delete Points",
880  "You have chosen to delete "
881  + QString::number(selected.size())
882  + " point(s). Do you want to continue?",
883  "&Yes", "&No", 0, 0)) {
884  case 0: // Yes was clicked or Enter was pressed, delete points
885 
886 
887 #if 0 // If resetting filtered list, then re-filtering too slow, try code below
888 
889  // Keep track of rows to be deleted. They cannot be deleted until
890  // the end, or indices in list widget will be incorrect.
891  vector<int> deletedRows;
892  // Keep track of points deleted so far, to keep indices into network
893  // (stored in g_filteredPoints) accurate, they will need to be adjusted
894  // on the fly.
895  int deletedSoFar = 0;
896 
897  for (int i = 0; i < g_filteredPoints.size(); i++) {
898  if (m_listBox->item(i)->isSelected() {
899  QString id = m_listBox->item(i)->text();
900  if (g_controlNetwork->DeletePoint(id) == ControlPoint::PointLocked) {
901  lockedPoints++;
902  }
903  }
904  }
905 #endif
906  int lockedPoints = 0;
907  for (int i = 0; i < selected.size(); i++) {
908  QString id = selected.at(i)->text();
909  if (controlNet()->DeletePoint(id) == ControlPoint::PointLocked) {
910  lockedPoints++;
911  }
912  }
913 
914  // Print info about locked points if there are any
915  if (lockedPoints > 0) {
916  QMessageBox::information((QWidget *)parent(),"EditLocked Points",
917  QString::number(lockedPoints) + " / "
918  + QString::number(selected.size())
919  + " points are EditLocked and were not deleted.");
920  }
921 
922  // Reset filter list, if this becomes too slow, we might need to
923  // implement smarter algorithm, which would require adjusting indices
924  // as points get deleted. See commented out code above.
925  m_filteredPoints.clear();
926  // copy the control net indices into the filtered points list
927  for (int i = 0; i < controlNet()->GetNumPoints(); i++) {
928  m_filteredPoints.push_back(i);
929  }
930  emit deletedPoints();
931  emit netChanged();
932  break;
933  // case 1: // No was clicked, close window and do nothing to points
934  }
935  return;
936  }
937 
938 
954  // If no cubes are loaded, simply return
955  if (serialNumberList() == NULL)
956  return;
957 
958  if (!m_aprioriDialog) {
959  m_aprioriDialog = new QnetSetAprioriDialog(m_qnetTool);
961  connect(m_listBox, SIGNAL(itemSelectionChanged()),
962  this, SLOT(setAprioriDialogPoints()));
963  connect(m_aprioriDialog, SIGNAL(pointChanged(QString)),
964  this, SIGNAL(pointChanged(QString)));
965  connect(m_aprioriDialog, SIGNAL(netChanged()),
966  this, SIGNAL(netChanged()));
967  connect(m_aprioriDialog, SIGNAL(aprioriDialogClosed()),
968  this, SLOT(disconnectAprioriDialog()));
969  }
970  m_aprioriDialog->setVisiblity();
971  }
972 
973 
982 
983  if (m_aprioriDialog == NULL) return;
984 
985  // If cubes selected, return
986  if (m_listCombo->currentIndex() == Cubes) return;
987 
988  int index = m_listBox->currentRow();
989  if (index < 0) return;
990 
991  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
992  m_aprioriDialog->setPoints(selected);
993 
994  }
995 
996 
1005  if (m_aprioriDialog) {
1006  disconnect(m_listBox, SIGNAL(itemSelectionChanged()),
1007  this, SLOT(setAprioriDialogPoints()));
1008  disconnect(m_aprioriDialog, 0, 0, 0);
1009  m_aprioriDialog = NULL;
1010  }
1011  }
1012 
1013 
1036 
1037  m_filtered = true;
1038  QApplication::setOverrideCursor(Qt::WaitCursor);
1039  m_filter->setEnabled(false);
1040 
1041  QTabWidget *tab = (QTabWidget *)(m_filterStack->currentWidget());
1042 
1043  // We're dealing with points
1044  if (m_listCombo->currentIndex() == Points) {
1045  PointFilterIndex pointIndex = (PointFilterIndex) tab->currentIndex();
1046  // We have a jigsaw errors filter
1047  if (pointIndex == JigsawErrors) {
1048  QnetPointJigsawErrorFilter *widget =
1049  (QnetPointJigsawErrorFilter *)(tab->currentWidget());
1050  widget->filter();
1051  }
1052  // We have a registration errors filter
1053  if (pointIndex == RegistrationErrors) {
1055  (QnetPointRegistrationErrorFilter *)(tab->currentWidget());
1056  widget->filter();
1057  }
1058  // We have a point id filter
1059  else if (pointIndex == Id) {
1060  QnetPointIdFilter *widget =
1061  (QnetPointIdFilter *)(tab->currentWidget());
1062  widget->filter();
1063  }
1064  // We have a number of images filter
1065  else if (pointIndex == NumberImages) {
1066  QnetPointImagesFilter *widget =
1067  (QnetPointImagesFilter *)(tab->currentWidget());
1068  widget->filter();
1069  }
1070  // We have a point type filter
1071  else if (pointIndex == Type) {
1072  QnetPointTypeFilter *widget =
1073  (QnetPointTypeFilter *)(tab->currentWidget());
1074  widget->filter();
1075  }
1076  // We have a lat/lon range filter
1077  else if (pointIndex == LatLonRange) {
1078  QnetPointRangeFilter *widget =
1079  (QnetPointRangeFilter *)(tab->currentWidget());
1080  widget->filter();
1081  }
1082  // We have a distance filter
1083  else if (pointIndex == Distance) {
1084  QnetPointDistanceFilter *widget =
1085  (QnetPointDistanceFilter *)(tab->currentWidget());
1086  widget->filter();
1087  }
1088  // We have a measure filter
1089  else if (pointIndex == MeasureType) {
1090  QnetPointMeasureFilter *widget =
1091  (QnetPointMeasureFilter *)(tab->currentWidget());
1092  widget->filter();
1093  }
1094  // We have a goodness of fit filter
1095  else if(pointIndex == GoodnessOfFit) {
1096  QnetPointGoodnessFilter *widget =
1097  (QnetPointGoodnessFilter *)(tab->currentWidget());
1098  widget->filter();
1099  }
1100  // We have a cube name filter
1101  else if (pointIndex == CubeName) {
1102  QnetPointCubeNameFilter *widget =
1103  (QnetPointCubeNameFilter *)(tab->currentWidget());
1104  widget->filter();
1105  }
1106  }
1107 
1108  // We're dealing with cubes
1109  else if (m_listCombo->currentIndex() == Cubes) {
1110  CubeFilterIndex cubeIndex = (CubeFilterIndex) tab->currentIndex();
1111  // We have a cube name filter
1112  if (cubeIndex == Name) {
1113  QnetCubeNameFilter *widget =
1114  (QnetCubeNameFilter *)(tab->currentWidget());
1115  widget->filter();
1116  }
1117  // We have a point filter
1118  else if (cubeIndex == NumberPoints) {
1119  QnetCubePointsFilter *widget =
1120  (QnetCubePointsFilter *)(tab->currentWidget());
1121  widget->filter();
1122  }
1123  // We have a distance filter
1124  else if (cubeIndex == PointDistance) {
1125  QnetCubeDistanceFilter *widget =
1126  (QnetCubeDistanceFilter *)(tab->currentWidget());
1127  widget->filter();
1128  }
1129  }
1130  m_filter->setEnabled(true);
1131  QApplication::restoreOverrideCursor();
1132  return;
1133  }
1134 
1143  if (m_listCombo->currentIndex() == Points) {
1144  m_tie->setEnabled(true);
1145  m_multiIgnore->setEnabled(true);
1146  m_multiDelete->setEnabled(true);
1147  m_setApriori->setEnabled(true);
1148  }
1149  else {
1150  m_tie->setEnabled(false);
1151  m_multiIgnore->setEnabled(false);
1152  m_multiDelete->setEnabled(false);
1153  m_setApriori->setEnabled(false);
1154  if (m_aprioriDialog != NULL) {
1155  m_aprioriDialog->close();
1156  }
1157  }
1158  }
1159 
1170  emit serialListModified();
1171  }
1172 
1181  m_navDialog->setVisible(true);
1182  }
1183 
1184 #if 0
1185 
1188  void QnetNavTool::listLockedPoints() {
1189 
1190  QDialog lockDialog = new QDialog();
1191  lockDialog.setWindowTitle("Un-lock Points");
1192  lockDialog.setModal(true);
1193 
1194  QListWidget editLockPointsListBox = new QListWidget(lockDialog);
1195  connect(editLockPointsListBox, SIGNAL(itemChanged(QListWidgetItem *)),
1196  this, SLOT(unlockPoint(QListWidgetItem *)));
1197 
1198  QList<QListWidgetItem *> selected = m_listBox->selectedItems();
1199  QList<QListWidgetItem *> lockedPoints;
1200 
1201  // Fill editLock List Box
1202  for (int i=0; i<selected.size(); i++) {
1203  QString id = selected.at(i)->text();
1204  ControlPoint *pt = g_controlNetwork->GetPoint(id);
1205  if (pt->IsEditLocked()) {
1206  QListWidgetItem *item = new QListWidgetItem(*(selected[i]));
1207  item->setCheckState(Qt::Checked);
1208  editLockPointsListBox->addItem(item);
1209  }
1210  }
1211 
1212  if (lockDialog.exec()) {
1213 
1214  }
1215 
1216 
1217 
1218  switch (QMessageBox::question((QWidget *)parent(),
1219  "Control Network Navigator - Ignore Points",
1220  "You have chosen to set "
1221  + QString::number(selected.size())
1222  + " point(s) to ignore. Do you want to continue?",
1223  "&Yes", "&No", 0, 0)) {
1224  case 0: // Yes was clicked or Enter was pressed, delete points
1225  QApplication::setOverrideCursor(Qt::WaitCursor);
1226  emit pointChanged((*g_controlNetwork)[g_filteredPoints[index]]->GetId());
1227  }
1228 
1229 
1230  }
1231 
1232  void QnetNavTool::unlockPoint(QListWidgetItem *pointId) {
1233  ControlPoint *pt = g_controlNetwork->GetPoint(pointId->text());
1234  if (pt->IsEditLocked() && pointId->checkState() == Qt::Unchecked) {
1235  pt->SetEditLock(false);
1236  editLockPointsListBox->removeItemWidget(pointId);
1237  pointId->setHidden(true);
1238  editLockPointsListBox->repaint();
1239  this->repaint();
1240  emit netChanged();
1241  }
1242 
1243  }
1244 #endif
1245 }
1246 
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:111
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...
int size() const
How many serial number / filename combos are in the list.
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.
void load()
Tells the filetool to load an image, slot for &quot;View Cube(s)&quot; button.
Defines the Distance filter for the QnetNavTool&#39;s Points section.
int GetNumPoints() const
Return the number of control points in the network.
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 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...
Defines the Range filter for the QnetNavTool&#39;s Points section.
void tie()
Calls the qnet tool for the given control point.
void setPoints(QList< QListWidgetItem * > selectedPoints)
Set control points in the dialog.
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.
A single control point.
Definition: ControlPoint.h:339
Defines the Name filter for the QnetNavTool&#39;s Cubes section.
Defines the Point ID filter for the QnetNavTool&#39;s Points section.
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.
Base class for the Qisis tools.
Definition: Tool.h:81
Qnet tool operations.
Definition: QnetTool.h:251
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.
Definition: QnetNavTool.cpp:96
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:393
void editPoint(QListWidgetItem *ptItem)
Emits a modifyPoint signal.

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:27:37