@@ -178,90 +178,73 @@ fun parseAnimationCurve(value: String): AnimationCurve {
178
178
}
179
179
}
180
180
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 ]!!
232
246
}
233
247
234
248
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
267
250
}
0 commit comments