diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-16 23:34:36 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-16 23:34:36 -0600 |
commit | 54d1bb1f14e13256fb205a2ef1a8c9779f795d9a (patch) | |
tree | 20bdd817ecaea24194f81cc7bf40931e2b21855f /shared/src/commonMain/kotlin/mx/trackermap | |
parent | 273baf1982beac68a1e32fb238b490b9cd43e9dc (diff) | |
download | etbsa-trackermap-mobile-54d1bb1f14e13256fb205a2ef1a8c9779f795d9a.tar.gz etbsa-trackermap-mobile-54d1bb1f14e13256fb205a2ef1a8c9779f795d9a.tar.bz2 etbsa-trackermap-mobile-54d1bb1f14e13256fb205a2ef1a8c9779f795d9a.zip |
Fixed initial zoom issue and refactored layers into MapLayer in shared module
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap')
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt | 26 | ||||
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt | 2 |
2 files changed, 27 insertions, 1 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt index 64381d9..ff0489e 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt @@ -5,4 +5,28 @@ data class MapLayer( val minZoom: Int, val maxZoom: Int, val attribution: String -)
\ No newline at end of file +) { + enum class Type { + STREETS, + SATELLITE + } + + companion object { + val layers = mapOf( + Type.STREETS to MapLayer( + url = "https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png", + minZoom = 1, + maxZoom = 23, + attribution = "© OpenStreetMap France | © <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors" + ), + Type.SATELLITE to MapLayer( + url = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", + minZoom = 1, + maxZoom = 20, + attribution = "Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community" + ) + ) + + val defaultLayer = layers[Type.STREETS]!! + } +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt index b1a6444..d4d69fa 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt @@ -32,6 +32,8 @@ class MapCalculus { 20 -> 533.182395965 21 -> 266.5911979825 22 -> 133.29559899125 + 23 -> 66.647799495625 + 24 -> 33.3238997478125 else -> null } } |