A list model storing a list of DirectionManeuver for a Route. More...
Header: | #include <DirectionManeuverListModel.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | QAbstractListModel |
Public Types
enum | DirectionManeuverRoles { DirectionManeuverTypeRole, DirectionTextRole, DurationRole, EstimatedArrivalTimeRole, EstimatedArrivalTimeShiftRole, …, LengthRole } |
Public Functions
virtual | ~DirectionManeuverListModel() override |
QList<Esri::ArcGISRuntime::DirectionManeuver> | directionManeuvers() const |
Reimplemented Public Functions
virtual QVariant | data(const QModelIndex &index, int role = Qt::DisplayRole) const override |
Detailed Description
Direction maneuvers give you a step-by-step explanation of how you would get from one location to another along a transportation network. Each direction maneuver contains information such as the description of what you should do (e.g. "Turn right on Main St"), the duration of that maneuver (e.g. 2 minutes), and the local arrival time. DirectionManeuverListModel is meant to simplify the workflow of obtaining direction maneuvers from a RouteResult, and populating the resulting information into a view. For example, you may want to get all of your route's direction maneuvers and display them in a list view for a user to scroll through. Since each direction maneuver contains geometry, you can zoom to each direction maneuver on the map as the user clicks on the different items in the list.
The model returns data for the following roles:
Role | Type | Description | DirectionManeuverRoles |
---|---|---|---|
directionManeuverType | DirectionManeuverType | The type of direction maneuver. | DirectionManeuverTypeRole |
directionText | QString | The step-by-step directions of the maneuver. | DirectionTextRole |
duration | double | The duration of the maneuver in minutes. | DurationRole |
estimatedArrivalTime | QDateTime | The estimated arrival time in UTC time. | EstimatedArrivalTimeRole |
estimatedArrivalTimeShift | double | The time zone shift in minutes of the estimated arrival time. | EstimatedArrivalTimeShiftRole |
geometry | Geometry | The geometry of the maneuver, typically a Polyline or a Point. | GeometryRole |
length | double | The length of the maneuver in meters. | LengthRole |
Relevant samples:
- Route around barriers: Find a route that reaches all stops without crossing any barriers.
See also RouteTask, Route, RouteResult, and DirectionManeuver.
Member Type Documentation
enum DirectionManeuverListModel::DirectionManeuverRoles
This enum specifies the custom roles which can be used with DirectionManeuverListModel::data.
Constant | Value | Description |
---|---|---|
Esri::ArcGISRuntime::DirectionManeuverListModel::DirectionManeuverTypeRole | Qt::UserRole + 1 | The type of direction maneuver. |
Esri::ArcGISRuntime::DirectionManeuverListModel::DirectionTextRole | Qt::UserRole + 2 | The step-by-step directions of the maneuver. |
Esri::ArcGISRuntime::DirectionManeuverListModel::DurationRole | Qt::UserRole + 3 | The duration of the maneuver in minutes. |
Esri::ArcGISRuntime::DirectionManeuverListModel::EstimatedArrivalTimeRole | Qt::UserRole + 4 | The estimated arrival time in UTC time. |
Esri::ArcGISRuntime::DirectionManeuverListModel::EstimatedArrivalTimeShiftRole | Qt::UserRole + 5 | The time zone shift in minutes of the estimated arrival time. |
Esri::ArcGISRuntime::DirectionManeuverListModel::GeometryRole | Qt::UserRole + 6 | The geometry of the maneuver, typically a Polyline or a Point. |
Esri::ArcGISRuntime::DirectionManeuverListModel::LengthRole | Qt::UserRole + 7 | The length of the maneuver in meters. |
Member Function Documentation
[override virtual]
DirectionManeuverListModel::~DirectionManeuverListModel ()
Destructor.
[override virtual]
QVariant DirectionManeuverListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const
Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.
Returns the data stored under the given role for the maneuver referred to by the index.
- index. The index in the model for which to return data.
- role. The role for which to return data.
QList<Esri::ArcGISRuntime::DirectionManeuver > DirectionManeuverListModel::directionManeuvers () const
Returns the list of DirectionManeuver contained in the list model.
Use this to directly obtain the list of DirectionManeuver objects, as opposed to hooking up the list model to a view.