dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
modelmapproxy.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  *
29  * Additional note on redistribution: The copyright and license notices above
30  * must be maintained in each individual source file that is a derivative work
31  * of this source file; otherwise redistribution is prohibited.
32  */
33 
34 #ifndef MODELMAPPROXY_H
35 #define MODELMAPPROXY_H
36 #include <QWidget>
38 #include "waypoint.h"
39 #include "QPointer"
40 #include <QItemSelectionModel>
41 
42 #include "../pathplanner/flightdatamodel.h"
43 
44 using namespace mapcontrol;
45 
51 class ModelMapProxy : public QObject
52 {
53  typedef enum {
54  OVERLAY_LINE,
55  OVERLAY_CURVE_RIGHT,
56  OVERLAY_CURVE_LEFT,
57  OVERLAY_CIRCLE_RIGHT,
58  OVERLAY_CIRCLE_LEFT
59  } overlayType;
60  Q_OBJECT
61 public:
62  explicit ModelMapProxy(QObject *parent, TLMapWidget *map, FlightDataModel *model,
63  QItemSelectionModel *selectionModel);
64 
66  WayPointItem *findWayPointNumber(int number);
67 
69  void createWayPoint(internals::PointLatLng coord);
70 
72  void deleteWayPoint(int number);
73 
75  void deleteAll();
76 private slots:
77 
79  void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
80 
82  void rowsInserted(const QModelIndex &parent, int first, int last);
83 
85  void rowsRemoved(const QModelIndex &parent, int first, int last);
86 
88  void WPValuesChanged(WayPointItem *wp);
89 
91  void currentRowChanged(QModelIndex, QModelIndex);
92 
94  void selectedWPChanged(QList<WayPointItem *>);
95 
96 private:
97  overlayType overlayTranslate(int type);
98  void createOverlay(WayPointItem *from, WayPointItem *to, overlayType type, QColor color,
99  double radius);
100  void createOverlay(WayPointItem *from, HomeItem *to, ModelMapProxy::overlayType type,
101  QColor color);
102  TLMapWidget *myMap;
103  FlightDataModel *model;
104  void refreshOverlays();
105  QItemSelectionModel *selection;
106 };
107 
108 #endif // MODELMAPPROXY_H
Trim off last
The ModelMapProxy class maps from the FlightDataModel to the OPMap and provides synchronization, both when the model changes updating the UI and if it is modified on the UI propagating changes to the model.
Definition: modelmapproxy.h:51
A QGraphicsItem representing a WayPoint.
Definition: waypointitem.h:41
Definition: icore.h:39