Skip to content

Commit cf25de6

Browse files
committed
Basemap styles cleanup
1 parent 62257c2 commit cf25de6

File tree

10 files changed

+524
-204
lines changed

10 files changed

+524
-204
lines changed

arcgis_map_sdk_android/android/src/main/kotlin/dev/fluttercommunity/arcgis_map_sdk_android/Parsing.kt

Lines changed: 66 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -178,90 +178,73 @@ fun parseAnimationCurve(value: String): AnimationCurve {
178178
}
179179
}
180180

181-
fun BasemapStyle.getJsonValue(): String? {
182-
return when (this) {
183-
BasemapStyle.ArcGISImagery -> "arcgisImagery"
184-
BasemapStyle.ArcGISImageryStandard -> "arcgisImageryStandard"
185-
BasemapStyle.ArcGISImageryLabels -> "arcgisImageryLabels"
186-
BasemapStyle.ArcGISLightGray -> "arcgisLightGray"
187-
BasemapStyle.ArcGISLightGray -> null
188-
BasemapStyle.ArcGISLightGrayLabels -> null
189-
BasemapStyle.ArcGISDarkGray -> "arcgisDarkGray"
190-
BasemapStyle.ArcGISDarkGrayBase -> null
191-
BasemapStyle.ArcGISDarkGrayLabels -> null
192-
BasemapStyle.ArcGISNavigation -> "arcgisNavigation"
193-
BasemapStyle.ArcGISNavigationNight -> "arcgisNavigationNight"
194-
BasemapStyle.ArcGISStreets -> "arcgisStreets"
195-
BasemapStyle.ArcGISStreetsNight -> "arcgisStreetsNight"
196-
BasemapStyle.OsmStreetsRelief -> "arcgisStreetsRelief"
197-
BasemapStyle.ArcGISTopographic -> "arcgisTopographic"
198-
BasemapStyle.ArcGISOceans -> "arcgisOceans"
199-
BasemapStyle.ArcGISOceansBase -> null
200-
BasemapStyle.ArcGISOceansLabels -> null
201-
BasemapStyle.ArcGISTerrain -> "arcgisTerrain"
202-
BasemapStyle.ArcGISTerrainBase -> null
203-
BasemapStyle.ArcGISTerrainDetail -> null
204-
BasemapStyle.ArcGISCommunity -> "arcgisCommunity"
205-
BasemapStyle.ArcGISChartedTerritory -> "arcgisChartedTerritory"
206-
BasemapStyle.ArcGISColoredPencil -> "arcgisColoredPencil"
207-
BasemapStyle.ArcGISNova -> "arcgisNova"
208-
BasemapStyle.ArcGISModernAntique -> "arcgisModernAntique"
209-
BasemapStyle.ArcGISMidcentury -> "arcgisMidcentury"
210-
BasemapStyle.ArcGISNewspaper -> "arcgisNewspaper"
211-
BasemapStyle.ArcGISHillshadeLight -> "arcgisHillshadeLight"
212-
BasemapStyle.ArcGISHillshadeDark -> "arcgisHillshadeDark"
213-
BasemapStyle.ArcGISStreetsReliefBase -> null
214-
BasemapStyle.ArcGISTopographicBase -> null
215-
BasemapStyle.ArcGISChartedTerritoryBase -> null
216-
BasemapStyle.ArcGISModernAntiqueBase -> null
217-
BasemapStyle.OsmStandard -> "osmStandard"
218-
BasemapStyle.OsmStandardRelief -> "osmStandardRelief"
219-
BasemapStyle.OsmStandardReliefBase -> null
220-
BasemapStyle.OsmStreets -> "osmStreets"
221-
BasemapStyle.OsmStreetsRelief -> "osmStreetsRelief"
222-
BasemapStyle.OsmStreetsReliefBase -> null
223-
BasemapStyle.OsmLightGray -> "osmLightGray"
224-
BasemapStyle.OsmLightGrayBase -> null
225-
BasemapStyle.OsmLightGrayLabels -> null
226-
BasemapStyle.OsmDarkGray -> "osmDarkGray"
227-
BasemapStyle.OsmDarkGrayBase -> null
228-
BasemapStyle.OsmDarkGrayLabels -> null
229-
BasemapStyle.OsmHybrid -> "hybrid"
230-
else -> null
231-
}
181+
private val basemapStyleMapping = mapOf(
182+
BasemapStyle.ArcGISImagery to "arcgisImagery",
183+
BasemapStyle.ArcGISImageryStandard to "arcgisImageryStandard",
184+
BasemapStyle.ArcGISImageryLabels to "arcgisImageryLabels",
185+
BasemapStyle.ArcGISLightGray to "arcgisLightGray",
186+
BasemapStyle.ArcGISLightGrayBase to "arcgisLightGrayBase",
187+
BasemapStyle.ArcGISLightGrayLabels to "arcgisLightGrayLabels",
188+
BasemapStyle.ArcGISDarkGray to "arcgisDarkGray",
189+
BasemapStyle.ArcGISDarkGrayBase to "arcgisDarkGrayBase",
190+
BasemapStyle.ArcGISDarkGrayLabels to "arcgisDarkGrayLabels",
191+
BasemapStyle.ArcGISNavigation to "arcgisNavigation",
192+
BasemapStyle.ArcGISNavigationNight to "arcgisNavigationNight",
193+
BasemapStyle.ArcGISStreets to "arcgisStreets",
194+
BasemapStyle.ArcGISStreetsRelief to "arcgisStreetsRelief",
195+
BasemapStyle.ArcGISStreetsReliefBase to "arcgisStreetsReliefBase",
196+
BasemapStyle.ArcGISStreetsNight to "arcgisStreetsNight",
197+
BasemapStyle.ArcGISTopographic to "arcgisTopographic",
198+
BasemapStyle.ArcGISTopographicBase to "arcgisTopographicBase",
199+
BasemapStyle.ArcGISOceans to "arcgisOceans",
200+
BasemapStyle.ArcGISOceansBase to "arcgisOceansBase",
201+
BasemapStyle.ArcGISOceansLabels to "arcgisOceansLabels",
202+
BasemapStyle.ArcGISTerrain to "arcgisTerrain",
203+
BasemapStyle.ArcGISTerrainBase to "arcgisTerrainBase",
204+
BasemapStyle.ArcGISTerrainDetail to "arcgisTerrainDetail",
205+
BasemapStyle.ArcGISCommunity to "arcgisCommunity",
206+
BasemapStyle.ArcGISChartedTerritory to "arcgisChartedTerritory",
207+
BasemapStyle.ArcGISChartedTerritoryBase to "arcgisChartedTerritoryBase",
208+
BasemapStyle.ArcGISColoredPencil to "arcgisColoredPencil",
209+
BasemapStyle.ArcGISNova to "arcgisNova",
210+
BasemapStyle.ArcGISModernAntique to "arcgisModernAntique",
211+
BasemapStyle.ArcGISModernAntiqueBase to "arcgisModernAntiqueBase",
212+
BasemapStyle.ArcGISMidcentury to "arcgisMidcentury",
213+
BasemapStyle.ArcGISNewspaper to "arcgisNewspaper",
214+
BasemapStyle.ArcGISHillshadeLight to "arcgisHillshadeLight",
215+
BasemapStyle.ArcGISHillshadeDark to "arcgisHillshadeDark",
216+
BasemapStyle.ArcGISOutdoor to "arcgisOutdoor",
217+
BasemapStyle.ArcGISHumanGeography to "arcgisHumanGeography",
218+
BasemapStyle.ArcGISHumanGeographyBase to "arcgisHumanGeographyBase",
219+
BasemapStyle.ArcGISHumanGeographyDetail to "arcgisHumanGeographyDetail",
220+
BasemapStyle.ArcGISHumanGeographyLabels to "arcgisHumanGeographyLabels",
221+
BasemapStyle.ArcGISHumanGeographyDark to "arcgisHumanGeographyDark",
222+
BasemapStyle.ArcGISHumanGeographyDarkBase to "arcgisHumanGeographyDarkBase",
223+
BasemapStyle.ArcGISHumanGeographyDarkDetail to "arcgisHumanGeographyDarkDetail",
224+
BasemapStyle.ArcGISHumanGeographyDarkLabels to "arcgisHumanGeographyDarkLabels",
225+
BasemapStyle.OsmStandard to "osmStandard",
226+
BasemapStyle.OsmStandardRelief to "osmStandardRelief",
227+
BasemapStyle.OsmStandardReliefBase to "osmStandardReliefBase",
228+
BasemapStyle.OsmStreets to "osmStreets",
229+
BasemapStyle.OsmStreetsRelief to "osmStreetsRelief",
230+
BasemapStyle.OsmStreetsReliefBase to "osmStreetsReliefBase",
231+
BasemapStyle.OsmLightGray to "osmLightGray",
232+
BasemapStyle.OsmLightGrayBase to "osmLightGrayBase",
233+
BasemapStyle.OsmLightGrayLabels to "osmLightGrayLabels",
234+
BasemapStyle.OsmDarkGray to "osmDarkGray",
235+
BasemapStyle.OsmDarkGrayBase to "osmDarkGrayBase",
236+
BasemapStyle.OsmDarkGrayLabels to "osmDarkGrayLabels",
237+
BasemapStyle.OsmBlueprint to "osmBlueprint",
238+
BasemapStyle.OsmHybrid to "osmHybrid",
239+
BasemapStyle.OsmHybridDetail to "osmHybridDetail",
240+
BasemapStyle.OsmNavigation to "osmNavigation",
241+
BasemapStyle.OsmNavigationDark to "osmNavigationDark"
242+
)
243+
244+
fun BasemapStyle.getJsonValue(): String {
245+
return basemapStyleMapping[this]!!
232246
}
233247

234248
fun parseBasemapStyle(value: String): BasemapStyle? {
235-
return when (value) {
236-
"arcgisImagery" -> BasemapStyle.ArcGISImagery
237-
"arcgisImageryStandard" -> BasemapStyle.ArcGISImageryStandard
238-
"arcgisImageryLabels" -> BasemapStyle.ArcGISImageryLabels
239-
"arcgisLightGray" -> BasemapStyle.ArcGISLightGray
240-
"arcgisDarkGray" -> BasemapStyle.ArcGISDarkGray
241-
"arcgisNavigation" -> BasemapStyle.ArcGISNavigation
242-
"arcgisNavigationNight" -> BasemapStyle.ArcGISNavigationNight
243-
"arcgisStreets" -> BasemapStyle.ArcGISStreets
244-
"arcgisStreetsNight" -> BasemapStyle.ArcGISStreetsNight
245-
"arcgisStreetsRelief" -> BasemapStyle.OsmStreetsRelief
246-
"arcgisTopographic" -> BasemapStyle.ArcGISTopographic
247-
"arcgisOceans" -> BasemapStyle.ArcGISOceans
248-
"arcgisTerrain" -> BasemapStyle.ArcGISTerrain
249-
"arcgisCommunity" -> BasemapStyle.ArcGISCommunity
250-
"arcgisChartedTerritory" -> BasemapStyle.ArcGISChartedTerritory
251-
"arcgisColoredPencil" -> BasemapStyle.ArcGISColoredPencil
252-
"arcgisNova" -> BasemapStyle.ArcGISNova
253-
"arcgisModernAntique" -> BasemapStyle.ArcGISModernAntique
254-
"arcgisMidcentury" -> BasemapStyle.ArcGISMidcentury
255-
"arcgisNewspaper" -> BasemapStyle.ArcGISNewspaper
256-
"arcgisHillshadeLight" -> BasemapStyle.ArcGISHillshadeLight
257-
"arcgisHillshadeDark" -> BasemapStyle.ArcGISHillshadeDark
258-
"osmStandard" -> BasemapStyle.OsmStandard
259-
"osmStandardRelief" -> BasemapStyle.OsmStandardRelief
260-
"osmStreets" -> BasemapStyle.OsmStreets
261-
"osmStreetsRelief" -> BasemapStyle.OsmStreetsRelief
262-
"osmLightGray" -> BasemapStyle.OsmLightGray
263-
"osmDarkGray" -> BasemapStyle.OsmDarkGray
264-
"hybrid" -> BasemapStyle.OsmHybrid
265-
else -> null
266-
}
249+
return basemapStyleMapping.entries.firstOrNull { it.value == value }?.key
267250
}

arcgis_map_sdk_ios/ios/arcgis_map_sdk_ios/Sources/arcgis_map_sdk_ios/ArcgisMapView.swift

Lines changed: 73 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,9 @@ extension Basemap.Style: CaseIterable {
615615
.arcGISStreets,
616616
.arcGISStreetsNight,
617617
.arcGISStreetsRelief,
618+
.arcGISStreetsReliefBase,
618619
.arcGISTopographic,
620+
.arcGISTopographicBase,
619621
.arcGISOceans,
620622
.arcGISOceansBase,
621623
.arcGISOceansLabels,
@@ -624,29 +626,41 @@ extension Basemap.Style: CaseIterable {
624626
.arcGISTerrainDetail,
625627
.arcGISCommunity,
626628
.arcGISChartedTerritory,
629+
.arcGISChartedTerritoryBase,
627630
.arcGISColoredPencil,
628631
.arcGISNova,
629632
.arcGISModernAntique,
633+
.arcGISModernAntiqueBase,
630634
.arcGISMidcentury,
631635
.arcGISNewspaper,
632636
.arcGISHillshadeLight,
633637
.arcGISHillshadeDark,
634-
.arcGISStreetsReliefBase,
635-
.arcGISTopographicBase,
636-
.arcGISChartedTerritoryBase,
637-
.arcGISModernAntiqueBase,
638+
.arcGISOutdoor,
639+
.arcGISHumanGeography,
640+
.arcGISHumanGeographyBase,
641+
.arcGISHumanGeographyDetail,
642+
.arcGISHumanGeographyLabels,
643+
.arcGISHumanGeographyDark,
644+
.arcGISHumanGeographyDarkBase,
645+
.arcGISHumanGeographyDarkDetail,
646+
.arcGISHumanGeographyDarkLabels,
638647
.osmStandard,
639648
.osmStandardRelief,
640649
.osmStandardReliefBase,
641650
.osmStreets,
642651
.osmStreetsRelief,
652+
.osmStreetsReliefBase,
643653
.osmLightGray,
644654
.osmLightGrayBase,
645655
.osmLightGrayLabels,
646656
.osmDarkGray,
647657
.osmDarkGrayBase,
648658
.osmDarkGrayLabels,
649-
.osmStreetsReliefBase
659+
.osmBlueprint,
660+
.osmHybrid,
661+
.osmHybridDetail,
662+
.osmNavigation,
663+
.osmNavigationDark,
650664
]
651665
}
652666
}
@@ -663,49 +677,57 @@ extension Basemap.Style {
663677
case .arcGISLightGray:
664678
return "arcgisLightGray"
665679
case .arcGISLightGrayBase:
666-
return "arcgisDarkGray"
680+
return "arcgisLightGrayBase"
667681
case .arcGISLightGrayLabels:
668-
return nil
682+
return "arcgisLightGrayLabels"
669683
case .arcGISDarkGray:
670-
return nil
684+
return "arcgisDarkGray"
671685
case .arcGISDarkGrayBase:
672-
return nil
686+
return "arcgisDarkGrayBase"
673687
case .arcGISDarkGrayLabels:
674-
return nil
688+
return "arcgisDarkGrayLabels"
675689
case .arcGISNavigation:
676690
return "arcgisNavigation"
677691
case .arcGISNavigationNight:
678692
return "arcgisNavigationNight"
679693
case .arcGISStreets:
680694
return "arcgisStreets"
681-
case .arcGISStreetsNight:
682-
return "arcgisStreetsNight"
683695
case .arcGISStreetsRelief:
684696
return "arcgisStreetsRelief"
697+
case .arcGISStreetsReliefBase:
698+
return "arcgisStreetsReliefBase"
699+
case .arcGISStreetsNight:
700+
return "arcgisStreetsNight"
685701
case .arcGISTopographic:
686702
return "arcgisTopographic"
703+
case .arcGISTopographicBase:
704+
return "arcgisTopographicBase"
687705
case .arcGISOceans:
688706
return "arcgisOceans"
689707
case .arcGISOceansBase:
690-
return nil
708+
return "arcgisOceansBase"
691709
case .arcGISOceansLabels:
692-
return nil
710+
return "arcgisOceansLabels"
693711
case .arcGISTerrain:
694712
return "arcgisTerrain"
695713
case .arcGISTerrainBase:
696-
return nil
714+
return "arcgisTerrainBase"
697715
case .arcGISTerrainDetail:
698-
return nil
716+
return "arcgisTerrainDetail"
699717
case .arcGISCommunity:
700718
return "arcgisCommunity"
701719
case .arcGISChartedTerritory:
702720
return "arcgisChartedTerritory"
721+
case .arcGISChartedTerritoryBase:
722+
return "arcgisChartedTerritoryBase"
703723
case .arcGISColoredPencil:
704724
return "arcgisColoredPencil"
705725
case .arcGISNova:
706726
return "arcgisNova"
707727
case .arcGISModernAntique:
708728
return "arcgisModernAntique"
729+
case .arcGISModernAntiqueBase:
730+
return "arcgisModernAntiqueBase"
709731
case .arcGISMidcentury:
710732
return "arcgisMidcentury"
711733
case .arcGISNewspaper:
@@ -714,14 +736,24 @@ extension Basemap.Style {
714736
return "arcgisHillshadeLight"
715737
case .arcGISHillshadeDark:
716738
return "arcgisHillshadeDark"
717-
case .arcGISStreetsReliefBase:
718-
return nil
719-
case .arcGISTopographicBase:
720-
return nil
721-
case .arcGISChartedTerritoryBase:
722-
return nil
723-
case .arcGISModernAntiqueBase:
724-
return nil
739+
case .arcGISOutdoor:
740+
return "arcgisOutdoor"
741+
case .arcGISHumanGeography:
742+
return "arcgisHumanGeography"
743+
case .arcGISHumanGeographyBase:
744+
return "arcgisHumanGeographyBase"
745+
case .arcGISHumanGeographyDetail:
746+
return "arcgisHumanGeographyDetail"
747+
case .arcGISHumanGeographyLabels:
748+
return "arcgisHumanGeographyLabels"
749+
case .arcGISHumanGeographyDark:
750+
return "arcgisHumanGeographyDark"
751+
case .arcGISHumanGeographyDarkBase:
752+
return "arcgisHumanGeographyDarkBase"
753+
case .arcGISHumanGeographyDarkDetail:
754+
return "arcgisHumanGeographyDarkDetail"
755+
case .arcGISHumanGeographyDarkLabels:
756+
return "arcgisHumanGeographyDarkLabels"
725757
case .osmStandard:
726758
return "osmStandard"
727759
case .osmStandardRelief:
@@ -732,22 +764,31 @@ extension Basemap.Style {
732764
return "osmStreets"
733765
case .osmStreetsRelief:
734766
return "osmStreetsRelief"
767+
case .osmStreetsReliefBase:
768+
return "osmStreetsReliefBase"
735769
case .osmLightGray:
736770
return "osmLightGray"
737771
case .osmLightGrayBase:
738-
return nil
772+
return "osmLightGrayBase"
739773
case .osmLightGrayLabels:
740-
return nil
774+
return "osmLightGrayLabels"
741775
case .osmDarkGray:
742776
return "osmDarkGray"
743777
case .osmDarkGrayBase:
744-
return nil
778+
return "osmDarkGrayBase"
745779
case .osmDarkGrayLabels:
746-
return nil
747-
case .osmStreetsReliefBase:
748-
return nil
749-
@unknown default:
750-
return nil
780+
return "osmDarkGrayLabels"
781+
case .osmBlueprint:
782+
return "osmBlueprint"
783+
case .osmHybrid:
784+
return "osmHybrid"
785+
case .osmHybridDetail:
786+
return "osmHybridDetail"
787+
case .osmNavigation:
788+
return "osmNavigation"
789+
case .osmNavigationDark:
790+
return "osmNavigationDark"
791+
751792
}
752793
}
753794
}

arcgis_map_sdk_ios/ios/arcgis_map_sdk_ios/Sources/arcgis_map_sdk_ios/GraphicsParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class GraphicsParser {
9898
case "simple-marker":
9999
return parseSimpleMarkerSymbol(dictionary)
100100
case "picture-marker":
101-
return parsePictureMarkerSymbol(dictionary)
101+
return try parsePictureMarkerSymbol(dictionary)
102102
case "simple-fill":
103103
return parseSimpleFillMarkerSymbol(dictionary)
104104
case "simple-line":

0 commit comments

Comments
 (0)