From c3d553ece065f1fceed77e13daaf3710681dcf32 Mon Sep 17 00:00:00 2001 From: Piotr Dec Date: Fri, 2 Aug 2024 00:55:05 +0200 Subject: [PATCH] feat: More Mapbox mappings --- .../java/eu/ztsh/garmin/data/MapboxMapper.kt | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/eu/ztsh/garmin/data/MapboxMapper.kt b/app/src/main/java/eu/ztsh/garmin/data/MapboxMapper.kt index 777b5a2..e2228d9 100644 --- a/app/src/main/java/eu/ztsh/garmin/data/MapboxMapper.kt +++ b/app/src/main/java/eu/ztsh/garmin/data/MapboxMapper.kt @@ -14,27 +14,38 @@ class MapboxMapper { "roundabout" -> { direction.out = OutType.RightRoundabout } - "fork" -> direction.out = OutType.LongerLane "arrive" -> { -// flag = true + direction.out = OutType.Flag + direction.angle = OutAngle.Right } "turn" -> { - when (this.type) { + when (this.modifier) { "straight" -> direction.angle = OutAngle.Straight + "slight right" -> direction.angle = OutAngle.EasyRight + "slight left" -> direction.angle = OutAngle.EasyLeft + "sharp right" -> direction.angle = OutAngle.SharpRight + "sharp left" -> direction.angle = OutAngle.SharpLeft + "uturn" -> direction.angle = OutAngle.LeftDown } } } when (this.modifier) { "right" -> { + direction.angle = OutAngle.Right when (this.type) { - "turn" -> direction.angle = OutAngle.Right "roundabout" -> { - when (this.degrees) { - 137.0 -> direction.angle = OutAngle.EasyRight - 180.0 -> direction.angle = OutAngle.Straight + when (this.degrees!!.toInt()) { + in 22..66 -> direction.angle = OutAngle.SharpRight + in 67..111 -> direction.angle = OutAngle.Right + in 112..156 -> direction.angle = OutAngle.EasyRight + in 157..203 -> direction.angle = OutAngle.Straight + in 204..248 -> direction.angle = OutAngle.EasyLeft + in 249..293 -> direction.angle = OutAngle.Left + in 294..338 -> direction.angle = OutAngle.SharpLeft + else -> direction.angle = OutAngle.Down } } - "off ramp" -> { + "fork", "off ramp" -> { direction.angle = OutAngle.EasyRight direction.out = OutType.LongerLane } @@ -42,9 +53,9 @@ class MapboxMapper { } "left" -> { + direction.angle = OutAngle.Left when (this.type) { - "turn" -> direction.angle = OutAngle.Left - "off ramp" -> { + "fork", "off ramp" -> { direction.angle = OutAngle.EasyLeft direction.out = OutType.LongerLane }