From 70b9b16a85dd5ce3ce6fecd97397d6ca76d22933 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 6 Sep 2012 22:42:51 +0200 Subject: [PATCH] Fixed painting of waypoints to better perform in overlapping cases --- src/ui/HSIDisplay.cc | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index c2dce3575..c9492bc6e 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -1120,10 +1120,6 @@ void HSIDisplay::drawWaypoint(QPainter& painter, const QColor& color, float widt { painter.setBrush(Qt::NoBrush); - // Setup pen for background - QPen penBg(color); - penBg.setWidthF(width*2.0f); - // Setup pen for foreground QPen pen(color); pen.setWidthF(width); @@ -1144,10 +1140,10 @@ void HSIDisplay::drawWaypoint(QPainter& painter, const QColor& color, float widt // Draw background pen.setColor(Qt::black); - painter.setPen(penBg); - drawLine(p.x(), p.y(), p.x()+sin(list.at(i)->getYaw()/180.0*M_PI-yaw) * radius, p.y()-cos(list.at(i)->getYaw()/180.0*M_PI-yaw) * radius, refLineWidthToPen(0.4f), color, &painter); + painter.setPen(pen); + drawLine(p.x(), p.y(), p.x()+sin(list.at(i)->getYaw()/180.0*M_PI-yaw) * radius, p.y()-cos(list.at(i)->getYaw()/180.0*M_PI-yaw) * radius, refLineWidthToPen(0.4f*3.0f), Qt::black, &painter); drawPolygon(poly, &painter); - drawCircle(p.x(), p.y(), metricToRef(acceptRadius), 1.0, Qt::black, &painter); + drawCircle(p.x(), p.y(), metricToRef(acceptRadius), 3.0, Qt::black, &painter); // Draw foreground pen.setColor(color); @@ -1208,11 +1204,8 @@ void HSIDisplay::drawWaypoints(QPainter& painter) // Draw line from last waypoint to this one if (!lastWaypoint.isNull()) { - QPen pen(QGC::colorCyan); - pen.setWidthF(refLineWidthToPen(0.4f)); - painter.setPen(pen); - color = QGC::colorCyan; - drawLine(lastWaypoint.x(), lastWaypoint.y(), p.x(), p.y(), refLineWidthToPen(0.4f), color, &painter); + drawLine(lastWaypoint.x(), lastWaypoint.y(), p.x(), p.y(), refLineWidthToPen(0.4f*2.0f), Qt::black, &painter); + drawLine(lastWaypoint.x(), lastWaypoint.y(), p.x(), p.y(), refLineWidthToPen(0.4f), QGC::colorCyan, &painter); } lastWaypoint = p; } -- 2.22.0