1
0
mirror of git://projects.qi-hardware.com/nanomap.git synced 2024-11-24 01:04:59 +02:00

draw start and end markers only when they are set

This commit is contained in:
Niels 2010-11-04 18:56:26 +01:00
parent e18428cb23
commit fd81fcf1f0

View File

@ -111,16 +111,23 @@ void MonavLayer::paint(QPainter *painter)
}
}
QPoint p = map()->geo2screen(m_routeStart.x(), m_routeStart.y());
QPoint p;
QPolygon tri;
tri << p << p+QPoint(-5, -9) << p+QPoint(5, -9) << p;
painter->setBrush(Qt::red);
painter->drawPolygon(tri);
p = map()->geo2screen(m_routeEnd.x(), m_routeEnd.y());
tri.clear();
tri << p << p+QPoint(-5, -9) << p+QPoint(5, -9) << p;
painter->setBrush(Qt::blue);
painter->drawPolygon(tri);
if (!m_routeStart.isNull()) {
p = map()->geo2screen(m_routeStart.x(), m_routeStart.y());
tri << p << p+QPoint(-5, -9) << p+QPoint(5, -9) << p;
painter->setBrush(Qt::red);
painter->drawPolygon(tri);
}
if (!m_routeEnd.isNull()) {
p = map()->geo2screen(m_routeEnd.x(), m_routeEnd.y());
tri.clear();
tri << p << p+QPoint(-5, -9) << p+QPoint(5, -9) << p;
painter->setBrush(Qt::blue);
painter->drawPolygon(tri);
}
}
void MonavLayer::keyPressed(QKeyEvent *event)