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_H
38 #define QGEOROUTE_H
39 
40 #include <QtPositioning/QGeoCoordinate>
41 #include <QtLocation/QGeoRouteRequest>
42 
43 #include <QtCore/QExplicitlySharedDataPointer>
44 #include <QtCore/QList>
45 #include <QtCore/QHash>
46 
47 QT_BEGIN_NAMESPACE
48 
49 class QGeoRectangle;
50 class QGeoRouteSegment;
51 
52 class QGeoRoutePrivate;
53 class QGeoRouteLeg;
54 class Q_LOCATION_EXPORT QGeoRoute
55 {
56 public:
57     QGeoRoute();
58     QGeoRoute(const QGeoRoute &other);
59     ~QGeoRoute(); // ### Qt6: make this virtual
60 
61     QGeoRoute &operator = (const QGeoRoute &other);
62 
63     bool operator == (const QGeoRoute &other) const;
64     bool operator != (const QGeoRoute &other) const;
65 
66     void setRouteId(const QString &id);
67     QString routeId() const;
68 
69     void setRequest(const QGeoRouteRequest &request);
70     QGeoRouteRequest request() const;
71 
72     void setBounds(const QGeoRectangle &bounds);
73     QGeoRectangle bounds() const;
74 
75     void setFirstRouteSegment(const QGeoRouteSegment &routeSegment);
76     QGeoRouteSegment firstRouteSegment() const;
77 
78     void setTravelTime(int secs);
79     int travelTime() const;
80 
81     void setDistance(qreal distance);
82     qreal distance() const;
83 
84     void setTravelMode(QGeoRouteRequest::TravelMode mode);
85     QGeoRouteRequest::TravelMode travelMode() const;
86 
87     void setPath(const QList<QGeoCoordinate> &path);
88     QList<QGeoCoordinate> path() const;
89 
90     void setRouteLegs(const QList<QGeoRouteLeg> &legs);
91     QList<QGeoRouteLeg> routeLegs() const;
92 
93     void setExtendedAttributes(const QVariantMap &extendedAttributes);
94     QVariantMap extendedAttributes() const;
95 
96 protected:
97     QGeoRoute(const QExplicitlySharedDataPointer<QGeoRoutePrivate> &dd);
98     QExplicitlySharedDataPointer<QGeoRoutePrivate> &d();
99     const QExplicitlySharedDataPointer<QGeoRoutePrivate> &const_d() const;
100 
101 private:
102     QExplicitlySharedDataPointer<QGeoRoutePrivate> d_ptr;
103     friend class QDeclarativeGeoRoute;
104     friend class QGeoRoutePrivate;
105 };
106 
107 class Q_LOCATION_EXPORT QGeoRouteLeg: public QGeoRoute
108 {
109 public:
110     QGeoRouteLeg();
111     QGeoRouteLeg(const QGeoRouteLeg &other);
112     QGeoRouteLeg &operator=(const QGeoRouteLeg &other) = default;
113     ~QGeoRouteLeg();
114 
115     void setLegIndex(int idx);
116     int legIndex() const;
117 
118     void setOverallRoute(const QGeoRoute &route);
119     QGeoRoute overallRoute() const;
120 
121 protected:
122     QGeoRouteLeg(const QExplicitlySharedDataPointer<QGeoRoutePrivate> &dd);
123 
124     friend class QDeclarativeGeoRoute;
125     friend class QGeoRoutePrivate;
126 };
127 
128 QT_END_NAMESPACE
129 
130 #endif
131