OP-1900 have path_progress updated correctly for leg_remaining and error_below end...
[librepilot.git] / ground / openpilotgcs / src / plugins / opmap / modelmapproxy.h
blob0c169698a04f80de4222c58829164749dab29ab6
1 /**
2 ******************************************************************************
4 * @file modelmapproxy.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 MODELMAPPROXY_H
28 #define MODELMAPPROXY_H
29 #include <QWidget>
30 #include "opmapcontrol/opmapcontrol.h"
31 #include "pathaction.h"
32 #include "waypoint.h"
33 #include "QMutexLocker"
34 #include "QPointer"
35 #include "flightdatamodel.h"
36 #include <QItemSelectionModel>
37 #include <widgetdelegates.h>
40 using namespace mapcontrol;
41 class modelMapProxy : public QObject {
42 typedef enum { OVERLAY_LINE, OVERLAY_CIRCLE_RIGHT, OVERLAY_CIRCLE_LEFT } overlayType;
43 Q_OBJECT
44 public:
45 explicit modelMapProxy(QObject *parent, OPMapWidget *map, flightDataModel *model, QItemSelectionModel *selectionModel);
46 WayPointItem *findWayPointNumber(int number);
47 void createWayPoint(internals::PointLatLng coord);
48 void deleteWayPoint(int number);
49 void deleteAll();
50 private slots:
51 void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
52 void rowsInserted(const QModelIndex & parent, int first, int last);
53 void rowsRemoved(const QModelIndex & parent, int first, int last);
54 void WPValuesChanged(WayPointItem *wp);
55 void currentRowChanged(QModelIndex, QModelIndex);
56 void selectedWPChanged(QList<WayPointItem *>);
57 private:
58 overlayType overlayTranslate(int type);
59 void createOverlay(WayPointItem *from, WayPointItem *to, overlayType type, QColor color, bool dashed = false, int width = -1);
60 void createOverlay(WayPointItem *from, HomeItem *to, modelMapProxy::overlayType type, QColor color, bool dashed = false, int width = -1);
61 OPMapWidget *myMap;
62 flightDataModel *model;
63 void refreshOverlays();
64 QItemSelectionModel *selection;
67 #endif // MODELMAPPROXY_H