The RouteQuery type is used to provide query parameters to a RouteModel . 更多...
import 语句: | import QtLocation 5.12 |
Since: | QtLocation 5.5 |
A RouteQuery is used to pack all the parameters necessary to make a request to a routing service, which can then populate the contents of a RouteModel .
These parameters describe key details of the route, such as waypoints to pass through, excludedAreas to avoid, the travelModes in use, as well as detailed preferences on how to optimize the route and what features to prefer or avoid along the path (such as toll roads, highways, etc).
RouteQuery objects are used exclusively to fill out the value of a RouteModel 's query property, which can then begin the retrieval process to populate the model.
Some plugins might allow or require specific parameters to operate. In order to specify these plugin-specific parameters, MapParameter elements can be nested inside a RouteQuery .
The following snipped shows an incomplete example of creating a RouteQuery object and setting it as the value of a RouteModel 's query 特性。
RouteQuery {
id: aQuery
}
RouteModel {
query: aQuery
autoUpdate: false
}
For a more complete example, see the documentation for the RouteModel type, and the Mapviewer example.
另请参阅 RouteModel .
excludedAreas : list < georectangle > |
Areas that the route must not cross.
Excluded areas can be set as part of the RouteQuery type declaration or dynamically with the functions provided.
另请参阅 addExcludedArea , removeExcludedArea ,和 clearExcludedAreas .
The route query extra parameters. This property is read only. If the query is defined by the user, these can be set by using MapParameters. If the route query comes from the engine via signals, the query is intended to be read-only.
该特性在 Qt 5.11 引入。
List of features that will be considered when planning the route. Features with a weight of NeutralFeatureWeight will not be returned.
另请参阅 setFeatureWeight and featureWeight .
maneuverDetail : enumeration |
The level of detail which will be used in the representation of routing maneuvers.
常量 | 描述 |
---|---|
RouteQuery.NoManeuvers
|
No maneuvers should be included with the route |
RouteQuery.BasicManeuvers
|
Basic maneuvers will be included with the route |
默认值为
RouteQuery.BasicManeuvers
.
numberAlternativeRoutes : int |
The number of alternative routes requested when requesting routes. The default value is 0.
routeOptimizations : enumeration |
The route optimizations which should be considered during the planning of the route. Values can be combined with OR ('|') -operator.
常量 | 描述 |
---|---|
RouteQuery.ShortestRoute
|
Minimize the length of the journey |
RouteQuery.FastestRoute
|
Minimize the traveling time for the journey |
RouteQuery.MostEconomicRoute
|
Minimize the cost of the journey |
RouteQuery.MostScenicRoute
|
Maximize the scenic potential of the journey |
默认值为
RouteQuery.FastestRoute
.
segmentDetail : enumeration |
The level of detail which will be used in the representation of routing segments.
常量 | 描述 |
---|---|
RouteQuery.NoSegmentData
|
No segment data should be included with the route |
RouteQuery.BasicSegmentData
|
Basic segment data will be included with the route |
默认值为
RouteQuery.BasicSegmentData
.
travelModes : enumeration |
The travel modes which should be considered during the planning of the route. Values can be combined with OR ('|') -operator.
常量 | 描述 |
---|---|
RouteQuery.CarTravel
|
The route will be optimized for someone who is driving a car |
RouteQuery.PedestrianTravel
|
The route will be optimized for someone who is walking |
RouteQuery.BicycleTravel
|
The route will be optimized for someone who is riding a bicycle |
RouteQuery.PublicTransit
|
Travel The route will be optimized for someone who is making use of public transit |
RouteQuery.TruckTravel
|
The route will be optimized for someone who is driving a truck |
默认值为
RouteQuery.CarTravel
.
waypoints : list < coordinate > |
The coordinates of the waypoints for the desired route. The waypoints should be given in order from origin to destination. Two or more coordinates are needed.
Waypoints can be set as part of the RouteQuery type declaration or dynamically with the functions provided.
When setting this property to a list of waypoints, each waypoint can be either a coordinate 或 Waypoint , interchangeably. If a coordinate is passed, it will be internally converted to a Waypoint .
This property, however, always contains a list of coordinates.
另请参阅 waypointObjects , addWaypoint , removeWaypoint ,和 clearWaypoints .
Adds the given area to excluded areas (areas that the route must not cross). Same area can only be added once.
另请参阅 removeExcludedArea and clearExcludedAreas .
Appends a coordinate to the list of waypoints. Same coordinate can be set multiple times. The coordinate argument can be a coordinate 或 Waypoint . If a coordinate is used, it will be internally converted to a Waypoint .
另请参阅 removeWaypoint and clearWaypoints .
Clears all excluded areas (areas that the route must not cross).
另请参阅 addExcludedArea and removeExcludedArea .
Clears all waypoints.
另请参阅 removeWaypoint and addWaypoint .
Gets the weight for the featureType .
另请参阅 featureTypes , setFeatureWeight ,和 resetFeatureWeights .
Removes the given area to excluded areas (areas that the route must not cross).
另请参阅 addExcludedArea and clearExcludedAreas .
Removes the given from the list of waypoints. In case same coordinate appears multiple times, the most recently added coordinate instance is removed.
另请参阅 addWaypoint and clearWaypoints .
Resets all feature weights to their default state (NeutralFeatureWeight).
另请参阅 featureTypes , setFeatureWeight ,和 featureWeight .
Defines the weight to associate with a feature during the planning of a route.
Following lists the possible feature weights:
常量 | 描述 |
---|---|
RouteQuery.NeutralFeatureWeight
|
The presence or absence of the feature will not affect the planning of the route |
RouteQuery.PreferFeatureWeight
|
Routes which contain the feature will be preferred over those that do not |
RouteQuery.RequireFeatureWeight
|
Only routes which contain the feature will be considered, otherwise no route will be returned |
RouteQuery.AvoidFeatureWeight
|
Routes which do not contain the feature will be preferred over those that do |
RouteQuery.DisallowFeatureWeight
|
Only routes which do not contain the feature will be considered, otherwise no route will be returned |
另请参阅 featureTypes , resetFeatureWeights ,和 featureWeight .
This method can be used to retrieve the list of Waypoint objects relative to RouteQuery::waypoints .
另请参阅 waypointObjects, addWaypoint , removeWaypoint ,和 clearWaypoints .