Added comment to tab index list appending.
[situare] / src / routing / routesegment.h
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Sami Rämö - sami.ramo@ixonos.com
6
7     Situare is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License
9     version 2 as published by the Free Software Foundation.
10
11     Situare is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with Situare; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19     USA.
20 */
21
22
23 #ifndef ROUTESEGMENT_H
24 #define ROUTESEGMENT_H
25
26 #include <QtGlobal>
27 #include <QString>
28
29 /**
30  * @brief Container for a single route segment data
31  *
32  * Contains all data for a single route segment.
33  *
34  * @author Sami Rämö - sami.ramo@ixonos.com
35  */
36 class RouteSegment
37 {
38 public:
39     /**
40     * @brief Constructor
41     */
42     RouteSegment();
43
44 /*******************************************************************************
45  * MEMBER FUNCTIONS AND SLOTS
46  ******************************************************************************/
47     /**
48     * @brief Getter for azimuth
49     *
50     * @return Azimuth (in degrees)
51     */
52     qreal azimuth() const;
53
54     /**
55     * @brief Getter for earth direction code of the start of the segment
56     *
57     * @returns Earth direction (N, NE, E, SE, S, SW, W, NW)
58     */
59     const QString& earthDirection() const;
60
61     /**
62     * @brief Getter for text instruction
63     *
64     * e.g. Turn left at Oxford Street
65     *
66     * @returns Instruction text
67     */
68     const QString& instruction() const;
69
70     /**
71     * @brief Getter for segment length
72     *
73     * @returns Length of the segment in meters
74     */
75     qreal length() const;
76
77     /**
78     * @brief Getter for length caption text
79     *
80     * e.g. 22m, 23.4 km, 14.4 miles
81     *
82     * @returns Length of the segment text
83     */
84     const QString& lengthCaption() const;
85
86     /**
87     * @brief Getter for the route geometry position index of the segment
88     *
89     * @returns Index of the first point of the segment in route geometry
90     */
91     int positionIndex() const;
92
93     /**
94     * @brief Set azimuth
95     *
96     * @param azimuth Azimuth (in degrees)
97     */
98     void setAzimuth(qreal azimuth);
99
100     /**
101     * @brief Set earth direction code of the start of the segment
102     *
103     * @param direction Direction code
104     */
105     void setEarthDirection(const QString &direction);
106
107     /**
108     * @brief Set instruction text
109     *
110     * @param instruction Instructon text
111     */
112     void setInstruction(const QString &instruction);
113
114     /**
115     * @brief Set length
116     *
117     * @param meters Length in meters
118     */
119     void setLength(qreal meters);
120
121     /**
122     * @brief Set length caption text
123     *
124     * @param length Length caption text
125     */
126     void setLengthCaption(const QString &length);
127
128     /**
129     * @brief Set position index
130     *
131     * @param index Position index
132     */
133     void setPositionIndex(int index);
134
135     /**
136     * @brief Set estimated travel time of the segment
137     *
138     * @param seconds Estimated travel time in seconds
139     */
140     void setTime(int seconds);
141
142     /**
143     * @brief Set turn angle
144     *
145     * @param degrees Turn angle in degrees
146     */
147     void setTurnAngle(qreal degrees);
148
149     /**
150     * @brief Set turn type code
151     *
152     * @param type Turn type code
153     */
154     void setTurnType(const QString &type);
155
156     /**
157     * @brief Get street name/number parsed from the text instruction
158     *
159     * @returns Street name/number, or empty QString if value is missing
160     */
161     QString street() const;
162
163     /**
164     * @brief Getter for estimated travel time of the segment
165     *
166     * @returns Estimated travel time of the segment in seconds
167     */
168     int time() const;
169
170     /**
171     * @brief Getter for turn angle
172     *
173     * @returns Turn angle in degrees
174     */
175     qreal turnAngle() const;
176
177     /**
178     * @brief Getter for turn type code
179     *
180     * e.g.
181     *    C      continue (go straight)
182     *    TL     turn left
183     *    TSLL   turn slight left
184     *    TSHL   turn sharp left
185     *    TR     turn right
186     *    TSLR   turn slight right
187     *    TSHR   turn sharp right
188     *    TU     U-turn
189     *
190     * @returns Turn type code
191     */
192     const QString& turnType() const;
193
194 /*******************************************************************************
195  * DATA MEMBERS
196  ******************************************************************************/
197 private:
198     int m_timeSeconds;          ///< estimated time required to travel the segment in seconds
199     int m_positionIndex;        ///< index of the first point of the segment in route geometry
200
201     qreal m_azimuth;            ///< azimuth
202     qreal m_length;             ///< length of the segment in meters
203     qreal m_turnAngle;          ///< angle in degress of the turn between two segments, 0 for straight
204
205     QString m_earthDirection;   ///< direction: N, NE, E, SE, S, SW, W, NW
206     QString m_instruction;      ///< text instruction, e.g. Turn left at Oxford Street
207     QString m_lengthCaption;    ///< length of the segment e.g. 22m, 23.4 km, 14.4 miles
208     QString m_turnType;         ///< code of the turn type, optional, absent for the first segment
209 };
210
211 #endif // ROUTESEGMENT_H