Marble

RoutingInstruction.h
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2010 Dennis Nienhüser <[email protected]>
9 //
10 
11 #ifndef MARBLE_ROUTINGINSTRUCTION_H
12 #define MARBLE_ROUTINGINSTRUCTION_H
13 
14 #include "RoutingWaypoint.h"
15 #include "RoutingPoint.h"
16 #include "marble_export.h"
17 
18 #include <QVector>
19 #include <QMetaType>
20 
21 class QTextStream;
22 
23 namespace Marble
24 {
25 
30 class MARBLE_EXPORT RoutingInstruction
31 {
32 public:
33  enum TurnType {
34  Unknown = 0,
35  Continue = 13 ,
36  Merge = 14,
37  Straight = 1,
38  SlightRight = 2,
39  Right = 3,
40  SharpRight = 4,
41  TurnAround = 5 ,
42  SharpLeft = 6,
43  Left = 7,
44  SlightLeft = 8,
45  RoundaboutFirstExit = 9 ,
46  RoundaboutSecondExit = 10 ,
47  RoundaboutThirdExit = 11 ,
48  RoundaboutExit = 12 ,
49  ExitLeft = 15,
50  ExitRight = 16
51  };
52 
54  explicit RoutingInstruction( const RoutingWaypoint &item = RoutingWaypoint() );
55 
60  bool append( const RoutingWaypoint &item, int angle );
61 
63  QString roadName() const;
64 
66  QString roadType() const;
67 
69  int secondsLeft() const;
70 
72  QVector<RoutingWaypoint> points() const;
73 
79  QVector<RoutingPoint> intersectionPoints() const;
80 
82  qreal angleToPredecssor() const;
83 
85  RoutingInstruction* predecessor();
86 
88  const RoutingInstruction* predecessor() const;
89 
91  void setPredecessor( RoutingInstruction* predecessor );
92 
94  RoutingInstruction* successor();
95 
97  const RoutingInstruction* successor() const;
98 
100  void setSuccessor( RoutingInstruction* successor );
101 
103  qreal distance() const;
104 
106  qreal distanceFromStart() const;
107 
109  qreal distanceToEnd() const;
110 
111  TurnType turnType() const;
112 
114  QString nextRoadInstruction() const;
115 
117  QString nextDistanceInstruction() const;
118 
120  QString totalDurationRemaining() const;
121 
123  QString instructionText() const;
124 
125  static QString generateRoadInstruction( TurnType turnType, const QString &roadName );
126 
127 protected:
128  int roundaboutExitNumber() const;
129 
130 private:
131  void calculateAngle();
132 
133  void calculateTurnType();
134 
135  QVector<RoutingWaypoint> m_points;
136 
137  QVector<RoutingPoint> m_intersectionPoints;
138 
139  QString m_roadName;
140 
141  QString m_roadType;
142 
143  int m_secondsLeft;
144 
145  qreal m_angleToPredecessor;
146 
147  TurnType m_turnType;
148 
149  int m_roundaboutExit;
150 
151  RoutingInstruction* m_predecessor;
152 
153  RoutingInstruction* m_successor;
154 };
155 
157 
159 
160 } // namespace Marble
161 
162 Q_DECLARE_METATYPE( Marble::RoutingInstruction::TurnType )
163 
164 #endif // MARBLE_ROUTINGINSTRUCTION_H
Stores data related to one instruction: Road name, angle to predecessor, associated waypoints etc...
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Binds a QML item to a specific geodetic location in screen coordinates.
Left
Stores one line of gosmore/routino output.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 24 2020 22:38:26 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.