@react-native-kakao/map 2.2.7 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +5 -38
- package/RNCKakaoMap.podspec +16 -52
- package/android/build.gradle +12 -107
- package/android/consumer-rules.pro +2 -0
- package/android/src/main/AndroidManifest.xml +3 -1
- package/android/src/main/java/net/mjstudio/rnkakao/map/CameraOptions.kt +61 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/KakaoMapModule.kt +131 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/KakaoMapView.kt +1257 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapCameraCommands.kt +306 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapDimScreen.kt +431 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapGui.kt +899 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapImageLoader.kt +232 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapLabels.kt +1572 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapOptions.kt +360 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapRoutes.kt +805 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapShapes.kt +1096 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapUtilities.kt +495 -0
- package/expo-module.config.json +5 -0
- package/ios/CameraOptions.swift +41 -0
- package/ios/KakaoMapModule.swift +204 -0
- package/ios/KakaoMapView.swift +1018 -0
- package/ios/MapCameraCommands.swift +451 -0
- package/ios/MapDimScreen.swift +463 -0
- package/ios/MapGui.swift +1099 -0
- package/ios/MapImageLoader.swift +177 -0
- package/ios/MapLabels.swift +1676 -0
- package/ios/MapOptions.swift +374 -0
- package/ios/MapRoutes.swift +903 -0
- package/ios/MapShapes.swift +1294 -0
- package/ios/MapUnits.swift +20 -0
- package/ios/MapUtilities.swift +365 -0
- package/lib/commonjs/index.js +180 -29
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +18 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types-assets.js +2 -0
- package/lib/commonjs/types-assets.js.map +1 -0
- package/lib/commonjs/types-camera.js +6 -0
- package/lib/commonjs/types-camera.js.map +1 -0
- package/lib/commonjs/types-dim.js +6 -0
- package/lib/commonjs/types-dim.js.map +1 -0
- package/lib/commonjs/types-gui.js +6 -0
- package/lib/commonjs/types-gui.js.map +1 -0
- package/lib/commonjs/types-labels.js +6 -0
- package/lib/commonjs/types-labels.js.map +1 -0
- package/lib/commonjs/types-routes.js +6 -0
- package/lib/commonjs/types-routes.js.map +1 -0
- package/lib/commonjs/types-shapes.js +6 -0
- package/lib/commonjs/types-shapes.js.map +1 -0
- package/lib/commonjs/types-utilities.js +6 -0
- package/lib/commonjs/types-utilities.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/index.js +180 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +13 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/types-assets.js +2 -0
- package/lib/module/types-assets.js.map +1 -0
- package/lib/module/types-camera.js +4 -0
- package/lib/module/types-camera.js.map +1 -0
- package/lib/module/types-dim.js +4 -0
- package/lib/module/types-dim.js.map +1 -0
- package/lib/module/types-gui.js +4 -0
- package/lib/module/types-gui.js.map +1 -0
- package/lib/module/types-labels.js +4 -0
- package/lib/module/types-labels.js.map +1 -0
- package/lib/module/types-routes.js +4 -0
- package/lib/module/types-routes.js.map +1 -0
- package/lib/module/types-shapes.js +4 -0
- package/lib/module/types-shapes.js.map +1 -0
- package/lib/module/types-utilities.js +4 -0
- package/lib/module/types-utilities.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/index.d.ts +59 -9
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types-assets.d.ts +9 -0
- package/lib/typescript/src/types-assets.d.ts.map +1 -0
- package/lib/typescript/src/types-camera.d.ts +123 -0
- package/lib/typescript/src/types-camera.d.ts.map +1 -0
- package/lib/typescript/src/types-dim.d.ts +54 -0
- package/lib/typescript/src/types-dim.d.ts.map +1 -0
- package/lib/typescript/src/types-gui.d.ts +189 -0
- package/lib/typescript/src/types-gui.d.ts.map +1 -0
- package/lib/typescript/src/types-labels.d.ts +246 -0
- package/lib/typescript/src/types-labels.d.ts.map +1 -0
- package/lib/typescript/src/types-routes.d.ts +162 -0
- package/lib/typescript/src/types-routes.d.ts.map +1 -0
- package/lib/typescript/src/types-shapes.d.ts +253 -0
- package/lib/typescript/src/types-shapes.d.ts.map +1 -0
- package/lib/typescript/src/types-utilities.d.ts +130 -0
- package/lib/typescript/src/types-utilities.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +222 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +24 -77
- package/src/index.tsx +322 -0
- package/src/index.web.tsx +46 -0
- package/src/types-assets.ts +8 -0
- package/src/types-camera.ts +97 -0
- package/src/types-dim.ts +54 -0
- package/src/types-gui.ts +171 -0
- package/src/types-labels.ts +207 -0
- package/src/types-routes.ts +118 -0
- package/src/types-shapes.ts +244 -0
- package/src/types-utilities.ts +115 -0
- package/src/types.ts +223 -0
- package/android/gradle.properties +0 -1
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/main/java/net/mjstudio/rnkakao/map/RNCKakaoMapModule.kt +0 -25
- package/android/src/main/java/net/mjstudio/rnkakao/map/RNCKakaoMapPackage.kt +0 -35
- package/android/src/newarch/KakaoMapSpec.kt +0 -7
- package/android/src/oldarch/KakaoMapSpec.kt +0 -14
- package/ios/Component/Map/RNCKakaoMapView.h +0 -23
- package/ios/Component/Map/RNCKakaoMapView.mm +0 -209
- package/ios/Component/Map/RNCKakaoMapViewManager.mm +0 -19
- package/ios/NativeModule/RNCKakaoMap.h +0 -7
- package/ios/NativeModule/RNCKakaoMap.mm +0 -19
- package/ios/NativeModule/RNCKakaoMapManager.swift +0 -7
- package/ios/Util/Util.h +0 -97
- package/lib/commonjs/component/KakaoMapView.js +0 -54
- package/lib/commonjs/component/KakaoMapView.js.map +0 -1
- package/lib/commonjs/spec/NativeKakaoMap.js +0 -9
- package/lib/commonjs/spec/NativeKakaoMap.js.map +0 -1
- package/lib/commonjs/spec/RNCKakaoMapViewNativeComponent.js +0 -15
- package/lib/commonjs/spec/RNCKakaoMapViewNativeComponent.js.map +0 -1
- package/lib/commonjs/type/type.js +0 -2
- package/lib/commonjs/type/type.js.map +0 -1
- package/lib/commonjs/util/Const.js +0 -14
- package/lib/commonjs/util/Const.js.map +0 -1
- package/lib/commonjs/util/Util.js +0 -15
- package/lib/commonjs/util/Util.js.map +0 -1
- package/lib/module/component/KakaoMapView.js +0 -48
- package/lib/module/component/KakaoMapView.js.map +0 -1
- package/lib/module/spec/NativeKakaoMap.js +0 -3
- package/lib/module/spec/NativeKakaoMap.js.map +0 -1
- package/lib/module/spec/RNCKakaoMapViewNativeComponent.js +0 -10
- package/lib/module/spec/RNCKakaoMapViewNativeComponent.js.map +0 -1
- package/lib/module/type/type.js +0 -2
- package/lib/module/type/type.js.map +0 -1
- package/lib/module/util/Const.js +0 -8
- package/lib/module/util/Const.js.map +0 -1
- package/lib/module/util/Util.js +0 -9
- package/lib/module/util/Util.js.map +0 -1
- package/lib/typescript/src/component/KakaoMapView.d.ts +0 -25
- package/lib/typescript/src/component/KakaoMapView.d.ts.map +0 -1
- package/lib/typescript/src/spec/NativeKakaoMap.d.ts +0 -7
- package/lib/typescript/src/spec/NativeKakaoMap.d.ts.map +0 -1
- package/lib/typescript/src/spec/RNCKakaoMapViewNativeComponent.d.ts +0 -32
- package/lib/typescript/src/spec/RNCKakaoMapViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/type/type.d.ts +0 -8
- package/lib/typescript/src/type/type.d.ts.map +0 -1
- package/lib/typescript/src/util/Const.d.ts +0 -8
- package/lib/typescript/src/util/Const.d.ts.map +0 -1
- package/lib/typescript/src/util/Util.d.ts +0 -3
- package/lib/typescript/src/util/Util.d.ts.map +0 -1
- package/src/component/KakaoMapView.tsx +0 -82
- package/src/index.ts +0 -43
- package/src/spec/NativeKakaoMap.ts +0 -8
- package/src/spec/RNCKakaoMapViewNativeComponent.ts +0 -38
- package/src/type/type.ts +0 -7
- package/src/util/Const.ts +0 -7
- package/src/util/Util.ts +0 -11
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
package net.mjstudio.rnkakao.map
|
|
2
|
+
|
|
3
|
+
import com.kakao.vectormap.GestureType
|
|
4
|
+
import com.kakao.vectormap.MapGravity
|
|
5
|
+
import com.kakao.vectormap.MapOverlay
|
|
6
|
+
import com.kakao.vectormap.MapType
|
|
7
|
+
import com.kakao.vectormap.PoiScale
|
|
8
|
+
import expo.modules.kotlin.exception.CodedException
|
|
9
|
+
import expo.modules.kotlin.records.Field
|
|
10
|
+
import expo.modules.kotlin.records.Record
|
|
11
|
+
import expo.modules.kotlin.records.Required
|
|
12
|
+
|
|
13
|
+
class CoordinateRecord : Record {
|
|
14
|
+
@Field @Required
|
|
15
|
+
var latitude: Double = Double.NaN
|
|
16
|
+
|
|
17
|
+
@Field @Required
|
|
18
|
+
var longitude: Double = Double.NaN
|
|
19
|
+
|
|
20
|
+
fun validate(name: String = "Coordinate") {
|
|
21
|
+
if (!latitude.isFinite() || !longitude.isFinite() || latitude !in -90.0..90.0 || longitude !in -180.0..180.0) {
|
|
22
|
+
throw CodedException(INVALID_ARGUMENT, "$name must contain a valid latitude and longitude.", null)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class ScreenPointRecord : Record {
|
|
28
|
+
@Field @Required
|
|
29
|
+
var x: Double = Double.NaN
|
|
30
|
+
|
|
31
|
+
@Field @Required
|
|
32
|
+
var y: Double = Double.NaN
|
|
33
|
+
|
|
34
|
+
fun validate(name: String = "Screen point") {
|
|
35
|
+
if (!x.isFinite() || !y.isFinite()) {
|
|
36
|
+
throw CodedException(INVALID_ARGUMENT, "$name must contain finite x and y values.", null)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
class MapPaddingRecord : Record {
|
|
42
|
+
@Field @Required
|
|
43
|
+
var top: Double = Double.NaN
|
|
44
|
+
|
|
45
|
+
@Field @Required
|
|
46
|
+
var right: Double = Double.NaN
|
|
47
|
+
|
|
48
|
+
@Field @Required
|
|
49
|
+
var bottom: Double = Double.NaN
|
|
50
|
+
|
|
51
|
+
@Field @Required
|
|
52
|
+
var left: Double = Double.NaN
|
|
53
|
+
|
|
54
|
+
fun validate() {
|
|
55
|
+
if (!listOf(top, right, bottom, left).all { it.isFinite() && it >= 0.0 }) {
|
|
56
|
+
throw CodedException(INVALID_ARGUMENT, "Map padding values must be finite and non-negative.", null)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
class MapViewInfoRecord : Record {
|
|
62
|
+
@Field @Required
|
|
63
|
+
var name: String = ""
|
|
64
|
+
|
|
65
|
+
@Field var appName: String? = null
|
|
66
|
+
|
|
67
|
+
fun validate() {
|
|
68
|
+
if (name.isBlank() || appName?.isBlank() == true) {
|
|
69
|
+
throw CodedException(INVALID_ARGUMENT, "View info name and app name must not be blank.", null)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
class PoiOptionsRecord : Record {
|
|
75
|
+
@Field var visible: Boolean? = null
|
|
76
|
+
|
|
77
|
+
@Field var clickable: Boolean? = null
|
|
78
|
+
|
|
79
|
+
@Field var scale: String? = null
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
class ZoomRangeRecord : Record {
|
|
83
|
+
@Field @Required
|
|
84
|
+
var min: Double = Double.NaN
|
|
85
|
+
|
|
86
|
+
@Field @Required
|
|
87
|
+
var max: Double = Double.NaN
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class MapWidgetPositionRecord : Record {
|
|
91
|
+
@Field @Required
|
|
92
|
+
var x: Double = Double.NaN
|
|
93
|
+
|
|
94
|
+
@Field @Required
|
|
95
|
+
var y: Double = Double.NaN
|
|
96
|
+
|
|
97
|
+
@Field @Required
|
|
98
|
+
var gravity: String = ""
|
|
99
|
+
|
|
100
|
+
fun validate(name: String) {
|
|
101
|
+
if (!x.isFinite() || !y.isFinite() || gravity !in gravityValues) {
|
|
102
|
+
throw CodedException(INVALID_ARGUMENT, "$name must contain a supported gravity and finite x and y values.", null)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
fun nativeGravity() =
|
|
107
|
+
when (gravity) {
|
|
108
|
+
"topLeft" -> MapGravity.TOP or MapGravity.LEFT
|
|
109
|
+
"topCenter" -> MapGravity.TOP or MapGravity.CENTER_HORIZONTAL
|
|
110
|
+
"topRight" -> MapGravity.TOP or MapGravity.RIGHT
|
|
111
|
+
"centerLeft" -> MapGravity.CENTER_VERTICAL or MapGravity.LEFT
|
|
112
|
+
"center" -> MapGravity.CENTER
|
|
113
|
+
"centerRight" -> MapGravity.CENTER_VERTICAL or MapGravity.RIGHT
|
|
114
|
+
"bottomLeft" -> MapGravity.BOTTOM or MapGravity.LEFT
|
|
115
|
+
"bottomCenter" -> MapGravity.BOTTOM or MapGravity.CENTER_HORIZONTAL
|
|
116
|
+
"bottomRight" -> MapGravity.BOTTOM or MapGravity.RIGHT
|
|
117
|
+
else -> error("Position must be validated before conversion.")
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
companion object {
|
|
121
|
+
private val gravityValues =
|
|
122
|
+
setOf(
|
|
123
|
+
"topLeft",
|
|
124
|
+
"topCenter",
|
|
125
|
+
"topRight",
|
|
126
|
+
"centerLeft",
|
|
127
|
+
"center",
|
|
128
|
+
"centerRight",
|
|
129
|
+
"bottomLeft",
|
|
130
|
+
"bottomCenter",
|
|
131
|
+
"bottomRight",
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class CompassOptionsRecord : Record {
|
|
137
|
+
@Field var visible: Boolean? = null
|
|
138
|
+
|
|
139
|
+
@Field var position: MapWidgetPositionRecord? = null
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
class ScaleBarOptionsRecord : Record {
|
|
143
|
+
@Field var visible: Boolean? = null
|
|
144
|
+
|
|
145
|
+
@Field var position: MapWidgetPositionRecord? = null
|
|
146
|
+
|
|
147
|
+
@Field var autoHide: Boolean? = null
|
|
148
|
+
|
|
149
|
+
@Field var fade: ScaleBarFadeRecord? = null
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
class ScaleBarFadeRecord : Record {
|
|
153
|
+
@Field @Required
|
|
154
|
+
var inDuration: Double = Double.NaN
|
|
155
|
+
|
|
156
|
+
@Field @Required
|
|
157
|
+
var outDuration: Double = Double.NaN
|
|
158
|
+
|
|
159
|
+
@Field @Required
|
|
160
|
+
var retentionDuration: Double = Double.NaN
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
class MapOptionsRecord : Record {
|
|
164
|
+
@Field var mapType: String? = null
|
|
165
|
+
|
|
166
|
+
@Field var viewInfo: MapViewInfoRecord? = null
|
|
167
|
+
|
|
168
|
+
@Field var overlays: List<String>? = null
|
|
169
|
+
|
|
170
|
+
@Field var customOverlays: List<String>? = null
|
|
171
|
+
|
|
172
|
+
@Field var language: String? = null
|
|
173
|
+
|
|
174
|
+
@Field var poi: PoiOptionsRecord? = null
|
|
175
|
+
|
|
176
|
+
@Field var buildingScale: Double? = null
|
|
177
|
+
|
|
178
|
+
@Field var padding: MapPaddingRecord? = null
|
|
179
|
+
|
|
180
|
+
@Field var zoomRange: ZoomRangeRecord? = null
|
|
181
|
+
|
|
182
|
+
@Field var gestures: Map<String, Boolean>? = null
|
|
183
|
+
|
|
184
|
+
@Field var compass: CompassOptionsRecord? = null
|
|
185
|
+
|
|
186
|
+
@Field var scaleBar: ScaleBarOptionsRecord? = null
|
|
187
|
+
|
|
188
|
+
@Field var logo: MapWidgetPositionRecord? = null
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
class CameraUpdateRecord : Record {
|
|
192
|
+
@Field @Required
|
|
193
|
+
var type: String = ""
|
|
194
|
+
|
|
195
|
+
@Field var position: CoordinateRecord? = null
|
|
196
|
+
|
|
197
|
+
@Field var zoomLevel: Double? = null
|
|
198
|
+
|
|
199
|
+
@Field var rotation: Double? = null
|
|
200
|
+
|
|
201
|
+
@Field var tilt: Double? = null
|
|
202
|
+
|
|
203
|
+
@Field var coordinates: List<CoordinateRecord>? = null
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
internal fun mergeMapOptions(
|
|
207
|
+
base: MapOptionsRecord?,
|
|
208
|
+
patch: MapOptionsRecord,
|
|
209
|
+
): MapOptionsRecord {
|
|
210
|
+
val result = base ?: MapOptionsRecord()
|
|
211
|
+
patch.mapType?.let {
|
|
212
|
+
result.mapType = it
|
|
213
|
+
result.viewInfo = null
|
|
214
|
+
}
|
|
215
|
+
patch.viewInfo?.let {
|
|
216
|
+
result.viewInfo = it
|
|
217
|
+
result.mapType = null
|
|
218
|
+
}
|
|
219
|
+
patch.overlays?.let { result.overlays = it }
|
|
220
|
+
patch.customOverlays?.let { result.customOverlays = it }
|
|
221
|
+
patch.language?.let { result.language = it }
|
|
222
|
+
patch.poi?.let { poiPatch ->
|
|
223
|
+
val poi = result.poi ?: PoiOptionsRecord()
|
|
224
|
+
poiPatch.visible?.let { poi.visible = it }
|
|
225
|
+
poiPatch.clickable?.let { poi.clickable = it }
|
|
226
|
+
poiPatch.scale?.let { poi.scale = it }
|
|
227
|
+
result.poi = poi
|
|
228
|
+
}
|
|
229
|
+
patch.buildingScale?.let { result.buildingScale = it }
|
|
230
|
+
patch.padding?.let { result.padding = it }
|
|
231
|
+
patch.zoomRange?.let { result.zoomRange = it }
|
|
232
|
+
patch.gestures?.let { result.gestures = result.gestures.orEmpty() + it }
|
|
233
|
+
patch.compass?.let { compassPatch ->
|
|
234
|
+
val compass = result.compass ?: CompassOptionsRecord()
|
|
235
|
+
compassPatch.visible?.let { compass.visible = it }
|
|
236
|
+
compassPatch.position?.let { compass.position = it }
|
|
237
|
+
result.compass = compass
|
|
238
|
+
}
|
|
239
|
+
patch.scaleBar?.let { scaleBarPatch ->
|
|
240
|
+
val scaleBar = result.scaleBar ?: ScaleBarOptionsRecord()
|
|
241
|
+
scaleBarPatch.visible?.let { scaleBar.visible = it }
|
|
242
|
+
scaleBarPatch.position?.let { scaleBar.position = it }
|
|
243
|
+
scaleBarPatch.autoHide?.let { scaleBar.autoHide = it }
|
|
244
|
+
scaleBarPatch.fade?.let { scaleBar.fade = it }
|
|
245
|
+
result.scaleBar = scaleBar
|
|
246
|
+
}
|
|
247
|
+
patch.logo?.let { result.logo = it }
|
|
248
|
+
return result
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
internal fun changedMapOptions(
|
|
252
|
+
applied: MapOptionsRecord,
|
|
253
|
+
patch: MapOptionsRecord,
|
|
254
|
+
): MapOptionsRecord {
|
|
255
|
+
val changed = MapOptionsRecord()
|
|
256
|
+
patch.mapType?.takeIf { it != applied.mapType }?.let { changed.mapType = it }
|
|
257
|
+
patch.viewInfo?.takeIf { !it.sameAs(applied.viewInfo) }?.let { changed.viewInfo = it }
|
|
258
|
+
patch.overlays?.takeIf { it.toSet() != applied.overlays?.toSet() }?.let { changed.overlays = it }
|
|
259
|
+
patch.customOverlays?.takeIf { it.toSet() != applied.customOverlays?.toSet() }?.let { changed.customOverlays = it }
|
|
260
|
+
patch.language?.takeIf { it != applied.language }?.let { changed.language = it }
|
|
261
|
+
patch.poi?.let { poiPatch ->
|
|
262
|
+
val poi = PoiOptionsRecord()
|
|
263
|
+
poiPatch.visible?.takeIf { it != applied.poi?.visible }?.let { poi.visible = it }
|
|
264
|
+
poiPatch.clickable?.takeIf { it != applied.poi?.clickable }?.let { poi.clickable = it }
|
|
265
|
+
poiPatch.scale?.takeIf { it != applied.poi?.scale }?.let { poi.scale = it }
|
|
266
|
+
if (poi.visible != null || poi.clickable != null || poi.scale != null) changed.poi = poi
|
|
267
|
+
}
|
|
268
|
+
patch.buildingScale?.takeIf { it != applied.buildingScale }?.let { changed.buildingScale = it }
|
|
269
|
+
patch.padding?.takeIf { !it.sameAs(applied.padding) }?.let { changed.padding = it }
|
|
270
|
+
patch.zoomRange?.takeIf { !it.sameAs(applied.zoomRange) }?.let { changed.zoomRange = it }
|
|
271
|
+
patch.gestures?.filter { (gesture, enabled) -> applied.gestures?.get(gesture) != enabled }?.takeIf { it.isNotEmpty() }?.let {
|
|
272
|
+
changed.gestures = it
|
|
273
|
+
}
|
|
274
|
+
patch.compass?.let { compassPatch ->
|
|
275
|
+
val compass = CompassOptionsRecord()
|
|
276
|
+
compassPatch.visible?.takeIf { it != applied.compass?.visible }?.let { compass.visible = it }
|
|
277
|
+
compassPatch.position?.takeIf { !it.sameAs(applied.compass?.position) }?.let { compass.position = it }
|
|
278
|
+
if (compass.visible != null || compass.position != null) changed.compass = compass
|
|
279
|
+
}
|
|
280
|
+
patch.scaleBar?.let { scaleBarPatch ->
|
|
281
|
+
val scaleBar = ScaleBarOptionsRecord()
|
|
282
|
+
scaleBarPatch.visible?.takeIf { it != applied.scaleBar?.visible }?.let { scaleBar.visible = it }
|
|
283
|
+
scaleBarPatch.position?.takeIf { !it.sameAs(applied.scaleBar?.position) }?.let { scaleBar.position = it }
|
|
284
|
+
scaleBarPatch.autoHide?.takeIf { it != applied.scaleBar?.autoHide }?.let { scaleBar.autoHide = it }
|
|
285
|
+
scaleBarPatch.fade?.takeIf { !it.sameAs(applied.scaleBar?.fade) }?.let { scaleBar.fade = it }
|
|
286
|
+
if (scaleBar.visible != null || scaleBar.position != null || scaleBar.autoHide != null || scaleBar.fade != null) {
|
|
287
|
+
changed.scaleBar = scaleBar
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
patch.logo?.takeIf { !it.sameAs(applied.logo) }?.let { changed.logo = it }
|
|
291
|
+
return changed
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
internal fun MapOptionsRecord.isEmpty() =
|
|
295
|
+
mapType == null &&
|
|
296
|
+
viewInfo == null &&
|
|
297
|
+
overlays == null &&
|
|
298
|
+
customOverlays == null &&
|
|
299
|
+
language == null &&
|
|
300
|
+
poi == null &&
|
|
301
|
+
buildingScale == null &&
|
|
302
|
+
padding == null &&
|
|
303
|
+
zoomRange == null &&
|
|
304
|
+
gestures == null &&
|
|
305
|
+
compass == null &&
|
|
306
|
+
scaleBar == null &&
|
|
307
|
+
logo == null
|
|
308
|
+
|
|
309
|
+
private fun MapViewInfoRecord.sameAs(other: MapViewInfoRecord?) = name == other?.name && appName == other.appName
|
|
310
|
+
|
|
311
|
+
private fun MapPaddingRecord.sameAs(other: MapPaddingRecord?) =
|
|
312
|
+
top == other?.top && right == other.right && bottom == other.bottom && left == other.left
|
|
313
|
+
|
|
314
|
+
private fun ZoomRangeRecord.sameAs(other: ZoomRangeRecord?) = min == other?.min && max == other.max
|
|
315
|
+
|
|
316
|
+
private fun MapWidgetPositionRecord.sameAs(other: MapWidgetPositionRecord?) = x == other?.x && y == other.y && gravity == other.gravity
|
|
317
|
+
|
|
318
|
+
private fun ScaleBarFadeRecord.sameAs(other: ScaleBarFadeRecord?) =
|
|
319
|
+
inDuration == other?.inDuration && outDuration == other.outDuration && retentionDuration == other.retentionDuration
|
|
320
|
+
|
|
321
|
+
internal fun nativeMapType(value: String) =
|
|
322
|
+
when (value) {
|
|
323
|
+
"normal" -> MapType.NORMAL
|
|
324
|
+
"skyview" -> MapType.SKYVIEW
|
|
325
|
+
else -> throw CodedException(INVALID_ARGUMENT, "Unsupported map type: $value.", null)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
internal fun nativeMapOverlay(value: String) =
|
|
329
|
+
when (value) {
|
|
330
|
+
"roadviewLine" -> MapOverlay.ROADVIEW_LINE
|
|
331
|
+
"hillShading" -> MapOverlay.HILLSHADING
|
|
332
|
+
"bicycleRoad" -> MapOverlay.BICYCLE_ROAD
|
|
333
|
+
"hybrid" -> MapOverlay.SKYVIEW_HYBRID
|
|
334
|
+
else -> throw CodedException(INVALID_ARGUMENT, "Unsupported map overlay: $value.", null)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
internal fun nativeGesture(value: String) =
|
|
338
|
+
when (value) {
|
|
339
|
+
"doubleTapZoomIn" -> GestureType.OneFingerDoubleTap
|
|
340
|
+
"twoFingerTapZoomOut" -> GestureType.TwoFingerSingleTap
|
|
341
|
+
"pan" -> GestureType.Pan
|
|
342
|
+
"rotate" -> GestureType.Rotate
|
|
343
|
+
"zoom" -> GestureType.Zoom
|
|
344
|
+
"tilt" -> GestureType.Tilt
|
|
345
|
+
"longTapAndDrag" -> GestureType.LongTapAndDrag
|
|
346
|
+
"rotateZoom" -> GestureType.RotateZoom
|
|
347
|
+
"oneFingerZoom" -> GestureType.OneFingerZoom
|
|
348
|
+
else -> throw CodedException(INVALID_ARGUMENT, "Unsupported map gesture: $value.", null)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
internal fun nativePoiScale(value: String) =
|
|
352
|
+
when (value) {
|
|
353
|
+
"small" -> PoiScale.SMALL
|
|
354
|
+
"regular" -> PoiScale.REGULAR
|
|
355
|
+
"large" -> PoiScale.LARGE
|
|
356
|
+
"xLarge" -> PoiScale.XLARGE
|
|
357
|
+
else -> throw CodedException(INVALID_ARGUMENT, "Unsupported POI scale: $value.", null)
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
internal fun mapTypePayload(value: String) = if (value == MapType.SKYVIEW.value) "skyview" else "normal"
|