Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgeoroutesegment.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qgeoroutesegment.h"
6
7#include "qgeocoordinate.h"
8#include <QDateTime>
9
11
13
14
70
75
79QGeoRouteSegment::QGeoRouteSegment(QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &&dd)
80 : d_ptr(dd) {}
81
86
87
93{
94 if (this == &other)
95 return *this;
96
97 d_ptr = other.d_ptr;
98 return *this;
99}
100
116bool QGeoRouteSegment::isEqual(const QGeoRouteSegment &other) const noexcept
117{
118 return ( (d_ptr.constData() == other.d_ptr.constData())
119 || (*d_ptr) == (*other.d_ptr));
120}
121
129{
130 return d_ptr->valid();
131}
132
139{
140 if (!d_ptr->valid())
141 return false;
142
143 if (!d_ptr->nextRouteSegment())
144 return true;
145 return d_ptr->isLegLastSegment();
146}
147
152{
153 d_ptr->setValid(true);
154 d_ptr->setNextRouteSegment(routeSegment.d_ptr);
155}
156
164{
165 if (d_ptr->valid() && d_ptr->nextRouteSegment())
166 return QGeoRouteSegment(d_ptr->nextRouteSegment());
167
168 return QGeoRouteSegment();
169}
170
185{
186 d_ptr->setValid(true);
187 d_ptr->setTravelTime(secs);
188}
189
191{
192 return d_ptr->travelTime();
193}
194
207{
208 d_ptr->setValid(true);
209 d_ptr->setDistance(distance);
210}
211
213{
214 return d_ptr->distance();
215}
216
238void QGeoRouteSegment::setPath(const QList<QGeoCoordinate> &path)
239{
240 d_ptr->setValid(true);
241 d_ptr->setPath(path);
242}
243
244QList<QGeoCoordinate> QGeoRouteSegment::path() const
245{
246 return d_ptr->path();
247}
248
266{
267 d_ptr->setValid(true);
268 d_ptr->setManeuver(maneuver);
269}
270
272{
273 return d_ptr->maneuver();
274}
275
276/*******************************************************************************
277*******************************************************************************/
278
280
282{
283 return lhs.m_valid == rhs.m_valid
284 && lhs.m_travelTime == rhs.m_travelTime
285 && lhs.m_distance == rhs.m_distance
286 && lhs.m_path == rhs.m_path
287 && lhs.m_maneuver == rhs.m_maneuver;
288}
289
291{
292 return m_valid;
293}
294
296{
297 m_valid = valid;
298}
299
304
306{
307 m_legLastSegment = lastSegment;
308}
309
311{
312 return m_travelTime;
313}
314
319
324
329
330QList<QGeoCoordinate> QGeoRouteSegmentPrivate::path() const
331{
332 return m_path;
333}
334
335void QGeoRouteSegmentPrivate::setPath(const QList<QGeoCoordinate> &path)
336{
337 m_path = path;
338}
339
344
349
350QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> QGeoRouteSegmentPrivate::nextRouteSegment() const
351{
352 return m_nextSegment;
353}
354
355void QGeoRouteSegmentPrivate::setNextRouteSegment(const QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &next)
356{
358}
359
364
366
367#include "moc_qgeoroutesegment.cpp"
\inmodule QtLocation
void setNextRouteSegment(const QExplicitlySharedDataPointer< QGeoRouteSegmentPrivate > &next)
QExplicitlySharedDataPointer< QGeoRouteSegmentPrivate > nextRouteSegment() const
void setDistance(qreal distance)
void setLegLastSegment(bool lastSegment)
void setTravelTime(int travelTime)
QList< QGeoCoordinate > m_path
QExplicitlySharedDataPointer< QGeoRouteSegmentPrivate > m_nextSegment
void setManeuver(const QGeoManeuver &maneuver)
void setPath(const QList< QGeoCoordinate > &path)
static QGeoRouteSegmentPrivate * get(QGeoRouteSegment &segment)
QList< QGeoCoordinate > path() const
QGeoManeuver maneuver() const
\inmodule QtLocation
bool isLegLastSegment() const
Returns whether this route segment is the last segment of a route leg.
void setManeuver(const QGeoManeuver &maneuver)
QList< QGeoCoordinate > path
\qmlproperty list<coordinate> QtLocation::routeSegment::path
~QGeoRouteSegment()
Destroys this route segment object.
qreal distance
\qmlproperty real QtLocation::routeSegment::distance
void setNextRouteSegment(const QGeoRouteSegment &routeSegment)
Sets the next route segment in the route to routeSegment.
QGeoRouteSegment nextRouteSegment() const
Returns the next route segment in the route.
void setDistance(qreal distance)
QML_STRUCTURED_VALUEint travelTime
\qmlproperty int QtLocation::routeSegment::travelTime
QGeoRouteSegment()
\qmltype routeSegment \inqmlmodule QtLocation
QGeoRouteSegment & operator=(const QGeoRouteSegment &other) noexcept
Assigns other to this route segment object and then returns a reference to this route segment object.
bool isValid() const
Returns whether this route segment is valid or not.
void setTravelTime(int secs)
QGeoManeuver maneuver
\qmlproperty RouteManeuver QtLocation::routeSegment::maneuver
void setPath(const QList< QGeoCoordinate > &path)
short next
Definition keywords.cpp:445
Combined button and popup list for selecting options.
bool operator==(const QGeoRouteSegmentPrivate &lhs, const QGeoRouteSegmentPrivate &rhs)
GLsizei GLsizei GLfloat distance
GLuint segment
GLsizei const GLchar *const * path
#define QT_DEFINE_QESDP_SPECIALIZATION_DTOR(Class)
double qreal
Definition qtypes.h:187
QSharedPointer< T > other(t)
[5]