DefaultRouteEditorViewModel

class DefaultRouteEditorViewModel(val routeEditor: RouteEditor, val allowedTransportTypes: EnumSet<TransportMode> = EnumSet.allOf(TransportMode::class.java), val briefRouteDurationProvider: BriefRouteDurationProvider? = null, val routeSearchOptionsProvider: RouteSearchOptionsProvider = DefaultRouteSearchOptionsProvider, val onStartNavigation: (TrafficRoute, RouteBuildOptions) -> Unit = { _, _ -> }) : RouteEditorViewModel, Closeable

Constructors

Link copied to clipboard
constructor(routeEditor: RouteEditor, allowedTransportTypes: EnumSet<TransportMode> = EnumSet.allOf(TransportMode::class.java), briefRouteDurationProvider: BriefRouteDurationProvider? = null, routeSearchOptionsProvider: RouteSearchOptionsProvider = DefaultRouteSearchOptionsProvider, onStartNavigation: (TrafficRoute, RouteBuildOptions) -> Unit = { _, _ -> })

Properties

Link copied to clipboard

Optional provider for fetching ETAs for non-selected transport modes. When provided, enables displaying estimated times for all transport modes in the UI. Note: This will make additional API requests which may count towards your usage quota. The currently selected transport mode's ETA is always obtained from the full route.

Link copied to clipboard
val onStartNavigation: (TrafficRoute, RouteBuildOptions) -> Unit
Link copied to clipboard
val routeEditor: RouteEditor
Link copied to clipboard

Provider for creating route search options for different transport modes. Can be customized by implementing the interface and overriding specific methods for the transport modes that need custom routing behavior.

Link copied to clipboard
open override val uiState: State<RouteEditorUiState>

Current UI state containing route information, selected transport mode, point titles, and route options.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard

Updates the order of intermediate points and recalculates the route.

Link copied to clipboard
open override fun onStartNavigation()

Initiates navigation with the currently selected route.

Link copied to clipboard
open override fun selectRoute(index: Int)

Selects a route from the list of calculated route options.

Link copied to clipboard
open override fun selectTransportMode(mode: TransportMode)

Changes the transport mode and recalculates the route.

Link copied to clipboard
open override fun setPoints(startPoint: RouteUiPoint, finishPoint: RouteUiPoint, intermediatePoints: List<RouteUiPoint>, mode: TransportMode?)

Sets the route points and optionally the transport mode.

Link copied to clipboard
open override fun swapStartAndDestinationPoints()

Swaps the start and destination points and recalculates the route.