| 1 | // CarrierDiagram.hxx - part of GUI launcher using Qt5 |
| 2 | // |
| 3 | // Written by Stuart Buchanan, started April 2020. |
| 4 | // |
| 5 | // Copyright (C) 2022 Stuart Buchanan <[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_CARRIER_DIAGRAM_HXX |
| 22 | #define GUI_CARRIER_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 CarrierDiagram : public BaseDiagram |
| 32 | { |
| 33 | Q_OBJECT |
| 34 | |
| 35 | Q_PROPERTY(QmlGeod geod READ geod WRITE setGeod NOTIFY locationChanged) |
| 36 | Q_PROPERTY(bool offsetEnabled READ isOffsetEnabled WRITE setOffsetEnabled NOTIFY offsetChanged) |
| 37 | Q_PROPERTY(bool abeam READ isAbeam WRITE setAbeam NOTIFY offsetChanged) |
| 38 | Q_PROPERTY(QuantityValue offsetDistance READ offsetDistance WRITE setOffsetDistance NOTIFY offsetChanged) |
| 39 | public: |
| 40 | CarrierDiagram(QQuickItem* pr = nullptr); |
| 41 | |
| 42 | //void setCarrier(qlonglong nav); |
| 43 | //qlonglong navaid() const; |
| 44 | |
| 45 | void setGeod(QmlGeod geod); |
| 46 | QmlGeod geod() const; |
| 47 | |
| 48 | void setGeod(const SGGeod& geod); |
| 49 | |
| 50 | bool isOffsetEnabled() const |
| 51 | { return m_offsetEnabled; } |
| 52 | |
| 53 | bool isAbeam() const |
| 54 | { return m_abeam; } |
| 55 | |
| 56 | void setOffsetEnabled(bool offset); |
| 57 | void setAbeam(bool abeam); |
| 58 | |
| 59 | void setOffsetDistance(QuantityValue distance); |
| 60 | QuantityValue offsetDistance() const |
| 61 | { return m_offsetDistance; } |
| 62 | |
| 63 | signals: |
| 64 | void locationChanged(); |
| 65 | void offsetChanged(); |
| 66 | |
| 67 | protected: |
| 68 | void paintContents(QPainter *) override; |
| 69 | |
| 70 | void doComputeBounds() override; |
| 71 | private: |
| 72 | FGPositionedRef m_Carrier; |
| 73 | SGGeod m_geod; |
| 74 | |
| 75 | bool m_offsetEnabled = false; |
| 76 | bool m_abeam = false; |
| 77 | QuantityValue m_offsetDistance; |
| 78 | }; |
| 79 | |
| 80 | #endif // of GUI_CARRIER_DIAGRAM_HXX |