mirror of
git://projects.qi-hardware.com/nanomap.git
synced 2024-11-24 04:01:53 +02:00
draw start and end markers only when they are set
This commit is contained in:
parent
e18428cb23
commit
fd81fcf1f0
@ -111,16 +111,23 @@ void MonavLayer::paint(QPainter *painter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint p = map()->geo2screen(m_routeStart.x(), m_routeStart.y());
|
QPoint p;
|
||||||
QPolygon tri;
|
QPolygon tri;
|
||||||
tri << p << p+QPoint(-5, -9) << p+QPoint(5, -9) << p;
|
|
||||||
painter->setBrush(Qt::red);
|
if (!m_routeStart.isNull()) {
|
||||||
painter->drawPolygon(tri);
|
p = map()->geo2screen(m_routeStart.x(), m_routeStart.y());
|
||||||
p = map()->geo2screen(m_routeEnd.x(), m_routeEnd.y());
|
tri << p << p+QPoint(-5, -9) << p+QPoint(5, -9) << p;
|
||||||
tri.clear();
|
painter->setBrush(Qt::red);
|
||||||
tri << p << p+QPoint(-5, -9) << p+QPoint(5, -9) << p;
|
painter->drawPolygon(tri);
|
||||||
painter->setBrush(Qt::blue);
|
}
|
||||||
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)
|
void MonavLayer::keyPressed(QKeyEvent *event)
|
||||||
|
Loading…
Reference in New Issue
Block a user