OP-1900 have path_progress updated correctly for leg_remaining and error_below end...
[librepilot.git] / ground / openpilotgcs / src / plugins / opmap / flightdatamodel.h
blob3dcdf337c6cea2595ae33ed91007807e0e49482c
1 /**
2 ******************************************************************************
4 * @file flightdatamodel.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup OPMapPlugin OpenPilot Map Plugin
9 * @{
10 * @brief The OpenPilot Map plugin
11 *****************************************************************************/
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.
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.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #ifndef FLIGHTDATAMODEL_H
28 #define FLIGHTDATAMODEL_H
29 #include <QAbstractTableModel>
30 #include "opmapcontrol/opmapcontrol.h"
32 struct pathPlanData {
33 QString wpDescritption;
34 double latPosition;
35 double lngPosition;
36 double disRelative;
37 double beaRelative;
38 double altitudeRelative;
39 bool isRelative;
40 double altitude;
41 float velocity;
42 int mode;
43 float mode_params[4];
44 int condition;
45 float condition_params[4];
46 int command;
47 int jumpdestination;
48 int errordestination;
49 bool locked;
52 class flightDataModel : public QAbstractTableModel {
53 Q_OBJECT
54 public:
55 enum pathPlanDataEnum {
56 WPDESCRITPTION, LATPOSITION, LNGPOSITION, DISRELATIVE, BEARELATIVE, ALTITUDERELATIVE, ISRELATIVE, ALTITUDE,
57 VELOCITY, MODE, MODE_PARAMS0, MODE_PARAMS1, MODE_PARAMS2, MODE_PARAMS3,
58 CONDITION, CONDITION_PARAMS0, CONDITION_PARAMS1, CONDITION_PARAMS2, CONDITION_PARAMS3,
59 COMMAND, JUMPDESTINATION, ERRORDESTINATION, LOCKED
61 flightDataModel(QObject *parent);
62 int rowCount(const QModelIndex &parent = QModelIndex()) const;
63 int columnCount(const QModelIndex &parent = QModelIndex()) const;
64 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
65 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
67 bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
68 Qt::ItemFlags flags(const QModelIndex & index) const;
69 bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex());
70 bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
71 bool writeToFile(QString filename);
72 void readFromFile(QString fileName);
73 private:
74 QList<pathPlanData *> dataStorage;
75 QVariant getColumnByIndex(const pathPlanData *row, const int index) const;
76 bool setColumnByIndex(pathPlanData *row, const int index, const QVariant value);
79 #endif // FLIGHTDATAMODEL_H