1
0
Fork 0

Launcher: heliport / helipad fixes

This commit is contained in:
James Turner 2018-05-31 22:12:01 +02:00
parent 3da6d42945
commit 19ec0027e8
4 changed files with 41 additions and 5 deletions

View file

@ -143,13 +143,21 @@ void AirportDiagram::setSelectedRunway(FGRunwayRef r)
}
m_selectedParking.clear();
m_selectedHelipad.clear();
m_selectedRunway = r;
update();
}
void AirportDiagram::setSelectedHelipad(FGHelipadRef pad)
{
qWarning() << Q_FUNC_INFO << "implement me";
if (pad == m_selectedHelipad) {
return;
}
m_selectedParking.clear();
m_selectedRunway.clear();
m_selectedHelipad = pad;
update();
}
void AirportDiagram::setSelectedParking(FGParkingRef park)
@ -159,6 +167,7 @@ void AirportDiagram::setSelectedParking(FGParkingRef park)
}
m_selectedRunway.clear();
m_selectedHelipad.clear();
m_selectedParking = park;
update();
}
@ -568,7 +577,10 @@ QPainterPath AirportDiagram::pathForHelipad(const HelipadData& h, const QTransfo
QRect r = m_helipadIcon.rect();
r.moveCenter(QPoint(0, 0));
pp.addEllipse(r);
return t.map(pp);
QTransform x = t;
x.translate(h.pt.x(), h.pt.y());
return x.map(pp);
}
void AirportDiagram::buildTaxiways()

View file

@ -117,6 +117,7 @@ private:
double m_approachDistanceNm;
FGRunwayRef m_selectedRunway;
FGParkingRef m_selectedParking;
FGHelipadRef m_selectedHelipad;
QPixmap m_helipadIcon;
};

View file

@ -200,15 +200,23 @@ public:
addType(FGPositioned::FIX);
addType(FGPositioned::NDB);
// aircraft type isn't reliable yet, until we ensure
// most aircraft are tagged accordingly with helicopter,
// seaplane, etc. Hnece disabling this logic for now
#if 0
if (aircraft == Helicopter) {
addType(FGPositioned::HELIPAD);
addType(FGPositioned::HELIPORT);
}
if (aircraft == Seaplane) {
addType(FGPositioned::SEAPORT);
} else {
addType(FGPositioned::AIRPORT);
}
#else
addType(FGPositioned::HELIPORT);
addType(FGPositioned::SEAPORT);
#endif
// always include airports regardless of acft type
addType(FGPositioned::AIRPORT);
}
};
@ -391,6 +399,8 @@ LocationWidget::LocationWidget(QWidget *parent) :
this, &LocationWidget::onAirportRunwayClicked);
connect(m_ui->airportDiagram, &AirportDiagram::clickedParking,
this, &LocationWidget::onAirportParkingClicked);
connect(m_ui->airportDiagram, &AirportDiagram::clickedHelipad,
this, &LocationWidget::onAirportHelipadClicked);
connect(m_ui->locationSearchEdit, &QLineEdit::returnPressed,
this, &LocationWidget::onSearch);
@ -962,6 +972,18 @@ void LocationWidget::onAirportParkingClicked(FGParkingRef park)
updateDescription();
}
void LocationWidget::onAirportHelipadClicked(FGHelipadRef pad)
{
if (pad) {
m_ui->runwayRadio->setChecked(true);
int rwyIndex = m_ui->runwayCombo->findText(QString::fromStdString(pad->ident()));
m_ui->runwayCombo->setCurrentIndex(rwyIndex);
m_ui->airportDiagram->setSelectedHelipad(pad);
}
updateDescription();
}
QString compassPointFromHeading(int heading)
{
const int labelArc = 360 / 8;

View file

@ -85,6 +85,7 @@ private:
void onAirportRunwayClicked(FGRunwayRef rwy);
void onAirportParkingClicked(FGParkingRef park);
void onAirportHelipadClicked(FGHelipadRef pad);
void onOffsetBearingTrueChanged(bool on);