From b90eae8426379bb62096021b3e765ee737e49843 Mon Sep 17 00:00:00 2001 From: liodali <16631886+liodali@users.noreply.github.com> Date: Fri, 5 Apr 2024 03:46:22 +0200 Subject: [PATCH] fix bug in draw polyline android side #518 --- .../kotlin/hamza/dali/flutter_osm_plugin/FlutterOsmView.kt | 6 +++--- .../hamza/dali/flutter_osm_plugin/models/RoadConfig.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/src/main/kotlin/hamza/dali/flutter_osm_plugin/FlutterOsmView.kt b/android/src/main/kotlin/hamza/dali/flutter_osm_plugin/FlutterOsmView.kt index 2f3905eb..cbc0aba3 100644 --- a/android/src/main/kotlin/hamza/dali/flutter_osm_plugin/FlutterOsmView.kt +++ b/android/src/main/kotlin/hamza/dali/flutter_osm_plugin/FlutterOsmView.kt @@ -1488,13 +1488,13 @@ class FlutterOsmView( if (road.mRouteHigh.size > 2) { routePointsEncoded = PolylineEncoder.encode(road.mRouteHigh, 10) val polyLine = Polyline(map!!, false, false).apply { - this.setStyle( + setStyle( borderColor = roadConfig.roadOption.roadBorderColor, borderWidth = roadConfig.roadOption.roadBorderWidth, color = roadConfig.roadOption.roadColor ?: Color.GREEN, width = roadConfig.roadOption.roadWidth, ) - this.setPoints(RoadManager.buildRoadOverlay(road).actualPoints) + setPoints(RoadManager.buildRoadOverlay(road).actualPoints) } flutterRoad = createRoad( @@ -1546,7 +1546,7 @@ class FlutterOsmView( val encodedWayPoints = (args["road"] as String) val roadColor = (args["roadColor"] as List).toRGB() val roadWidth = (args["roadWidth"] as Double).toFloat() - val roadBorderWidth = (args["roadBorderWidth"] as Double).toFloat() + val roadBorderWidth = (args["roadBorderWidth"] as Double? ?: 0).toFloat() val roadBorderColor = (args["roadBorderColor"] as List).toRGB() val zoomToRegion = args["zoomIntoRegion"] as Boolean diff --git a/android/src/main/kotlin/hamza/dali/flutter_osm_plugin/models/RoadConfig.kt b/android/src/main/kotlin/hamza/dali/flutter_osm_plugin/models/RoadConfig.kt index 60f76f25..5e03524d 100644 --- a/android/src/main/kotlin/hamza/dali/flutter_osm_plugin/models/RoadConfig.kt +++ b/android/src/main/kotlin/hamza/dali/flutter_osm_plugin/models/RoadConfig.kt @@ -53,7 +53,7 @@ fun HashMap.toRoadConfig(): RoadConfig { } return RoadConfig( roadID = roadId, - roadOption = this.toRoadOption(), + roadOption = toRoadOption(), wayPoints = when { this.containsKey("wayPoints") -> (this["wayPoints"] as List>) .map { g ->