9
9
** $QT_BEGIN_LICENSE:LGPL$
10
10
** Commercial Usage
11
** Licensees holding valid Qt Commercial licenses may use this file in
12
** accordance with the Qt Solutions Commercial License Agreement provided
13
** with the Software or, alternatively, in accordance with the terms
11
** Licensees holding valid Qt Commercial licenses may use this file in
12
** accordance with the Qt Commercial License Agreement provided with
13
** the Software or, alternatively, in accordance with the terms
14
14
** contained in a written agreement between you and Nokia.
16
16
** GNU Lesser General Public License Usage
33
33
** ensure the GNU General Public License version 3.0 requirements will be
34
34
** met: http://www.gnu.org/copyleft/gpl.html.
36
** Please note Third Party Software included with Qt Solutions may impose
37
** additional restrictions and it is the user's responsibility to ensure
38
** that they have met the licensing requirements of the GPL, LGPL, or Qt
39
** Solutions Commercial license and the relevant license of the Third
40
** Party Software they are using.
42
36
** If you are unsure which license is appropriate for your use, please
43
37
** contact the sales department at qt-sales@nokia.com.
44
38
** $QT_END_LICENSE$
62
56
\ingroup maps-routing
64
58
A QGeoRouteSegment instance has information about the physcial layout
65
of the route segment, the length of the route and the estimated time and
66
navigation instructions required to traverse the route segment.
59
of the route segment, the length of the route and estimated time required
60
to traverse the route segment and an optional QGeoManeuver associated with
61
the end of the route segment.
63
QGeoRouteSegment instances can be thought of as edges on a routing
64
graph, with QGeoManeuver instances as optional labels attached to the
65
vertices of the graph.
70
Constructs a route segment object.
69
Constructs an invalid route segment object.
71
The route segment will remain invalid until one of setNextRouteSegment(),
72
setTravelTime(), setDistance(), setPath() or setManeuver() is called.
72
74
QGeoRouteSegment::QGeoRouteSegment()
73
: d_ptr(new QGeoRouteSegmentPrivate()) {}
75
: d_ptr(new QGeoRouteSegmentPrivate()) {}
76
78
Constructs a route segment object from the contents of \a other.
78
80
QGeoRouteSegment::QGeoRouteSegment(const QGeoRouteSegment &other)
79
: d_ptr(other.d_ptr) {}
81
: d_ptr(other.d_ptr) {}
86
QGeoRouteSegment::QGeoRouteSegment(QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &d_ptr)
82
90
Destroys this route segment object.
106
116
Returns whether this route segment and \a other are not equal.
118
The value of nextRouteSegment() is not considered in the comparison.
108
120
bool QGeoRouteSegment::operator !=(const QGeoRouteSegment &other) const
110
return (d_ptr.constData() != other.d_ptr.constData());
122
return !(operator==(other));
126
Returns whether this route segment is valid or not.
128
If nextRouteSegment() is called on the last route segment of a route, the
129
returned value will be an invalid route segment.
131
bool QGeoRouteSegment::isValid() const
137
Sets the next route segment in the route to \a routeSegment.
139
void QGeoRouteSegment::setNextRouteSegment(const QGeoRouteSegment &routeSegment)
142
d_ptr->nextSegment = routeSegment.d_ptr;
146
Returns the next route segment in the route.
148
Will return an invalid route segment if this is the last route
149
segment in the route.
151
QGeoRouteSegment QGeoRouteSegment::nextRouteSegment() const
153
if (d_ptr->valid && d_ptr->nextSegment)
154
return QGeoRouteSegment(d_ptr->nextSegment);
156
QGeoRouteSegment segment;
157
segment.d_ptr->valid = false;
167
218
return d_ptr->path;
170
Sets the instruction for this route segement to \a instruction.
222
Sets the maneuver for this route segement to \a maneuver.
172
void QGeoRouteSegment::setInstruction(const QGeoInstruction &instruction)
224
void QGeoRouteSegment::setManeuver(const QGeoManeuver &maneuver)
174
d_ptr->instruction = instruction;
227
d_ptr->maneuver = maneuver;
178
Returns the instruction for this route segment.
231
Returns the manevuer for this route segment.
233
Will return an invalid QGeoManeuver if no information has been attached
234
to the endpoint of this route segment.
180
QGeoInstruction QGeoRouteSegment::instruction() const
236
QGeoManeuver QGeoRouteSegment::maneuver() const
182
return d_ptr->instruction;
238
return d_ptr->maneuver;
185
241
/*******************************************************************************
186
242
*******************************************************************************/
188
244
QGeoRouteSegmentPrivate::QGeoRouteSegmentPrivate()
192
249
QGeoRouteSegmentPrivate::QGeoRouteSegmentPrivate(const QGeoRouteSegmentPrivate &other)
193
: QSharedData(other),
194
travelTime(other.travelTime),
195
distance(other.distance),
197
instruction(other.instruction) {}
250
: QSharedData(other),
252
travelTime(other.travelTime),
253
distance(other.distance),
255
maneuver(other.maneuver),
256
nextSegment(other.nextSegment) {}
199
QGeoRouteSegmentPrivate::~QGeoRouteSegmentPrivate() {}
258
QGeoRouteSegmentPrivate::~QGeoRouteSegmentPrivate()
201
263
bool QGeoRouteSegmentPrivate::operator ==(const QGeoRouteSegmentPrivate &other) const
203
return ((travelTime == other.travelTime)
265
return ((valid == other.valid)
266
&& (travelTime == other.travelTime)
204
267
&& (distance == other.distance)
205
268
&& (path == other.path)
206
&& (instruction == other.instruction));
269
&& (maneuver == other.maneuver));
272
/*******************************************************************************
273
*******************************************************************************/
209
275
QTM_END_NAMESPACE