X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FGUI%2FAirportDiagram.hxx;h=c5c87004dd62e26596d103a74c01a2803faa416f;hb=3cee5eea735545dddd0c1e5b9551d97cf8f79c2c;hp=d6802e5553074a5098416d373a162d7b2f9a46d4;hpb=78e8f533124ad38c414d10470abcd2149b6d01e8;p=flightgear.git diff --git a/src/GUI/AirportDiagram.hxx b/src/GUI/AirportDiagram.hxx index d6802e555..c5c87004d 100644 --- a/src/GUI/AirportDiagram.hxx +++ b/src/GUI/AirportDiagram.hxx @@ -1,44 +1,76 @@ -#include -#include +// AirportDiagram.hxx - part of GUI launcher using Qt5 +// +// Written by James Turner, started December 2014. +// +// Copyright (C) 2014 James Turner +// +// 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. -#include +#ifndef GUI_AIRPORT_DIAGRAM_HXX +#define GUI_AIRPORT_DIAGRAM_HXX + +#include "BaseDiagram.hxx" + +#include +#include #include -class AirportDiagram : public QWidget +class AirportDiagram : public BaseDiagram { + Q_OBJECT public: AirportDiagram(QWidget* pr); + virtual ~AirportDiagram(); void setAirport(FGAirportRef apt); void addRunway(FGRunwayRef rwy); - void addParking(FGParking* park); -protected: - virtual void paintEvent(QPaintEvent* pe); - // wheel event for zoom + void addParking(FGParkingRef park); + + FGRunwayRef selectedRunway() const; + void setSelectedRunway(FGRunwayRef r); - // mouse drag for pan + void setApproachExtensionDistance(double distanceNm); +Q_SIGNALS: + void clickedRunway(FGRunwayRef rwy); + + void clickedParking(FGParkingRef park); +protected: + + virtual void mouseReleaseEvent(QMouseEvent* me); + void paintContents(QPainter*) Q_DECL_OVERRIDE; + void doComputeBounds() Q_DECL_OVERRIDE; private: - void extendBounds(const QPointF& p); - QPointF project(const SGGeod& geod) const; void buildTaxiways(); void buildPavements(); + void drawILS(QPainter *painter, FGRunwayRef runway) const; + void drawParkings(QPainter *p); + FGAirportRef m_airport; - SGGeod m_projectionCenter; - double m_scale; - QRectF m_bounds; struct RunwayData { QPointF p1, p2; int widthM; FGRunwayRef runway; }; - - QList m_runways; + + QVector m_runways; struct TaxiwayData { QPointF p1, p2; @@ -50,6 +82,21 @@ private: } }; - QList m_taxiways; - QList m_pavements; + QVector m_taxiways; + QVector m_pavements; + + struct ParkingData + { + QPointF pt; + FGParkingRef parking; + }; + + QVector m_parking; + + QPainterPath m_parkingIconPath, // arrow points right + m_parkingIconLeftPath; // arrow points left + double m_approachDistanceNm; + FGRunwayRef m_selectedRunway; }; + +#endif // of GUI_AIRPORT_DIAGRAM_HXX