FlightGear next
NavaidDiagram.hxx
Go to the documentation of this file.
1// NavaidDiagram.hxx - part of GUI launcher using Qt5
2//
3// Written by James Turner, started October 2015.
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#ifndef GUI_NAVAID_DIAGRAM_HXX
22#define GUI_NAVAID_DIAGRAM_HXX
23
24#include "BaseDiagram.hxx"
25#include "QmlPositioned.hxx"
26#include "UnitsModel.hxx"
27
28#include <Navaids/navrecord.hxx>
29#include <simgear/math/sg_geodesy.hxx>
30
32{
33 Q_OBJECT
34
35 Q_PROPERTY(qlonglong navaid READ navaid WRITE setNavaid NOTIFY locationChanged)
36 Q_PROPERTY(QmlGeod geod READ geod WRITE setGeod NOTIFY locationChanged)
37
42public:
43 NavaidDiagram(QQuickItem* pr = nullptr);
44
45 void setNavaid(qlonglong nav);
46 qlonglong navaid() const;
47
48 void setGeod(QmlGeod geod);
49 QmlGeod geod() const;
50
51 void setGeod(const SGGeod& geod);
52
53 bool isOffsetEnabled() const
54 { return m_offsetEnabled; }
55
56 void setOffsetEnabled(bool offset);
57
58 void setOffsetDistance(QuantityValue distance);
60 { return m_offsetDistance; }
61
62 void setOffsetBearing(QuantityValue bearing);
64 { return m_offsetBearing; }
65
68 { return m_heading; }
69
70signals:
73
74protected:
75 void paintContents(QPainter *) override;
76
77 void doComputeBounds() override;
78private:
79 FGPositionedRef m_navaid;
80 SGGeod m_geod;
81
82 bool m_offsetEnabled = false;
83 QuantityValue m_offsetDistance;
84 QuantityValue m_offsetBearing;
85 QuantityValue m_heading;
86};
87
88#endif // of GUI_NAVAID_DIAGRAM_HXX
SGSharedPtr< FGPositioned > FGPositionedRef
Definition airways.hxx:30
BaseDiagram(QQuickItem *pr=nullptr)
void setOffsetBearing(QuantityValue bearing)
void setHeading(QuantityValue heading)
NavaidDiagram(QQuickItem *pr=nullptr)
QuantityValue heading
QuantityValue offsetBearing
bool isOffsetEnabled() const
QuantityValue offsetBearing() const
void setNavaid(qlonglong nav)
void paintContents(QPainter *) override
void setOffsetEnabled(bool offset)
void locationChanged()
void setOffsetDistance(QuantityValue distance)
QuantityValue offsetDistance() const
QuantityValue heading() const
void setGeod(QmlGeod geod)
void doComputeBounds() override
void offsetChanged()
QuantityValue offsetDistance
Expose an SGGeod as Qml-friendly class.