Cluster
This commit is contained in:
@@ -10,15 +10,24 @@ data class NavigationState (
|
||||
val iconMapper: IconMapper = IconMapper(),
|
||||
val navigating: Boolean = false,
|
||||
val arrived: Boolean = false,
|
||||
// travel message
|
||||
val travelMessage: String = "",
|
||||
// maneuver type
|
||||
val maneuverType: Int = 0,
|
||||
// last location
|
||||
val lastLocation: Location = location(0.0, 0.0),
|
||||
// current location
|
||||
val currentLocation: Location = location(0.0, 0.0),
|
||||
// bearing of the route
|
||||
val routeBearing: Float = 0F,
|
||||
// index of current route in the list of routes
|
||||
val currentRouteIndex: Int = 0,
|
||||
// destination name
|
||||
val destination: Place = Place(),
|
||||
// car connection used
|
||||
val carConnection: Int = 0,
|
||||
// routing engine used
|
||||
val routingEngine: Int = 0,
|
||||
// show next step information
|
||||
val nextStep: Boolean = false,
|
||||
)
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.kouros.navigation.data.tomtom
|
||||
|
||||
import android.content.Context
|
||||
import android.location.Location
|
||||
import com.kouros.data.BuildConfig
|
||||
import com.kouros.data.R
|
||||
import com.kouros.navigation.data.EngineType
|
||||
import com.kouros.navigation.data.NavigationRepository
|
||||
@@ -20,9 +21,9 @@ const val tomtomTrafficUrl = "https://api.tomtom.com/traffic/services/5/incident
|
||||
private const val tomtomFields =
|
||||
"{incidents{type,geometry{type,coordinates},properties{iconCategory,events{description}}}}"
|
||||
|
||||
const val useLocal = false
|
||||
val useLocal = BuildConfig.DEBUG
|
||||
|
||||
const val useLocalTraffic = false
|
||||
val useLocalTraffic = BuildConfig.DEBUG
|
||||
|
||||
|
||||
class TomTomRepository : NavigationRepository() {
|
||||
|
||||
@@ -54,6 +54,18 @@ class RouteCalculator(var routeModel: RouteModel) {
|
||||
return timeLeft
|
||||
}
|
||||
|
||||
fun travelStepLeftTime(): Double {
|
||||
var timeLeft = 0.0
|
||||
// time for current step
|
||||
val step = routeModel.route.currentStep()
|
||||
val curTime = step.duration
|
||||
val percent =
|
||||
100 * (step.maneuver.waypoints.size - step.waypointIndex) / (step.maneuver.waypoints.size)
|
||||
val time = curTime * percent / 100
|
||||
timeLeft += time
|
||||
return timeLeft
|
||||
}
|
||||
|
||||
/** Returns the current [Step] left distance in m. */
|
||||
fun leftStepDistance(): Double {
|
||||
val step = routeModel.route.currentStep()
|
||||
|
||||
Reference in New Issue
Block a user