dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
mappointitem.h
Go to the documentation of this file.
1 
13 /*
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, see <http://www.gnu.org/licenses/>
26 */
27 #ifndef MAPPOINTITEM_H
28 #define MAPPOINTITEM_H
29 
30 #include <QGraphicsItem>
31 #include <QLabel>
32 #include <QObject>
33 #include <QPainter>
34 #include <QPoint>
35 
36 #include "../internals/pointlatlng.h"
37 #include "mapgraphicitem.h"
38 #include "physical_constants.h"
39 #include "../core/corecommon.h"
40 
41 namespace mapcontrol
42 {
43 
44 struct TLMAPWIDGET_EXPORT distBearingAltitude
45 {
46  double distance;
47  double bearing;
48  distBearingAltitude() : distance(0.0), bearing(0.0) { }
49 };
50 
56 class TLMAPWIDGET_EXPORT MapPointItem: public QObject,public QGraphicsItem
57 {
58  Q_OBJECT
59  Q_INTERFACES(QGraphicsItem)
60 public:
61  enum GraphicItemTypes {TYPE_WAYPOINTITEM = 1, TYPE_UAVITEM = 2, TYPE_HOMEITEM = 4, TYPE_GPSITEM = 6};
62 
68  QString Description(){return description;}
69 
75  void SetDescription(QString const& value);
76 
81  internals::PointLatLng Coord(){return coord;}
82 
88  virtual void SetCoord(internals::PointLatLng const& value);
89 
95  float Altitude(){return altitude;}
96 
102  virtual void SetAltitude(const float &value);
103  void setRelativeCoord(distBearingAltitude value);
104  distBearingAltitude getRelativeCoord(){return relativeCoord;}
105 
106 protected:
108 
109  internals::PointLatLng coord; //coordinates of this MapPointItem
110  float altitude;
112  QString description;
113 
114  double DistanceToPoint_2D(const internals::PointLatLng &coord);
115  double DistanceToPoint_3D(const internals::PointLatLng &coord, const int &altitude);
116 private:
117 
118  QGraphicsSimpleTextItem* text;
119  QGraphicsRectItem* textBG;
120  QGraphicsSimpleTextItem* numberI;
121  QGraphicsRectItem* numberIBG;
122  QTransform transf;
123  QString myCustomString;
124 
125 public slots:
126 signals:
127  void absolutePositionChanged(internals::PointLatLng coord, float altitude);
128  void relativePositionChanged(QPointF point, MapPointItem* mappoint);
129  void aboutToBeDeleted(MapPointItem *);
130 };
131 }
132 #endif // MAPPOINTITEM_H
internals::PointLatLng coord
Definition: mappointitem.h:109
distBearingAltitude relativeCoord
Definition: mappointitem.h:111
The main graphicsItem used on the widget, contains the map and map logic.
The main graphicsItem used on the widget, contains the map and map logic.
A QGraphicsItem representing a MapPointItem.
Definition: mappointitem.h:56
MapGraphicItem * map
Definition: mappointitem.h:107