m_runways.clear();
m_approachDistanceNm = -1.0;
m_parking.clear();
+ m_helipads.clear();
if (apt) {
buildTaxiways();
update();
}
+void AirportDiagram::setSelectedHelipad(FGHelipadRef pad)
+{
+
+}
+
void AirportDiagram::setApproachExtensionDistance(double distanceNm)
{
m_approachDistanceNm = distanceNm;
extendBounds(p.pt);
}
+ Q_FOREACH(const HelipadData& p, m_helipads) {
+ extendBounds(p.pt);
+ }
+
if (m_selectedRunway && (m_approachDistanceNm > 0.0)) {
double d = SG_NM_TO_METER * m_approachDistanceNm;
QPointF pt = project(m_selectedRunway->pointOnCenterline(-d));
update();
}
+void AirportDiagram::addHelipad(FGHelipadRef pad)
+{
+ HelipadData pd = { project(pad->geod()), pad };
+ m_helipads.push_back(pd);
+ recomputeBounds(false);
+ update();
+}
+
void AirportDiagram::paintContents(QPainter* p)
{
p->drawLine(t.p1, t.p2);
}
-
+ drawHelipads(p);
drawParkings(p);
// runways
}
}
+void AirportDiagram::drawHelipads(QPainter* painter)
+{
+ QTransform t = painter->transform();
+ QPixmap icon(":/heliport-icon");
+
+ QRect r = icon.rect();
+ r.moveCenter(QPoint(0, 0));
+
+ Q_FOREACH(const HelipadData& p, m_helipads) {
+ painter->setTransform(t);
+ painter->translate(p.pt);
+ painter->drawPixmap(r, icon);
+ }
+}
void AirportDiagram::drawParkings(QPainter* painter)
{
void addRunway(FGRunwayRef rwy);
void addParking(FGParkingRef park);
-
+ void addHelipad(FGHelipadRef pad);
+
FGRunwayRef selectedRunway() const;
void setSelectedRunway(FGRunwayRef r);
+ void setSelectedHelipad(FGHelipadRef pad);
+
void setApproachExtensionDistance(double distanceNm);
Q_SIGNALS:
void clickedRunway(FGRunwayRef rwy);
void drawILS(QPainter *painter, FGRunwayRef runway) const;
void drawParkings(QPainter *p);
+ void drawHelipads(QPainter *painter);
FGAirportRef m_airport;
QVector<ParkingData> m_parking;
+ struct HelipadData
+ {
+ QPointF pt;
+ FGHelipadRef parking;
+ };
+
+ QVector<HelipadData> m_helipads;
+
QPainterPath m_parkingIconPath, // arrow points right
m_parkingIconLeftPath; // arrow points left
double m_approachDistanceNm;
opt->addOption("airport", apt->ident());
if (m_ui->runwayRadio->isChecked()) {
- int index = m_ui->runwayCombo->itemData(m_ui->runwayCombo->currentIndex()).toInt();
- if (index >= 0) {
- // explicit runway choice
- FGRunwayRef runway = apt->getRunwayByIndex(index);
- opt->addOption("runway", runway->ident());
-
- // set nav-radio 1 based on selected runway
- if (runway->ILS()) {
- double mhz = runway->ILS()->get_freq() / 100.0;
- QString navOpt = QString("%1:%2").arg(runway->headingDeg()).arg(mhz);
- opt->addOption("nav1", navOpt.toStdString());
+ if (apt->type() == FGPositioned::AIRPORT) {
+ int index = m_ui->runwayCombo->itemData(m_ui->runwayCombo->currentIndex()).toInt();
+ if (index >= 0) {
+ // explicit runway choice
+ FGRunwayRef runway = apt->getRunwayByIndex(index);
+ opt->addOption("runway", runway->ident());
+
+ // set nav-radio 1 based on selected runway
+ if (runway->ILS()) {
+ double mhz = runway->ILS()->get_freq() / 100.0;
+ QString navOpt = QString("%1:%2").arg(runway->headingDeg()).arg(mhz);
+ opt->addOption("nav1", navOpt.toStdString());
+ }
}
- }
- if (m_ui->onFinalCheckbox->isChecked()) {
- opt->addOption("glideslope", "3.0");
- double offsetNm = m_ui->approachDistanceSpin->value();
- opt->addOption("offset-distance", QString::number(offsetNm).toStdString());
+ if (m_ui->onFinalCheckbox->isChecked()) {
+ opt->addOption("glideslope", "3.0");
+ double offsetNm = m_ui->approachDistanceSpin->value();
+ opt->addOption("offset-distance", QString::number(offsetNm).toStdString());
+ }
+ } else if (apt->type() == FGPositioned::HELIPORT) {
+ int index = m_ui->runwayCombo->itemData(m_ui->runwayCombo->currentIndex()).toInt();
+ if (index >= 0) {
+ // explicit pad choice
+ FGHelipadRef pad = apt->getHelipadByIndex(index);
+ opt->addOption("runway", pad->ident());
+ }
+ } else {
+ qWarning() << Q_FUNC_INFO << "implement me";
}
} else if (m_ui->parkingRadio->isChecked()) {
m_ui->runwayCombo->clear();
m_ui->runwayCombo->addItem("Automatic", -1);
- for (unsigned int r=0; r<apt->numRunways(); ++r) {
- FGRunwayRef rwy = apt->getRunwayByIndex(r);
- // add runway with index as data role
- m_ui->runwayCombo->addItem(QString::fromStdString(rwy->ident()), r);
- m_ui->airportDiagram->addRunway(rwy);
+ if (apt->type() == FGPositioned::HELIPORT) {
+ for (unsigned int r=0; r<apt->numHelipads(); ++r) {
+ FGHelipadRef pad = apt->getHelipadByIndex(r);
+ // add pad with index as data role
+ m_ui->runwayCombo->addItem(QString::fromStdString(pad->ident()), r);
+
+ m_ui->airportDiagram->addHelipad(pad);
+ }
+ } else {
+ for (unsigned int r=0; r<apt->numRunways(); ++r) {
+ FGRunwayRef rwy = apt->getRunwayByIndex(r);
+ // add runway with index as data role
+ m_ui->runwayCombo->addItem(QString::fromStdString(rwy->ident()), r);
+
+ m_ui->airportDiagram->addRunway(rwy);
+ }
}
m_ui->parkingCombo->clear();
if (m_ui->runwayRadio->isChecked()) {
int comboIndex = m_ui->runwayCombo->currentIndex();
int runwayIndex = m_ui->runwayCombo->itemData(comboIndex).toInt();
- // we can't figure out the active runway in the launcher (yet)
- FGRunwayRef rwy = (runwayIndex >= 0) ?
- apt->getRunwayByIndex(runwayIndex) : FGRunwayRef();
- m_ui->airportDiagram->setSelectedRunway(rwy);
+ if (apt->type() == FGPositioned::HELIPORT) {
+ m_ui->airportDiagram->setSelectedRunway(FGRunwayRef());
+ FGHelipadRef pad = (runwayIndex >= 0) ?
+ apt->getHelipadByIndex(runwayIndex) : FGHelipadRef();
+ m_ui->airportDiagram->setSelectedHelipad(pad);
+ } else {
+ // we can't figure out the active runway in the launcher (yet)
+ FGRunwayRef rwy = (runwayIndex >= 0) ?
+ apt->getRunwayByIndex(runwayIndex) : FGRunwayRef();
+ m_ui->airportDiagram->setSelectedRunway(rwy);
+ }
}
if (m_ui->onFinalCheckbox->isChecked()) {