Data cache
This commit is contained in:
parent
89e16fb805
commit
b5cc580cf8
5 changed files with 178 additions and 40 deletions
|
@ -10,10 +10,12 @@ class ManeuverMapper {
|
|||
val state = State()
|
||||
maneuver.apply {
|
||||
this.primary.apply {
|
||||
state.direction = Direction()
|
||||
when (this.type) {
|
||||
"roundabout" -> {
|
||||
state.direction.out = OutType.RightRoundabout
|
||||
state.direction!!.out = OutType.RightRoundabout
|
||||
}
|
||||
|
||||
"arrive" -> {
|
||||
state.flag = true
|
||||
}
|
||||
|
@ -21,17 +23,18 @@ class ManeuverMapper {
|
|||
when (this.modifier) {
|
||||
"right" -> {
|
||||
when (this.type) {
|
||||
"turn" -> state.direction.angle = OutAngle.Right
|
||||
"turn" -> state.direction!!.angle = OutAngle.Right
|
||||
"roundabout" -> {
|
||||
when (this.degrees) {
|
||||
137.0 -> state.direction.angle = OutAngle.EasyRight
|
||||
137.0 -> state.direction!!.angle = OutAngle.EasyRight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"left" -> {
|
||||
when (this.type) {
|
||||
"turn" -> state.direction.angle = OutAngle.Left
|
||||
"turn" -> state.direction!!.angle = OutAngle.Left
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,13 +42,14 @@ class ManeuverMapper {
|
|||
this.stepDistance.apply {
|
||||
this.distanceRemaining?.apply {
|
||||
distanceFormatter.formatDistance(distanceRemaining!!).split(" ").apply {
|
||||
state.distance = this[0].toInt()
|
||||
state.unit = when (this[1]) {
|
||||
"m" -> Unit.Metres
|
||||
"km" -> Unit.Kilometres
|
||||
else -> {
|
||||
Unit.Any}
|
||||
}
|
||||
state.distance = Distance(
|
||||
this[0].toInt(),
|
||||
when (this[1]) {
|
||||
"m" -> Unit.Metres
|
||||
"km" -> Unit.Kilometres
|
||||
else -> Unit.Any
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue