|
|
|
@ -42,7 +42,7 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
@@ -42,7 +42,7 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
|
|
|
|
|
HDDisplay(NULL, parent), |
|
|
|
|
gpsSatellites() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void HSIDisplay::paintEvent(QPaintEvent * event) |
|
|
|
@ -133,6 +133,8 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
@@ -133,6 +133,8 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
|
|
|
|
|
//disconnect(uas, SIGNAL(valueChanged(UASInterface*,QString,double,quint64)), this, SLOT(updateValue(UASInterface*,QString,double,quint64)));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
connect(uas, SIGNAL(gpsSatelliteStatusChanged(int,int,float,float,float,bool)), this, SLOT(updateSatellite(int,int,float,float,float,bool))); |
|
|
|
|
|
|
|
|
|
// Now connect the new UAS
|
|
|
|
|
|
|
|
|
|
//if (this->uas != uas)
|
|
|
|
@ -146,7 +148,14 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
@@ -146,7 +148,14 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
|
|
|
|
|
void HSIDisplay::updateSatellite(int uasid, int satid, float azimuth, float direction, float snr, bool used) |
|
|
|
|
{ |
|
|
|
|
Q_UNUSED(uasid); |
|
|
|
|
//qDebug() << "UPDATED SATELLITE";
|
|
|
|
|
// If slot is empty, insert object
|
|
|
|
|
if (gpsSatellites.size() <= satid) |
|
|
|
|
{ |
|
|
|
|
gpsSatellites.resize(satid+1); |
|
|
|
|
// gpsSatellites.insert(satid, new GPSSatellite(satid, azimuth, direction, snr, used));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (gpsSatellites.at(satid) == NULL) |
|
|
|
|
{ |
|
|
|
|
gpsSatellites.insert(satid, new GPSSatellite(satid, azimuth, direction, snr, used)); |
|
|
|
@ -160,11 +169,30 @@ void HSIDisplay::updateSatellite(int uasid, int satid, float azimuth, float dire
@@ -160,11 +169,30 @@ void HSIDisplay::updateSatellite(int uasid, int satid, float azimuth, float dire
|
|
|
|
|
|
|
|
|
|
QColor HSIDisplay::getColorForSNR(float snr) |
|
|
|
|
{ |
|
|
|
|
return QColor(200, 250, 200); |
|
|
|
|
QColor color; |
|
|
|
|
if (snr < 10) |
|
|
|
|
{ |
|
|
|
|
color = QColor(250, 200, 200); |
|
|
|
|
} |
|
|
|
|
else if (snr > 20) |
|
|
|
|
{ |
|
|
|
|
color = QColor(200, 250, 200); |
|
|
|
|
} |
|
|
|
|
else if (snr > 30) |
|
|
|
|
{ |
|
|
|
|
color = QColor(100, 250, 100); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
color = QColor(180, 180, 180); |
|
|
|
|
} |
|
|
|
|
return color; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void HSIDisplay::drawGPS() |
|
|
|
|
{ |
|
|
|
|
float xCenter = vwidth/2.0f; |
|
|
|
|
float yCenter = vwidth/2.0f; |
|
|
|
|
QPainter painter(this); |
|
|
|
|
painter.setRenderHint(QPainter::Antialiasing, true); |
|
|
|
|
painter.setRenderHint(QPainter::HighQualityAntialiasing, true); |
|
|
|
@ -172,7 +200,8 @@ void HSIDisplay::drawGPS()
@@ -172,7 +200,8 @@ void HSIDisplay::drawGPS()
|
|
|
|
|
// Max satellite circle radius
|
|
|
|
|
|
|
|
|
|
const float margin = 0.2f; // 20% margin of total width on each side
|
|
|
|
|
float radius = (vwidth - vwidth * 2.0f * margin) / 2.0f; |
|
|
|
|
float radius = (vwidth - vwidth * 2.0f * margin) / 4.0f; |
|
|
|
|
radius = radius; |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < gpsSatellites.size(); i++) |
|
|
|
|
{ |
|
|
|
@ -195,10 +224,10 @@ void HSIDisplay::drawGPS()
@@ -195,10 +224,10 @@ void HSIDisplay::drawGPS()
|
|
|
|
|
painter.setPen(color); |
|
|
|
|
painter.setBrush(brush); |
|
|
|
|
|
|
|
|
|
float xPos = sin(sat->direction) * sat->azimuth * radius; |
|
|
|
|
float yPos = cos(sat->direction) * sat->azimuth * radius; |
|
|
|
|
float xPos = xCenter + sin(sat->direction/180.0f * M_PI) * (sat->azimuth/180.0f * M_PI) * radius; |
|
|
|
|
float yPos = yCenter + cos(sat->direction/180.0f * M_PI) * (sat->azimuth/180.0f * M_PI) * radius; |
|
|
|
|
|
|
|
|
|
drawCircle(xPos, yPos, vwidth/10.0f, 1.0f, color, &painter); |
|
|
|
|
drawCircle(xPos, yPos, vwidth*0.02f, 1.0f, color, &painter); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|