dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
waypointitem.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 WAYPOINTITEM_H
28 #define WAYPOINTITEM_H
29 
30 #include "mappointitem.h"
31 #include "../core/corecommon.h"
32 
33 namespace mapcontrol
34 {
35 class HomeItem;
41 class TLMAPWIDGET_EXPORT WayPointItem: public MapPointItem
42 {
43  Q_OBJECT
44  Q_INTERFACES(QGraphicsItem)
45 public:
46  enum { Type = UserType + TYPE_WAYPOINTITEM };
47  enum wptype {absolute,relative};
56  WayPointItem(internals::PointLatLng const& coord,int const& altitude,MapGraphicItem* map,wptype type=absolute);
57  WayPointItem(MapGraphicItem* map,bool magicwaypoint);
67  WayPointItem(internals::PointLatLng const& coord,int const& altitude,QString const& description,MapGraphicItem* map,wptype type=absolute);
68  WayPointItem(distBearingAltitude const& relativeCoord,QString const& description,MapGraphicItem* map);
69 
75  QString Description(){return description;}
81  void SetDescription(QString const& value);
87  bool Reached(){return reached;}
93  void SetReached(bool const& value);
98  int Number(){return number;}
99  int numberAdjusted(){return number+1;}
105  void SetNumber(int const& value);
111  virtual void SetCoord(internals::PointLatLng const& value);
116  bool ShowNumber(){return shownumber;}
122  void SetShowNumber(bool const& value);
129  virtual void SetAltitude(const float &value);
130  void setRelativeCoord(distBearingAltitude value);
131  distBearingAltitude getRelativeCoord(){return relativeCoord;}
132  int type() const;
133  QRectF boundingRect() const;
134  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
135  QWidget *widget);
136  void RefreshToolTip();
137  QPixmap picture;
138  QString customString(){return myCustomString;}
139  void setCustomString(QString arg){myCustomString=arg;}
140  void setFlag(GraphicsItemFlag flag, bool enabled);
141 ~WayPointItem();
142 
143  static int snumber;
144  void setWPType(wptype type);
145  wptype WPType(){return myType;}
146 protected:
147  void mouseMoveEvent ( QGraphicsSceneMouseEvent * event );
148  void mousePressEvent ( QGraphicsSceneMouseEvent * event );
149  void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
150  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
151 private:
152  bool reached;
153  bool shownumber;
154  bool isDragging;
155  int number;
156  bool isMagic;
157 
158  QGraphicsSimpleTextItem* text;
159  QGraphicsRectItem* textBG;
160  QGraphicsSimpleTextItem* numberI;
161  QGraphicsRectItem* numberIBG;
162  QTransform transf;
163  HomeItem * myHome;
164  wptype myType;
165  QString myCustomString;
166 
167 public slots:
173  void WPDeleted(int const& number,WayPointItem *waypoint);
181  void WPRenumbered(int const& oldnumber,int const& newnumber,WayPointItem* waypoint);
188  void WPInserted(int const& number,WayPointItem* waypoint);
189 
190  void onHomePositionChanged(internals::PointLatLng, float altitude);
191  void RefreshPos();
192  void setOpacitySlot(qreal opacity);
193 signals:
201  void WPNumberChanged(int const& oldnumber,int const& newnumber,WayPointItem* waypoint);
202 
214  void WPDropped(WayPointItem* waypoint);
215 
216  void WPValuesChanged(WayPointItem* waypoint);
217  void waypointdoubleclick(WayPointItem* waypoint);
218  void manualCoordChange(WayPointItem *);
219 };
220 }
221 #endif // WAYPOINTITEM_H
A graphicsItem representing a MapPointItem.
The main graphicsItem used on the widget, contains the map and map logic.
A QGraphicsItem representing a MapPointItem.
Definition: mappointitem.h:56
A QGraphicsItem representing a WayPoint.
Definition: waypointitem.h:41