1/****************************************************************************
2**
3** Copyright (C) 2015 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the QtLocation module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL3$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or later as published by the Free
28** Software Foundation and appearing in the file LICENSE.GPL included in
29** the packaging of this file. Please review the following information to
30** ensure the GNU General Public License version 2.0 requirements will be
31** met: http://www.gnu.org/licenses/gpl-2.0.html.
32**
33** $QT_END_LICENSE$
34**
35****************************************************************************/
36
37#ifndef QGEOROUTE_P_H
38#define QGEOROUTE_P_H
39
40//
41// W A R N I N G
42// -------------
43//
44// This file is not part of the Qt API. It exists purely as an
45// implementation detail. This header file may change from version to
46// version without notice, or even be removed.
47//
48// We mean it.
49//
50
51#include <QtLocation/private/qlocationglobal_p.h>
52#include "qgeoroute.h"
53#include "qgeorouterequest.h"
54#include "qgeorectangle.h"
55#include "qgeoroutesegment.h"
56
57#include <QSharedData>
58#include <QVariantMap>
59#include <QScopedPointer>
60
61QT_BEGIN_NAMESPACE
62
63class QGeoCoordinate;
64
65class Q_LOCATION_PRIVATE_EXPORT QGeoRoutePrivate : public QSharedData
66{
67public:
68 QGeoRoutePrivate();
69 QGeoRoutePrivate(const QGeoRoutePrivate &other);
70 virtual ~QGeoRoutePrivate();
71 virtual QGeoRoutePrivate *clone() = 0;
72
73 bool operator == (const QGeoRoutePrivate &other) const;
74
75 virtual void setId(const QString &id);
76 virtual QString id() const;
77
78 virtual void setRequest(const QGeoRouteRequest &request);
79 virtual QGeoRouteRequest request() const;
80
81 virtual void setBounds(const QGeoRectangle &bounds);
82 virtual QGeoRectangle bounds() const;
83
84 virtual void setTravelTime(int travelTime);
85 virtual int travelTime() const;
86
87 virtual void setDistance(qreal distance);
88 virtual qreal distance() const;
89
90 virtual void setTravelMode(QGeoRouteRequest::TravelMode mode);
91 virtual QGeoRouteRequest::TravelMode travelMode() const;
92
93 virtual void setPath(const QList<QGeoCoordinate> &path);
94 virtual QList<QGeoCoordinate> path() const;
95
96 virtual void setFirstSegment(const QGeoRouteSegment &firstSegment);
97 virtual QGeoRouteSegment firstSegment() const;
98
99 virtual QVariantMap metadata() const;
100
101 virtual void setRouteLegs(const QList<QGeoRouteLeg> &legs);
102 virtual QList<QGeoRouteLeg> routeLegs() const;
103
104 virtual void setExtendedAttributes(const QVariantMap &extendedAttributes);
105 virtual QVariantMap extendedAttributes() const;
106
107 virtual QString engineName() const = 0;
108 virtual int segmentsCount() const = 0;
109
110 // QGeoRouteLeg API
111 virtual void setLegIndex(int idx);
112 virtual int legIndex() const;
113 virtual void setContainingRoute(const QGeoRoute &route);
114 virtual QGeoRoute containingRoute() const;
115
116 static const QGeoRoutePrivate *routePrivateData(const QGeoRoute &route);
117
118protected:
119 virtual bool equals(const QGeoRoutePrivate &other) const;
120};
121
122class Q_LOCATION_PRIVATE_EXPORT QGeoRoutePrivateDefault : public QGeoRoutePrivate
123{
124public:
125 QGeoRoutePrivateDefault();
126 QGeoRoutePrivateDefault(const QGeoRoutePrivateDefault &other);
127 ~QGeoRoutePrivateDefault() override;
128 virtual QGeoRoutePrivate *clone() override;
129
130 virtual void setId(const QString &id) override;
131 virtual QString id() const override;
132
133 virtual void setRequest(const QGeoRouteRequest &request) override;
134 virtual QGeoRouteRequest request() const override;
135
136 virtual void setBounds(const QGeoRectangle &bounds) override;
137 virtual QGeoRectangle bounds() const override;
138
139 virtual void setTravelTime(int travelTime) override;
140 virtual int travelTime() const override;
141
142 virtual void setDistance(qreal distance) override;
143 virtual qreal distance() const override;
144
145 virtual void setTravelMode(QGeoRouteRequest::TravelMode mode) override;
146 virtual QGeoRouteRequest::TravelMode travelMode() const override;
147
148 virtual void setPath(const QList<QGeoCoordinate> &path) override;
149 virtual QList<QGeoCoordinate> path() const override;
150
151 virtual void setFirstSegment(const QGeoRouteSegment &firstSegment) override;
152 virtual QGeoRouteSegment firstSegment() const override;
153
154 virtual QString engineName() const override;
155 virtual int segmentsCount() const override;
156
157 virtual void setRouteLegs(const QList<QGeoRouteLeg> &legs) override;
158 virtual QList<QGeoRouteLeg> routeLegs() const override;
159
160 void setExtendedAttributes(const QVariantMap &extendedAttributes) override;
161 QVariantMap extendedAttributes() const override;
162
163 // QGeoRouteLeg API
164 virtual void setLegIndex(int idx) override;
165 virtual int legIndex() const override;
166 virtual void setContainingRoute(const QGeoRoute &route) override;
167 virtual QGeoRoute containingRoute() const override;
168
169 QString m_id;
170 QGeoRouteRequest m_request;
171
172 QGeoRectangle m_bounds;
173 mutable QList<QGeoRouteSegment> m_routeSegments;
174
175 int m_travelTime;
176 qreal m_distance;
177
178 QGeoRouteRequest::TravelMode m_travelMode;
179
180 QList<QGeoCoordinate> m_path;
181 QList<QGeoRouteLeg> m_legs;
182 QGeoRouteSegment m_firstSegment;
183 mutable int m_numSegments;
184 QScopedPointer<QGeoRoute> m_containingRoute;
185 QVariantMap m_extendedAttributes;
186 int m_legIndex = 0;
187};
188
189QT_END_NAMESPACE
190
191#endif
192

source code of qtlocation/src/location/maps/qgeoroute_p.h