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