diff --git a/ground/openpilotgcs/src/plugins/gpsdisplay/gpsconstellationwidget.cpp b/ground/openpilotgcs/src/plugins/gpsdisplay/gpsconstellationwidget.cpp
index 667727b99..f1b21b4de 100644
--- a/ground/openpilotgcs/src/plugins/gpsdisplay/gpsconstellationwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/gpsdisplay/gpsconstellationwidget.cpp
@@ -129,7 +129,7 @@ void GpsConstellationWidget::updateSat(int index, int prn, int elevation, int az
-satIcons[index]->boundingRect().center().y());
satIcons[index]->setTransform(QTransform::fromTranslate(opd.x(), opd.y()), false);
- // Show normal GPS, SBAS (120 - 158 range) or GLONASS (65 - 96, 255 if unidentified)
+ // Show normal GPS, SBAS (120 - 158 range), BeiDou (33 - 64, 159 - 163) or GLONASS (65 - 96, 255 if unidentified)
if (prn > 119 && prn < 159) {
if (snr) {
satIcons[index]->setElementId("satellite-sbas");
@@ -142,6 +142,12 @@ void GpsConstellationWidget::updateSat(int index, int prn, int elevation, int az
} else {
satIcons[index]->setElementId("sat-glonass-notSeen");
}
+ } else if ((prn > 32 && prn < 65) || (prn > 158 && prn < 164)) {
+ if (snr) {
+ satIcons[index]->setElementId("satellite-beidou");
+ } else {
+ satIcons[index]->setElementId("sat-beidou-notSeen");
+ }
} else {
if (snr) {
satIcons[index]->setElementId("satellite");
diff --git a/ground/openpilotgcs/src/plugins/gpsdisplay/gpsdisplaywidget.ui b/ground/openpilotgcs/src/plugins/gpsdisplay/gpsdisplaywidget.ui
index b0d2adebd..2eaffcce1 100644
--- a/ground/openpilotgcs/src/plugins/gpsdisplay/gpsdisplaywidget.ui
+++ b/ground/openpilotgcs/src/plugins/gpsdisplay/gpsdisplaywidget.ui
@@ -1,955 +1,955 @@
-
-
- GpsDisplayWidget
-
-
-
- 0
- 0
- 609
- 606
-
-
-
-
- 0
- 0
-
-
-
-
- 0
-
-
- 6
-
-
- 6
-
-
- 6
-
-
- 6
-
- -
-
-
-
- 0
- 0
-
-
-
- Qt::Vertical
-
-
- true
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 400
- 140
-
-
-
-
-
-
-
-
- 236
- 236
- 236
-
-
-
-
-
-
- 237
- 237
- 237
-
-
-
-
-
-
-
-
- 236
- 236
- 236
-
-
-
-
-
-
- 237
- 237
- 237
-
-
-
-
-
-
-
-
- 236
- 236
- 236
-
-
-
-
-
-
- 236
- 236
- 236
-
-
-
-
-
-
-
- <html><head/><body><p>Displays the SNR for each detected sat. GPS satellites are shown in green, GLONASS in cyan and SBAS in orange. Satellite number (PRN) is displayed inside the bar. Sat SNR is displayed above (in dBHz)</p></body></html>
-
-
- false
-
-
- QFrame::Panel
-
-
- 0
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAlwaysOff
-
-
-
- -
-
-
- 0
-
-
-
-
-
- true
-
-
-
- 400
- 400
-
-
-
- background-color: rgba(255, 255, 255, 0);
-
-
- QFrame::Panel
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAlwaysOff
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 20
- 40
-
-
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
- 0
-
-
-
-
-
- Coord:
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
- Unknown
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
- Unknown
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
- Alt :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 20
-
-
-
-
- -
-
-
- Unknown
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Preferred
-
-
-
- 20
- 6
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
- Speed:
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
- Unknown
-
-
- true
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
- Heading:
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
- Unknown
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Preferred
-
-
-
- 20
- 4
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Preferred
-
-
-
- 20
- 4
-
-
-
-
- -
-
-
-
-
-
- H / V / P DOP:
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
- 0 / 0 / 0
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Preferred
-
-
-
- 20
- 4
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Preferred
-
-
-
- 20
- 4
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
- Sats Used:
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
-
- 100
- 16777215
-
-
-
- Unknown
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
- Fix Type:
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Minimum
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Expanding
-
-
-
- 6
- 0
-
-
-
-
- -
-
-
- Unknown
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Preferred
-
-
-
- 20
- 6
-
-
-
-
- -
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 16777215
- 16777215
-
-
-
- Unknown
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- 0
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Ignored
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Preferred
-
-
-
- 9
- 20
-
-
-
-
- -
-
-
-
-
-
- Connect
-
-
-
- -
-
-
- Disconnect
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Preferred
-
-
-
- 9
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Expanding
-
-
-
- 0
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 191
- 95
-
-
-
-
- 191
- 95
-
-
-
- false
-
-
- <html><head/><body><p>Location of GCS on the Earth</p></body></html>
-
-
- QFrame::NoFrame
-
-
- 0
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAlwaysOff
-
-
- QGraphicsView::DontAdjustForAntialiasing
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 20
- 20
-
-
-
-
-
-
-
-
-
-
-
-
- GPS Data Stream
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
- 0
-
-
- Qt::ScrollBarAlwaysOn
-
-
- QTextEdit::WidgetWidth
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
- GpsConstellationWidget
- QGraphicsView
-
-
-
- GpsSnrWidget
- QGraphicsView
-
-
-
-
-
-
+
+
+ GpsDisplayWidget
+
+
+
+ 0
+ 0
+ 609
+ 606
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+
+
+ 6
+
+
+ 6
+
+
+ 6
+
+
+ 6
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Qt::Vertical
+
+
+ true
+
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 400
+ 140
+
+
+
+
+
+
+
+
+ 236
+ 236
+ 236
+
+
+
+
+
+
+ 237
+ 237
+ 237
+
+
+
+
+
+
+
+
+ 236
+ 236
+ 236
+
+
+
+
+
+
+ 237
+ 237
+ 237
+
+
+
+
+
+
+
+
+ 236
+ 236
+ 236
+
+
+
+
+
+
+ 236
+ 236
+ 236
+
+
+
+
+
+
+
+ <html><head/><body><p>Displays the SNR for each detected sat. GPS satellites are shown in green, GLONASS in cyan, BeiDou in red and SBAS in orange. Satellite number (PRN) is displayed inside the bar. Sat SNR is displayed above (in dBHz)</p></body></html>
+
+
+ false
+
+
+ QFrame::Panel
+
+
+ 0
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ true
+
+
+
+ 400
+ 400
+
+
+
+ background-color: rgba(255, 255, 255, 0);
+
+
+ QFrame::Panel
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Expanding
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ 0
+
+
-
+
+
+ Coord:
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+ Unknown
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+ Unknown
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ Alt :
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 20
+
+
+
+
+ -
+
+
+ Unknown
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 6
+
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ Speed:
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+ Unknown
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+ Heading:
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+ Unknown
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 4
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 4
+
+
+
+
+ -
+
+
-
+
+
+ H / V / P DOP:
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+ 0 / 0 / 0
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 4
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 4
+
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ Sats Used:
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+
+ 100
+ 16777215
+
+
+
+ Unknown
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+ Fix Type:
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
+
+ 6
+ 0
+
+
+
+
+ -
+
+
+ Unknown
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 6
+
+
+
+
+ -
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Unknown
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Ignored
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Preferred
+
+
+
+ 9
+ 20
+
+
+
+
+ -
+
+
-
+
+
+ Connect
+
+
+
+ -
+
+
+ Disconnect
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Preferred
+
+
+
+ 9
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
+
+ 0
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 191
+ 95
+
+
+
+
+ 191
+ 95
+
+
+
+ false
+
+
+ <html><head/><body><p>Location of GCS on the Earth</p></body></html>
+
+
+ QFrame::NoFrame
+
+
+ 0
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ QGraphicsView::DontAdjustForAntialiasing
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 20
+ 20
+
+
+
+
+
+
+
+
+
+
+
+
+ GPS Data Stream
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 50
+
+
+
+ 0
+
+
+ Qt::ScrollBarAlwaysOn
+
+
+ QTextEdit::WidgetWidth
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+ GpsConstellationWidget
+ QGraphicsView
+
+
+
+ GpsSnrWidget
+ QGraphicsView
+
+
+
+
+
+
diff --git a/ground/openpilotgcs/src/plugins/gpsdisplay/gpssnrwidget.cpp b/ground/openpilotgcs/src/plugins/gpsdisplay/gpssnrwidget.cpp
index c1bf63015..12b2a26d8 100644
--- a/ground/openpilotgcs/src/plugins/gpsdisplay/gpssnrwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/gpsdisplay/gpssnrwidget.cpp
@@ -1,146 +1,148 @@
-#include "gpssnrwidget.h"
-
-GpsSnrWidget::GpsSnrWidget(QWidget *parent) :
- QGraphicsView(parent)
-{
- scene = new QGraphicsScene(this);
- setScene(scene);
-
- // Now create 'maxSatellites' satellite icons which we will move around on the map:
- for (int i = 0; i < MAX_SATTELITES; i++) {
- satellites[i][0] = 0;
- satellites[i][1] = 0;
- satellites[i][2] = 0;
- satellites[i][3] = 0;
-
- boxes[i] = new QGraphicsRectItem();
- boxes[i]->setBrush(QColor("Green"));
- scene->addItem(boxes[i]);
- boxes[i]->hide();
-
- satTexts[i] = new QGraphicsSimpleTextItem("##", boxes[i]);
- satTexts[i]->setBrush(QColor("Black"));
- satTexts[i]->setFont(QFont("Courier"));
-
- satSNRs[i] = new QGraphicsSimpleTextItem("##", boxes[i]);
- satSNRs[i]->setBrush(QColor("Black"));
- satSNRs[i]->setFont(QFont("Courier"));
- }
-}
-
-GpsSnrWidget::~GpsSnrWidget()
-{
- delete scene;
- scene = 0;
-}
-
-void GpsSnrWidget::showEvent(QShowEvent *event)
-{
- Q_UNUSED(event)
- scene->setSceneRect(0, 0, this->viewport()->width(), this->viewport()->height());
- for (int index = 0; index < MAX_SATTELITES; index++) {
- drawSat(index);
- }
-}
-
-void GpsSnrWidget::resizeEvent(QResizeEvent *event)
-{
- Q_UNUSED(event);
- scene->setSceneRect(0, 0, this->viewport()->width(), this->viewport()->height());
- for (int index = 0; index < MAX_SATTELITES; index++) {
- drawSat(index);
- }
-}
-
-void GpsSnrWidget::updateSat(int index, int prn, int elevation, int azimuth, int snr)
-{
- if (index >= MAX_SATTELITES) {
- // A bit of error checking never hurts.
- return;
- }
-
- // TODO: add range checking
- satellites[index][0] = prn;
- satellites[index][1] = elevation;
- satellites[index][2] = azimuth;
- satellites[index][3] = snr;
-
- drawSat(index);
-}
-
-void GpsSnrWidget::drawSat(int index)
-{
- if (index >= MAX_SATTELITES) {
- // A bit of error checking never hurts.
- return;
- }
-
- const int prn = satellites[index][0];
- const int snr = satellites[index][3];
- if (prn && snr) {
- boxes[index]->show();
-
- // When using integer values, width and height are the
- // box width and height, but the left and bottom borders are drawn on the box,
- // and the top and right borders are drawn just next to the box.
- // So the box seems one pixel wider and higher with a border.
- // I'm sure there's a good explanation for that :)
-
- // Casting to int rounds down, which is what I want.
- // Minus 2 to allow a pixel of white left and right.
- int availableWidth = (int)((scene->width() - 2) / MAX_SATTELITES);
-
- // 2 pixels, one on each side.
- qreal width = availableWidth - 2;
- // SNR = 1-99 (0 is special)..
- qreal height = int((scene->height() / 99) * snr + 0.5);
- // 1 for showing a pixel of white to the left.
- qreal x = availableWidth * index + 1;
- // Rember, 0 is at the top.
- qreal y = scene->height() - height;
- // Compensate for the extra pixel for the border.
- boxes[index]->setRect(0, 0, width - 1, height - 1);
- boxes[index]->setPos(x, y);
-
- QRectF boxRect = boxes[index]->boundingRect();
-
- // Change color for SBAS sat (Egnos, etc..) 120 - 158 range
- // GLONASS range 65-96 or 255
- if (prn > 119 && prn < 159) {
- boxes[index]->setBrush(QColor("#fd700b"));
- } else if ((prn > 64 && prn < 97) || 255 == prn) {
- boxes[index]->setBrush(QColor("Cyan"));
- } else {
- boxes[index]->setBrush(QColor("Green"));
- }
- QString prnString = QString().number(prn);
- if (prnString.length() == 1) {
- prnString = "0" + prnString;
- }
- satTexts[index]->setText(prnString);
- QRectF textRect = satTexts[index]->boundingRect();
-
- QTransform matrix;
- qreal scale = 0.85 * (boxRect.width() / textRect.width());
- matrix.translate(boxRect.width() / 2, boxRect.height());
- matrix.scale(scale, scale);
- matrix.translate(-textRect.width() / 2, -textRect.height());
- satTexts[index]->setTransform(matrix, false);
-
- QString snrString = QString().number(snr);
- if (snrString.length() == 1) { // Will probably never happen!
- snrString = "0" + snrString;
- }
- satSNRs[index]->setText(snrString);
- textRect = satSNRs[index]->boundingRect();
-
- matrix.reset();
- scale = 0.85 * (boxRect.width() / textRect.width());
- matrix.translate(boxRect.width() / 2, 0);
- matrix.scale(scale, scale);
- matrix.translate(-textRect.width() / 2, -textRect.height());
- satSNRs[index]->setTransform(matrix, false);
- } else {
- boxes[index]->hide();
- }
-}
+#include "gpssnrwidget.h"
+
+GpsSnrWidget::GpsSnrWidget(QWidget *parent) :
+ QGraphicsView(parent)
+{
+ scene = new QGraphicsScene(this);
+ setScene(scene);
+
+ // Now create 'maxSatellites' satellite icons which we will move around on the map:
+ for (int i = 0; i < MAX_SATTELITES; i++) {
+ satellites[i][0] = 0;
+ satellites[i][1] = 0;
+ satellites[i][2] = 0;
+ satellites[i][3] = 0;
+
+ boxes[i] = new QGraphicsRectItem();
+ boxes[i]->setBrush(QColor("Green"));
+ scene->addItem(boxes[i]);
+ boxes[i]->hide();
+
+ satTexts[i] = new QGraphicsSimpleTextItem("##", boxes[i]);
+ satTexts[i]->setBrush(QColor("Black"));
+ satTexts[i]->setFont(QFont("Courier"));
+
+ satSNRs[i] = new QGraphicsSimpleTextItem("##", boxes[i]);
+ satSNRs[i]->setBrush(QColor("Black"));
+ satSNRs[i]->setFont(QFont("Courier"));
+ }
+}
+
+GpsSnrWidget::~GpsSnrWidget()
+{
+ delete scene;
+ scene = 0;
+}
+
+void GpsSnrWidget::showEvent(QShowEvent *event)
+{
+ Q_UNUSED(event)
+ scene->setSceneRect(0, 0, this->viewport()->width(), this->viewport()->height());
+ for (int index = 0; index < MAX_SATTELITES; index++) {
+ drawSat(index);
+ }
+}
+
+void GpsSnrWidget::resizeEvent(QResizeEvent *event)
+{
+ Q_UNUSED(event);
+ scene->setSceneRect(0, 0, this->viewport()->width(), this->viewport()->height());
+ for (int index = 0; index < MAX_SATTELITES; index++) {
+ drawSat(index);
+ }
+}
+
+void GpsSnrWidget::updateSat(int index, int prn, int elevation, int azimuth, int snr)
+{
+ if (index >= MAX_SATTELITES) {
+ // A bit of error checking never hurts.
+ return;
+ }
+
+ // TODO: add range checking
+ satellites[index][0] = prn;
+ satellites[index][1] = elevation;
+ satellites[index][2] = azimuth;
+ satellites[index][3] = snr;
+
+ drawSat(index);
+}
+
+void GpsSnrWidget::drawSat(int index)
+{
+ if (index >= MAX_SATTELITES) {
+ // A bit of error checking never hurts.
+ return;
+ }
+
+ const int prn = satellites[index][0];
+ const int snr = satellites[index][3];
+ if (prn && snr) {
+ boxes[index]->show();
+
+ // When using integer values, width and height are the
+ // box width and height, but the left and bottom borders are drawn on the box,
+ // and the top and right borders are drawn just next to the box.
+ // So the box seems one pixel wider and higher with a border.
+ // I'm sure there's a good explanation for that :)
+
+ // Casting to int rounds down, which is what I want.
+ // Minus 2 to allow a pixel of white left and right.
+ int availableWidth = (int)((scene->width() - 2) / MAX_SATTELITES);
+
+ // 2 pixels, one on each side.
+ qreal width = availableWidth - 2;
+ // SNR = 1-99 (0 is special)..
+ qreal height = int((scene->height() / 99) * snr + 0.5);
+ // 1 for showing a pixel of white to the left.
+ qreal x = availableWidth * index + 1;
+ // Rember, 0 is at the top.
+ qreal y = scene->height() - height;
+ // Compensate for the extra pixel for the border.
+ boxes[index]->setRect(0, 0, width - 1, height - 1);
+ boxes[index]->setPos(x, y);
+
+ QRectF boxRect = boxes[index]->boundingRect();
+
+ // Change color for SBAS sat (Egnos, etc..) 120 - 158 range
+ // GLONASS range 65-96 or 255, BeiDou 33-64 or 159-163
+ if (prn > 119 && prn < 159) {
+ boxes[index]->setBrush(QColor("#fd700b"));
+ } else if ((prn > 64 && prn < 97) || 255 == prn) {
+ boxes[index]->setBrush(QColor("Cyan"));
+ } else if ((prn > 32 && prn < 65) || (prn > 158 && prn < 164)) {
+ boxes[index]->setBrush(QColor("Red"));
+ } else {
+ boxes[index]->setBrush(QColor("Green"));
+ }
+ QString prnString = QString().number(prn);
+ if (prnString.length() == 1) {
+ prnString = "0" + prnString;
+ }
+ satTexts[index]->setText(prnString);
+ QRectF textRect = satTexts[index]->boundingRect();
+
+ QTransform matrix;
+ qreal scale = 0.85 * (boxRect.width() / textRect.width());
+ matrix.translate(boxRect.width() / 2, boxRect.height());
+ matrix.scale(scale, scale);
+ matrix.translate(-textRect.width() / 2, -textRect.height());
+ satTexts[index]->setTransform(matrix, false);
+
+ QString snrString = QString().number(snr);
+ if (snrString.length() == 1) { // Will probably never happen!
+ snrString = "0" + snrString;
+ }
+ satSNRs[index]->setText(snrString);
+ textRect = satSNRs[index]->boundingRect();
+
+ matrix.reset();
+ scale = 0.85 * (boxRect.width() / textRect.width());
+ matrix.translate(boxRect.width() / 2, 0);
+ matrix.scale(scale, scale);
+ matrix.translate(-textRect.width() / 2, -textRect.height());
+ satSNRs[index]->setTransform(matrix, false);
+ } else {
+ boxes[index]->hide();
+ }
+}
diff --git a/ground/openpilotgcs/src/plugins/gpsdisplay/images/gpsEarth.svg b/ground/openpilotgcs/src/plugins/gpsdisplay/images/gpsEarth.svg
index 34563ae98..828910845 100644
--- a/ground/openpilotgcs/src/plugins/gpsdisplay/images/gpsEarth.svg
+++ b/ground/openpilotgcs/src/plugins/gpsdisplay/images/gpsEarth.svg
@@ -14,8 +14,8 @@
height="691.54303"
id="svg2"
version="1.1"
- inkscape:version="0.48.5 r10040"
- sodipodi:docname="gpsEarth_work.svg">
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="gpsEarth.svg">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
image/svg+xml
-
+
@@ -1007,7 +1103,7 @@
style="opacity:0.69172932;color:#000000;fill:#616a60;fill-opacity:1;fill-rule:nonzero;stroke:#6a6c69;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter5048);enable-background:accumulate" />
+
+
+
+
+
+
+
+