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