From 36d8a3aaa8e6e3828ec4abe980f9dd935c4c1643 Mon Sep 17 00:00:00 2001 From: Julian Bissekkou Date: Thu, 30 Nov 2023 14:08:23 +0100 Subject: [PATCH] fix bug for manual location source on android --- .../arcgis_map_sdk_android/ArcgisMapView.kt | 1 + .../arcgis_map_sdk_android/util/GraphicsParser.kt | 13 +++++++------ example/android/app/src/main/AndroidManifest.xml | 4 ++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/ArcgisMapView.kt b/arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/ArcgisMapView.kt index 92fd5f6c6..919a9c901 100644 --- a/arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/ArcgisMapView.kt +++ b/arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/ArcgisMapView.kt @@ -234,6 +234,7 @@ internal class ArcgisMapView( val position = optionParams.parseToClass() dataSource.setNewLocation(position) + result.success(true) } private fun onSetLocationDisplayDataSourceType(call: MethodCall, result: MethodChannel.Result) { diff --git a/arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/util/GraphicsParser.kt b/arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/util/GraphicsParser.kt index a6fa8e23c..cff99e2e3 100644 --- a/arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/util/GraphicsParser.kt +++ b/arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/util/GraphicsParser.kt @@ -47,10 +47,11 @@ class GraphicsParser { private fun parsePoint(map: Map): List { val point = (map["point"] as Map).parseToClass() + val symbolMap = map["symbol"] as Map val pointGraphic = Graphic().apply { geometry = point.toAGSPoint() - symbol = parseSymbol(map) + symbol = parseSymbol(symbolMap) } return listOf(pointGraphic) @@ -58,6 +59,7 @@ class GraphicsParser { private fun parsePolyline(map: Map): List { val points = parseToClass>>>(map["paths"]!!) + val symbolMap = map["symbol"] as Map return points.map { subPoints -> Graphic().apply { @@ -72,26 +74,25 @@ class GraphicsParser { if (z != null) Point(x, y, z, SpatialReferences.getWgs84()) else Point(x, y, SpatialReferences.getWgs84()) })) - symbol = parseSymbol(map) + symbol = parseSymbol(symbolMap) } } } private fun parsePolygon(map: Map): List { val rings = parseToClass>>>(map["rings"]!!) + val symbolMap = map["symbol"] as Map return rings.map { ring -> Graphic().apply { geometry = Polygon(PointCollection(ring.map { LatLng(it[0], it[1]).toAGSPoint() })) - symbol = parseSymbol(map) + symbol = parseSymbol(symbolMap) } } } - fun parseSymbol(map: Map): Symbol { - val symbolMap = map["symbol"] as Map - + fun parseSymbol(symbolMap: Map): Symbol { val symbol = when (val type = symbolMap["type"]) { "simple-marker" -> parseSimpleMarkerSymbol(symbolMap) "picture-marker" -> parsePictureMarkerSymbol(symbolMap) diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 3f41384db..5d3c10d75 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,9 @@ + + + +