dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
flightdatamodel.h
Go to the documentation of this file.
1 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 
27 #ifndef FlightDataModel_H
28 #define FlightDataModel_H
29 
30 #include <QAbstractTableModel>
31 #include "pathplanner_global.h"
32 
38 {
39  QString wpDescription;
40  double latPosition;
41  double lngPosition;
42  double altitude;
43  float velocity;
44  int mode;
45  float mode_params;
46  bool locked;
47 };
48 
49 class PATHPLANNER_EXPORT FlightDataModel : public QAbstractTableModel
50 {
51  Q_OBJECT
52 public:
66  LASTCOLUMN
67  };
68 
69  FlightDataModel(QObject *parent);
70  int rowCount(const QModelIndex &parent = QModelIndex()) const;
71  int columnCount(const QModelIndex &parent = QModelIndex()) const;
72  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
73  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
74  void fixupValidationErrors();
75 
76  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
77  Qt::ItemFlags flags(const QModelIndex &index) const;
78  bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
79  bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
80  bool writeToFile(QString filename);
81  void readFromFile(QString fileName);
82 
83  static QMap<int, QString> modeNames;
84 
86  bool replaceData(FlightDataModel *newModel);
87 
89  void pauseValidation(bool pausing);
90 
91 private:
92  QList<PathPlanData *> dataStorage;
93 
94  bool valPaused;
95 
97  struct NED
98  {
99  double North;
100  double East;
101  double Down;
102  };
103 
105  struct FlightDataModel::NED getNED(int index) const;
106  struct FlightDataModel::NED getNED(PathPlanData *row) const;
107 
109  bool setNED(int index, struct FlightDataModel::NED NED);
110  bool setNED(PathPlanData *row, struct FlightDataModel::NED NED);
111 
113  bool getHomeLocation(double *homeLLA) const;
115  bool setHomeLocation(double *homeLLA);
116 
118  void showErrorDialog(const char *title, const char *message);
119 };
120 
121 #endif // FlightDataModel_H
PathPlanDataEnum
The column names.
double lngPosition
Longitude of the waypoint.
int mode
Navigation mode for this waypoint.
double altitude
Altitude of the waypoint (m above ellipsoid)
static QMap< int, QString > modeNames
axis equal end function NED
Definition: OPPlots.m:63
float velocity
Velocity associated with this waypoint.
double latPosition
Latitude of the waypoint.
QString wpDescription
Description for the waypoint.
DataFields data
void setData(const DataFields &data)
The PathPlanData struct is the internal representation of the waypoints. Notice this is in absolute t...
bool locked
Lock a waypoint.
float mode_params
Optional parameters associated with this waypoint.