expo-gaode-map 0.1.6 → 1.0.1

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.
Files changed (50) hide show
  1. package/PUBLISHING.md +1 -1
  2. package/README.md +68 -27
  3. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapModule.kt +117 -26
  4. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapView.kt +97 -36
  5. package/android/src/main/java/expo/modules/gaodemap/managers/CameraManager.kt +27 -21
  6. package/android/src/main/java/expo/modules/gaodemap/managers/OverlayManager.kt +4 -23
  7. package/android/src/main/java/expo/modules/gaodemap/managers/UIManager.kt +30 -27
  8. package/android/src/main/java/expo/modules/gaodemap/modules/LocationManager.kt +49 -4
  9. package/android/src/main/java/expo/modules/gaodemap/modules/SDKInitializer.kt +13 -5
  10. package/android/src/main/java/expo/modules/gaodemap/overlays/CircleView.kt +0 -6
  11. package/build/ExpoGaodeMapView.js +2 -2
  12. package/build/ExpoGaodeMapView.js.map +1 -1
  13. package/build/index.d.ts +2 -0
  14. package/build/index.d.ts.map +1 -1
  15. package/build/index.js +3 -1
  16. package/build/index.js.map +1 -1
  17. package/build/modules/AMapPermissions.d.ts +27 -0
  18. package/build/modules/AMapPermissions.d.ts.map +1 -0
  19. package/build/modules/AMapPermissions.js +31 -0
  20. package/build/modules/AMapPermissions.js.map +1 -0
  21. package/build/modules/AMapView.d.ts +7 -2
  22. package/build/modules/AMapView.d.ts.map +1 -1
  23. package/build/modules/AMapView.js +15 -3
  24. package/build/modules/AMapView.js.map +1 -1
  25. package/build/types/common.types.d.ts +1 -0
  26. package/build/types/common.types.d.ts.map +1 -1
  27. package/build/types/common.types.js +1 -0
  28. package/build/types/common.types.js.map +1 -1
  29. package/docs/API.md +5 -1
  30. package/docs/ARCHITECTURE.md +421 -0
  31. package/docs/EXAMPLES.md +166 -24
  32. package/docs/INITIALIZATION.md +335 -0
  33. package/ios/ExpoGaodeMapModule.swift +95 -9
  34. package/ios/ExpoGaodeMapView.swift +88 -6
  35. package/ios/managers/CameraManager.swift +58 -0
  36. package/ios/managers/OverlayManager.swift +105 -29
  37. package/ios/managers/UIManager.swift +73 -1
  38. package/ios/modules/LocationManager.swift +109 -3
  39. package/ios/overlays/CircleView.swift +53 -0
  40. package/ios/overlays/HeatMapView.swift +27 -0
  41. package/ios/overlays/MarkerView.swift +29 -1
  42. package/ios/overlays/PolygonView.swift +51 -0
  43. package/ios/overlays/PolylineView.swift +61 -14
  44. package/ios/utils/PermissionManager.swift +58 -0
  45. package/package.json +1 -1
  46. package/src/ExpoGaodeMapView.tsx +2 -2
  47. package/src/index.ts +9 -1
  48. package/src/modules/AMapPermissions.ts +48 -0
  49. package/src/modules/AMapView.ts +15 -3
  50. package/src/types/common.types.ts +1 -0
@@ -10,15 +10,27 @@ import expo.modules.kotlin.Promise
10
10
 
11
11
  /**
12
12
  * 定位管理器
13
+ *
14
+ * 负责:
15
+ * - 连续定位和单次定位
16
+ * - 定位配置管理
17
+ * - 坐标转换
18
+ * - 定位结果回调
13
19
  */
