FlightGear next
RouteDiagram.hxx
Go to the documentation of this file.
1// RouteDiagram.hxx - show a route graphically
2//
3// Written by James Turner, started August 2018.
4//
5// Copyright (C) 2018 James Turner <james@flightgear.org>
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_ROUTE_DIAGRAM_HXX
22#define GUI_ROUTE_DIAGRAM_HXX
23
24#include "BaseDiagram.hxx"
25#include "QmlPositioned.hxx"
26#include "UnitsModel.hxx"
27
28#include <Navaids/navrecord.hxx>
29#include <Navaids/routePath.hxx>
30
31#include <simgear/math/sg_geodesy.hxx>
32
34
36{
37 Q_OBJECT
38
40
42 Q_PROPERTY(int numLegs READ numLegs NOTIFY flightplanChanged)
43 public:
44 RouteDiagram(QQuickItem* pr = nullptr);
45
47 {
48 return m_flightplan;
49 }
50
52
53 int numLegs() const;
54
55 int activeLegIndex() const
56 {
57 return m_activeLegIndex;
58 }
59
60public slots:
62
63signals:
65
67
68protected:
69 void paintContents(QPainter *) override;
70
71 void doComputeBounds() override;
72private:
73 void fpChanged();
74
75 FlightPlanController* m_flightplan = nullptr;
76
77 std::unique_ptr<RoutePath> m_path;
78 int m_activeLegIndex = 0;
79};
80
81#endif // of GUI_ROUTE_DIAGRAM_HXX
BaseDiagram(QQuickItem *pr=nullptr)
RouteDiagram(QQuickItem *pr=nullptr)
int activeLegIndex() const
void setFlightplan(FlightPlanController *fp)
void paintContents(QPainter *) override
void setActiveLegIndex(int activeLegIndex)
void flightplanChanged(FlightPlanController *flightplan)
FlightPlanController * flightplan
void legIndexChanged(int activeLegIndex)
void doComputeBounds() override