fix: Model rebuilt

This commit is contained in:
Piotr Dec 2024-07-31 20:16:44 +02:00
parent 75e10c1579
commit 785a35473e
Signed by: stawros
GPG key ID: F89F27AD8F881A91
6 changed files with 136 additions and 137 deletions

View file

@ -7,14 +7,14 @@ class MapboxMapper {
companion object {
fun apply(maneuver: Maneuver): State {
val state = State()
fun map(maneuver: Maneuver): GarminManeuver {
val state = GarminManeuver()
maneuver.apply {
this.primary.apply {
state.direction = Direction()
when (this.type) {
"roundabout" -> {
state.direction!!.out = OutType.RightRoundabout
state.direction.out = OutType.RightRoundabout
}
"arrive" -> {
@ -24,11 +24,11 @@ class MapboxMapper {
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
180.0 -> state.direction!!.angle = OutAngle.Straight
137.0 -> state.direction.angle = OutAngle.EasyRight
180.0 -> state.direction.angle = OutAngle.Straight
}
}
}
@ -36,16 +36,16 @@ class MapboxMapper {
"left" -> {
when (this.type) {
"turn" -> state.direction!!.angle = OutAngle.Left
"turn" -> state.direction.angle = OutAngle.Left
}
}
}
}
this.stepDistance.apply {
this.distanceRemaining?.apply {
distanceFormatter.formatDistance(distanceRemaining!!).split(" ").apply {
distanceFormatter.formatDistance(this).split(" ").apply {
state.distance = Distance(
this[0].replace(',', '.').toDouble().toInt(),
this[0].replace(',', '.').toDouble(),
when (this[1]) {
"m" -> Unit.Metres
"km" -> Unit.Kilometres
@ -65,8 +65,8 @@ class MapboxMapper {
return state
}
fun apply(locationMatcherResult: LocationMatcherResult): State {
val state = State()
fun map(locationMatcherResult: LocationMatcherResult): GarminLocation {
val state = GarminLocation()
// TODO: speed, limit, location?, bearing
return state
}