Debian Codegraph @

src/GUI/NavaidDiagram.hxx

raw symbols SCIP
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 <[email protected]>
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
31 class NavaidDiagram : public BaseDiagram
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
38 Q_PROPERTY(QuantityValue heading READ heading WRITE setHeading NOTIFY offsetChanged)
39 Q_PROPERTY(QuantityValue offsetBearing READ offsetBearing WRITE setOffsetBearing NOTIFY offsetChanged)
40 Q_PROPERTY(bool offsetEnabled READ isOffsetEnabled WRITE setOffsetEnabled NOTIFY offsetChanged)
41 Q_PROPERTY(QuantityValue offsetDistance READ offsetDistance WRITE setOffsetDistance NOTIFY offsetChanged)
42 public:
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);
59 QuantityValue offsetDistance() const
60 { return m_offsetDistance; }
61
62 void setOffsetBearing(QuantityValue bearing);
63 QuantityValue offsetBearing() const
64 { return m_offsetBearing; }
65
66 void setHeading(QuantityValue heading);
67 QuantityValue heading() const
68 { return m_heading; }
69
70 signals:
71 void locationChanged();
72 void offsetChanged();
73
74 protected:
75 void paintContents(QPainter *) override;
76
77 void doComputeBounds() override;
78 private:
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