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 QGEOROUTEREQUEST_H
38 #define QGEOROUTEREQUEST_H
39 
40 #include <QtCore/QList>
41 #include <QtCore/QExplicitlySharedDataPointer>
42 #include <QtCore/QDateTime>
43 
44 #include <QtLocation/qlocationglobal.h>
45 #include <QtPositioning/qgeocoordinate.h>
46 #include <QtPositioning/qgeorectangle.h>
47 
48 QT_BEGIN_NAMESPACE
49 
50 class QGeoRouteRequestPrivate;
51 
52 class Q_LOCATION_EXPORT QGeoRouteRequest
53 {
54 public:
55     enum TravelMode {
56         CarTravel = 0x0001,
57         PedestrianTravel = 0x0002,
58         BicycleTravel = 0x0004,
59         PublicTransitTravel = 0x0008,
60         TruckTravel = 0x0010
61     };
62     Q_DECLARE_FLAGS(TravelModes, TravelMode)
63 
64     enum FeatureType {
65         NoFeature = 0x00000000,
66         TollFeature = 0x00000001,
67         HighwayFeature = 0x00000002,
68         PublicTransitFeature = 0x00000004,
69         FerryFeature = 0x00000008,
70         TunnelFeature = 0x00000010,
71         DirtRoadFeature = 0x00000020,
72         ParksFeature = 0x00000040,
73         MotorPoolLaneFeature = 0x00000080,
74         TrafficFeature = 0x00000100
75     };
76     Q_DECLARE_FLAGS(FeatureTypes, FeatureType)
77 
78     enum FeatureWeight {
79         NeutralFeatureWeight = 0x00000000,
80         PreferFeatureWeight = 0x00000001,
81         RequireFeatureWeight = 0x00000002,
82         AvoidFeatureWeight = 0x00000004,
83         DisallowFeatureWeight = 0x00000008
84     };
85     Q_DECLARE_FLAGS(FeatureWeights, FeatureWeight)
86 
87     enum RouteOptimization {
88         ShortestRoute = 0x0001,
89         FastestRoute = 0x0002,
90         MostEconomicRoute = 0x0004,
91         MostScenicRoute = 0x0008
92     };
93     Q_DECLARE_FLAGS(RouteOptimizations, RouteOptimization)
94 
95     enum SegmentDetail {
96         NoSegmentData = 0x0000,
97         BasicSegmentData = 0x0001
98     };
99     Q_DECLARE_FLAGS(SegmentDetails, SegmentDetail)
100 
101     enum ManeuverDetail {
102         NoManeuvers = 0x0000,
103         BasicManeuvers = 0x0001
104     };
105     Q_DECLARE_FLAGS(ManeuverDetails, ManeuverDetail)
106 
107     explicit QGeoRouteRequest(const QList<QGeoCoordinate> &waypoints = QList<QGeoCoordinate>());
108     QGeoRouteRequest(const QGeoCoordinate &origin,
109                      const QGeoCoordinate &destination);
110     QGeoRouteRequest(const QGeoRouteRequest &other);
111 
112     ~QGeoRouteRequest();
113 
114     QGeoRouteRequest &operator= (const QGeoRouteRequest &other);
115 
116     bool operator == (const QGeoRouteRequest &other) const;
117     bool operator != (const QGeoRouteRequest &other) const;
118 
119     void setWaypoints(const QList<QGeoCoordinate> &waypoints);
120     QList<QGeoCoordinate> waypoints() const;
121 
122     void setWaypointsMetadata(const QList<QVariantMap> &waypointMetadata);
123     QList<QVariantMap> waypointsMetadata() const;
124 
125     void setExcludeAreas(const QList<QGeoRectangle> &areas);
126     QList<QGeoRectangle> excludeAreas() const;
127 
128     // defaults to 0
129     void setNumberAlternativeRoutes(int alternatives);
130     int numberAlternativeRoutes() const;
131 
132     // defaults to TravelByCar
133     void setTravelModes(TravelModes travelModes);
134     TravelModes travelModes() const;
135 
136     void setFeatureWeight(FeatureType featureType, FeatureWeight featureWeight);
137     FeatureWeight featureWeight(FeatureType featureType) const;
138     QList<FeatureType> featureTypes() const;
139 
140     // defaults to OptimizeFastest
141     void setRouteOptimization(RouteOptimizations optimization);
142     RouteOptimizations routeOptimization() const;
143 
144     // defaults to BasicSegmentData
145     void setSegmentDetail(SegmentDetail segmentDetail);
146     SegmentDetail segmentDetail() const;
147 
148     // defaults to BasicManeuvers
149     void setManeuverDetail(ManeuverDetail maneuverDetail);
150     ManeuverDetail maneuverDetail() const;
151 
152     // defaults to invalid datetime
153     void setDepartureTime(const QDateTime &departureTime);
154     QDateTime departureTime() const;
155 
156     void setExtraParameters(const QVariantMap &extraParameters);
157     QVariantMap extraParameters() const;
158 
159 private:
160     QExplicitlySharedDataPointer<QGeoRouteRequestPrivate> d_ptr;
161 };
162 
163 Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoRouteRequest::TravelModes)
164 Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoRouteRequest::FeatureTypes)
165 Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoRouteRequest::FeatureWeights)
166 Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoRouteRequest::RouteOptimizations)
167 Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoRouteRequest::SegmentDetails)
168 Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoRouteRequest::ManeuverDetails)
169 
170 QT_END_NAMESPACE
171 
172 #endif
173