ManeuverSelection
A collection of zero or more Maneuver instances, returned by the maneuvers() method on a TripLeg or SegmentSelection.
map.nav().directions(waypoints, function (error, trip) {
var maneuvers = trip.leg().maneuvers();
// Highlight a maneuver and reveal the floor it is on:
maneuvers.find("3").highlight().floors().show();
});ManeuverSelection.length
The number of Maneuver instances in the collection.
ManeuverSelection.first()
Get the first Maneuver in the collection.
Returns
A new ManeuverSelection instance.
ManeuverSelection.last()
Get the last Maneuver in the collection.
Returns
A new ManeuverSelection instance.
ManeuverSelection.find(id)
Get all Maneuver instances in the collection which match the given id or ids.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| id | Yes | String | Array | undefined | A single id or an array of ids to look for. |
Returns
A new ManeuverSelection instance.
ManeuverSelection.at(index)
Get the Maneuver at the given index.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| index | Yes | Integer | undefined | The index of the desired Maneuver. |
Returns
A new ManeuverSelection instance.
ManeuverSelection.floors()
Get the distinct Floor instances the maneuvers in the collection take place on. In practice, the
returned FloorSelection instance will contain a single Floor.
Returns
A new FloorSelection instance.
ManeuverSelection.highlight()
Visually highlight the Maneuver instances in the collection on the map. This method is chainable.
Returns
The object chain.
ManeuverSelection.unhighlight()
Remove the highlight from the Maneuver instances in the collection. This method is chainable.
Returns
The object chain.
ManeuverSelection.center()
Get the center position of the maneuvers in the collection.
Returns
An [x, y] coordinates Array when the collection contains a single maneuver, otherwise an Array of [x, y] coordinate pairs.
ManeuverSelection.bounds()
Get the combined bounding box of the Maneuver instances in the collection.
// Zoom and pan the map to fit every maneuver in the collection.
map.fitBounds(maneuvers.bounds(), { padding: 100 });Returns
A bounding box as a nested Array of the form [[minX, minY], [maxX, maxY]], suitable for passing to UnitMap.fitBounds.
ManeuverSelection.each(iterator)
Iterate over each Maneuver in the collection. This method is chainable.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| iterator | Yes | Function | undefined | A function invoked with each Maneuver in the collection. |
Returns
The object chain.
ManeuverSelection.map(iterator)
Map over each Maneuver in the collection, returning an array of the iterator results.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| iterator | Yes | Function | undefined | A function invoked with each Maneuver in the collection. |
Returns
An Array of the iterator return values.
Updated 1 day ago
