1
0
Fork 0

Launcher: show helipads and runways for airports

Where an airport (as opposed to heliport) has helipads, show them
as well in the diagram.
This commit is contained in:
James Turner 2020-07-13 14:27:18 +01:00
parent f5c70e01b0
commit b08de513d0
2 changed files with 19 additions and 15 deletions

View file

@ -141,6 +141,11 @@ void AirportDiagram::setAirport(FGAirportRef apt)
addHelipad(pad);
}
} else {
for (unsigned int r = 0; r < apt->numHelipads(); ++r) {
FGHelipadRef pad = apt->getHelipadByIndex(r);
addHelipad(pad);
}
for (unsigned int r=0; r<apt->numRunways(); ++r) {
addRunway(apt->getRunwayByIndex(r));
}
@ -555,11 +560,15 @@ void AirportDiagram::mouseReleaseEvent(QMouseEvent* me)
me->accept();
QTransform t(transform());
double minWidth = 8.0 * unitLengthAfterMapping(t.inverted());
#if 0
QImage img(width(), height(), QImage::Format_ARGB32);
QPainter imgPaint(&img);
imgPaint.setPen(QPen(Qt::cyan, 1));
#endif
Q_FOREACH (const HelipadData& pad, m_helipads) {
QPainterPath pp = pathForHelipad(pad, t);
//imgPaint.drawPath(pp);
if (pp.contains(me->pos())) {
emit clicked(new QmlPositioned{pad.helipad});
return;
}
}
Q_FOREACH(const RunwayData& r, m_runways) {
QPainterPath pp = pathForRunway(r, t, minWidth);
@ -582,14 +591,7 @@ void AirportDiagram::mouseReleaseEvent(QMouseEvent* me)
}
}
Q_FOREACH(const HelipadData& pad, m_helipads) {
QPainterPath pp = pathForHelipad(pad, t);
//imgPaint.drawPath(pp);
if (pp.contains(me->pos())) {
emit clicked(new QmlPositioned{pad.helipad});
return;
}
}
#if 0
img.save("/Users/jmt/Desktop/img.png");
#endif

View file

@ -259,9 +259,11 @@ public:
if (aircraft == LauncherController::Seaplane) {
addType(FGPositioned::SEAPORT);
} else {
addType(FGPositioned::AIRPORT);
}
// always add regular aiports, since they may contain helipads,
// and seaplanes may have wheels on their floats
addType(FGPositioned::AIRPORT);
}
virtual bool pass(FGPositioned* aPos) const