expo-gaode-map-navigation 1.1.5-next.1 → 1.1.5-next.3
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/android/build.gradle +10 -0
- package/android/src/main/cpp/CMakeLists.txt +24 -0
- package/android/src/main/cpp/cluster_jni.cpp +848 -0
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapModule.kt +616 -92
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapOfflineModule.kt +493 -0
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapView.kt +230 -14
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapViewModule.kt +37 -27
- package/android/src/main/java/expo/modules/gaodemap/map/MapPreloadManager.kt +494 -0
- package/android/src/main/java/expo/modules/gaodemap/map/companion/BitmapDescriptorCache.kt +30 -0
- package/android/src/main/java/expo/modules/gaodemap/map/companion/IconBitmapCache.kt +37 -0
- package/android/src/main/java/expo/modules/gaodemap/map/managers/UIManager.kt +76 -0
- package/android/src/main/java/expo/modules/gaodemap/map/modules/LocationManager.kt +15 -3
- package/android/src/main/java/expo/modules/gaodemap/map/modules/SDKInitializer.kt +4 -59
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/CircleView.kt +9 -12
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/CircleViewModule.kt +5 -6
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/ClusterView.kt +539 -66
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/ClusterViewModule.kt +17 -1
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapView.kt +165 -33
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapViewModule.kt +15 -3
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerView.kt +1249 -672
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerViewModule.kt +40 -17
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MultiPointView.kt +177 -22
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MultiPointViewModule.kt +11 -3
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolygonView.kt +57 -14
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolygonViewModule.kt +9 -5
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolylineView.kt +90 -63
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolylineViewModule.kt +7 -3
- package/android/src/main/java/expo/modules/gaodemap/map/services/LocationForegroundService.kt +3 -2
- package/android/src/main/java/expo/modules/gaodemap/map/utils/BitmapDescriptorCache.kt +20 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/ClusterNative.kt +13 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/ColorParser.kt +20 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/GeometryUtils.kt +515 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/LatLngParser.kt +91 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/PermissionHelper.kt +248 -0
- package/build/ExpoGaodeMapNaviView.d.ts +7 -7
- package/build/ExpoGaodeMapNaviView.js +8 -8
- package/build/ExpoGaodeMapNavigationModule.d.ts +2 -1
- package/build/index.d.ts +35 -33
- package/build/index.js +70 -106
- package/build/map/ExpoGaodeMapModule.d.ts +2 -201
- package/build/map/ExpoGaodeMapModule.js +584 -14
- package/build/map/ExpoGaodeMapOfflineModule.d.ts +139 -0
- package/build/map/ExpoGaodeMapOfflineModule.js +8 -0
- package/build/map/ExpoGaodeMapView.js +66 -58
- package/build/map/components/FoldableMapView.d.ts +38 -0
- package/build/map/components/FoldableMapView.js +209 -0
- package/build/map/components/MapContext.d.ts +12 -0
- package/build/map/components/MapContext.js +54 -0
- package/build/map/components/MapUI.d.ts +18 -0
- package/build/map/components/MapUI.js +29 -0
- package/build/map/components/overlays/Circle.js +34 -3
- package/build/map/components/overlays/Cluster.d.ts +3 -1
- package/build/map/components/overlays/Cluster.js +31 -2
- package/build/map/components/overlays/HeatMap.d.ts +3 -1
- package/build/map/components/overlays/HeatMap.js +33 -3
- package/build/map/components/overlays/Marker.d.ts +1 -1
- package/build/map/components/overlays/Marker.js +37 -32
- package/build/map/components/overlays/MultiPoint.js +1 -1
- package/build/map/components/overlays/Polygon.js +30 -3
- package/build/map/components/overlays/Polyline.js +36 -3
- package/build/map/index.d.ts +25 -5
- package/build/map/index.js +59 -18
- package/build/map/types/common.types.d.ts +40 -0
- package/build/map/types/common.types.js +0 -4
- package/build/map/types/index.d.ts +3 -2
- package/build/map/types/map-view.types.d.ts +108 -3
- package/build/map/types/native-module.types.d.ts +363 -0
- package/build/map/types/native-module.types.js +5 -0
- package/build/map/types/offline.types.d.ts +132 -0
- package/build/map/types/offline.types.js +5 -0
- package/build/map/types/overlays.types.d.ts +137 -24
- package/build/map/utils/ErrorHandler.d.ts +110 -0
- package/build/map/utils/ErrorHandler.js +421 -0
- package/build/map/utils/GeoUtils.d.ts +20 -0
- package/build/map/utils/GeoUtils.js +76 -0
- package/build/map/utils/OfflineMapManager.d.ts +148 -0
- package/build/map/utils/OfflineMapManager.js +217 -0
- package/build/map/utils/PermissionUtils.d.ts +91 -0
- package/build/map/utils/PermissionUtils.js +255 -0
- package/build/map/utils/PlatformDetector.d.ts +102 -0
- package/build/map/utils/PlatformDetector.js +186 -0
- package/build/types/index.d.ts +1 -0
- package/build/types/index.js +1 -0
- package/build/types/native-module.types.d.ts +69 -0
- package/build/types/native-module.types.js +2 -0
- package/build/types/naviview.types.d.ts +1 -1
- package/expo-module.config.json +12 -10
- package/ios/ExpoGaodeMapNavigation.podspec +9 -0
- package/ios/map/ExpoGaodeMapModule.swift +485 -75
- package/ios/map/ExpoGaodeMapOfflineModule.swift +479 -0
- package/ios/map/ExpoGaodeMapView.swift +611 -62
- package/ios/map/ExpoGaodeMapViewModule.swift +48 -26
- package/ios/map/MapPreloadManager.swift +348 -0
- package/ios/map/cpp/ClusterEngine.cpp +110 -0
- package/ios/map/cpp/ClusterEngine.hpp +20 -0
- package/ios/map/cpp/ColorParser.cpp +135 -0
- package/ios/map/cpp/ColorParser.hpp +14 -0
- package/ios/map/cpp/GeometryEngine.cpp +574 -0
- package/ios/map/cpp/GeometryEngine.hpp +159 -0
- package/ios/map/cpp/QuadTree.cpp +92 -0
- package/ios/map/cpp/QuadTree.hpp +42 -0
- package/ios/map/cpp/README.md +55 -0
- package/ios/map/cpp/tests/benchmark_js.js +41 -0
- package/ios/map/cpp/tests/run.sh +17 -0
- package/ios/map/cpp/tests/test_main.cpp +276 -0
- package/ios/map/managers/UIManager.swift +72 -1
- package/ios/map/modules/LocationManager.swift +114 -165
- package/ios/map/overlays/CircleView.swift +16 -32
- package/ios/map/overlays/CircleViewModule.swift +12 -12
- package/ios/map/overlays/ClusterAnnotation.swift +32 -0
- package/ios/map/overlays/ClusterView.swift +331 -45
- package/ios/map/overlays/ClusterViewModule.swift +20 -6
- package/ios/map/overlays/HeatMapView.swift +135 -32
- package/ios/map/overlays/HeatMapViewModule.swift +20 -8
- package/ios/map/overlays/MarkerView.swift +613 -130
- package/ios/map/overlays/MarkerViewModule.swift +38 -18
- package/ios/map/overlays/MultiPointView.swift +168 -10
- package/ios/map/overlays/MultiPointViewModule.swift +27 -5
- package/ios/map/overlays/PolygonView.swift +62 -23
- package/ios/map/overlays/PolygonViewModule.swift +18 -12
- package/ios/map/overlays/PolylineView.swift +21 -13
- package/ios/map/overlays/PolylineViewModule.swift +18 -12
- package/ios/map/utils/ClusterNative.h +96 -0
- package/ios/map/utils/ClusterNative.mm +377 -0
- package/ios/map/utils/ColorParser.swift +12 -1
- package/ios/map/utils/CppBridging.mm +13 -0
- package/ios/map/utils/GeometryUtils.swift +34 -0
- package/ios/map/utils/LatLngParser.swift +87 -0
- package/ios/map/utils/PermissionManager.swift +135 -6
- package/package.json +1 -1
- package/build/map/ExpoGaodeMap.types.d.ts +0 -41
- package/build/map/ExpoGaodeMap.types.js +0 -24
- package/build/map/utils/EventManager.d.ts +0 -10
- package/build/map/utils/EventManager.js +0 -26
- package/build/map/utils/ModuleLoader.d.ts +0 -73
- package/build/map/utils/ModuleLoader.js +0 -112
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* 基于 Expo Modules API
|
|
4
4
|
*/
|
|
5
5
|
import type { StyleProp, ViewStyle, NativeSyntheticEvent } from 'react-native';
|
|
6
|
-
import type { CameraPosition, LatLng, LatLngBounds, MapPoi, MapType, Point } from './common.types';
|
|
6
|
+
import type { CameraPosition, LatLng, LatLngBounds, MapPoi, MapType, Point, LatLngPoint } from './common.types';
|
|
7
|
+
import { Coordinates, ReGeocode } from './location.types';
|
|
7
8
|
/**
|
|
8
9
|
* 定位事件数据
|
|
9
10
|
*/
|
|
@@ -81,6 +82,37 @@ export interface MapViewProps {
|
|
|
81
82
|
imageWidth?: number;
|
|
82
83
|
/** 定位图标高度(像素) */
|
|
83
84
|
imageHeight?: number;
|
|
85
|
+
/**
|
|
86
|
+
* 是否显示定位蓝点 @default true
|
|
87
|
+
* - iOS: 对应 mapView.showsUserLocation
|
|
88
|
+
* - Android: 对应 MyLocationStyle.showMyLocation() (5.1.0+)
|
|
89
|
+
*/
|
|
90
|
+
showMyLocation?: boolean;
|
|
91
|
+
/** 定位图标锚点 U 坐标 (0.0-1.0) @platform android */
|
|
92
|
+
anchorU?: number;
|
|
93
|
+
/** 定位图标锚点 V 坐标 (0.0-1.0) @platform android */
|
|
94
|
+
anchorV?: number;
|
|
95
|
+
/**
|
|
96
|
+
* 定位蓝点展现模式 @platform android
|
|
97
|
+
* @default 'LOCATION_ROTATE' (连续定位、定位点旋转、移动到中心)
|
|
98
|
+
*
|
|
99
|
+
* 🧭 **方向指示说明**:
|
|
100
|
+
* - Android 通过 locationType 实现方向指示(定位点依照设备方向旋转)
|
|
101
|
+
* - iOS 通过 showsHeadingIndicator 实现方向指示(显示扇形方向指示器)
|
|
102
|
+
*
|
|
103
|
+
* 📱 **Android 方向指示模式**(推荐使用以下两种):
|
|
104
|
+
* - 'LOCATION_ROTATE': 定位点依照设备方向旋转,视角跟随移动到中心(默认)⭐
|
|
105
|
+
* - 'LOCATION_ROTATE_NO_CENTER': 定位点依照设备方向旋转,视角不移动到中心 ⭐
|
|
106
|
+
*
|
|
107
|
+
* 🗺️ **其他模式**:
|
|
108
|
+
* - 'SHOW': 只定位一次
|
|
109
|
+
* - 'LOCATE': 定位一次,且将视角移动到地图中心点
|
|
110
|
+
* - 'FOLLOW': 连续定位、跟随移动,但定位点不旋转
|
|
111
|
+
* - 'MAP_ROTATE': 地图依照设备方向旋转(而非定位点旋转)
|
|
112
|
+
* - 'FOLLOW_NO_CENTER': 连续定位、不移动到中心,定位点不旋转
|
|
113
|
+
* - 'MAP_ROTATE_NO_CENTER': 地图依照设备方向旋转,不移动到中心
|
|
114
|
+
*/
|
|
115
|
+
locationType?: 'SHOW' | 'LOCATE' | 'FOLLOW' | 'MAP_ROTATE' | 'LOCATION_ROTATE' | 'LOCATION_ROTATE_NO_CENTER' | 'FOLLOW_NO_CENTER' | 'MAP_ROTATE_NO_CENTER';
|
|
84
116
|
};
|
|
85
117
|
/**
|
|
86
118
|
* 是否显示室内地图
|
|
@@ -151,6 +183,40 @@ export interface MapViewProps {
|
|
|
151
183
|
* @platform ios
|
|
152
184
|
*/
|
|
153
185
|
headingFilter?: number;
|
|
186
|
+
/**
|
|
187
|
+
* 是否启用国内外地图自动切换
|
|
188
|
+
* - true: 当中心点在国外时自动切换到苹果地图(iOS),国内时切换回高德地图
|
|
189
|
+
* - false: 始终使用高德地图
|
|
190
|
+
* @platform ios 当前仅支持 iOS 安卓因为需要使用 Google Maps SDK和谷歌服务
|
|
191
|
+
* @default false
|
|
192
|
+
*/
|
|
193
|
+
worldMapSwitchEnabled?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* 自定义地图样式
|
|
196
|
+
*
|
|
197
|
+
* 支持两种方式:
|
|
198
|
+
* 1. 在线样式:提供 styleId(从高德开放平台获取)
|
|
199
|
+
* 2. 本地样式:提供 styleDataPath 和可选的 extraStyleDataPath
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* // 使用在线样式
|
|
203
|
+
* customMapStyle={{ styleId: "your-style-id" }}
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* // 使用本地样式文件
|
|
207
|
+
* customMapStyle={{
|
|
208
|
+
* styleDataPath: "path/to/style.data",
|
|
209
|
+
* extraStyleDataPath: "path/to/extra.data"
|
|
210
|
+
* }}
|
|
211
|
+
*/
|
|
212
|
+
customMapStyle?: {
|
|
213
|
+
/** 在线样式ID(从高德开放平台获取) */
|
|
214
|
+
styleId?: string;
|
|
215
|
+
/** 本地样式文件路径 */
|
|
216
|
+
styleDataPath?: string;
|
|
217
|
+
/** 额外样式文件路径(可选) */
|
|
218
|
+
extraStyleDataPath?: string;
|
|
219
|
+
};
|
|
154
220
|
/**
|
|
155
221
|
* 样式
|
|
156
222
|
*/
|
|
@@ -209,7 +275,7 @@ export interface MapViewMethods {
|
|
|
209
275
|
* @param center 中心点
|
|
210
276
|
* @param animated 是否启用动画
|
|
211
277
|
*/
|
|
212
|
-
setCenter(center:
|
|
278
|
+
setCenter(center: LatLngPoint, animated?: boolean): void;
|
|
213
279
|
/**
|
|
214
280
|
* 设置地图缩放级别
|
|
215
281
|
* @param zoom 缩放级别
|
|
@@ -221,6 +287,11 @@ export interface MapViewMethods {
|
|
|
221
287
|
* @returns 相机位置
|
|
222
288
|
*/
|
|
223
289
|
getCameraPosition(): Promise<CameraPosition>;
|
|
290
|
+
/**
|
|
291
|
+
* 截取地图快照
|
|
292
|
+
* @returns 快照图片文件路径
|
|
293
|
+
*/
|
|
294
|
+
takeSnapshot(): Promise<string>;
|
|
224
295
|
}
|
|
225
296
|
/**
|
|
226
297
|
* MapView Ref 公开接口(用户使用)
|
|
@@ -228,7 +299,41 @@ export interface MapViewMethods {
|
|
|
228
299
|
export interface MapViewRef {
|
|
229
300
|
moveCamera(position: CameraPosition, duration?: number): Promise<void>;
|
|
230
301
|
getLatLng(point: Point): Promise<LatLng>;
|
|
231
|
-
setCenter(center:
|
|
302
|
+
setCenter(center: LatLngPoint, animated?: boolean): Promise<void>;
|
|
232
303
|
setZoom(zoom: number, animated?: boolean): Promise<void>;
|
|
233
304
|
getCameraPosition(): Promise<CameraPosition>;
|
|
305
|
+
takeSnapshot(): Promise<string>;
|
|
234
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Expo 模块事件类型
|
|
309
|
+
* 定义了原生模块可以触发的事件
|
|
310
|
+
*/
|
|
311
|
+
export type ExpoGaodeMapModuleEvents = {
|
|
312
|
+
/**
|
|
313
|
+
* 定位更新事件
|
|
314
|
+
* 当位置发生变化时触发
|
|
315
|
+
* @param location 位置信息,包含坐标和可选的逆地理编码信息
|
|
316
|
+
*/
|
|
317
|
+
onLocationUpdate: (location: Coordinates | ReGeocode) => void;
|
|
318
|
+
/**
|
|
319
|
+
* 方向更新事件(iOS)
|
|
320
|
+
* 当设备方向发生变化时触发
|
|
321
|
+
* @param heading 方向信息
|
|
322
|
+
*/
|
|
323
|
+
onHeadingUpdate: (heading: {
|
|
324
|
+
/** 磁北方向角度 (0-359.9) */
|
|
325
|
+
magneticHeading: number;
|
|
326
|
+
/** 真北方向角度 (0-359.9) */
|
|
327
|
+
trueHeading: number;
|
|
328
|
+
/** 方向精度 */
|
|
329
|
+
headingAccuracy: number;
|
|
330
|
+
/** X 轴原始数据 */
|
|
331
|
+
x: number;
|
|
332
|
+
/** Y 轴原始数据 */
|
|
333
|
+
y: number;
|
|
334
|
+
/** Z 轴原始数据 */
|
|
335
|
+
z: number;
|
|
336
|
+
/** 时间戳 */
|
|
337
|
+
timestamp: number;
|
|
338
|
+
}) => void;
|
|
339
|
+
};
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 高德地图原生模块类型定义
|
|
3
|
+
*/
|
|
4
|
+
import type { NativeModule } from 'expo';
|
|
5
|
+
import type { LatLng, SDKConfig, PermissionStatus, LatLngPoint } from './common.types';
|
|
6
|
+
import type { CoordinateType, Coordinates, ReGeocode, LocationMode, LocationAccuracy, LocationListener } from './location.types';
|
|
7
|
+
import type { ExpoGaodeMapModuleEvents } from './map-view.types';
|
|
8
|
+
export interface ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {
|
|
9
|
+
/**
|
|
10
|
+
* 原生事件订阅方法
|
|
11
|
+
*/
|
|
12
|
+
addListener<K extends keyof ExpoGaodeMapModuleEvents>(eventName: K, listener: ExpoGaodeMapModuleEvents[K]): {
|
|
13
|
+
remove: () => void;
|
|
14
|
+
};
|
|
15
|
+
addListener(eventName: string, listener: (...args: unknown[]) => void): {
|
|
16
|
+
remove: () => void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 初始化高德地图 SDK
|
|
20
|
+
* @param config SDK 配置参数,包含 Android 和 iOS 的 API Key
|
|
21
|
+
*/
|
|
22
|
+
initSDK(config: SDKConfig): void;
|
|
23
|
+
/**
|
|
24
|
+
* 设置是否加载世界向量地图(海外地图)
|
|
25
|
+
* 必须在地图初始化之前调用
|
|
26
|
+
* 世界地图为高级服务,需要开通相关权限
|
|
27
|
+
*/
|
|
28
|
+
setLoadWorldVectorMap(enabled: boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* 获取高德地图 SDK 版本号
|
|
31
|
+
* @returns SDK 版本字符串
|
|
32
|
+
*/
|
|
33
|
+
getVersion(): string;
|
|
34
|
+
/**
|
|
35
|
+
* 开始连续定位
|
|
36
|
+
* 启动后会持续接收位置更新,通过 onLocationUpdate 事件回调
|
|
37
|
+
*/
|
|
38
|
+
start(): void;
|
|
39
|
+
/**
|
|
40
|
+
* 停止定位
|
|
41
|
+
* 停止接收位置更新
|
|
42
|
+
*/
|
|
43
|
+
stop(): void;
|
|
44
|
+
/**
|
|
45
|
+
* 检查是否正在定位
|
|
46
|
+
* @returns 是否正在定位
|
|
47
|
+
*/
|
|
48
|
+
isStarted(): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* 获取当前位置(单次定位)
|
|
51
|
+
* @returns 位置信息,包含坐标和可选的逆地理编码信息
|
|
52
|
+
*/
|
|
53
|
+
getCurrentLocation(): Promise<Coordinates | ReGeocode>;
|
|
54
|
+
/**
|
|
55
|
+
* 坐标转换
|
|
56
|
+
* 将其他坐标系的坐标转换为高德地图使用的 GCJ-02 坐标系
|
|
57
|
+
* @param coordinate 需要转换的坐标
|
|
58
|
+
* @param type 原坐标系类型
|
|
59
|
+
*/
|
|
60
|
+
coordinateConvert(coordinate: LatLngPoint, type: CoordinateType): Promise<LatLng>;
|
|
61
|
+
/**
|
|
62
|
+
* 设置是否返回逆地理编码信息
|
|
63
|
+
* @param isReGeocode true: 返回地址信息; false: 只返回坐标
|
|
64
|
+
*/
|
|
65
|
+
setLocatingWithReGeocode(isReGeocode: boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* 设置定位模式(Android)
|
|
68
|
+
* @param mode 定位模式:高精度/低功耗/仅设备
|
|
69
|
+
*/
|
|
70
|
+
setLocationMode(mode: LocationMode): void;
|
|
71
|
+
/**
|
|
72
|
+
* 设置定位间隔(毫秒)
|
|
73
|
+
* @param interval 定位间隔时间,单位毫秒,默认 2000ms
|
|
74
|
+
*/
|
|
75
|
+
setInterval(interval: number): void;
|
|
76
|
+
/**
|
|
77
|
+
* 设置是否单次定位(Android)
|
|
78
|
+
* @param isOnceLocation true: 单次定位; false: 连续定位
|
|
79
|
+
*/
|
|
80
|
+
setOnceLocation(isOnceLocation: boolean): void;
|
|
81
|
+
/**
|
|
82
|
+
* 设置是否使用设备传感器(Android)
|
|
83
|
+
* @param sensorEnable true: 使用传感器; false: 不使用
|
|
84
|
+
*/
|
|
85
|
+
setSensorEnable(sensorEnable: boolean): void;
|
|
86
|
+
/**
|
|
87
|
+
* 设置是否允许 WiFi 扫描(Android)
|
|
88
|
+
* @param wifiScan true: 允许; false: 不允许
|
|
89
|
+
*/
|
|
90
|
+
setWifiScan(wifiScan: boolean): void;
|
|
91
|
+
/**
|
|
92
|
+
* 设置是否 GPS 优先(Android)
|
|
93
|
+
* @param gpsFirst true: GPS 优先; false: 网络优先
|
|
94
|
+
*/
|
|
95
|
+
setGpsFirst(gpsFirst: boolean): void;
|
|
96
|
+
/**
|
|
97
|
+
* 设置是否等待 WiFi 列表刷新(Android)
|
|
98
|
+
* @param onceLocationLatest true: 等待; false: 不等待
|
|
99
|
+
*/
|
|
100
|
+
setOnceLocationLatest(onceLocationLatest: boolean): void;
|
|
101
|
+
/**
|
|
102
|
+
* 设置逆地理编码语言
|
|
103
|
+
* @param language 语言代码,如 "zh-CN", "en"
|
|
104
|
+
*/
|
|
105
|
+
setGeoLanguage(language: string): void;
|
|
106
|
+
/**
|
|
107
|
+
* 设置是否使用缓存策略(Android)
|
|
108
|
+
* @param locationCacheEnable true: 使用缓存; false: 不使用
|
|
109
|
+
*/
|
|
110
|
+
setLocationCacheEnable(locationCacheEnable: boolean): void;
|
|
111
|
+
/**
|
|
112
|
+
* 设置网络请求超时时间(Android)
|
|
113
|
+
* @param httpTimeOut 超时时间,单位毫秒
|
|
114
|
+
*/
|
|
115
|
+
setHttpTimeOut(httpTimeOut: number): void;
|
|
116
|
+
/**
|
|
117
|
+
* 设置期望的定位精度(iOS)
|
|
118
|
+
* @param accuracy 精度级别:最佳/10米/100米/1公里/3公里
|
|
119
|
+
*/
|
|
120
|
+
setDesiredAccuracy(accuracy: LocationAccuracy): void;
|
|
121
|
+
/**
|
|
122
|
+
* 设置定位超时时间(秒)
|
|
123
|
+
* @param timeout 超时时间,单位秒,默认 10 秒
|
|
124
|
+
*/
|
|
125
|
+
setLocationTimeout(timeout: number): void;
|
|
126
|
+
/**
|
|
127
|
+
* 设置逆地理编码超时时间(秒)
|
|
128
|
+
* @param timeout 超时时间,单位秒,默认 5 秒
|
|
129
|
+
*/
|
|
130
|
+
setReGeocodeTimeout(timeout: number): void;
|
|
131
|
+
/**
|
|
132
|
+
* 设置距离过滤器(米)(iOS)
|
|
133
|
+
* 只有移动超过指定距离才会更新位置
|
|
134
|
+
* @param distance 距离阈值,单位米
|
|
135
|
+
*/
|
|
136
|
+
setDistanceFilter(distance: number): void;
|
|
137
|
+
/**
|
|
138
|
+
* 设置是否自动暂停位置更新(iOS)
|
|
139
|
+
* @param pauses true: 自动暂停; false: 不暂停
|
|
140
|
+
*/
|
|
141
|
+
setPausesLocationUpdatesAutomatically(pauses: boolean): void;
|
|
142
|
+
/**
|
|
143
|
+
* 设置是否允许后台定位(iOS)
|
|
144
|
+
* @param allows true: 允许; false: 不允许
|
|
145
|
+
*/
|
|
146
|
+
setAllowsBackgroundLocationUpdates(allows: boolean): void;
|
|
147
|
+
/**
|
|
148
|
+
* iOS 是否已启用后台定位配置
|
|
149
|
+
*/
|
|
150
|
+
readonly isBackgroundLocationEnabled: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* 设置定位协议
|
|
153
|
+
* @param protocol 协议类型
|
|
154
|
+
*/
|
|
155
|
+
setLocationProtocol(protocol: string): void;
|
|
156
|
+
/**
|
|
157
|
+
* 开始更新设备方向(罗盘朝向)(iOS)
|
|
158
|
+
*/
|
|
159
|
+
startUpdatingHeading(): void;
|
|
160
|
+
/**
|
|
161
|
+
* 停止更新设备方向(iOS)
|
|
162
|
+
*/
|
|
163
|
+
stopUpdatingHeading(): void;
|
|
164
|
+
/**
|
|
165
|
+
* 检查前台位置权限状态(增强版)
|
|
166
|
+
* @returns 详细的权限状态信息
|
|
167
|
+
*/
|
|
168
|
+
checkLocationPermission(): Promise<PermissionStatus>;
|
|
169
|
+
/**
|
|
170
|
+
* 请求前台位置权限(增强版)
|
|
171
|
+
* @returns 请求后的权限状态
|
|
172
|
+
*/
|
|
173
|
+
requestLocationPermission(): Promise<PermissionStatus>;
|
|
174
|
+
/**
|
|
175
|
+
* 请求后台位置权限(Android 10+、iOS)
|
|
176
|
+
* 注意:必须在前台权限已授予后才能请求
|
|
177
|
+
* @returns 请求后的权限状态
|
|
178
|
+
*/
|
|
179
|
+
requestBackgroundLocationPermission(): Promise<PermissionStatus>;
|
|
180
|
+
/**
|
|
181
|
+
* 打开应用设置页面
|
|
182
|
+
* 引导用户手动授予权限(当权限被永久拒绝时使用)
|
|
183
|
+
*/
|
|
184
|
+
openAppSettings(): void;
|
|
185
|
+
/**
|
|
186
|
+
* 检查原生 SDK 是否已配置 API Key
|
|
187
|
+
* @returns 是否已配置
|
|
188
|
+
*/
|
|
189
|
+
isNativeSDKConfigured(): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* 添加定位监听器(便捷方法)
|
|
192
|
+
* 封装原生事件订阅,返回带 remove 的订阅对象
|
|
193
|
+
*/
|
|
194
|
+
addLocationListener(listener: LocationListener): {
|
|
195
|
+
remove: () => void;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* 计算两个坐标点之间的距离
|
|
199
|
+
* @param coordinate1 第一个坐标点
|
|
200
|
+
* @param coordinate2 第二个坐标点
|
|
201
|
+
* @returns 两点之间的距离(单位:米)
|
|
202
|
+
*/
|
|
203
|
+
distanceBetweenCoordinates(coordinate1: LatLngPoint, coordinate2: LatLngPoint): number;
|
|
204
|
+
/**
|
|
205
|
+
* 判断点是否在圆内
|
|
206
|
+
* @param point 要判断的点
|
|
207
|
+
* @param center 圆心坐标
|
|
208
|
+
* @param radius 圆半径(单位:米)
|
|
209
|
+
* @returns 是否在圆内
|
|
210
|
+
*/
|
|
211
|
+
isPointInCircle(point: LatLngPoint, center: LatLngPoint, radius: number): boolean;
|
|
212
|
+
/**
|
|
213
|
+
* 判断点是否在多边形内
|
|
214
|
+
* @param point 要判断的点
|
|
215
|
+
* @param polygon 多边形的顶点坐标数组,支持嵌套数组(多边形空洞)
|
|
216
|
+
* @returns 是否在多边形内
|
|
217
|
+
*/
|
|
218
|
+
isPointInPolygon(point: LatLngPoint, polygon: LatLngPoint[] | LatLngPoint[][]): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* 计算多边形面积
|
|
221
|
+
* @param polygon 多边形的顶点坐标数组,支持嵌套数组(多边形空洞,会自动展平计算)
|
|
222
|
+
* @returns 面积(单位:平方米)
|
|
223
|
+
*/
|
|
224
|
+
calculatePolygonArea(polygon: LatLngPoint[] | LatLngPoint[][]): number;
|
|
225
|
+
/**
|
|
226
|
+
* 计算矩形面积
|
|
227
|
+
* @param southWest 西南角坐标
|
|
228
|
+
* @param northEast 东北角坐标
|
|
229
|
+
* @returns 面积(单位:平方米)
|
|
230
|
+
*/
|
|
231
|
+
calculateRectangleArea(southWest: LatLngPoint, northEast: LatLngPoint): number;
|
|
232
|
+
/**
|
|
233
|
+
* 获取路径上距离目标点最近的点
|
|
234
|
+
* @param path 路径点集合
|
|
235
|
+
* @param target 目标点
|
|
236
|
+
* @returns 最近点信息,包含坐标、索引和距离
|
|
237
|
+
*/
|
|
238
|
+
getNearestPointOnPath(path: LatLngPoint[], target: LatLngPoint): {
|
|
239
|
+
latitude: number;
|
|
240
|
+
longitude: number;
|
|
241
|
+
index: number;
|
|
242
|
+
distanceMeters: number;
|
|
243
|
+
} | null;
|
|
244
|
+
/**
|
|
245
|
+
* 计算多边形质心
|
|
246
|
+
* @param polygon 多边形顶点坐标数组,支持嵌套数组
|
|
247
|
+
* @returns 质心坐标
|
|
248
|
+
*/
|
|
249
|
+
calculateCentroid(polygon: LatLngPoint[] | LatLngPoint[][]): LatLng | null;
|
|
250
|
+
/**
|
|
251
|
+
* 计算路径边界和中心点
|
|
252
|
+
* @param points 路径点
|
|
253
|
+
* @returns 边界和中心点
|
|
254
|
+
*/
|
|
255
|
+
calculatePathBounds(points: LatLngPoint[]): {
|
|
256
|
+
north: number;
|
|
257
|
+
south: number;
|
|
258
|
+
east: number;
|
|
259
|
+
west: number;
|
|
260
|
+
center: LatLngPoint;
|
|
261
|
+
} | null;
|
|
262
|
+
/**
|
|
263
|
+
* GeoHash 编码
|
|
264
|
+
* @param coordinate 坐标点
|
|
265
|
+
* @param precision 精度 (1-12)
|
|
266
|
+
* @returns GeoHash 字符串
|
|
267
|
+
*/
|
|
268
|
+
encodeGeoHash(coordinate: LatLngPoint, precision: number): string;
|
|
269
|
+
/**
|
|
270
|
+
* 轨迹抽稀 (RDP 算法)
|
|
271
|
+
* @param points 原始轨迹点
|
|
272
|
+
* @param tolerance 允许误差(米)
|
|
273
|
+
* @returns 简化后的轨迹点
|
|
274
|
+
*/
|
|
275
|
+
simplifyPolyline(points: LatLngPoint[], tolerance: number): LatLng[];
|
|
276
|
+
/**
|
|
277
|
+
* 计算路径总长度
|
|
278
|
+
* @param points 路径点
|
|
279
|
+
* @returns 长度(米)
|
|
280
|
+
*/
|
|
281
|
+
calculatePathLength(points: LatLngPoint[]): number;
|
|
282
|
+
/**
|
|
283
|
+
* 解析高德地图 API 返回的 Polyline 字符串
|
|
284
|
+
* 格式: "lng,lat;lng,lat;..."
|
|
285
|
+
* @param polylineStr 高德原始 polyline 字符串,或包含 polyline 属性的对象
|
|
286
|
+
* @returns 解析后的点集
|
|
287
|
+
*/
|
|
288
|
+
parsePolyline(polylineStr: string | {
|
|
289
|
+
polyline: string;
|
|
290
|
+
}): LatLng[];
|
|
291
|
+
/**
|
|
292
|
+
* 获取路径上指定距离的点
|
|
293
|
+
* @param points 路径点
|
|
294
|
+
* @param distance 距离起点的米数
|
|
295
|
+
* @returns 点信息(坐标+角度)
|
|
296
|
+
*/
|
|
297
|
+
getPointAtDistance(points: LatLngPoint[], distance: number): {
|
|
298
|
+
latitude: number;
|
|
299
|
+
longitude: number;
|
|
300
|
+
angle: number;
|
|
301
|
+
} | null;
|
|
302
|
+
/**
|
|
303
|
+
* 瓦片坐标转换:经纬度 -> 瓦片坐标
|
|
304
|
+
* @param coordinate 坐标点
|
|
305
|
+
* @param zoom 缩放级别
|
|
306
|
+
* @returns 瓦片坐标 (x, y, z)
|
|
307
|
+
*/
|
|
308
|
+
latLngToTile(coordinate: LatLngPoint, zoom: number): {
|
|
309
|
+
x: number;
|
|
310
|
+
y: number;
|
|
311
|
+
z: number;
|
|
312
|
+
} | null;
|
|
313
|
+
/**
|
|
314
|
+
* 瓦片坐标转换:瓦片坐标 -> 经纬度
|
|
315
|
+
* @param tile 瓦片坐标 (x, y, z)
|
|
316
|
+
* @returns 经纬度
|
|
317
|
+
*/
|
|
318
|
+
tileToLatLng(tile: {
|
|
319
|
+
x: number;
|
|
320
|
+
y: number;
|
|
321
|
+
z: number;
|
|
322
|
+
}): LatLng | null;
|
|
323
|
+
/**
|
|
324
|
+
* 像素坐标转换:经纬度 -> 像素坐标
|
|
325
|
+
* @param coordinate 坐标点
|
|
326
|
+
* @param zoom 缩放级别
|
|
327
|
+
* @returns 像素坐标 (x, y)
|
|
328
|
+
*/
|
|
329
|
+
latLngToPixel(coordinate: LatLngPoint, zoom: number): {
|
|
330
|
+
x: number;
|
|
331
|
+
y: number;
|
|
332
|
+
} | null;
|
|
333
|
+
/**
|
|
334
|
+
* 像素坐标转换:像素坐标 -> 经纬度
|
|
335
|
+
* @param pixel 像素坐标 (x, y)
|
|
336
|
+
* @param zoom 缩放级别
|
|
337
|
+
* @returns 经纬度
|
|
338
|
+
*/
|
|
339
|
+
pixelToLatLng(pixel: {
|
|
340
|
+
x: number;
|
|
341
|
+
y: number;
|
|
342
|
+
}, zoom: number): LatLng | null;
|
|
343
|
+
/**
|
|
344
|
+
* 批量地理围栏检测
|
|
345
|
+
* @param point 待检测点
|
|
346
|
+
* @param polygons 多边形集合 (支持嵌套)
|
|
347
|
+
* @returns 包含该点的多边形索引,若不在任何多边形内返回 -1
|
|
348
|
+
*/
|
|
349
|
+
findPointInPolygons(point: LatLngPoint, polygons: LatLngPoint[][] | LatLngPoint[][][]): number;
|
|
350
|
+
/**
|
|
351
|
+
* 生成热力图网格数据 (C++ 加速)
|
|
352
|
+
* @param points 点集,包含权重
|
|
353
|
+
* @param gridSizeMeters 网格大小(米)
|
|
354
|
+
* @returns 聚合后的网格点
|
|
355
|
+
*/
|
|
356
|
+
generateHeatmapGrid(points: Array<LatLngPoint & {
|
|
357
|
+
weight?: number;
|
|
358
|
+
}>, gridSizeMeters: number): Array<{
|
|
359
|
+
latitude: number;
|
|
360
|
+
longitude: number;
|
|
361
|
+
intensity: number;
|
|
362
|
+
}>;
|
|
363
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 高德地图离线地图类型定义
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 离线地图下载状态
|
|
6
|
+
*/
|
|
7
|
+
export type OfflineMapStatus = 'not_downloaded' | 'downloading' | 'downloaded' | 'paused' | 'failed' | 'updating' | 'unzipping';
|
|
8
|
+
/**
|
|
9
|
+
* 离线地图信息
|
|
10
|
+
*/
|
|
11
|
+
export interface OfflineMapInfo {
|
|
12
|
+
/** 城市代码 */
|
|
13
|
+
cityCode: string;
|
|
14
|
+
/** 城市名称 */
|
|
15
|
+
cityName: string;
|
|
16
|
+
/** 地图大小(字节) */
|
|
17
|
+
size: number;
|
|
18
|
+
/** 下载状态 */
|
|
19
|
+
status: OfflineMapStatus;
|
|
20
|
+
/** 下载进度 (0-100) */
|
|
21
|
+
progress: number;
|
|
22
|
+
/** 版本号 */
|
|
23
|
+
version: string;
|
|
24
|
+
/** 是否有更新 */
|
|
25
|
+
hasUpdate?: boolean;
|
|
26
|
+
/** 省份名称 */
|
|
27
|
+
provinceName?: string;
|
|
28
|
+
/** 省份代码 */
|
|
29
|
+
provinceCode?: string;
|
|
30
|
+
/** 已下载大小(字节) */
|
|
31
|
+
downloadedSize?: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 离线地图下载配置
|
|
35
|
+
*/
|
|
36
|
+
export interface OfflineMapDownloadConfig {
|
|
37
|
+
/** 城市代码 */
|
|
38
|
+
cityCode: string;
|
|
39
|
+
/** 是否允许移动网络下载 @default false */
|
|
40
|
+
allowCellular?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 离线地图下载进度事件
|
|
44
|
+
*/
|
|
45
|
+
export interface OfflineMapDownloadEvent {
|
|
46
|
+
/** 城市代码 */
|
|
47
|
+
cityCode: string;
|
|
48
|
+
/** 城市名称 */
|
|
49
|
+
cityName: string;
|
|
50
|
+
/** 下载进度 (0-100) */
|
|
51
|
+
progress: number;
|
|
52
|
+
/** 已下载大小(字节) */
|
|
53
|
+
downloadedSize: number;
|
|
54
|
+
/** 总大小(字节) */
|
|
55
|
+
totalSize: number;
|
|
56
|
+
/** 下载状态 */
|
|
57
|
+
status: OfflineMapStatus;
|
|
58
|
+
/** 当前状态描述 */
|
|
59
|
+
statusMessage?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 离线地图完成事件
|
|
63
|
+
*/
|
|
64
|
+
export interface OfflineMapCompleteEvent {
|
|
65
|
+
/** 城市代码 */
|
|
66
|
+
cityCode: string;
|
|
67
|
+
/** 城市名称 */
|
|
68
|
+
cityName: string;
|
|
69
|
+
/** 是否成功 */
|
|
70
|
+
success: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 离线地图暂停事件
|
|
74
|
+
*/
|
|
75
|
+
export interface OfflineMapPausedEvent {
|
|
76
|
+
/** 城市代码 */
|
|
77
|
+
cityCode: string;
|
|
78
|
+
/** 城市名称 */
|
|
79
|
+
cityName: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 离线地图取消事件
|
|
83
|
+
*/
|
|
84
|
+
export interface OfflineMapCancelledEvent {
|
|
85
|
+
/** 城市代码 */
|
|
86
|
+
cityCode: string;
|
|
87
|
+
/** 城市名称 */
|
|
88
|
+
cityName: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 离线地图错误事件
|
|
92
|
+
*/
|
|
93
|
+
export interface OfflineMapErrorEvent {
|
|
94
|
+
/** 城市代码 */
|
|
95
|
+
cityCode: string;
|
|
96
|
+
/** 城市名称 */
|
|
97
|
+
cityName: string;
|
|
98
|
+
/** 错误信息 */
|
|
99
|
+
error: string;
|
|
100
|
+
/** 错误代码 */
|
|
101
|
+
errorCode?: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 离线地图存储信息
|
|
105
|
+
*/
|
|
106
|
+
export interface OfflineMapStorageInfo {
|
|
107
|
+
/** 总存储空间(字节) */
|
|
108
|
+
totalSpace: number;
|
|
109
|
+
/** 已使用空间(字节) */
|
|
110
|
+
usedSpace: number;
|
|
111
|
+
/** 可用空间(字节) */
|
|
112
|
+
availableSpace: number;
|
|
113
|
+
/** 离线地图占用空间(字节) */
|
|
114
|
+
offlineMapSize: number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 离线地图事件类型
|
|
118
|
+
*/
|
|
119
|
+
export type OfflineMapEvents = {
|
|
120
|
+
/** 下载进度更新 */
|
|
121
|
+
onDownloadProgress: (event: OfflineMapDownloadEvent) => void;
|
|
122
|
+
/** 下载完成 */
|
|
123
|
+
onDownloadComplete: (event: OfflineMapCompleteEvent) => void;
|
|
124
|
+
/** 下载错误 */
|
|
125
|
+
onDownloadError: (event: OfflineMapErrorEvent) => void;
|
|
126
|
+
/** 解压进度更新 */
|
|
127
|
+
onUnzipProgress: (event: OfflineMapDownloadEvent) => void;
|
|
128
|
+
/** 下载暂停 */
|
|
129
|
+
onDownloadPaused: (event: OfflineMapPausedEvent) => void;
|
|
130
|
+
/** 下载取消 */
|
|
131
|
+
onDownloadCancelled: (event: OfflineMapCancelledEvent) => void;
|
|
132
|
+
};
|