1
0
Fork 0
flightgear/src/GUI/AirportDiagram.hxx

115 lines
2.9 KiB
C++
Raw Normal View History

2015-03-07 23:52:03 +00:00
// AirportDiagram.hxx - part of GUI launcher using Qt5
//
// Written by James Turner, started December 2014.
//
// Copyright (C) 2014 James Turner <zakalawe@mac.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2015-11-03 21:28:36 +00:00
#ifndef GUI_AIRPORT_DIAGRAM_HXX
#define GUI_AIRPORT_DIAGRAM_HXX
2015-11-03 21:28:36 +00:00
#include "BaseDiagram.hxx"
#include <Airports/parking.hxx>
#include <Airports/runways.hxx>
#include <simgear/math/sg_geodesy.hxx>
2015-11-03 21:28:36 +00:00
class AirportDiagram : public BaseDiagram
{
Q_OBJECT
public:
AirportDiagram(QWidget* pr);
2015-11-03 21:28:36 +00:00
virtual ~AirportDiagram();
void setAirport(FGAirportRef apt);
void addRunway(FGRunwayRef rwy);
2015-11-03 21:28:36 +00:00
void addParking(FGParkingRef park);
void addHelipad(FGHelipadRef pad);
FGRunwayRef selectedRunway() const;
void setSelectedRunway(FGRunwayRef r);
2015-11-03 21:28:36 +00:00
void setSelectedHelipad(FGHelipadRef pad);
2015-11-03 21:28:36 +00:00
void setApproachExtensionDistance(double distanceNm);
Q_SIGNALS:
void clickedRunway(FGRunwayRef rwy);
2015-11-03 21:28:36 +00:00
void clickedParking(FGParkingRef park);
protected:
virtual void mouseReleaseEvent(QMouseEvent* me);
2015-11-03 21:28:36 +00:00
void paintContents(QPainter*) Q_DECL_OVERRIDE;
2015-11-03 21:28:36 +00:00
void doComputeBounds() Q_DECL_OVERRIDE;
private:
2015-11-03 21:28:36 +00:00
void buildTaxiways();
void buildPavements();
void drawILS(QPainter *painter, FGRunwayRef runway) const;
void drawParkings(QPainter *p);
void drawHelipads(QPainter *painter);
FGAirportRef m_airport;
struct RunwayData {
QPointF p1, p2;
int widthM;
FGRunwayRef runway;
};
2015-03-07 23:52:03 +00:00
2015-11-03 21:28:36 +00:00
QVector<RunwayData> m_runways;
struct TaxiwayData {
QPointF p1, p2;
int widthM;
bool operator<(const TaxiwayData& other) const
{
return widthM < other.widthM;
}
};
2015-11-03 21:28:36 +00:00
QVector<TaxiwayData> m_taxiways;
QVector<QPainterPath> m_pavements;
struct ParkingData
{
QPointF pt;
FGParkingRef parking;
};
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
2015-11-03 21:28:36 +00:00
double m_approachDistanceNm;
FGRunwayRef m_selectedRunway;
};
2015-11-03 21:28:36 +00:00
#endif // of GUI_AIRPORT_DIAGRAM_HXX