|
|
|
@ -14,7 +14,10 @@ MAV2DIcon::MAV2DIcon(qreal x, qreal y, QString name, Alignment alignment, QPen*
@@ -14,7 +14,10 @@ MAV2DIcon::MAV2DIcon(qreal x, qreal y, QString name, Alignment alignment, QPen*
|
|
|
|
|
{ |
|
|
|
|
int radius = 10; |
|
|
|
|
size = QSize(radius, radius); |
|
|
|
|
drawIcon(pen); |
|
|
|
|
if (pen) |
|
|
|
|
{ |
|
|
|
|
drawIcon(pen); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MAV2DIcon::~MAV2DIcon() |
|
|
|
@ -24,8 +27,11 @@ MAV2DIcon::~MAV2DIcon()
@@ -24,8 +27,11 @@ MAV2DIcon::~MAV2DIcon()
|
|
|
|
|
|
|
|
|
|
void MAV2DIcon::setPen(QPen* pen) |
|
|
|
|
{ |
|
|
|
|
mypen = pen; |
|
|
|
|
drawIcon(pen); |
|
|
|
|
if (pen) |
|
|
|
|
{ |
|
|
|
|
mypen = pen; |
|
|
|
|
drawIcon(pen); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -38,46 +44,49 @@ void MAV2DIcon::setYaw(float yaw)
@@ -38,46 +44,49 @@ void MAV2DIcon::setYaw(float yaw)
|
|
|
|
|
|
|
|
|
|
void MAV2DIcon::drawIcon(QPen* pen) |
|
|
|
|
{ |
|
|
|
|
mypixmap = new QPixmap(radius+1, radius+1); |
|
|
|
|
mypixmap->fill(Qt::transparent); |
|
|
|
|
QPainter painter(mypixmap); |
|
|
|
|
if (pen) |
|
|
|
|
{ |
|
|
|
|
mypixmap = new QPixmap(radius+1, radius+1); |
|
|
|
|
mypixmap->fill(Qt::transparent); |
|
|
|
|
QPainter painter(mypixmap); |
|
|
|
|
|
|
|
|
|
// DRAW MICRO AIR VEHICLE
|
|
|
|
|
QPointF p(radius/2, radius/2); |
|
|
|
|
// DRAW MICRO AIR VEHICLE
|
|
|
|
|
QPointF p(radius/2, radius/2); |
|
|
|
|
|
|
|
|
|
float waypointSize = radius; |
|
|
|
|
QPolygonF poly(3); |
|
|
|
|
// Top point
|
|
|
|
|
poly.replace(0, QPointF(p.x(), p.y()+waypointSize/2.0f)); |
|
|
|
|
// Right point
|
|
|
|
|
poly.replace(1, QPointF(p.x()-waypointSize/2.0f, p.y()-waypointSize/2.0f)); |
|
|
|
|
// Left point
|
|
|
|
|
poly.replace(2, QPointF(p.x()+waypointSize/2.0f, p.y() + waypointSize/2.0f)); |
|
|
|
|
float waypointSize = radius; |
|
|
|
|
QPolygonF poly(3); |
|
|
|
|
// Top point
|
|
|
|
|
poly.replace(0, QPointF(p.x(), p.y()+waypointSize/2.0f)); |
|
|
|
|
// Right point
|
|
|
|
|
poly.replace(1, QPointF(p.x()-waypointSize/2.0f, p.y()-waypointSize/2.0f)); |
|
|
|
|
// Left point
|
|
|
|
|
poly.replace(2, QPointF(p.x()+waypointSize/2.0f, p.y() + waypointSize/2.0f)); |
|
|
|
|
|
|
|
|
|
// // Select color based on if this is the current waypoint
|
|
|
|
|
// if (list.at(i)->getCurrent())
|
|
|
|
|
// {
|
|
|
|
|
// color = QGC::colorCyan;//uas->getColor();
|
|
|
|
|
// pen.setWidthF(refLineWidthToPen(0.8f));
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// color = uas->getColor();
|
|
|
|
|
// pen.setWidthF(refLineWidthToPen(0.4f));
|
|
|
|
|
// }
|
|
|
|
|
// // Select color based on if this is the current waypoint
|
|
|
|
|
// if (list.at(i)->getCurrent())
|
|
|
|
|
// {
|
|
|
|
|
// color = QGC::colorCyan;//uas->getColor();
|
|
|
|
|
// pen.setWidthF(refLineWidthToPen(0.8f));
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// color = uas->getColor();
|
|
|
|
|
// pen.setWidthF(refLineWidthToPen(0.4f));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//pen.setColor(color);
|
|
|
|
|
if (pen) |
|
|
|
|
{ |
|
|
|
|
pen->setWidthF(2); |
|
|
|
|
painter.setPen(*pen); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
QPen pen2(Qt::yellow); |
|
|
|
|
pen2.setWidth(2); |
|
|
|
|
painter.setPen(pen2); |
|
|
|
|
//pen.setColor(color);
|
|
|
|
|
if (pen) |
|
|
|
|
{ |
|
|
|
|
pen->setWidthF(2); |
|
|
|
|
painter.setPen(*pen); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
QPen pen2(Qt::yellow); |
|
|
|
|
pen2.setWidth(2); |
|
|
|
|
painter.setPen(pen2); |
|
|
|
|
} |
|
|
|
|
painter.setBrush(Qt::NoBrush); |
|
|
|
|
painter.drawPolygon(poly); |
|
|
|
|
} |
|
|
|
|
painter.setBrush(Qt::NoBrush); |
|
|
|
|
painter.drawPolygon(poly); |
|
|
|
|
} |
|
|
|
|