Isis 3 Programmer Reference
ControlHealthMonitorWidget.cpp
Go to the documentation of this file.
1 
24 
25 
26 #include "ControlNet.h"
27 #include "IString.h"
28 #include "Progress.h"
29 #include <QCheckBox>
30 #include <QToolBar>
31 #include <iostream>
32 
33 #include <QApplication>
34 #include <QtCore>
35 #include <QLabel>
36 #include <QtGui>
37 #include <QPushButton>
38 #include <QProgressBar>
39 #include <QTabWidget>
40 #include <QPointer>
41 #include <QTableWidgetItem>
42 #include <QIcon>
43 #include <QLineEdit>
44 #include <QHeaderView>
45 #include <QDesktopWidget>
46 #include <QGridLayout>
47 #include <QWidgetAction>
48 #include <QMenu>
49 #include <ControlNet.h>
50 #include <ControlNetVitals.h>
51 #include <ControlPoint.h>
52 
53 
54 namespace Isis {
55 
65  createGui();
66  m_vitals = vitals;
67 
68  connect (m_vitals, SIGNAL(networkChanged()),
69  this, SLOT(update()));
70 
71  connect (m_vitals, SIGNAL(historyEntry(QString, QString, QVariant, QVariant, QString)),
72  this, SLOT (historyEntry(QString, QString, QVariant, QVariant, QString)));
73  update();
74  }
75 
76 
85  m_numImagesLabel->setText("Images: " + toString(m_vitals->numImages()));
86  m_numPointsLabel->setText("Points " + toString(m_vitals->numPoints()));
87  m_numMeasuresLabel->setText("Measures: " + toString(m_vitals->numMeasures()));
88  m_netLabel->setText("Control Network: " + m_vitals->getNetworkId());
89  m_statusLabel->setText(m_vitals->getStatus());
90  m_statusDetails->setText(m_vitals->getStatusDetails());
91  m_imagesMeasuresValue->setText(toString(m_vitals->numImagesBelowMeasureThreshold()));
92  m_imagesHullValue->setText(toString(m_vitals->numImagesBelowHullTolerance()));
93  m_pointsIgnoredLabel->setText(toString(m_vitals->numIgnoredPoints()));
94  m_pointsFreeLabel->setText(toString(m_vitals->numFreePoints()));
95  m_pointsFixedLabel->setText(toString(m_vitals->numFixedPoints()));
96  m_pointsConstrainedLabel->setText(toString(m_vitals->numConstrainedPoints()));
97  m_pointsEditLockedLabel->setText(toString(m_vitals->numLockedPoints()));
98  m_pointsFewMeasuresLabel->setText(toString(m_vitals->numPointsBelowMeasureThreshold()));
99 
100  double freePercent = ( (double) m_vitals->numFreePoints() ) / ( (double) m_vitals->numPoints() ) * 100;
101  freePercent = ( (int) (freePercent * 100) ) / 100.0;
102  QString freeFormat = toString(m_vitals->numFreePoints()) + " (" + toString(freePercent) + ")%";
103  m_pointsFreeProgressbar->setValue(freePercent);
104  m_pointsFreeProgressbar->setFormat(freeFormat);
105 
106  double constrainedPercent = ( (double) m_vitals->numConstrainedPoints() ) /
107  ( (double) m_vitals->numPoints() ) * 100;
108  constrainedPercent = ( (int) (constrainedPercent * 100) ) / 100.0;
109  QString constrainedFormat = toString(m_vitals->numConstrainedPoints()) + " (" + toString(constrainedPercent) + ")%";
110  m_pointsConstrainedProgressbar->setValue(constrainedPercent);
111  m_pointsConstrainedProgressbar->setFormat(constrainedFormat);
112 
113  double fixedPercent = ( (double) m_vitals->numFixedPoints() ) / ( (double) m_vitals->numPoints() ) * 100;
114  fixedPercent = ( (int) (fixedPercent * 100) ) / 100.0;
115  QString fixedFormat = toString(m_vitals->numFixedPoints()) + " (" + toString(fixedPercent) + ")%";
116  m_pointsFixedProgressbar->setValue(fixedPercent);
117  m_pointsFixedProgressbar->setFormat(fixedFormat);
118 
119 
120  // We should enumerate the network state and do a comparison on enums here, not strings.
121  if (m_vitals->getStatus() == "Broken!") updateStatus(0);
122  else if (m_vitals->getStatus() == "Weak!") updateStatus(1);
123  else if (m_vitals->getStatus() == "Healthy!") updateStatus(2);
124 
125  // QPieSeries series;
126  // series.append("Free", m_vitals->numFreePoints());
127  // series.append("Constrained", m_vitals->numConstrainedPoints());
128  // series.append("Fixed", m_vitals->numFixedPoints());
129  //
130  // foreach (QPieSlice *slice, series->slices()) {
131  //
132  // // Get the percent and round it to two decimal places.
133  // double percent = slice->percentage() * 100;
134  // percent = ( (int) (percent * 100) ) / 100.0;
135  //
136  // QString label = slice->label() + " " + toString(percent) + "%";
137  //
138  // if (percent > 0.0) {
139  // slice->setLabelVisible();
140  // }
141  // slice->setLabel(label);
142  // }
143  // //
144  // m_pointChartView->chart()->removeAllSeries();
145  // m_pointChartView->chart()->addSeries(series);
146 
147  viewImageAll();
148  viewPointAll();
149  }
150 
151 
152  /*
153  * This SLOT is designed to update the values in the gui to properly represent
154  * The current state of the Control Network. This SLOT is triggered whenever the
155  * projectStructureModified() signal is emitted from the Control Network, which triggers
156  * the "Update()" signal in the ControlNetVitals class in which this slot is connected.
157  *
158  * The status bar will display the proper color with respect to the health of the network,
159  * And will display details related to that health as well.
160  *
161  * @param code The status code. Should be an ENUM eventually for the 3 network states.
162  */
163  void ControlHealthMonitorWidget::updateStatus(int code) {
164  QPalette p = m_statusBar->palette();
165  switch(code) {
166  case 0:
167  p.setColor(QPalette::Highlight, Qt::red);
168  p.setColor(QPalette::Text, Qt::black);
169  break;
170  case 1:
171  p.setColor(QPalette::Highlight, Qt::yellow);
172  p.setColor(QPalette::Text, Qt::black);
173  break;
174  case 2:
175  p.setColor(QPalette::Highlight, Qt::green);
176  p.setColor(QPalette::Text, Qt::white);
177  break;
178  }
179  m_statusBar->setPalette(p);
180  }
181 
182 
187 
189  setWindowTitle("Control Net Health Monitor");
190  resize(725, 1100);
191 
192  QFont fontBig("Arial", 18, QFont::Bold);
193  QFont fontNormal("Arial", 14);
194  QFont searchFont("Seqoe UI Symbol", 12);
195 
196  // Parent layout for this entire widget.
197  QVBoxLayout *gridLayout = new QVBoxLayout;
198  gridLayout->setAlignment(Qt::AlignTop);
199  gridLayout->setSpacing(5);
200  setLayout(gridLayout);
201 
202  // Title and net
203  QLabel *titleLabel = new QLabel("Control Net Health Monitor");
204  titleLabel->setFont(fontBig);
205  titleLabel->setAlignment(Qt::AlignTop);
206 
207  QWidget *netWidget = new QWidget;
208  QHBoxLayout *netLayout = new QHBoxLayout;
209  netLayout->setAlignment(Qt::AlignLeft);
210 
211  m_netLabel = new QLabel("Control Network:");
212  m_netLabel->setFont(fontNormal);
213  m_netLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
214  gridLayout->addWidget(titleLabel);
215 
216  netLayout->addWidget(m_netLabel);
217  netWidget->setLayout(netLayout);
218 
219  gridLayout->addWidget(netWidget);
220 
221  // 4 net details, size, images, points, measures.
222  QWidget *stats = new QWidget;
223  QHBoxLayout *netStatsLayout = new QHBoxLayout;
224  netStatsLayout->setAlignment(Qt::AlignLeft);
225  netStatsLayout->setSpacing(25);
226  m_numImagesLabel = new QLabel("Images:");
227  m_numPointsLabel = new QLabel("Points:");
228  m_numMeasuresLabel = new QLabel("Measures:");
229 
230  netStatsLayout->addWidget(m_numImagesLabel);
231  netStatsLayout->addWidget(m_numPointsLabel);
232  netStatsLayout->addWidget(m_numMeasuresLabel);
233 
234  stats->setLayout(netStatsLayout);
235  gridLayout->addWidget(stats);
236 
237  // Status Bar
238  m_statusBar = new QProgressBar();
239  QPalette p = m_statusBar->palette();
240  p.setColor(QPalette::Highlight, Qt::green);
241  p.setColor(QPalette::Text, Qt::red);
242  m_statusBar->setPalette(p);
243  m_statusBar->setRange(0, 0);
244 
245  m_statusBar->setFormat("Loading...");
246  gridLayout->addWidget(m_statusBar);
247 
248  m_lastModLabel = new QLabel("Last Modification:");
249  gridLayout->addWidget(m_lastModLabel);
250 
251  QFrame* line = new QFrame();
252  line->setFrameShape(QFrame::HLine);
253  line->setFrameShadow(QFrame::Sunken);
254  gridLayout->addSpacing(15);
255 
256  gridLayout->addWidget(line);
257  gridLayout->addSpacing(15);
258 
259  // Tabs
260  QTabWidget *tabs = new QTabWidget();
261 
262  QWidget *overviewTab = createOverviewTab();
263  QWidget *imagesTab = createImagesTab();
264  QWidget *pointsTab = createPointsTab();
265  // QWidget *graphTab = createGraphTab();
266 
267  tabs->insertTab(0, overviewTab, "Overview");
268  tabs->insertTab(1, imagesTab, "Images");
269  tabs->insertTab(2, pointsTab, "Points");
270  // tabs->insertTab(3, graphTab, "Graph");
271 
272  gridLayout->addWidget(tabs);
273  }
274 
275 
281  m_historyTable = NULL;
282  m_imagesHullValue = NULL;
283  m_imagesMeasuresValue = NULL;
284  m_imagesShowingLabel = NULL;
285  m_imagesTable = NULL;
286  m_lastModLabel = NULL;
287  m_numImagesLabel = NULL;
288  m_numMeasuresLabel = NULL;
289  m_numPointsLabel = NULL;
290  // m_pointChartView = NULL;
291  m_pointsEditLockedLabel = NULL;
292  m_pointsFewMeasuresLabel = NULL;
293  m_pointsIgnoredLabel = NULL;
294  m_pointsShowingLabel = NULL;
295  m_pointsTable = NULL;
296  m_statusBar = NULL;
297  m_statusDetails = NULL;
298  m_statusLabel = NULL;
299  m_vitals = NULL;
300  }
301 
302 
303  /*
304  * This method creates the Overview tab.
305  *
306  */
307  QWidget* ControlHealthMonitorWidget::createOverviewTab() {
308 
309  // Parent container for the overview tab.
310  QWidget *overview = new QWidget();
311  QVBoxLayout *overviewLayout = new QVBoxLayout;
312  overviewLayout->setAlignment(Qt::AlignTop);
313  overviewLayout->setSpacing(5);
314 
315  QFont fontBig("Arial", 16, QFont::Bold);
316  QFont fontNormal("Arial", 14);
317  QFont fontSmall("Arial", 12);
318 
319  m_statusLabel = new QLabel("Healthy!");
320  m_statusLabel->setFont(fontBig);
321  m_statusLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
322 
323  m_statusDetails = new QLabel("Your network is healthy.");
324  m_statusDetails->setFont(fontNormal);
325  m_statusDetails->setAlignment(Qt::AlignTop | Qt::AlignLeft);
326 
327  m_statusDetails->setFont(fontNormal);
328  m_statusDetails->setAlignment(Qt::AlignTop | Qt::AlignLeft);
329 
330  overviewLayout->addWidget(m_statusLabel);
331  overviewLayout->addWidget(m_statusDetails);
332  overviewLayout->addSpacing(50);
333 
334  QLabel *modLabel = new QLabel("Modification History");
335  modLabel->setFont(fontSmall);
336  overviewLayout->addWidget(modLabel);
337 
338  QStringList headers;
339  headers.append("Action");
340  headers.append("Id");
341  headers.append("Old Value");
342  headers.append("New Value");
343  headers.append("Timestamp");
344 
345  m_historyTable = new QTableWidget();
346  m_historyTable->setColumnCount(5);
347  m_historyTable->setHorizontalHeaderLabels(headers);
348  m_historyTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
349  m_historyTable->horizontalHeader()->setStretchLastSection(true);
350  m_historyTable->verticalHeader()->setVisible(false);
351  m_historyTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
352  m_historyTable->setSelectionBehavior(QAbstractItemView::SelectRows);
353  m_historyTable->setSelectionMode(QAbstractItemView::SingleSelection);
354  m_historyTable->setGeometry(QApplication::desktop()->screenGeometry());
355 
356  overviewLayout->addWidget(m_historyTable);
357  overview->setLayout(overviewLayout);
358 
359  return overview;
360  }
361 
362 
363  /*
364  * This method creates the Images tab.
365  *
366  */
367  QWidget* ControlHealthMonitorWidget::createImagesTab() {
368  QFont fontSmall("Arial", 12);
369  QFont fontMedium("Arial", 14);
370 
371  // This is the parent QWidget for the images tab.
372  QWidget *imagesTab = new QWidget();
373  QVBoxLayout *imagesLayout = new QVBoxLayout;
374  imagesLayout->setAlignment(Qt::AlignTop);
375  imagesLayout->setSpacing(15);
376  imagesLayout->addSpacing(10);
377 
378  QWidget *temp = new QWidget;
379  QGridLayout *tempLayout = new QGridLayout;
380 
381  // Create the labels
382  QLabel *threeMeasure = new QLabel("Less than 3 valid Measures:");
383  m_imagesMeasuresValue = new QLabel("");
384 
385  QLabel *withoutMeasures = new QLabel("Exceeding convex hull tolerance:");
386  m_imagesHullValue = new QLabel("");
387 
388  // Set the fonts
389  m_imagesMeasuresValue->setFont(fontSmall);
390  threeMeasure->setFont(fontSmall);
391  withoutMeasures->setFont(fontSmall);
392  m_imagesHullValue->setFont(fontSmall);
393 
394  // Create the view buttons
395  QPushButton *button = new QPushButton("View");
396  QPushButton *button2 = new QPushButton("View");
397 
398  connect(button, SIGNAL(clicked()), this, SLOT(viewImageFewMeasures()));
399  connect(button2, SIGNAL(clicked()), this, SLOT(viewImageHullTolerance()));
400 
401  // Add everything in the right spot.
402  tempLayout->addWidget(threeMeasure, 0, 0);
403  tempLayout->addWidget(m_imagesMeasuresValue, 0, 1);
404  tempLayout->addWidget(button, 0, 2);
405 
406  tempLayout->addWidget(withoutMeasures, 1, 0);
407  tempLayout->addWidget(m_imagesHullValue, 1, 1);
408  tempLayout->addWidget(button2, 1, 2);
409 
410  temp->setLayout(tempLayout);
411  imagesLayout->addWidget(temp);
412 
413  // Create the table.
414  m_imagesTable = new QTableWidget();
415 
416  connect(m_imagesTable, SIGNAL(itemDoubleClicked(QTableWidgetItem *)),
417  this, SLOT(emitOpenImageEditor()));
418 
419  QStringList headers;
420  headers.append("#");
421  headers.append("Cube Serial");
422 
423  m_imagesTable->setColumnCount(2);
424  m_imagesTable->setHorizontalHeaderLabels(headers);
425  m_imagesTable->horizontalHeader()->setStretchLastSection(true);
426  m_imagesTable->verticalHeader()->setVisible(false);
427  m_imagesTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
428  m_imagesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
429  m_imagesTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
430 
431  m_imagesTable->setShowGrid(true);
432  m_imagesTable->setGeometry(QApplication::desktop()->screenGeometry());
433  m_imagesTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
434 
435  imagesLayout->addSpacing(30);
436 
437  m_imagesShowingLabel = new QLabel("");
438  m_imagesShowingLabel->setFont(fontMedium);
439 
440  QPushButton *viewAllButton = new QPushButton("View All");
441  connect(viewAllButton, SIGNAL(clicked()),
442  this, SLOT(viewImageAll()));
443 
444  QGridLayout *showingLayout = new QGridLayout;
445  QWidget *showingWidget = new QWidget;
446 
447  showingLayout->addWidget(m_imagesShowingLabel, 0, 0, 1, 2);
448  showingLayout->addWidget(viewAllButton, 0, 2);
449  showingWidget->setLayout(showingLayout);
450 
451  imagesLayout->addWidget(showingWidget);
452  imagesLayout->addWidget(m_imagesTable);
453 
454  imagesTab->setLayout(imagesLayout);
455  return imagesTab;
456  }
457 
458 
459  /*
460  * This method creates the Points tab.
461  *
462  */
463  QWidget* ControlHealthMonitorWidget::createPointsTab() {
464 
465  QFont fontSmall("Arial", 12);
466  QFont fontMedium("Arial", 14);
467  QFont searchFont("Seqoe UI Symbol", 12);
468 
469  // This is the main parent widget for the points tab.
470  QWidget *pointsTab = new QWidget();
471  QVBoxLayout *pointsLayout = new QVBoxLayout;
472  pointsLayout->setAlignment(Qt::AlignTop);
473  pointsLayout->setSpacing(15);
474  pointsLayout->addSpacing(10);
475 
476  QWidget *viewWidget = new QWidget;
477  QGridLayout *viewLayout = new QGridLayout;
478 
479  // Create the labels.
480  QLabel *pointsIgnored = new QLabel("Points Ignored:");
481  m_pointsIgnoredLabel = new QLabel("");
482 
483  QLabel *freePoints = new QLabel("Points Free:");
484  m_pointsFreeLabel = new QLabel("");
485  m_pointsFreeProgressbar = new QProgressBar();
486  QPalette p = m_pointsFreeProgressbar->palette();
487  p.setColor(QPalette::Highlight, Qt::blue);
488  p.setColor(QPalette::Text, Qt::black);
489  m_pointsFreeProgressbar->setPalette(p);
490  m_pointsFreeProgressbar->setRange(0, 100);
491 
492  QLabel *constrainedPoints = new QLabel("Points Constrained:");
493  m_pointsConstrainedLabel = new QLabel("");
494  m_pointsConstrainedProgressbar = new QProgressBar();
495  m_pointsConstrainedProgressbar->setPalette(p);
496  m_pointsConstrainedProgressbar->setRange(0, 100);
497 
498  QLabel *fixedPoints = new QLabel("Points Fixed:");
499  m_pointsFixedLabel = new QLabel("");
500  m_pointsFixedProgressbar = new QProgressBar();
501  m_pointsFixedProgressbar->setPalette(p);
502  m_pointsFixedProgressbar->setRange(0, 100);
503 
504  QLabel *pointsLocked = new QLabel("Points Edit Locked:");
505  m_pointsEditLockedLabel = new QLabel("");
506 
507  QLabel *pointsMeasure = new QLabel("Less than 3 valid Measures:");
508  m_pointsFewMeasuresLabel = new QLabel("");
509 
510  // Set the font for the labels.
511  pointsLocked->setFont(fontSmall);
512  m_pointsEditLockedLabel->setFont(fontSmall);
513  pointsMeasure->setFont(fontSmall);
514  m_pointsFewMeasuresLabel->setFont(fontSmall);
515  freePoints->setFont(fontSmall);
516  m_pointsFreeLabel->setFont(fontSmall);
517  fixedPoints->setFont(fontSmall);
518  constrainedPoints->setFont(fontSmall);
519  pointsIgnored->setFont(fontSmall);
520  m_pointsFixedLabel->setFont(fontSmall);
521  m_pointsConstrainedLabel->setFont(fontSmall);
522  m_pointsIgnoredLabel->setFont(fontSmall);
523 
524  // Create the view buttons.
525  QPushButton *viewIgnoredButton = new QPushButton("View");
526  QPushButton *viewLockedButton = new QPushButton("View");
527  QPushButton *viewMeasureButton = new QPushButton("View");
528  QPushButton *viewFreePoints = new QPushButton("View");
529  QPushButton *viewFixedPoints = new QPushButton("View");
530  QPushButton *viewConstrainedPoints = new QPushButton("View");
531 
532  // Connect the buttons.
533  connect(viewIgnoredButton, SIGNAL(clicked()), this, SLOT(viewPointIgnored()));
534  connect(viewLockedButton, SIGNAL(clicked()), this, SLOT(viewPointEditLocked()));
535  connect(viewMeasureButton, SIGNAL(clicked()), this, SLOT(viewPointFewMeasures()));
536  connect(viewFreePoints, SIGNAL(clicked()), this, SLOT(viewPointFree()));
537  connect(viewFixedPoints, SIGNAL(clicked()), this, SLOT(viewPointFixed()));
538  connect(viewConstrainedPoints, SIGNAL(clicked()), this, SLOT(viewPointConstrained()));
539 
540  // Add the widgets in the proper place.
541  viewLayout->addWidget(freePoints, 0, 0);
542  viewLayout->addWidget(m_pointsFreeProgressbar, 0, 1);
543  viewLayout->addWidget(viewFreePoints, 0, 2);
544 
545  viewLayout->addWidget(fixedPoints, 1, 0);
546  viewLayout->addWidget(m_pointsFixedProgressbar, 1, 1);
547  viewLayout->addWidget(viewFixedPoints, 1, 2);
548 
549  viewLayout->addWidget(constrainedPoints, 2, 0);
550  viewLayout->addWidget(m_pointsConstrainedProgressbar, 2, 1);
551  viewLayout->addWidget(viewConstrainedPoints, 2, 2);
552 
553  viewLayout->addWidget(pointsIgnored, 3, 0);
554  viewLayout->addWidget(m_pointsIgnoredLabel, 3, 1);
555  viewLayout->addWidget(viewIgnoredButton, 3, 2);
556 
557  viewLayout->addWidget(pointsLocked, 4, 0);
558  viewLayout->addWidget(m_pointsEditLockedLabel, 4, 1);
559  viewLayout->addWidget(viewLockedButton, 4, 2);
560 
561  viewLayout->addWidget(pointsMeasure, 5, 0);
562  viewLayout->addWidget(m_pointsFewMeasuresLabel, 5, 1);
563  viewLayout->addWidget(viewMeasureButton, 5, 2);
564 
565  viewWidget->setLayout(viewLayout);
566  pointsLayout->addWidget(viewWidget);
567 
568  // Create the table.
569  m_pointsTable = new QTableWidget();
570  QStringList headers;
571  headers.append("#");
572  headers.append("Point ID");
573  headers.append("Type");
574  headers.append("Ignored");
575  headers.append("Rejected");
576  headers.append("Edit Locked");
577 
578  m_pointsTable->setColumnCount(6);
579  m_pointsTable->setHorizontalHeaderLabels(headers);
580  m_pointsTable->horizontalHeader()->setStretchLastSection(true);
581  m_pointsTable->verticalHeader()->setVisible(false);
582  m_pointsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
583  m_pointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
584  m_pointsTable->setSelectionMode(QAbstractItemView::SingleSelection);
585  m_pointsTable->setShowGrid(true);
586  m_pointsTable->setGeometry(QApplication::desktop()->screenGeometry());
587  m_pointsTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
588 
589  connect(m_pointsTable, SIGNAL(itemDoubleClicked(QTableWidgetItem *)),
590  this, SLOT(emitOpenPointEditor()));
591 
592  m_pointsShowingLabel = new QLabel("");
593  m_pointsShowingLabel->setFont(fontMedium);
594  QPushButton *showAllButton = new QPushButton("View All");
595 
596  QGridLayout *showLayout = new QGridLayout;
597  QWidget *showWidget = new QWidget;
598 
599  connect(showAllButton, SIGNAL(clicked()),
600  this, SLOT(viewPointAll()));
601 
602  showLayout->addWidget(m_pointsShowingLabel, 0, 0, 1, 2);
603  showLayout->addWidget(showAllButton, 0, 2);
604  showWidget->setLayout(showLayout);
605 
606  pointsLayout->addSpacing(30);
607  pointsLayout->addWidget(showWidget);
608  pointsLayout->addWidget(m_pointsTable);
609 
610  pointsTab->setLayout(pointsLayout);
611  return pointsTab;
612  }
613 
614 
624  QList<QString> serials;
625  QModelIndexList rows = m_imagesTable->selectionModel()->selectedRows(1);
626  foreach (QModelIndex index, rows) {
627  serials.append(index.data().toString());
628  }
629  emit openImageEditor(serials);
630  }
631 
632 
642  // Get the point
643  QModelIndex pointId = m_pointsTable->selectionModel()->selectedIndexes()[1];
644  ControlPoint *point = m_vitals->getPoint(pointId.data().toString());
645  emit openPointEditor(point);
646  }
647 
648 
661  void ControlHealthMonitorWidget::historyEntry(QString entry, QString id,
662  QVariant oldValue, QVariant newValue,
663  QString timeStamp) {
664 
665  m_lastModLabel->setText("Last Modification: " + timeStamp);
666 
667  m_historyTable->insertRow(0);
668  m_historyTable->setItem(0, 0, new QTableWidgetItem(entry));
669  m_historyTable->setItem(0, 1, new QTableWidgetItem(id));
670  m_historyTable->setItem(0, 2, new QTableWidgetItem(oldValue.toString()));
671  m_historyTable->setItem(0, 3, new QTableWidgetItem(newValue.toString()));
672  m_historyTable->setItem(0, 4, new QTableWidgetItem(timeStamp));
673  }
674 
675 
676  /*
677  * This method creates the Graph tab.
678  *
679  */
680  QWidget* ControlHealthMonitorWidget::createGraphTab() {
681  QWidget *graph = new QWidget();
682 
683  QVBoxLayout *graphLayout = new QVBoxLayout;
684  graphLayout->setAlignment(Qt::AlignTop);
685  graphLayout->setSpacing(5);
686  //
687  // m_pointChartView = new QChartView;
688  // m_pointChartView->resize(200, 200);
689  // m_pointChartView->setRenderHint(QPainter::Antialiasing);
690  //
691  // QChart *chart = new QChart();
692  // chart->setTitle("Point Breakdown");
693  // chart->setTheme(QChart::ChartThemeBlueCerulean);
694  // chart->legend()->setAlignment(Qt::AlignRight);
695  // m_pointChartView->setChart(chart);
696  // graphLayout->addWidget(m_pointChartView);
697 
698  graph->setLayout(graphLayout);
699  return graph;
700 
701  }
702 
703 
704  /*
705  * This method loads a QList of cube serials into the images table.
706  *
707  */
708  void ControlHealthMonitorWidget::updateImageTable(QList<QString> serials) {
709  m_imagesTable->setRowCount(0);
710  for (int i = 0; i < serials.size(); i++) {
711  m_imagesTable->insertRow(i);
712  m_imagesTable->setItem(i, 0, new QTableWidgetItem(toString(i + 1)));
713  m_imagesTable->setItem(i, 1, new QTableWidgetItem(serials.at(i)));
714  }
715  }
716 
717 
718  /*
719  * This method loads a QList of ControlPoint* into the points table.
720  *
721  */
722  void ControlHealthMonitorWidget::updatePointTable(QList<ControlPoint*> points) {
723  m_pointsTable->setRowCount(0);
724  for (int i = 0; i < points.size(); i++) {
725  ControlPoint *point = points.at(i);
726  m_pointsTable->insertRow(i);
727  m_pointsTable->setItem(i, 0, new QTableWidgetItem(toString(i + 1)));
728  m_pointsTable->setItem(i, 1, new QTableWidgetItem(point->GetId()));
729  m_pointsTable->setItem(i, 2, new QTableWidgetItem(point->GetPointTypeString()));
730  m_pointsTable->setItem(i, 3, new QTableWidgetItem(toString(point->IsIgnored())));
731  m_pointsTable->setItem(i, 4, new QTableWidgetItem(toString(point->IsRejected())));
732  m_pointsTable->setItem(i, 5, new QTableWidgetItem(toString(point->IsEditLocked())));
733  }
734  }
735 
736 
737  /*
738  * This SLOT is designed to view all points in the Control Network.
739  *
740  */
741  void ControlHealthMonitorWidget::viewPointAll() {
742  updatePointTable(m_vitals->getAllPoints());
743  m_pointsShowingLabel->setText("Showing: All Points <sup>" +
744  toString(m_vitals->numPoints()) +
745  " / " + toString(m_vitals->numPoints()) + "</sup>");
746  }
747 
748 
749  /*
750  * This SLOT is designed to view ignored points in the Control Network.
751  *
752  */
753  void ControlHealthMonitorWidget::viewPointIgnored() {
754  updatePointTable(m_vitals->getIgnoredPoints());
755  m_pointsShowingLabel->setText("Showing: Ignored Points <sup>" +
756  toString(m_vitals->numIgnoredPoints()) +
757  " / " + toString(m_vitals->numPoints()) + "</sup>");
758  }
759 
760 
761  /*
762  * This SLOT is designed to view free points in the Control Network.
763  *
764  */
765  void ControlHealthMonitorWidget::viewPointFree() {
766  updatePointTable(m_vitals->getFreePoints());
767  m_pointsShowingLabel->setText("Showing: Free Points <sup>" +
768  toString(m_vitals->numFreePoints()) +
769  " / " + toString(m_vitals->numPoints()) + "</sup>");
770  }
771 
772 
773  /*
774  * This SLOT is designed to view fixed points in the Control Network.
775  *
776  */
777  void ControlHealthMonitorWidget::viewPointFixed() {
778  updatePointTable(m_vitals->getFixedPoints());
779  m_pointsShowingLabel->setText("Showing: Fixed Points <sup>" +
780  toString(m_vitals->numFixedPoints()) +
781  " / " + toString(m_vitals->numPoints()) + "</sup>");
782  }
783 
784 
785  /*
786  * This SLOT is designed to view constrained points in the Control Network.
787  *
788  */
789  void ControlHealthMonitorWidget::viewPointConstrained() {
790  updatePointTable(m_vitals->getConstrainedPoints());
791  m_pointsShowingLabel->setText("Showing: Constrained Points <sup>" +
792  toString(m_vitals->numConstrainedPoints()) +
793  " / " + toString(m_vitals->numPoints()) + "</sup>");
794  }
795 
796 
797  /*
798  * This SLOT is designed to view locked points in the Control Network.
799  *
800  */
801  void ControlHealthMonitorWidget::viewPointEditLocked() {
802  updatePointTable(m_vitals->getLockedPoints());
803  m_pointsShowingLabel->setText("Showing: Locked Points <sup>" +
804  toString(m_vitals->numLockedPoints()) +
805  " / " + toString(m_vitals->numPoints()) + "</sup>");
806 
807  }
808 
809 
810  /*
811  * This SLOT is designed to view points with less than 3 valid measures in the Control Network.
812  *
813  */
814  void ControlHealthMonitorWidget::viewPointFewMeasures() {
815  updatePointTable(m_vitals->getPointsBelowMeasureThreshold());
816  m_pointsShowingLabel->setText("Showing: Points with less than 3 Measures <sup>" +
818  " / " + toString(m_vitals->numPoints()) + "</sup>");
819  }
820 
821 
822  /*
823  * This SLOT is designed to view all images in the Control Network.
824  *
825  */
826  void ControlHealthMonitorWidget::viewImageAll() {
827  updateImageTable(m_vitals->getCubeSerials());
828  m_imagesShowingLabel->setText("Showing: All Images <sup>" +
829  toString(m_vitals->numImages()) +
830  " / " + toString(m_vitals->numImages()) + "</sup>");
831  }
832 
833 
834  /*
835  * This SLOT is designed to view images with less than 3 valid measures in the Control Network.
836  *
837  */
838  void ControlHealthMonitorWidget::viewImageFewMeasures() {
839  updateImageTable(m_vitals->getImagesBelowMeasureThreshold());
840  m_imagesShowingLabel->setText("Showing: Images with less than 3 Measures <sup>" +
842  " / " + toString(m_vitals->numImages()) + "</sup>");
843  }
844 
845 
846  /*
847  * This SLOT is designed to view images below the Convex Hull Tolerance in the Control Network.
848  *
849  */
850  void ControlHealthMonitorWidget::viewImageHullTolerance() {
851  updateImageTable(m_vitals->getImagesBelowHullTolerance());
852  m_imagesShowingLabel->setText("Showing: Images below a hull tolerance of 75% <sup>" +
854  " / " + toString(m_vitals->numImages()) + "</sup>");
855  }
856 
857 
862 
863  delete m_historyTable;
864  delete m_imagesHullValue;
865  delete m_imagesMeasuresValue;
866  delete m_imagesShowingLabel;
867  delete m_imagesTable;
868  delete m_lastModLabel;
869  delete m_numImagesLabel;
870  delete m_numMeasuresLabel;
871  delete m_numPointsLabel;
872  // delete m_pointChartView;
873  delete m_pointsEditLockedLabel;
874  delete m_pointsFewMeasuresLabel;
875  delete m_pointsIgnoredLabel;
876  delete m_pointsShowingLabel;
877  delete m_pointsTable;
878  delete m_statusBar;
879  delete m_statusDetails;
880  delete m_statusLabel;
881  delete m_vitals;
882 
883  m_historyTable = NULL;
884  m_imagesHullValue = NULL;
885  m_imagesMeasuresValue = NULL;
886  m_imagesShowingLabel = NULL;
887  m_imagesTable = NULL;
888  m_lastModLabel = NULL;
889  m_numImagesLabel = NULL;
890  m_numMeasuresLabel = NULL;
891  m_numPointsLabel = NULL;
892  // m_pointChartView = NULL;
893  m_pointsEditLockedLabel = NULL;
894  m_pointsFewMeasuresLabel = NULL;
895  m_pointsIgnoredLabel = NULL;
896  m_pointsShowingLabel = NULL;
897  m_pointsTable = NULL;
898  m_statusBar = NULL;
899  m_statusDetails = NULL;
900  m_statusLabel = NULL;
901  m_vitals = NULL;
902  }
903 }
QList< QString > getImagesBelowMeasureThreshold(int num=3)
This method is designed to return a QList containing cube serials for all images that fall below a me...
QList< ControlPoint * > getLockedPoints()
This method is designed to return all edit locked points in the Control Network.
QList< ControlPoint * > getFreePoints()
This method is designed to return all free points in the Control Network.
int numImagesBelowMeasureThreshold(int num=3)
This method is designed to return the number of images that fall below a measure threshold.
void historyEntry(QString, QString, QVariant, QVariant, QString)
This SLOT is designed to intercept the historyEntry() signal emitted from the ControlNetVitals class ...
QList< ControlPoint * > getPointsBelowMeasureThreshold(int num=3)
This method is designed to return all points that fall below a measure threshold. ...
QString getStatusDetails()
This method is designed to return details for the status of the network.
QList< ControlPoint * > getAllPoints()
This method is designed to return all points in the Control Network.
QList< QString > getImagesBelowHullTolerance(int num=75)
This method is designed to return a QList containing cube serials for all images that fall below a co...
int numPoints()
This method is designed to return the number of points in the Control Network.
void emitOpenImageEditor()
This method is designed to be called whenever a user double-clicks on an image in the image table of ...
QString getNetworkId()
This method is designed to return networkId of the observed Control Network.
ControlNetVitals.
void update()
This SLOT is called whenever the is a change made to the network embedded in the Global m_vitals obje...
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
ControlHealthMonitorWidget(ControlNetVitals *vitals, QWidget *parent=0)
This class is the front end representation of a ControlNetVitals object.
QString getStatus()
This method is designed to return the current status of the network.
int numFreePoints()
This method is designed to return the number of free points in the Control Network.
int numPointsBelowMeasureThreshold(int num=3)
This method is designed to return the number of points that fall below a measure threshold.
int numIgnoredPoints()
This method is designed to return the number of ignored points in the Control Network.
QList< ControlPoint * > getIgnoredPoints()
This method is designed to return all ignored points in the Control Network.
int numLockedPoints()
This method is designed to return the number of edit locked points in the Control Network...
int numImages()
This method is designed to return the number of images in the Control Network.
A single control point.
Definition: ControlPoint.h:369
QList< ControlPoint * > getConstrainedPoints()
This method is designed to return all constrained points in the Control Network.
void createGui()
This method is responsible for creating all of the components that comprise the GUI.
QList< ControlPoint * > getFixedPoints()
This method is designed to return all fixed points in the Control Network.
ControlPoint * getPoint(QString id)
This method is designed to return the Control Point with the associated point id from the Control Net...
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
int numConstrainedPoints()
This method is designed to return the number of constrained points in the Control Network...
int numMeasures()
This method is designed to return the number of measures in the Control Network.
QList< QString > getCubeSerials()
This method is designed to return all cube serials present in the Control Network.
int numFixedPoints()
This method is designed to return the number of fixed points in the Control Network.
void emitOpenPointEditor()
This method is designed to be called whenever a user double-clicks on a point in the point table of t...
void initializeEverything()
Initializes all member variables to NULL.
int numImagesBelowHullTolerance(int tolerance=75)
This method is designed to return the number of images that fall below a hull tolerance.