]> git.mxchange.org Git - flightgear.git/blob - src/GUI/AirportDiagram.hxx
Add missing GPL boilerplate.
[flightgear.git] / src / GUI / AirportDiagram.hxx
1 // AirportDiagram.hxx - part of GUI launcher using Qt5
2 //
3 // Written by James Turner, started December 2014.
4 //
5 // Copyright (C) 2014 James Turner <zakalawe@mac.com>
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
21 #include <QWidget>
22 #include <QPainterPath>
23
24 #include <Airports/airports_fwd.hxx>
25 #include <simgear/math/sg_geodesy.hxx>
26
27 class AirportDiagram : public QWidget
28 {
29 public:
30     AirportDiagram(QWidget* pr);
31
32     void setAirport(FGAirportRef apt);
33
34     void addRunway(FGRunwayRef rwy);
35     void addParking(FGParking* park);
36 protected:
37     virtual void paintEvent(QPaintEvent* pe);
38     // wheel event for zoom
39
40     // mouse drag for pan
41
42
43 private:
44     void extendBounds(const QPointF& p);
45     QPointF project(const SGGeod& geod) const;
46
47     void buildTaxiways();
48     void buildPavements();
49
50     FGAirportRef m_airport;
51     SGGeod m_projectionCenter;
52     double m_scale;
53     QRectF m_bounds;
54
55     struct RunwayData {
56         QPointF p1, p2;
57         int widthM;
58         FGRunwayRef runway;
59     };
60
61     QList<RunwayData> m_runways;
62
63     struct TaxiwayData {
64         QPointF p1, p2;
65         int widthM;
66
67         bool operator<(const TaxiwayData& other) const
68         {
69             return widthM < other.widthM;
70         }
71     };
72
73     QList<TaxiwayData> m_taxiways;
74     QList<QPainterPath> m_pavements;
75 };