14
- class LocationManager(private val context: Context) {
20
+ class LocationManager(context: Context) {
15
21
  companion object {
16
22
  private const val TAG = "LocationManager"
17
23
  }
18
24
 
25
+ /** 应用上下文(避免 Activity 泄露) */
26
+ private val appContext: Context = context.applicationContext
27
+ /** 定位客户端 */
19
28
  private var locationClient: AMapLocationClient? = null
29
+ /** 定位配置选项 */
20
30
  private var locationOption: AMapLocationClientOption? = null
31
+ /** 定位是否已启动 */
21
32
  private var isLocationStarted = false
33
+ /** 定位更新回调 */
22
34
  private var onLocationUpdate: ((Map<String, Any?>) -> Unit)? = null
23
35
 
24
36
  init {
@@ -27,6 +39,7 @@ class LocationManager(private val context: Context) {
27
39
 
28
40
  /**
29
41
  * 设置定位更新回调
42
+ * @param callback 回调函数
30
43
  */
31
44
  fun setOnLocationUpdate(callback: (Map<String, Any?>) -> Unit) {
32
45
  onLocationUpdate = callback
@@ -52,12 +65,14 @@ class LocationManager(private val context: Context) {
52
65
  }
53
66
 
54
67
  /**
55
- * 是否正在定位
68
+ * 检查是否正在定位
69
+ * @return 是否正在定位
56
70
  */
57
71
  fun isStarted(): Boolean = isLocationStarted
58
72
 
59
73
  /**
60
74
  * 获取当前位置(单次定位)
75
+ * @param promise Promise 对象用于返回结果
61
76
  */
62
77
  fun getCurrentLocation(promise: Promise) {
63
78
  val onceOption = AMapLocationClientOption().apply {
@@ -69,7 +84,7 @@ class LocationManager(private val context: Context) {
69
84
  }
70
85
  }
71
86
 
72
- val tempClient = AMapLocationClient(context)
87
+ val tempClient = AMapLocationClient(appContext)
73
88
  tempClient.setLocationOption(onceOption)
74
89
  tempClient.setLocationListener { location ->
75
90
  if (location != null && location.errorCode == 0) {
@@ -85,6 +100,9 @@ class LocationManager(private val context: Context) {
85
100
 
86
101
  /**
87
102
  * 坐标转换
103
+ * @param coordinate 原始坐标
104
+ * @param type 坐标类型
105
+ * @param promise Promise 对象用于返回结果
88
106
  */
89
107
  fun coordinateConvert(
90
108
  coordinate: Map<String, Double>,
@@ -110,11 +128,13 @@ class LocationManager(private val context: Context) {
110
128
 
111
129
  // ==================== 配置方法 ====================
112
130
 
131
+ /** 设置是否返回逆地理信息 */
113
132
  fun setLocatingWithReGeocode(isReGeocode: Boolean) {
114
133
  getOrCreateLocationOption().isNeedAddress = isReGeocode
115
134
  applyLocationOption()
116
135
  }
117
136
 
137
+ /** 设置定位模式 */
118
138
  fun setLocationMode(mode: Int) {
119
139
  val locationMode = when (mode) {
120
140
  1 -> AMapLocationClientOption.AMapLocationMode.Hight_Accuracy
@@ -126,36 +146,43 @@ class LocationManager(private val context: Context) {
126
146
  applyLocationOption()
127
147
  }
128
148
 
149
+ /** 设置定位间隔(毫秒) */
129
150
  fun setInterval(interval: Int) {
130
151
  getOrCreateLocationOption().interval = interval.toLong()
131
152
  applyLocationOption()
132
153
  }
133
154
 
155
+ /** 设置是否单次定位 */
134
156
  fun setOnceLocation(isOnceLocation: Boolean) {
135
157
  getOrCreateLocationOption().isOnceLocation = isOnceLocation
136
158
  applyLocationOption()
137
159
  }
138
160
 
161
+ /** 设置是否使用设备传感器 */
139
162
  fun setSensorEnable(sensorEnable: Boolean) {
140
163
  getOrCreateLocationOption().isSensorEnable = sensorEnable
141
164
  applyLocationOption()
142
165
  }
143
166
 
167
+ /** 设置是否允许 WIFI 扫描 */
144
168
  fun setWifiScan(wifiScan: Boolean) {
145
169
  getOrCreateLocationOption().isWifiScan = wifiScan
146
170
  applyLocationOption()
147
171
  }
148
172
 
173
+ /** 设置是否 GPS 优先 */
149
174
  fun setGpsFirst(gpsFirst: Boolean) {
150
175
  getOrCreateLocationOption().isGpsFirst = gpsFirst
151
176
  applyLocationOption()
152
177
  }
153
178
 
179
+ /** 设置是否等待 WIFI 列表刷新 */
154
180
  fun setOnceLocationLatest(onceLocationLatest: Boolean) {
155
181
  getOrCreateLocationOption().isOnceLocationLatest = onceLocationLatest
156
182
  applyLocationOption()
157
183
  }
158
184
 
185
+ /** 设置逆地理语言 */
159
186
  fun setGeoLanguage(language: String) {
160
187
  val geoLanguage = when (language) {
161
188
  "EN" -> AMapLocationClientOption.GeoLanguage.EN
@@ -166,11 +193,13 @@ class LocationManager(private val context: Context) {
166
193
  applyLocationOption()
167
194
  }
168
195
 
196
+ /** 设置是否使用缓存策略 */
169
197
  fun setLocationCacheEnable(locationCacheEnable: Boolean) {
170
198
  getOrCreateLocationOption().isLocationCacheEnable = locationCacheEnable
171
199
  applyLocationOption()
172
200
  }
173
201
 
202
+ /** 设置网络请求超时时间(毫秒) */
174
203
  fun setHttpTimeOut(httpTimeOut: Int) {
175
204
  getOrCreateLocationOption().httpTimeOut = httpTimeOut.toLong()
176
205
  applyLocationOption()
@@ -180,6 +209,7 @@ class LocationManager(private val context: Context) {
180
209
  * 销毁资源
181
210
  */
182
211
  fun destroy() {
212
+ onLocationUpdate = null
183
213
  locationClient?.stopLocation()
184
214
  locationClient?.onDestroy()
185
215
  locationClient = null
@@ -188,9 +218,12 @@ class LocationManager(private val context: Context) {
188
218
 
189
219
  // ==================== 私有方法 ====================
190
220
 
221
+ /**
222
+ * 初始化定位客户端
223
+ */
191
224
  private fun initLocationClient() {
192
225
  if (locationClient == null) {
193
- locationClient = AMapLocationClient(context).apply {
226
+ locationClient = AMapLocationClient(appContext).apply {
194
227
  setLocationListener { location ->
195
228
  if (location != null && location.errorCode == 0) {
196
229
  onLocationUpdate?.invoke(formatLocation(location))
@@ -208,6 +241,10 @@ class LocationManager(private val context: Context) {
208
241
  }
209
242
  }
210
243
 
244
+ /**
245
+ * 获取或创建定位配置选项
246
+ * @return 定位配置选项
247
+ */
211
248
  private fun getOrCreateLocationOption(): AMapLocationClientOption {
212
249
  if (locationOption == null) {
213
250
  locationOption = AMapLocationClientOption()
@@ -215,10 +252,18 @@ class LocationManager(private val context: Context) {
215
252
  return locationOption!!
216
253
  }
217
254
 
255
+ /**
256
+ * 应用定位配置
257
+ */
218
258
  private fun applyLocationOption() {
219
259
  locationClient?.setLocationOption(locationOption)
220
260
  }
221
261
 
262
+ /**
263
+ * 格式化定位结果
264
+ * @param location 定位对象
265
+ * @return 格式化后的定位信息
266
+ */
222
267
  private fun formatLocation(location: AMapLocation): Map<String, Any?> {
223
268
  return mapOf(
224
269
  "latitude" to location.latitude,
@@ -7,28 +7,34 @@ import com.amap.api.maps.MapsInitializer
7
7
 
8
8
  /**
9
9
  * SDK 初始化管理器
10
+ *
11
+ * 负责:
12
+ * - 初始化高德地图 SDK
13
+ * - 初始化高德定位 SDK
14
+ * - 设置隐私合规
15
+ * - 获取 SDK 版本信息
10
16
  */
11
17
  object SDKInitializer {
12
18
  private const val TAG = "SDKInitializer"
13
19
 
14
20
  /**
15
21
  * 初始化高德地图和定位 SDK
22
+ *
23
+ * @param context 应用上下文
24
+ * @param androidKey Android 平台的 API Key
25
+ * @throws Exception 初始化失败时抛出异常
16
26
  */
17
27
  fun initSDK(context: Context, androidKey: String) {
18
28
  try {
19
- Log.d(TAG, "开始初始化 SDK...")
20
-
21
29
  // 更新地图隐私合规
22
30
  MapsInitializer.updatePrivacyShow(context, true, true)
23
31
  MapsInitializer.updatePrivacyAgree(context, true)
24
32
  MapsInitializer.setApiKey(androidKey)
25
- Log.d(TAG, "地图 SDK 初始化完成")
26
33
 
27
34
  // 更新定位隐私合规
28
35
  AMapLocationClient.updatePrivacyShow(context, true, true)
29
36
  AMapLocationClient.updatePrivacyAgree(context, true)
30
37
  AMapLocationClient.setApiKey(androidKey)
31
- Log.d(TAG, "定位 SDK 初始化完成")
32
38
 
33
39
  } catch (e: Exception) {
34
40
  Log.e(TAG, "SDK 初始化失败", e)
@@ -37,7 +43,9 @@ object SDKInitializer {
37
43
  }
38
44
 
39
45
  /**
40
- * 获取 SDK 版本
46
+ * 获取 SDK 版本号
47
+ *
48
+ * @return SDK 版本字符串
41
49
  */
42
50
  fun getVersion(): String {
43
51
  return MapsInitializer.getVersion()
@@ -25,7 +25,6 @@ class CircleView(context: Context, appContext: AppContext) : ExpoView(context, a
25
25
  */
26
26
  @Suppress("unused")
27
27
  fun setMap(map: AMap) {
28
- android.util.Log.d("CircleView", "setMap 被调用")
29
28
  aMap = map
30
29
  // 不立即创建,等 props 设置完成后再创建
31
30
  }
@@ -56,10 +55,8 @@ class CircleView(context: Context, appContext: AppContext) : ExpoView(context, a
56
55
  * 设置半径
57
56
  */
58
57
  fun setRadius(radiusValue: Double) {
59
- android.util.Log.d("CircleView", "setRadius 被调用: $radiusValue")
60
58
  radius = radiusValue
61
59
  circle?.let {
62
- android.util.Log.d("CircleView", "更新现有圆形的半径")
63
60
  it.radius = radius
64
61
  }
65
62
  // 半径可以后续更新,不需要在这里创建圆形
@@ -69,7 +66,6 @@ class CircleView(context: Context, appContext: AppContext) : ExpoView(context, a
69
66
  * 设置填充颜色
70
67
  */
71
68
  fun setFillColor(color: Int) {
72
- android.util.Log.d("CircleView", "setFillColor 被调用: ${Integer.toHexString(color)}")
73
69
  circle?.let {
74
70
  it.fillColor = color
75
71
  }
@@ -79,7 +75,6 @@ class CircleView(context: Context, appContext: AppContext) : ExpoView(context, a
79
75
  * 设置边框颜色
80
76
  */
81
77
  fun setStrokeColor(color: Int) {
82
- android.util.Log.d("CircleView", "setStrokeColor 被调用: ${Integer.toHexString(color)}")
83
78
  circle?.let {
84
79
  it.strokeColor = color
85
80
  }
@@ -89,7 +84,6 @@ class CircleView(context: Context, appContext: AppContext) : ExpoView(context, a
89
84
  * 设置边框宽度
90
85
  */
91
86
  fun setStrokeWidth(width: Float) {
92
- android.util.Log.d("CircleView", "setStrokeWidth 被调用: $width")
93
87
  circle?.let {
94
88
  it.strokeWidth = width
95
89
  }
@@ -2,7 +2,7 @@
2
2
  * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
3
  * @Date : 2025-11-13 14:03:56
4
4
  * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
- * @LastEditTime : 2025-11-13 19:35:20
5
+ * @LastEditTime : 2025-11-15 01:50:18
6
6
  * @FilePath : /expo-gaode-map/src/ExpoGaodeMapView.tsx
7
7
  * @Description : 高德地图视图组件
8
8
  *
@@ -41,7 +41,7 @@ const ExpoGaodeMapView = React.forwardRef((props, ref) => {
41
41
  const nativeRef = React.useRef(null);
42
42
  const internalRef = React.useRef(null);
43
43
  const apiRef = React.useMemo(() => ({
44
- moveCamera: async (position, duration = 0) => {
44
+ moveCamera: async (position, duration = 300) => {
45
45
  if (!nativeRef.current)
46
46
  throw new Error('MapView not initialized');
47
47
  return nativeRef.current.moveCamera(position, duration);
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoGaodeMapView.js","sourceRoot":"","sources":["../src/ExpoGaodeMapView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,MAAM,UAAU,GAA8E,wBAAwB,CAAC,cAAc,CAAC,CAAC;AAEvI,4B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,gBAAgB,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 14:03:56\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 19:35:20\n * @FilePath : /expo-gaode-map/src/ExpoGaodeMapView.tsx\n * @Description : 高德地图视图组件\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\n\nimport type { \n MapViewProps, \n MapViewRef,\n NativeMapViewRef,\n CameraPosition, \n LatLng, \n Point, \n CircleProps,\n MarkerProps,\n PolylineProps,\n PolygonProps,\n} from './types';\n\n// 重新导出 MapViewRef 供外部使用\nexport type { MapViewRef } from './types';\n\nconst NativeView: React.ComponentType<MapViewProps & { ref?: React.Ref<NativeMapViewRef> }> = requireNativeViewManager('ExpoGaodeMap');\n\n// 创建 Context 用于子组件访问 MapRef\nexport const MapContext = React.createContext<React.RefObject<MapViewRef | null> | null>(null);\n\n/**\n * 高德地图视图组件\n * \n * @example\n * ```tsx\n * import { MapView } from 'expo-gaode-map';\n * \n * function MyMap() {\n * const mapRef = React.useRef(null);\n * \n * return (\n * <MapView\n * ref={mapRef}\n * style={{ flex: 1 }}\n * initialCameraPosition={{\n * target: { latitude: 39.9, longitude: 116.4 },\n * zoom: 10,\n * }}\n * onLoad={() => console.log('地图加载完成')}\n * />\n * );\n * }\n * ```\n */\nconst ExpoGaodeMapView = React.forwardRef<MapViewRef, MapViewProps>((props, ref) => {\n const nativeRef = React.useRef<NativeMapViewRef>(null);\n const internalRef = React.useRef<MapViewRef | null>(null);\n\n const apiRef: MapViewRef = React.useMemo(() => ({\n moveCamera: async (position: CameraPosition, duration: number = 0) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.moveCamera(position, duration);\n },\n getLatLng: async (point: Point) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.getLatLng(point);\n },\n setCenter: async (center: LatLng, animated: boolean = false) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.setCenter(center, animated);\n },\n setZoom: async (zoom: number, animated: boolean = false) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.setZoom(zoom, animated);\n },\n getCameraPosition: async () => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.getCameraPosition();\n },\n addCircle: async (id: string, props: CircleProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addCircle(id, props);\n },\n removeCircle: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removeCircle(id);\n },\n updateCircle: async (id: string, props: Partial<CircleProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updateCircle(id, props);\n },\n addMarker: async (id: string, props: MarkerProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addMarker(id, props);\n },\n removeMarker: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removeMarker(id);\n },\n updateMarker: async (id: string, props: Partial<MarkerProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updateMarker(id, props);\n },\n addPolyline: async (id: string, props: PolylineProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addPolyline(id, props);\n },\n removePolyline: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removePolyline(id);\n },\n updatePolyline: async (id: string, props: Partial<PolylineProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updatePolyline(id, props);\n },\n addPolygon: async (id: string, props: PolygonProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addPolygon(id, props);\n },\n removePolygon: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removePolygon(id);\n },\n updatePolygon: async (id: string, props: Partial<PolygonProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updatePolygon(id, props);\n },\n }), []);\n\n // 设置 internalRef 和外部 ref\n React.useEffect(() => {\n internalRef.current = apiRef;\n }, [apiRef]);\n\n React.useImperativeHandle(ref, () => apiRef, [apiRef]);\n\n return (\n <MapContext.Provider value={internalRef}>\n <NativeView ref={nativeRef} {...props} />\n </MapContext.Provider>\n );\n});\n\nExpoGaodeMapView.displayName = 'ExpoGaodeMapView';\n\nexport default ExpoGaodeMapView;\n"]}
1
+ {"version":3,"file":"ExpoGaodeMapView.js","sourceRoot":"","sources":["../src/ExpoGaodeMapView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,MAAM,UAAU,GAA8E,wBAAwB,CAAC,cAAc,CAAC,CAAC;AAEvI,4BAA4B;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,CAA4C,IAAI,CAAC,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CAA2B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACjF,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IAE1D,MAAM,MAAM,GAAe,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC9C,UAAU,EAAE,KAAK,EAAE,QAAwB,EAAE,WAAmB,GAAG,EAAE,EAAE;YACrE,IAAI,CAAC,SAAS,CAAC,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YACnE,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AAC,aAAa,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;KACF,CAAC,EAAE,EAAE,CAAC,CAAC;IAER,yBAAyB;IACzB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,WAAW,CAAC,OAAO,GAAG,MAAM,CAAC;IAC/B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvD,OAAO,CACL,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CACtC;MAAA,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,CAAC,EACxC;IAAA,EAAE,UAAU,CAAC,QAAQ,CAAC,CACvB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAElD,eAAe,gBAAgB,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 14:03:56\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-15 01:50:18\n * @FilePath : /expo-gaode-map/src/ExpoGaodeMapView.tsx\n * @Description : 高德地图视图组件\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\n\nimport type { \n MapViewProps, \n MapViewRef,\n NativeMapViewRef,\n CameraPosition, \n LatLng, \n Point, \n CircleProps,\n MarkerProps,\n PolylineProps,\n PolygonProps,\n} from './types';\n\n// 重新导出 MapViewRef 供外部使用\nexport type { MapViewRef } from './types';\n\nconst NativeView: React.ComponentType<MapViewProps & { ref?: React.Ref<NativeMapViewRef> }> = requireNativeViewManager('ExpoGaodeMap');\n\n// 创建 Context 用于子组件访问 MapRef\nexport const MapContext = React.createContext<React.RefObject<MapViewRef | null> | null>(null);\n\n/**\n * 高德地图视图组件\n * \n * @example\n * ```tsx\n * import { MapView } from 'expo-gaode-map';\n * \n * function MyMap() {\n * const mapRef = React.useRef(null);\n * \n * return (\n * <MapView\n * ref={mapRef}\n * style={{ flex: 1 }}\n * initialCameraPosition={{\n * target: { latitude: 39.9, longitude: 116.4 },\n * zoom: 10,\n * }}\n * onLoad={() => console.log('地图加载完成')}\n * />\n * );\n * }\n * ```\n */\nconst ExpoGaodeMapView = React.forwardRef<MapViewRef, MapViewProps>((props, ref) => {\n const nativeRef = React.useRef<NativeMapViewRef>(null);\n const internalRef = React.useRef<MapViewRef | null>(null);\n\n const apiRef: MapViewRef = React.useMemo(() => ({\n moveCamera: async (position: CameraPosition, duration: number = 300) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.moveCamera(position, duration);\n },\n getLatLng: async (point: Point) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.getLatLng(point);\n },\n setCenter: async (center: LatLng, animated: boolean = false) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.setCenter(center, animated);\n },\n setZoom: async (zoom: number, animated: boolean = false) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.setZoom(zoom, animated);\n },\n getCameraPosition: async () => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.getCameraPosition();\n },\n addCircle: async (id: string, props: CircleProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addCircle(id, props);\n },\n removeCircle: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removeCircle(id);\n },\n updateCircle: async (id: string, props: Partial<CircleProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updateCircle(id, props);\n },\n addMarker: async (id: string, props: MarkerProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addMarker(id, props);\n },\n removeMarker: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removeMarker(id);\n },\n updateMarker: async (id: string, props: Partial<MarkerProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updateMarker(id, props);\n },\n addPolyline: async (id: string, props: PolylineProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addPolyline(id, props);\n },\n removePolyline: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removePolyline(id);\n },\n updatePolyline: async (id: string, props: Partial<PolylineProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updatePolyline(id, props);\n },\n addPolygon: async (id: string, props: PolygonProps) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.addPolygon(id, props);\n },\n removePolygon: async (id: string) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.removePolygon(id);\n },\n updatePolygon: async (id: string, props: Partial<PolygonProps>) => {\n if (!nativeRef.current) throw new Error('MapView not initialized');\n return nativeRef.current.updatePolygon(id, props);\n },\n }), []);\n\n // 设置 internalRef 和外部 ref\n React.useEffect(() => {\n internalRef.current = apiRef;\n }, [apiRef]);\n\n React.useImperativeHandle(ref, () => apiRef, [apiRef]);\n\n return (\n <MapContext.Provider value={internalRef}>\n <NativeView ref={nativeRef} {...props} />\n </MapContext.Provider>\n );\n});\n\nExpoGaodeMapView.displayName = 'ExpoGaodeMapView';\n\nexport default ExpoGaodeMapView;\n"]}
package/build/index.d.ts CHANGED
@@ -3,6 +3,8 @@ export * from './types';
3
3
  export { default as ExpoGaodeMapModule } from './ExpoGaodeMapModule';
4
4
  export { default as AMapSDK, initSDK, getVersion } from './modules/AMapSDK';
5
5
  export { default as AMapLocation, configure, start, stop, isStarted, getCurrentLocation, addLocationListener, coordinateConvert, startUpdatingHeading, stopUpdatingHeading, } from './modules/AMapLocation';
6
+ export { default as AMapPermissions, checkLocationPermission, requestLocationPermission, } from './modules/AMapPermissions';
7
+ export type { PermissionStatus } from './modules/AMapPermissions';
6
8
  export { default as MapView } from './ExpoGaodeMapView';
7
9
  export type { MapViewRef } from './ExpoGaodeMapView';
8
10
  export { Marker, Polyline, Polygon, Circle, HeatMap, MultiPoint, Cluster, } from './components/overlays';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG5E,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,OAAO,GACR,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG5E,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAMlE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,OAAO,GACR,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
package/build/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
3
  * @Date : 2025-11-13 14:45:15
4
4
  * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
- * @LastEditTime : 2025-11-14 16:15:52
5
+ * @LastEditTime : 2025-11-15 02:21:17
6
6
  * @FilePath : /expo-gaode-map/src/index.ts
7
7
  * @Description : 高德地图 Expo Module 主导出文件
8
8
  *
@@ -17,6 +17,8 @@ export { default as ExpoGaodeMapModule } from './ExpoGaodeMapModule';
17
17
  export { default as AMapSDK, initSDK, getVersion } from './modules/AMapSDK';
18
18
  // 导出定位模块
19
19
  export { default as AMapLocation, configure, start, stop, isStarted, getCurrentLocation, addLocationListener, coordinateConvert, startUpdatingHeading, stopUpdatingHeading, } from './modules/AMapLocation';
20
+ // 导出权限管理模块
21
+ export { default as AMapPermissions, checkLocationPermission, requestLocationPermission, } from './modules/AMapPermissions';
20
22
  // 地图视图控制已移至 MapView 的 ref 调用
21
23
  // 使用方式: const mapRef = useRef<MapViewRef>(null); mapRef.current.moveCamera() 等
22
24
  // 导出地图视图组件
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,SAAS;AACT,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AAExB,SAAS;AACT,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAErE,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE5E,SAAS;AACT,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,6BAA6B;AAC7B,+EAA+E;AAE/E,WAAW;AACX,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGxD,UAAU;AACV,OAAO,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,OAAO,GACR,MAAM,uBAAuB,CAAC;AAE/B,kBAAkB;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 14:45:15\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-14 16:15:52\n * @FilePath : /expo-gaode-map/src/index.ts\n * @Description : 高德地图 Expo Module 主导出文件\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\n// 导出类型定义\nexport * from './ExpoGaodeMap.types';\nexport * from './types';\n\n// 导出原生模块\nexport { default as ExpoGaodeMapModule } from './ExpoGaodeMapModule';\n\n// 导出 SDK 模块\nexport { default as AMapSDK, initSDK, getVersion } from './modules/AMapSDK';\n\n// 导出定位模块\nexport {\n default as AMapLocation,\n configure,\n start,\n stop,\n isStarted,\n getCurrentLocation,\n addLocationListener,\n coordinateConvert,\n startUpdatingHeading,\n stopUpdatingHeading,\n} from './modules/AMapLocation';\n\n// 地图视图控制已移至 MapView 的 ref 调用\n// 使用方式: const mapRef = useRef<MapViewRef>(null); mapRef.current.moveCamera() 等\n\n// 导出地图视图组件\nexport { default as MapView } from './ExpoGaodeMapView';\nexport type { MapViewRef } from './ExpoGaodeMapView';\n\n// 导出覆盖物组件\nexport {\n Marker,\n Polyline,\n Polygon,\n Circle,\n HeatMap,\n MultiPoint,\n Cluster,\n} from './components/overlays';\n\n// 默认导出:直接重新导出所有模块\nexport { default } from './ExpoGaodeMapModule';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,SAAS;AACT,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AAExB,SAAS;AACT,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAErE,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE5E,SAAS;AACT,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,WAAW;AACX,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAGnC,6BAA6B;AAC7B,+EAA+E;AAE/E,WAAW;AACX,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGxD,UAAU;AACV,OAAO,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,OAAO,GACR,MAAM,uBAAuB,CAAC;AAE/B,kBAAkB;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 14:45:15\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-15 02:21:17\n * @FilePath : /expo-gaode-map/src/index.ts\n * @Description : 高德地图 Expo Module 主导出文件\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\n// 导出类型定义\nexport * from './ExpoGaodeMap.types';\nexport * from './types';\n\n// 导出原生模块\nexport { default as ExpoGaodeMapModule } from './ExpoGaodeMapModule';\n\n// 导出 SDK 模块\nexport { default as AMapSDK, initSDK, getVersion } from './modules/AMapSDK';\n\n// 导出定位模块\nexport {\n default as AMapLocation,\n configure,\n start,\n stop,\n isStarted,\n getCurrentLocation,\n addLocationListener,\n coordinateConvert,\n startUpdatingHeading,\n stopUpdatingHeading,\n} from './modules/AMapLocation';\n\n// 导出权限管理模块\nexport {\n default as AMapPermissions,\n checkLocationPermission,\n requestLocationPermission,\n} from './modules/AMapPermissions';\nexport type { PermissionStatus } from './modules/AMapPermissions';\n\n// 地图视图控制已移至 MapView 的 ref 调用\n// 使用方式: const mapRef = useRef<MapViewRef>(null); mapRef.current.moveCamera() 等\n\n// 导出地图视图组件\nexport { default as MapView } from './ExpoGaodeMapView';\nexport type { MapViewRef } from './ExpoGaodeMapView';\n\n// 导出覆盖物组件\nexport {\n Marker,\n Polyline,\n Polygon,\n Circle,\n HeatMap,\n MultiPoint,\n Cluster,\n} from './components/overlays';\n\n// 默认导出:直接重新导出所有模块\nexport { default } from './ExpoGaodeMapModule';\n"]}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 权限状态
3
+ */
4
+ export interface PermissionStatus {
5
+ /** 是否已授权 */
6
+ granted: boolean;
7
+ /** iOS 权限状态字符串 */
8
+ status?: 'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'unknown';
9
+ /** Android 精确位置权限 */
10
+ fineLocation?: boolean;
11
+ /** Android 粗略位置权限 */
12
+ coarseLocation?: boolean;
13
+ }
14
+ /**
15
+ * 检查位置权限状态
16
+ */
17
+ export declare function checkLocationPermission(): Promise<PermissionStatus>;
18
+ /**
19
+ * 请求位置权限
20
+ */
21
+ export declare function requestLocationPermission(): Promise<PermissionStatus>;
22
+ declare const _default: {
23
+ checkLocationPermission: typeof checkLocationPermission;
24
+ requestLocationPermission: typeof requestLocationPermission;
25
+ };
26
+ export default _default;
27
+ //# sourceMappingURL=AMapPermissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AMapPermissions.d.ts","sourceRoot":"","sources":["../../src/modules/AMapPermissions.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB;IAClB,MAAM,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,QAAQ,GAAG,kBAAkB,GAAG,qBAAqB,GAAG,SAAS,CAAC;IAC5G,qBAAqB;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAEzE;AAED;;GAEG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAE3E;;;;;AAED,wBAGE"}
@@ -0,0 +1,31 @@
1
+ /*
2
+ * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
+ * @Date : 2025-11-15 02:20:56
4
+ * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
+ * @LastEditTime : 2025-11-15 02:20:58
6
+ * @FilePath : /expo-gaode-map/src/modules/AMapPermissions.ts
7
+ * @Description :
8
+ *
9
+ * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
+ */
11
+ /*
12
+ * 高德地图权限管理模块
13
+ */
14
+ import ExpoGaodeMapModule from '../ExpoGaodeMapModule';
15
+ /**
16
+ * 检查位置权限状态
17
+ */
18
+ export async function checkLocationPermission() {
19
+ return await ExpoGaodeMapModule.checkLocationPermission();
20
+ }
21
+ /**
22
+ * 请求位置权限
23
+ */
24
+ export async function requestLocationPermission() {
25
+ return await ExpoGaodeMapModule.requestLocationPermission();
26
+ }
27
+ export default {
28
+ checkLocationPermission,
29
+ requestLocationPermission,
30
+ };
31
+ //# sourceMappingURL=AMapPermissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AMapPermissions.js","sourceRoot":"","sources":["../../src/modules/AMapPermissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH;;GAEG;AAEH,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAgBvD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,OAAO,MAAM,kBAAkB,CAAC,uBAAuB,EAAE,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,OAAO,MAAM,kBAAkB,CAAC,yBAAyB,EAAE,CAAC;AAC9D,CAAC;AAED,eAAe;IACb,uBAAuB;IACvB,yBAAyB;CAC1B,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-15 02:20:56\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-15 02:20:58\n * @FilePath : /expo-gaode-map/src/modules/AMapPermissions.ts\n * @Description : \n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n/*\n * 高德地图权限管理模块\n */\n\nimport ExpoGaodeMapModule from '../ExpoGaodeMapModule';\n\n/**\n * 权限状态\n */\nexport interface PermissionStatus {\n /** 是否已授权 */\n granted: boolean;\n /** iOS 权限状态字符串 */\n status?: 'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'unknown';\n /** Android 精确位置权限 */\n fineLocation?: boolean;\n /** Android 粗略位置权限 */\n coarseLocation?: boolean;\n}\n\n/**\n * 检查位置权限状态\n */\nexport async function checkLocationPermission(): Promise<PermissionStatus> {\n return await ExpoGaodeMapModule.checkLocationPermission();\n}\n\n/**\n * 请求位置权限\n */\nexport async function requestLocationPermission(): Promise<PermissionStatus> {\n return await ExpoGaodeMapModule.requestLocationPermission();\n}\n\nexport default {\n checkLocationPermission,\n requestLocationPermission,\n};"]}
@@ -1,30 +1,35 @@
1
1
  import type { CameraPosition, Point, LatLng } from '../types';
2
2
  /**
3
3
  * 移动地图相机到指定位置
4
+ * @deprecated 不推荐使用,请使用 MapView ref 的 moveCamera 方法
4
5
  * @param cameraPosition 相机位置参数
5
- * @param duration 动画时长(毫秒),默认为0(无动画)
6
+ * @param duration 动画时长(毫秒),默认为0(无动画)
6
7
  */
7
8
  export declare function moveCamera(cameraPosition: CameraPosition, duration?: number): void;
8
9
  /**
9
10
  * 将屏幕坐标转换为地理坐标
11
+ * @deprecated 不推荐使用,请使用 MapView ref 的 getLatLng 方法
10
12
  * @param point 屏幕坐标点
11
13
  * @returns 地理坐标
12
14
  */
13
15
  export declare function getLatLng(point: Point): Promise<LatLng>;
14
16
  /**
15
17
  * 设置地图中心点
18
+ * @deprecated 不推荐使用,请使用 MapView ref 的 setCenter 方法
16
19
  * @param center 中心点坐标
17
20
  * @param animated 是否使用动画
18
21
  */
19
22
  export declare function setCenter(center: LatLng, animated?: boolean): void;
20
23
  /**
21
24
  * 设置地图缩放级别
22
- * @param zoom 缩放级别(3-20)
25
+ * @deprecated 不推荐使用,请使用 MapView ref 的 setZoom 方法
26
+ * @param zoom 缩放级别(3-20)
23
27
  * @param animated 是否使用动画
24
28
  */
25
29
  export declare function setZoom(zoom: number, animated?: boolean): void;
26
30
  /**
27
31
  * 获取当前地图状态
32
+ * @deprecated 不推荐使用,请使用 MapView ref 的 getCameraPosition 方法
28
33
  * @returns 当前相机位置
29
34
  */
30
35
  export declare function getCameraPosition(): Promise<CameraPosition>;
@@ -1 +1 @@
1
- {"version":3,"file":"AMapView.d.ts","sourceRoot":"","sources":["../../src/modules/AMapView.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,QAAQ,SAAI,GAAG,IAAI,CAE7E;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,IAAI,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,IAAI,CAE3D;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC,CAKjE;;;;;;;;AAED,wBAME"}
1
+ {"version":3,"file":"AMapView.d.ts","sourceRoot":"","sources":["../../src/modules/AMapView.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,QAAQ,SAAI,GAAG,IAAI,CAE7E;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,IAAI,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,UAAO,GAAG,IAAI,CAE3D;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC,CAKjE;;;;;;;;AAED,wBAME"}
@@ -2,23 +2,32 @@
2
2
  * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com
3
3
  * @Date : 2025-11-13 14:57:30
4
4
  * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com
5
- * @LastEditTime : 2025-11-13 14:57:35
5
+ * @LastEditTime : 2025-11-14 19:38:00
6
6
  * @FilePath : /expo-gaode-map/src/modules/AMapView.ts
7
7
  * @Description : 高德地图视图控制模块
8
8
  *
9
+ * ⚠️ 警告: 此模块中的方法已不推荐使用
10
+ * 请使用 MapView 的 ref 方式调用这些方法
11
+ *
12
+ * 示例:
13
+ * const mapRef = useRef<MapViewRef>(null);
14
+ * mapRef.current?.moveCamera({ target: { latitude: 39.9, longitude: 116.4 }, zoom: 10 });
15
+ *
9
16
  * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved.
10
17
  */
11
18
  import ExpoGaodeMapModule from '../ExpoGaodeMapModule';
12
19
  /**
13
20
  * 移动地图相机到指定位置
21
+ * @deprecated 不推荐使用,请使用 MapView ref 的 moveCamera 方法
14
22
  * @param cameraPosition 相机位置参数
15
- * @param duration 动画时长(毫秒),默认为0(无动画)
23
+ * @param duration 动画时长(毫秒),默认为0(无动画)
16
24
  */
17
25
  export function moveCamera(cameraPosition, duration = 0) {
18
26
  ExpoGaodeMapModule.moveCamera?.(cameraPosition, duration);
19
27
  }
20
28
  /**
21
29
  * 将屏幕坐标转换为地理坐标
30
+ * @deprecated 不推荐使用,请使用 MapView ref 的 getLatLng 方法
22
31
  * @param point 屏幕坐标点
23
32
  * @returns 地理坐标
24
33
  */
@@ -27,6 +36,7 @@ export async function getLatLng(point) {
27
36
  }
28
37
  /**
29
38
  * 设置地图中心点
39
+ * @deprecated 不推荐使用,请使用 MapView ref 的 setCenter 方法
30
40
  * @param center 中心点坐标
31
41
  * @param animated 是否使用动画
32
42
  */
@@ -35,7 +45,8 @@ export function setCenter(center, animated = true) {
35
45
  }
36
46
  /**
37
47
  * 设置地图缩放级别
38
- * @param zoom 缩放级别(3-20)
48
+ * @deprecated 不推荐使用,请使用 MapView ref 的 setZoom 方法
49
+ * @param zoom 缩放级别(3-20)
39
50
  * @param animated 是否使用动画
40
51
  */
41
52
  export function setZoom(zoom, animated = true) {
@@ -43,6 +54,7 @@ export function setZoom(zoom, animated = true) {
43
54
  }
44
55
  /**
45
56
  * 获取当前地图状态
57
+ * @deprecated 不推荐使用,请使用 MapView ref 的 getCameraPosition 方法
46
58
  * @returns 当前相机位置
47
59
  */
48
60
  export async function getCameraPosition() {
@@ -1 +1 @@
1
- {"version":3,"file":"AMapView.js","sourceRoot":"","sources":["../../src/modules/AMapView.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAGvD;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,cAA8B,EAAE,QAAQ,GAAG,CAAC;IACrE,kBAAkB,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAY;IAC1C,OAAO,kBAAkB,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;AACjG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc,EAAE,QAAQ,GAAG,IAAI;IACvD,kBAAkB,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,QAAQ,GAAG,IAAI;IACnD,kBAAkB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,kBAAkB,CAAC,iBAAiB,EAAE,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC;QACjE,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;QACrC,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;AACL,CAAC;AAED,eAAe;IACb,UAAU;IACV,SAAS;IACT,SAAS;IACT,OAAO;IACP,iBAAiB;CAClB,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 14:57:30\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-13 14:57:35\n * @FilePath : /expo-gaode-map/src/modules/AMapView.ts\n * @Description : 高德地图视图控制模块\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport ExpoGaodeMapModule from '../ExpoGaodeMapModule';\nimport type { CameraPosition, Point, LatLng } from '../types';\n\n/**\n * 移动地图相机到指定位置\n * @param cameraPosition 相机位置参数\n * @param duration 动画时长(毫秒),默认为0(无动画)\n */\nexport function moveCamera(cameraPosition: CameraPosition, duration = 0): void {\n ExpoGaodeMapModule.moveCamera?.(cameraPosition, duration);\n}\n\n/**\n * 将屏幕坐标转换为地理坐标\n * @param point 屏幕坐标点\n * @returns 地理坐标\n */\nexport async function getLatLng(point: Point): Promise<LatLng> {\n return ExpoGaodeMapModule.getLatLng?.(point) || Promise.resolve({ latitude: 0, longitude: 0 });\n}\n\n/**\n * 设置地图中心点\n * @param center 中心点坐标\n * @param animated 是否使用动画\n */\nexport function setCenter(center: LatLng, animated = true): void {\n ExpoGaodeMapModule.setCenter?.(center, animated);\n}\n\n/**\n * 设置地图缩放级别\n * @param zoom 缩放级别(3-20)\n * @param animated 是否使用动画\n */\nexport function setZoom(zoom: number, animated = true): void {\n ExpoGaodeMapModule.setZoom?.(zoom, animated);\n}\n\n/**\n * 获取当前地图状态\n * @returns 当前相机位置\n */\nexport async function getCameraPosition(): Promise<CameraPosition> {\n return ExpoGaodeMapModule.getCameraPosition?.() || Promise.resolve({\n target: { latitude: 0, longitude: 0 },\n zoom: 10,\n });\n}\n\nexport default {\n moveCamera,\n getLatLng,\n setCenter,\n setZoom,\n getCameraPosition,\n};\n"]}
1
+ {"version":3,"file":"AMapView.js","sourceRoot":"","sources":["../../src/modules/AMapView.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAGvD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,cAA8B,EAAE,QAAQ,GAAG,CAAC;IACrE,kBAAkB,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAY;IAC1C,OAAO,kBAAkB,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;AACjG,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc,EAAE,QAAQ,GAAG,IAAI;IACvD,kBAAkB,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,QAAQ,GAAG,IAAI;IACnD,kBAAkB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,kBAAkB,CAAC,iBAAiB,EAAE,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC;QACjE,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;QACrC,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;AACL,CAAC;AAED,eAAe;IACb,UAAU;IACV,SAAS;IACT,SAAS;IACT,OAAO;IACP,iBAAiB;CAClB,CAAC","sourcesContent":["/*\n * @Author : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @Date : 2025-11-13 14:57:30\n * @LastEditors : 尚博信_王强 wangqiang03@sunboxsoft.com\n * @LastEditTime : 2025-11-14 19:38:00\n * @FilePath : /expo-gaode-map/src/modules/AMapView.ts\n * @Description : 高德地图视图控制模块\n * \n * ⚠️ 警告: 此模块中的方法已不推荐使用\n * 请使用 MapView 的 ref 方式调用这些方法\n * \n * 示例:\n * const mapRef = useRef<MapViewRef>(null);\n * mapRef.current?.moveCamera({ target: { latitude: 39.9, longitude: 116.4 }, zoom: 10 });\n * \n * Copyright (c) 2025 by 尚博信_王强, All Rights Reserved. \n */\n\nimport ExpoGaodeMapModule from '../ExpoGaodeMapModule';\nimport type { CameraPosition, Point, LatLng } from '../types';\n\n/**\n * 移动地图相机到指定位置\n * @deprecated 不推荐使用,请使用 MapView ref 的 moveCamera 方法\n * @param cameraPosition 相机位置参数\n * @param duration 动画时长(毫秒),默认为0(无动画)\n */\nexport function moveCamera(cameraPosition: CameraPosition, duration = 0): void {\n ExpoGaodeMapModule.moveCamera?.(cameraPosition, duration);\n}\n\n/**\n * 将屏幕坐标转换为地理坐标\n * @deprecated 不推荐使用,请使用 MapView ref 的 getLatLng 方法\n * @param point 屏幕坐标点\n * @returns 地理坐标\n */\nexport async function getLatLng(point: Point): Promise<LatLng> {\n return ExpoGaodeMapModule.getLatLng?.(point) || Promise.resolve({ latitude: 0, longitude: 0 });\n}\n\n/**\n * 设置地图中心点\n * @deprecated 不推荐使用,请使用 MapView ref 的 setCenter 方法\n * @param center 中心点坐标\n * @param animated 是否使用动画\n */\nexport function setCenter(center: LatLng, animated = true): void {\n ExpoGaodeMapModule.setCenter?.(center, animated);\n}\n\n/**\n * 设置地图缩放级别\n * @deprecated 不推荐使用,请使用 MapView ref 的 setZoom 方法\n * @param zoom 缩放级别(3-20)\n * @param animated 是否使用动画\n */\nexport function setZoom(zoom: number, animated = true): void {\n ExpoGaodeMapModule.setZoom?.(zoom, animated);\n}\n\n/**\n * 获取当前地图状态\n * @deprecated 不推荐使用,请使用 MapView ref 的 getCameraPosition 方法\n * @returns 当前相机位置\n */\nexport async function getCameraPosition(): Promise<CameraPosition> {\n return ExpoGaodeMapModule.getCameraPosition?.() || Promise.resolve({\n target: { latitude: 0, longitude: 0 },\n zoom: 10,\n });\n}\n\nexport default {\n moveCamera,\n getLatLng,\n setCenter,\n setZoom,\n getCameraPosition,\n};\n"]}
@@ -95,6 +95,7 @@ export declare enum MapType {
95
95
  Navi = 3,
96
96
  /**
97
97
  * 公交地图
98
+ * @platform android
98
99
  */
99
100
  Bus = 4
100
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"common.types.d.ts","sourceRoot":"","sources":["../../src/types/common.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,oBAAY,OAAO;IACjB;;OAEG;IACH,QAAQ,IAAI;IAEZ;;OAEG;IACH,SAAS,IAAI;IAEb;;OAEG;IACH,KAAK,IAAI;IAET;;OAEG;IACH,IAAI,IAAI;IAER;;OAEG;IACH,GAAG,IAAI;CACR;AAED;;GAEG;AACH,MAAM,WAAW,QAAS,SAAQ,MAAM;IACtC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"common.types.d.ts","sourceRoot":"","sources":["../../src/types/common.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE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25
25
  MapType[MapType["Navi"] = 3] = "Navi";
26
26
  /**
27
27
  * 公交地图
28
+ * @platform android
28
29
  */
29
30
  MapType[MapType["Bus"] = 4] = "Bus";
30
31
  })(MapType || (MapType = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"common.types.js","sourceRoot":"","sources":["../../src/types/common.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqFH;;GAEG;AACH,MAAM,CAAN,IAAY,OAyBX;AAzBD,WAAY,OAAO;IACjB;;OAEG;IACH,6CAAY,CAAA;IAEZ;;OAEG;IACH,+CAAa,CAAA;IAEb;;OAEG;IACH,uCAAS,CAAA;IAET;;OAEG;IACH,qCAAQ,CAAA;IAER;;OAEG;IACH,mCAAO,CAAA;AACT,CAAC,EAzBW,OAAO,KAAP,OAAO,QAyBlB","sourcesContent":["/**\n * 高德地图通用类型定义\n * 基于 Expo Modules API\n */\n\n/**\n * 点坐标(屏幕坐标)\n */\nexport interface Point {\n x: number;\n y: number;\n}\n\n/**\n * 地理坐标\n */\nexport interface LatLng {\n /**\n * 纬度\n */\n latitude: number;\n\n /**\n * 经度\n */\n longitude: number;\n}\n\n/**\n * 地图标注点(POI)\n */\nexport interface MapPoi {\n /**\n * 标注点 ID\n */\n id: string;\n\n /**\n * 标注点名称\n */\n name: string;\n\n /**\n * 标注点坐标\n */\n position: LatLng;\n}\n\n/**\n * 矩形坐标边界\n */\nexport interface LatLngBounds {\n /**\n * 西南坐标\n */\n southwest: LatLng;\n\n /**\n * 东北坐标\n */\n northeast: LatLng;\n}\n\n/**\n * 地图相机位置\n */\nexport interface CameraPosition {\n /**\n * 中心坐标\n */\n target?: LatLng;\n\n /**\n * 缩放级别(3-20)\n */\n zoom?: number;\n\n /**\n * 朝向、旋转角度(0-360度)\n */\n bearing?: number;\n\n /**\n * 倾斜角度(0-60度)\n */\n tilt?: number;\n}\n\n/**\n * 地图类型\n */\nexport enum MapType {\n /**\n * 标准地图\n */\n Standard = 0,\n\n /**\n * 卫星地图\n */\n Satellite = 1,\n\n /**\n * 夜间地图\n */\n Night = 2,\n\n /**\n * 导航地图\n */\n Navi = 3,\n\n /**\n * 公交地图\n */\n Bus = 4,\n}\n\n/**\n * 定位信息(基础)\n */\nexport interface Location extends LatLng {\n /**\n * 精度(米)\n */\n accuracy: number;\n\n /**\n * 朝向(度)\n */\n heading: number;\n\n /**\n * 海拔(米)\n */\n altitude: number;\n\n /**\n * 运动速度(米/秒)\n */\n speed: number;\n\n /**\n * 时间戳\n */\n timestamp: number;\n}\n\n/**\n * 颜色值类型\n * 支持:\n * - 十六进制字符串: '#AARRGGBB' 或 '#RRGGBB'\n * - 数字格式: 0xAARRGGBB (用于 Android)\n */\nexport type ColorValue = string | number;\n"]}
1
+ {"version":3,"file":"common.types.js","sourceRoot":"","sources":["../../src/types/common.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqFH;;GAEG;AACH,MAAM,CAAN,IAAY,OA0BX;AA1BD,WAAY,OAAO;IACjB;;OAEG;IACH,6CAAY,CAAA;IAEZ;;OAEG;IACH,+CAAa,CAAA;IAEb;;OAEG;IACH,uCAAS,CAAA;IAET;;OAEG;IACH,qCAAQ,CAAA;IAER;;;OAGG;IACH,mCAAO,CAAA;AACT,CAAC,EA1BW,OAAO,KAAP,OAAO,QA0BlB","sourcesContent":["/**\n * 高德地图通用类型定义\n * 基于 Expo Modules API\n */\n\n/**\n * 点坐标(屏幕坐标)\n */\nexport interface Point {\n x: number;\n y: number;\n}\n\n/**\n * 地理坐标\n */\nexport interface LatLng {\n /**\n * 纬度\n */\n latitude: number;\n\n /**\n * 经度\n */\n longitude: number;\n}\n\n/**\n * 地图标注点(POI)\n */\nexport interface MapPoi {\n /**\n * 标注点 ID\n */\n id: string;\n\n /**\n * 标注点名称\n */\n name: string;\n\n /**\n * 标注点坐标\n */\n position: LatLng;\n}\n\n/**\n * 矩形坐标边界\n */\nexport interface LatLngBounds {\n /**\n * 西南坐标\n */\n southwest: LatLng;\n\n /**\n * 东北坐标\n */\n northeast: LatLng;\n}\n\n/**\n * 地图相机位置\n */\nexport interface CameraPosition {\n /**\n * 中心坐标\n */\n target?: LatLng;\n\n /**\n * 缩放级别(3-20)\n */\n zoom?: number;\n\n /**\n * 朝向、旋转角度(0-360度)\n */\n bearing?: number;\n\n /**\n * 倾斜角度(0-60度)\n */\n tilt?: number;\n}\n\n/**\n * 地图类型\n */\nexport enum MapType {\n /**\n * 标准地图\n */\n Standard = 0,\n\n /**\n * 卫星地图\n */\n Satellite = 1,\n\n /**\n * 夜间地图\n */\n Night = 2,\n\n /**\n * 导航地图\n */\n Navi = 3,\n\n /**\n * 公交地图\n * @platform android\n */\n Bus = 4,\n}\n\n/**\n * 定位信息(基础)\n */\nexport interface Location extends LatLng {\n /**\n * 精度(米)\n */\n accuracy: number;\n\n /**\n * 朝向(度)\n */\n heading: number;\n\n /**\n * 海拔(米)\n */\n altitude: number;\n\n /**\n * 运动速度(米/秒)\n */\n speed: number;\n\n /**\n * 时间戳\n */\n timestamp: number;\n}\n\n/**\n * 颜色值类型\n * 支持:\n * - 十六进制字符串: '#AARRGGBB' 或 '#RRGGBB'\n * - 数字格式: 0xAARRGGBB (用于 Android)\n */\nexport type ColorValue = string | number;\n"]}