calculateTrafficOnRouteWithCurrentCharge method - RoutingEngine class - routing library - Dart API
calculateTrafficOnRouteWithCurrentCharge abstract method
- Route route,
- int lastTraveledSectionIndex,
- int traveledDistanceOnLastSectionInMeters,
- double currentChargeInKilowattHours,
- CalculateTrafficOnRouteCallback callback,
Asynchronously calculates the traffic along an EV car route starting from the index of the last traveled route section and an offset in meters from the last visited position on the section.
The field TrafficOnSpan.consumptionInKilowattHours will contain the power consumption in kilowatt-hours (kWh) necessary to traverse the span, and RoutePlace.chargeInKilowattHours, inside TrafficOnSection.departurePlace and TrafficOnSection.arrivalPlace, the estimated battery charge in kilowatt-hours (kWh) when leaving/arriving to a section. Note: Only EV cars are supported.
-
routeA Route calculated using the online routing engine. Its RouteHandle and the original route calculation options, along with EV related information like BatterySpecifications, will be used to compute the traffic on the route. The original route remains untouched. -
lastTraveledSectionIndexIndicates the index of the last traveled route section. Traveled part of the route won't be reused. -
traveledDistanceOnLastSectionInMetersOffset, in meters, to the last visited position on the route section defined by the last traveled section index. -
currentChargeInKilowattHoursCharge level of the vehicle's battery at the current location (in kWh). It must be non-negative and less than or equal to the value of BatterySpecifications.totalCapacityInKilowattHours, otherwise the BatterySpecifications instance is considered invalid. Sets BatterySpecifications.initialChargeInKilowattHours to the given value. -
callbackCallback object that will be invoked after route traffic has been calculated. It is always invoked on the main thread.
Returns TaskHandle. Handle that will be used to manipulate the execution of the task.
Implementation
TaskHandle calculateTrafficOnRouteWithCurrentCharge(Route route, int lastTraveledSectionIndex, int traveledDistanceOnLastSectionInMeters, double currentChargeInKilowattHours, CalculateTrafficOnRouteCallback callback);