Launcher: show selected parking in yellow.
This commit is contained in:
parent
4aee633be3
commit
38202b0774
3 changed files with 87 additions and 37 deletions
|
@ -109,8 +109,7 @@ void AirportDiagram::setAirport(FGAirportRef apt)
|
|||
m_airport = apt;
|
||||
m_projectionCenter = apt ? apt->geod() : SGGeod();
|
||||
m_runways.clear();
|
||||
m_approachDistanceNm = -1.0;
|
||||
m_parking.clear();
|
||||
m_approachDistanceNm = -1.0; m_parking.clear();
|
||||
m_helipads.clear();
|
||||
|
||||
if (apt) {
|
||||
|
@ -136,13 +135,25 @@ void AirportDiagram::setSelectedRunway(FGRunwayRef r)
|
|||
return;
|
||||
}
|
||||
|
||||
m_selectedParking.clear();
|
||||
m_selectedRunway = r;
|
||||
update();
|
||||
}
|
||||
|
||||
void AirportDiagram::setSelectedHelipad(FGHelipadRef pad)
|
||||
{
|
||||
qWarning() << Q_FUNC_INFO << "implement me";
|
||||
}
|
||||
|
||||
void AirportDiagram::setSelectedParking(FGParkingRef park)
|
||||
{
|
||||
if (m_selectedParking == park) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_selectedRunway.clear();
|
||||
m_selectedParking = park;
|
||||
update();
|
||||
}
|
||||
|
||||
void AirportDiagram::setApproachExtensionDistance(double distanceNm)
|
||||
|
@ -336,17 +347,8 @@ void AirportDiagram::drawHelipads(QPainter* painter)
|
|||
}
|
||||
}
|
||||
|
||||
void AirportDiagram::drawParkings(QPainter* painter)
|
||||
void AirportDiagram::drawParking(QPainter* painter, const ParkingData& p) const
|
||||
{
|
||||
QTransform t = painter->transform();
|
||||
|
||||
|
||||
QFont f = painter->font();
|
||||
f.setPixelSize(16);
|
||||
painter->setFont(f);
|
||||
|
||||
Q_FOREACH(const ParkingData& p, m_parking) {
|
||||
painter->setTransform(t);
|
||||
painter->translate(p.pt);
|
||||
|
||||
double hdg = p.parking->getHeading();
|
||||
|
@ -363,7 +365,12 @@ void AirportDiagram::drawParkings(QPainter* painter)
|
|||
|
||||
painter->rotate(hdg);
|
||||
|
||||
if (p.parking == m_selectedParking) {
|
||||
painter->setBrush(Qt::yellow);
|
||||
} else {
|
||||
painter->setBrush(QColor(255, 196, 196)); // kind of pink
|
||||
}
|
||||
|
||||
painter->drawPath(useLeftIcon ? m_parkingIconLeftPath : m_parkingIconPath);
|
||||
|
||||
painter->fillRect(labelRect, Qt::white);
|
||||
|
@ -373,9 +380,43 @@ void AirportDiagram::drawParkings(QPainter* painter)
|
|||
painter->drawText(labelRect,
|
||||
Qt::AlignVCenter | Qt::AlignHCenter,
|
||||
QString::fromStdString(p.parking->name()));
|
||||
}
|
||||
|
||||
AirportDiagram::ParkingData AirportDiagram::findParkingData(const FGParkingRef &pk) const
|
||||
{
|
||||
Q_FOREACH(const ParkingData& p, m_parking) {
|
||||
if (p.parking == m_selectedParking) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return ParkingData();
|
||||
}
|
||||
|
||||
void AirportDiagram::drawParkings(QPainter* painter) const
|
||||
{
|
||||
painter->save();
|
||||
QTransform t = painter->transform();
|
||||
|
||||
QFont f = painter->font();
|
||||
f.setPixelSize(16);
|
||||
painter->setFont(f);
|
||||
|
||||
Q_FOREACH(const ParkingData& p, m_parking) {
|
||||
if (p.parking == m_selectedParking) {
|
||||
continue; // skip and draw last
|
||||
}
|
||||
|
||||
painter->setTransform(t);
|
||||
drawParking(painter, p);
|
||||
}
|
||||
|
||||
if (m_selectedParking) {
|
||||
painter->setTransform(t);
|
||||
drawParking(painter, findParkingData(m_selectedParking));
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void AirportDiagram::drawILS(QPainter* painter, FGRunwayRef runway) const
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
void setSelectedRunway(FGRunwayRef r);
|
||||
|
||||
void setSelectedHelipad(FGHelipadRef pad);
|
||||
void setSelectedParking(FGParkingRef park);
|
||||
|
||||
void setApproachExtensionDistance(double distanceNm);
|
||||
Q_SIGNALS:
|
||||
|
@ -59,12 +60,7 @@ protected:
|
|||
void doComputeBounds() Q_DECL_OVERRIDE;
|
||||
private:
|
||||
|
||||
void buildTaxiways();
|
||||
void buildPavements();
|
||||
|
||||
void drawILS(QPainter *painter, FGRunwayRef runway) const;
|
||||
void drawParkings(QPainter *p);
|
||||
void drawHelipads(QPainter *painter);
|
||||
|
||||
FGAirportRef m_airport;
|
||||
|
||||
|
@ -105,10 +101,23 @@ private:
|
|||
|
||||
QVector<HelipadData> m_helipads;
|
||||
|
||||
void buildTaxiways();
|
||||
void buildPavements();
|
||||
|
||||
void drawILS(QPainter *painter, FGRunwayRef runway) const;
|
||||
|
||||
void drawParkings(QPainter *p) const;
|
||||
void drawParking(QPainter *painter, const ParkingData &p) const;
|
||||
|
||||
ParkingData findParkingData(const FGParkingRef& pk) const;
|
||||
|
||||
void drawHelipads(QPainter *painter);
|
||||
|
||||
QPainterPath m_parkingIconPath, // arrow points right
|
||||
m_parkingIconLeftPath; // arrow points left
|
||||
double m_approachDistanceNm;
|
||||
FGRunwayRef m_selectedRunway;
|
||||
FGParkingRef m_selectedParking;
|
||||
};
|
||||
|
||||
#endif // of GUI_AIRPORT_DIAGRAM_HXX
|
||||
|
|
|
@ -764,7 +764,7 @@ void LocationWidget::onAirportParkingClicked(FGParkingRef park)
|
|||
m_ui->parkingRadio->setChecked(true);
|
||||
int parkingIndex = m_ui->parkingCombo->findData(park->getIndex());
|
||||
m_ui->parkingCombo->setCurrentIndex(parkingIndex);
|
||||
m_ui->airportDiagram->setSelectedRunway(FGRunwayRef());
|
||||
m_ui->airportDiagram->setSelectedParking(park);
|
||||
}
|
||||
|
||||
updateDescription();
|
||||
|
|
Loading…
Reference in a new issue