diff --git a/src/GUI/AirportDiagram.cxx b/src/GUI/AirportDiagram.cxx index 673151e8c..97052f18b 100644 --- a/src/GUI/AirportDiagram.cxx +++ b/src/GUI/AirportDiagram.cxx @@ -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() diff --git a/src/GUI/AirportDiagram.hxx b/src/GUI/AirportDiagram.hxx index 43ffd7c4f..4fb8946ab 100644 --- a/src/GUI/AirportDiagram.hxx +++ b/src/GUI/AirportDiagram.hxx @@ -117,6 +117,7 @@ private: double m_approachDistanceNm; FGRunwayRef m_selectedRunway; FGParkingRef m_selectedParking; + FGHelipadRef m_selectedHelipad; QPixmap m_helipadIcon; }; diff --git a/src/GUI/LocationWidget.cxx b/src/GUI/LocationWidget.cxx index a1cabf96e..38e949048 100644 --- a/src/GUI/LocationWidget.cxx +++ b/src/GUI/LocationWidget.cxx @@ -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; diff --git a/src/GUI/LocationWidget.hxx b/src/GUI/LocationWidget.hxx index 1f0adfa80..55302d44c 100644 --- a/src/GUI/LocationWidget.hxx +++ b/src/GUI/LocationWidget.hxx @@ -85,6 +85,7 @@ private: void onAirportRunwayClicked(FGRunwayRef rwy); void onAirportParkingClicked(FGParkingRef park); + void onAirportHelipadClicked(FGHelipadRef pad); void onOffsetBearingTrueChanged(bool on);