From 16558d7004ac0ff117ec3c5e47ef7e9a4f9de88b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 16 Apr 2013 08:19:20 +0200 Subject: [PATCH] Icon fixes, HSI shows satellites correctly rotated --- libs/opmapcontrol/src/mapwidget/uavitem.cpp | 3 +++ src/ui/HSIDisplay.cc | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libs/opmapcontrol/src/mapwidget/uavitem.cpp b/libs/opmapcontrol/src/mapwidget/uavitem.cpp index f854c9c98..28011cbd8 100644 --- a/libs/opmapcontrol/src/mapwidget/uavitem.cpp +++ b/libs/opmapcontrol/src/mapwidget/uavitem.cpp @@ -58,7 +58,10 @@ namespace mapcontrol Q_UNUSED(option); Q_UNUSED(widget); // painter->rotate(-90); + QPainter::RenderHints oldhints = painter->renderHints(); + painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); painter->drawPixmap(-pic.width()/2,-pic.height()/2,pic); + painter->setRenderHints(oldhints); // painter->drawRect(QRectF(-pic.width()/2,-pic.height()/2,pic.width()-1,pic.height()-1)); } QRectF UAVItem::boundingRect()const diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index 7129f26e3..736b5f279 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -1310,9 +1310,13 @@ void HSIDisplay::drawSafetyArea(const QPointF &topLeft, const QPointF &bottomRig void HSIDisplay::drawGPS(QPainter &painter) { float xCenter = xCenterPos; - float yCenter = xCenterPos; - // Max satellite circle radius + float yCenter = yCenterPos; + const float yawDeg = ((yaw/M_PI)*180.0f); + int yawRotate = static_cast(yawDeg) % 360; + // XXX check rotation direction + + // Max satellite circle radius const float margin = 0.15f; // 20% margin of total width on each side float radius = (vwidth - vwidth * 2.0f * margin) / 2.0f; quint64 currTime = MG::TIME::getGroundTimeNowUsecs(); @@ -1353,8 +1357,8 @@ void HSIDisplay::drawGPS(QPainter &painter) painter.setPen(color); painter.setBrush(brush); - float xPos = xCenter + (sin(((sat->azimuth/255.0f)*360.0f)/180.0f * M_PI) * cos(sat->elevation/180.0f * M_PI)) * radius; - float yPos = yCenter - (cos(((sat->azimuth/255.0f)*360.0f)/180.0f * M_PI) * cos(sat->elevation/180.0f * M_PI)) * radius; + float xPos = xCenter + (sin(((sat->azimuth/255.0f)*360.0f-yawRotate)/180.0f * M_PI) * cos(sat->elevation/180.0f * M_PI)) * radius; + float yPos = yCenter - (cos(((sat->azimuth/255.0f)*360.0f-yawRotate)/180.0f * M_PI) * cos(sat->elevation/180.0f * M_PI)) * radius; // Draw circle for satellite, filled for used satellites drawCircle(xPos, yPos, vwidth*0.02f, 1.0f, color, &painter); -- 2.22.0