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

View file

@ -259,9 +259,11 @@ public:
if (aircraft == LauncherController::Seaplane) { if (aircraft == LauncherController::Seaplane) {
addType(FGPositioned::SEAPORT); 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 virtual bool pass(FGPositioned* aPos) const