expo-gaode-map-navigation 2.0.11 → 2.0.12
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/src/main/cpp/cluster_jni.cpp +56 -0
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapModule.kt +45 -6
- package/android/src/main/java/expo/modules/gaodemap/map/modules/SDKInitializer.kt +23 -17
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerView.kt +37 -25
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerViewModule.kt +6 -6
- package/android/src/main/java/expo/modules/gaodemap/map/utils/GeometryUtils.kt +103 -0
- package/android/src/main/java/expo/modules/gaodemap/navigation/ExpoGaodeMapNaviView.kt +1 -1
- package/build/index.d.ts +10 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +6 -3
- package/build/index.js.map +1 -1
- package/build/map/ExpoGaodeMapModule.d.ts +15 -13
- package/build/map/ExpoGaodeMapModule.d.ts.map +1 -1
- package/build/map/ExpoGaodeMapModule.js +31 -39
- package/build/map/ExpoGaodeMapModule.js.map +1 -1
- package/build/map/ExpoGaodeMapView.d.ts +3 -4
- package/build/map/ExpoGaodeMapView.d.ts.map +1 -1
- package/build/map/ExpoGaodeMapView.js +28 -25
- package/build/map/ExpoGaodeMapView.js.map +1 -1
- package/build/map/components/overlays/Circle.d.ts.map +1 -1
- package/build/map/components/overlays/Circle.js +1 -30
- package/build/map/components/overlays/Circle.js.map +1 -1
- package/build/map/components/overlays/Cluster.d.ts.map +1 -1
- package/build/map/components/overlays/Cluster.js +1 -42
- package/build/map/components/overlays/Cluster.js.map +1 -1
- package/build/map/components/overlays/HeatMap.d.ts.map +1 -1
- package/build/map/components/overlays/HeatMap.js +1 -20
- package/build/map/components/overlays/HeatMap.js.map +1 -1
- package/build/map/components/overlays/Marker.d.ts.map +1 -1
- package/build/map/components/overlays/Marker.js +76 -80
- package/build/map/components/overlays/Marker.js.map +1 -1
- package/build/map/components/overlays/Polygon.d.ts.map +1 -1
- package/build/map/components/overlays/Polygon.js +1 -25
- package/build/map/components/overlays/Polygon.js.map +1 -1
- package/build/map/components/overlays/Polyline.d.ts.map +1 -1
- package/build/map/components/overlays/Polyline.js +1 -31
- package/build/map/components/overlays/Polyline.js.map +1 -1
- package/build/map/index.d.ts +6 -2
- package/build/map/index.d.ts.map +1 -1
- package/build/map/index.js +6 -2
- package/build/map/index.js.map +1 -1
- package/build/map/types/index.d.ts +2 -2
- package/build/map/types/index.d.ts.map +1 -1
- package/build/map/types/index.js.map +1 -1
- package/build/map/types/native-module.types.d.ts +11 -12
- package/build/map/types/native-module.types.d.ts.map +1 -1
- package/build/map/types/native-module.types.js.map +1 -1
- package/build/map/types/overlays.types.d.ts +9 -14
- package/build/map/types/overlays.types.d.ts.map +1 -1
- package/build/map/types/overlays.types.js.map +1 -1
- package/build/map/types/route-playback.types.d.ts +16 -0
- package/build/map/types/route-playback.types.d.ts.map +1 -1
- package/build/map/types/route-playback.types.js.map +1 -1
- package/build/types/coordinates.types.d.ts +3 -0
- package/build/types/coordinates.types.d.ts.map +1 -1
- package/build/types/coordinates.types.js.map +1 -1
- package/ios/ExpoGaodeMapNaviView.swift +31 -2
- package/ios/map/ExpoGaodeMapModule.swift +38 -6
- package/ios/map/ExpoGaodeMapView.swift +10 -3
- package/ios/map/GaodeMapPrivacyManager.swift +26 -18
- package/ios/map/cpp/GeometryEngine.cpp +112 -0
- package/ios/map/cpp/GeometryEngine.hpp +21 -0
- package/ios/map/modules/LocationManager.swift +1 -1
- package/ios/map/overlays/MarkerView.swift +11 -11
- package/ios/map/overlays/MarkerViewModule.swift +4 -4
- package/ios/map/utils/ClusterNative.h +8 -0
- package/ios/map/utils/ClusterNative.mm +27 -0
- package/package.json +6 -4
- package/scripts/check-expo-modules.js +68 -0
- package/shared/cpp/GeometryEngine.cpp +112 -0
- package/shared/cpp/GeometryEngine.hpp +21 -0
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import ExpoGaodeMapModule from '../../ExpoGaodeMapModule';
|
|
3
4
|
import { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';
|
|
4
5
|
import { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';
|
|
5
6
|
const getNativeMarkerView = createLazyNativeViewManager('MarkerView');
|
|
6
7
|
const AUTO_SIZE_FALLBACK = { width: 0, height: 0 };
|
|
7
|
-
function areSmoothMovePathsEqual(prevPath, nextPath) {
|
|
8
|
-
if (prevPath === nextPath) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
if (!prevPath || !nextPath) {
|
|
12
|
-
return prevPath === nextPath;
|
|
13
|
-
}
|
|
14
|
-
if (prevPath.length !== nextPath.length) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
for (let index = 0; index < prevPath.length; index += 1) {
|
|
18
|
-
const prevPoint = normalizeLatLng(prevPath[index]);
|
|
19
|
-
const nextPoint = normalizeLatLng(nextPath[index]);
|
|
20
|
-
if (prevPoint.latitude !== nextPoint.latitude ||
|
|
21
|
-
prevPoint.longitude !== nextPoint.longitude) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
8
|
/**
|
|
28
9
|
* Marker 组件 - 完全声明式 API
|
|
29
10
|
*
|
|
@@ -38,27 +19,82 @@ function Marker(props) {
|
|
|
38
19
|
const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);
|
|
39
20
|
const [measuredSize, setMeasuredSize] = React.useState(AUTO_SIZE_FALLBACK);
|
|
40
21
|
// 从 props 中排除 position 属性,避免传递到原生层
|
|
41
|
-
const { position,
|
|
22
|
+
const { position, iconWidth, iconHeight, children, smoothMovePath, cacheKey, ...restProps } = props;
|
|
42
23
|
// 归一化坐标处理
|
|
43
24
|
const normalizedPosition = normalizeLatLng(position);
|
|
44
25
|
const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;
|
|
45
26
|
// 根据是否有 children 来决定使用哪个尺寸属性
|
|
46
27
|
const hasChildren = !!children;
|
|
47
28
|
const shouldWrapChildrenForMeasurement = hasChildren;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
29
|
+
// Android 的 children marker 之前始终透传 0 尺寸,点击后重新快照时容易直接消失。
|
|
30
|
+
// 统一走自动测量后,两个平台都会拿到稳定尺寸。
|
|
31
|
+
const shouldUseAutoMeasuredSize = hasChildren;
|
|
32
|
+
const resolvedContentWidth = shouldUseAutoMeasuredSize ? measuredSize.width : 0;
|
|
33
|
+
const resolvedContentHeight = shouldUseAutoMeasuredSize ? measuredSize.height : 0;
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
if (!normalizedSmoothMovePath ||
|
|
36
|
+
normalizedSmoothMovePath.length < 2 ||
|
|
37
|
+
!props.smoothMoveDuration ||
|
|
38
|
+
props.smoothMoveDuration <= 0) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const totalDistance = ExpoGaodeMapModule.calculatePathLength(normalizedSmoothMovePath);
|
|
42
|
+
if (totalDistance <= 0) {
|
|
43
|
+
props.onSmoothMoveEnd?.({
|
|
44
|
+
nativeEvent: {
|
|
45
|
+
position: normalizedSmoothMovePath[normalizedSmoothMovePath.length - 1],
|
|
46
|
+
angle: 0,
|
|
47
|
+
totalDistance,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const durationMs = props.smoothMoveDuration * 1000;
|
|
53
|
+
const startedAt = Date.now();
|
|
54
|
+
const tick = () => {
|
|
55
|
+
const progress = Math.min(1, (Date.now() - startedAt) / durationMs);
|
|
56
|
+
const distance = totalDistance * progress;
|
|
57
|
+
const pointInfo = ExpoGaodeMapModule.getPointAtDistance(normalizedSmoothMovePath, distance);
|
|
58
|
+
const point = pointInfo
|
|
59
|
+
? { latitude: pointInfo.latitude, longitude: pointInfo.longitude }
|
|
60
|
+
: normalizedSmoothMovePath[normalizedSmoothMovePath.length - 1];
|
|
61
|
+
const angle = pointInfo?.angle ?? 0;
|
|
62
|
+
props.onSmoothMoveProgress?.({
|
|
63
|
+
nativeEvent: {
|
|
64
|
+
position: point,
|
|
65
|
+
angle,
|
|
66
|
+
progress,
|
|
67
|
+
distance,
|
|
68
|
+
totalDistance,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
if (progress >= 1) {
|
|
72
|
+
props.onSmoothMoveEnd?.({
|
|
73
|
+
nativeEvent: {
|
|
74
|
+
position: point,
|
|
75
|
+
angle,
|
|
76
|
+
totalDistance,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
tick();
|
|
82
|
+
const intervalId = setInterval(() => {
|
|
83
|
+
tick();
|
|
84
|
+
if (Date.now() - startedAt >= durationMs) {
|
|
85
|
+
clearInterval(intervalId);
|
|
86
|
+
}
|
|
87
|
+
}, 100);
|
|
88
|
+
return () => clearInterval(intervalId);
|
|
89
|
+
}, [
|
|
90
|
+
normalizedSmoothMovePath,
|
|
91
|
+
props.onSmoothMoveEnd,
|
|
92
|
+
props.onSmoothMoveProgress,
|
|
93
|
+
props.smoothMoveDuration,
|
|
94
|
+
]);
|
|
55
95
|
const handleAutoMeasure = (event) => {
|
|
56
|
-
const nextWidth =
|
|
57
|
-
|
|
58
|
-
: Math.ceil(event.nativeEvent.layout.width);
|
|
59
|
-
const nextHeight = customViewHeight && customViewHeight > 0
|
|
60
|
-
? customViewHeight
|
|
61
|
-
: Math.ceil(event.nativeEvent.layout.height);
|
|
96
|
+
const nextWidth = Math.ceil(event.nativeEvent.layout.width);
|
|
97
|
+
const nextHeight = Math.ceil(event.nativeEvent.layout.height);
|
|
62
98
|
if (nextWidth === measuredSize.width && nextHeight === measuredSize.height) {
|
|
63
99
|
return;
|
|
64
100
|
}
|
|
@@ -69,59 +105,19 @@ function Marker(props) {
|
|
|
69
105
|
};
|
|
70
106
|
// 智能尺寸计算
|
|
71
107
|
const finalIconWidth = hasChildren
|
|
72
|
-
?
|
|
108
|
+
? resolvedContentWidth
|
|
73
109
|
: (iconWidth && iconWidth > 0 ? iconWidth : 40);
|
|
74
110
|
const finalIconHeight = hasChildren
|
|
75
|
-
?
|
|
111
|
+
? resolvedContentHeight
|
|
76
112
|
: (iconHeight && iconHeight > 0 ? iconHeight : 40);
|
|
77
113
|
const optionalNativeProps = cacheKey != null ? { cacheKey } : undefined;
|
|
78
|
-
return (<NativeMarkerView latitude={normalizedPosition.latitude} longitude={normalizedPosition.longitude} iconWidth={finalIconWidth} iconHeight={finalIconHeight}
|
|
79
|
-
{hasChildren && shouldWrapChildrenForMeasurement ? (<View collapsable={false} onLayout={
|
|
114
|
+
return (<NativeMarkerView {...restProps} {...optionalNativeProps} latitude={normalizedPosition.latitude} longitude={normalizedPosition.longitude} iconWidth={finalIconWidth} iconHeight={finalIconHeight} contentWidth={hasChildren ? finalIconWidth : 0} contentHeight={hasChildren ? finalIconHeight : 0} smoothMovePath={normalizedSmoothMovePath}>
|
|
115
|
+
{hasChildren && shouldWrapChildrenForMeasurement ? (<View collapsable={false} onLayout={handleAutoMeasure} style={styles.measureContainer}>
|
|
80
116
|
{children}
|
|
81
117
|
</View>) : children}
|
|
82
118
|
</NativeMarkerView>);
|
|
83
119
|
}
|
|
84
|
-
|
|
85
|
-
* 🔑 性能优化:极简比较函数
|
|
86
|
-
* 只检查最常变化的关键属性,减少 JS 线程开销
|
|
87
|
-
*/
|
|
88
|
-
function arePropsEqual(prevProps, nextProps) {
|
|
89
|
-
// 快速路径:比较 position (最常变化)
|
|
90
|
-
const prevPos = normalizeLatLng(prevProps.position);
|
|
91
|
-
const nextPos = normalizeLatLng(nextProps.position);
|
|
92
|
-
if (prevPos.latitude !== nextPos.latitude ||
|
|
93
|
-
prevPos.longitude !== nextPos.longitude) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
// 比较 cacheKey (如果提供了 cacheKey,其他属性理论上不会变)
|
|
97
|
-
if (prevProps.cacheKey !== nextProps.cacheKey) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
// 比较 children (如果有 children)
|
|
101
|
-
if (prevProps.children !== nextProps.children) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
// 比较自定义内容尺寸和图标尺寸
|
|
105
|
-
if (prevProps.customViewWidth !== nextProps.customViewWidth ||
|
|
106
|
-
prevProps.customViewHeight !== nextProps.customViewHeight ||
|
|
107
|
-
prevProps.icon !== nextProps.icon ||
|
|
108
|
-
prevProps.iconWidth !== nextProps.iconWidth ||
|
|
109
|
-
prevProps.iconHeight !== nextProps.iconHeight) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
// 比较 smoothMovePath (平滑移动路径)
|
|
113
|
-
if (!areSmoothMovePathsEqual(prevProps.smoothMovePath, nextProps.smoothMovePath)) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
// 比较 smoothMoveDuration (平滑移动时长)
|
|
117
|
-
if (prevProps.smoothMoveDuration !== nextProps.smoothMoveDuration) {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
// 其他属性相同,不重新渲染
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
// 导出优化后的组件
|
|
124
|
-
export default React.memo(Marker, arePropsEqual);
|
|
120
|
+
export default React.memo(Marker);
|
|
125
121
|
const styles = StyleSheet.create({
|
|
126
122
|
measureContainer: {
|
|
127
123
|
alignSelf: 'flex-start',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC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C,SAAS,KAAK,SAAS,CAAC,SAAS;QAC3C,SAAS,CAAC,UAAU,KAAK,SAAS,CAAC,UAAU,EAC7C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6BAA6B;IAC7B,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;QACjF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,iCAAiC;IACjC,IAAI,SAAS,CAAC,kBAAkB,KAAK,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe;IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAEjD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,gBAAgB,EAAE;QAChB,SAAS,EAAE,YAAY;QACvB,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,CAAC;KACd;CACF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { Platform, StyleSheet, View } from 'react-native';\nimport type { MarkerProps } from '../../types';\nimport { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\n\ntype NativeMarkerViewProps = Omit<MarkerProps, 'position'> & {\n latitude: number;\n longitude: number;\n};\n\nconst getNativeMarkerView = createLazyNativeViewManager<NativeMarkerViewProps>('MarkerView');\n\nconst AUTO_SIZE_FALLBACK = { width: 0, height: 0 };\n\nfunction areSmoothMovePathsEqual(\n prevPath: MarkerProps['smoothMovePath'],\n nextPath: MarkerProps['smoothMovePath']\n): boolean {\n if (prevPath === nextPath) {\n return true;\n }\n\n if (!prevPath || !nextPath) {\n return prevPath === nextPath;\n }\n\n if (prevPath.length !== nextPath.length) {\n return false;\n }\n\n for (let index = 0; index < prevPath.length; index += 1) {\n const prevPoint = normalizeLatLng(prevPath[index]);\n const nextPoint = normalizeLatLng(nextPath[index]);\n\n if (\n prevPoint.latitude !== nextPoint.latitude ||\n prevPoint.longitude !== nextPoint.longitude\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Marker 组件 - 完全声明式 API\n *\n * 支持:\n * - 自定义图标(icon)\n * - 自定义内容(children)- 自动测量尺寸\n * - 大头针样式(pinColor)\n * - 拖拽功能\n * - 所有事件回调\n */\nfunction Marker(props: MarkerProps) {\n const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);\n const [measuredSize, setMeasuredSize] = React.useState(AUTO_SIZE_FALLBACK);\n // 从 props 中排除 position 属性,避免传递到原生层\n const {\n position,\n customViewWidth,\n customViewHeight,\n iconWidth,\n iconHeight,\n children,\n smoothMovePath,\n cacheKey,\n ...restProps\n } = props;\n \n // 归一化坐标处理\n const normalizedPosition = normalizeLatLng(position);\n const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;\n\n // 根据是否有 children 来决定使用哪个尺寸属性\n const hasChildren = !!children;\n const shouldWrapChildrenForMeasurement = hasChildren;\n const shouldUseAutoMeasuredSize = Platform.OS === 'ios';\n const resolvedCustomViewWidth = customViewWidth && customViewWidth > 0\n ? customViewWidth\n : (shouldUseAutoMeasuredSize ? measuredSize.width : 0);\n const resolvedCustomViewHeight = customViewHeight && customViewHeight > 0\n ? customViewHeight\n : (shouldUseAutoMeasuredSize ? measuredSize.height : 0);\n\n const handleAutoMeasure = (event: LayoutChangeEvent) => {\n const nextWidth = customViewWidth && customViewWidth > 0\n ? customViewWidth\n : Math.ceil(event.nativeEvent.layout.width);\n const nextHeight = customViewHeight && customViewHeight > 0\n ? customViewHeight\n : Math.ceil(event.nativeEvent.layout.height);\n\n if (nextWidth === measuredSize.width && nextHeight === measuredSize.height) {\n return;\n }\n\n setMeasuredSize({\n width: nextWidth,\n height: nextHeight,\n });\n };\n \n // 智能尺寸计算\n const finalIconWidth = hasChildren\n ? resolvedCustomViewWidth\n : (iconWidth && iconWidth > 0 ? iconWidth : 40);\n \n const finalIconHeight = hasChildren\n ? resolvedCustomViewHeight\n : (iconHeight && iconHeight > 0 ? iconHeight : 40);\n\n const optionalNativeProps = cacheKey != null ? { cacheKey } : undefined;\n \n return (\n <NativeMarkerView\n latitude={normalizedPosition.latitude}\n longitude={normalizedPosition.longitude}\n iconWidth={finalIconWidth}\n iconHeight={finalIconHeight}\n customViewWidth={finalIconWidth}\n customViewHeight={finalIconHeight}\n smoothMovePath={normalizedSmoothMovePath}\n {...optionalNativeProps}\n {...restProps}\n >\n {hasChildren && shouldWrapChildrenForMeasurement ? (\n <View\n collapsable={false}\n onLayout={Platform.OS === 'ios' ? handleAutoMeasure : undefined}\n style={styles.measureContainer}\n >\n {children}\n </View>\n ) : children}\n </NativeMarkerView>\n );\n}\n\n/**\n * 🔑 性能优化:极简比较函数\n * 只检查最常变化的关键属性,减少 JS 线程开销\n */\nfunction arePropsEqual(prevProps: MarkerProps, nextProps: MarkerProps): boolean {\n // 快速路径:比较 position (最常变化)\n const prevPos = normalizeLatLng(prevProps.position);\n const nextPos = normalizeLatLng(nextProps.position);\n\n if (\n prevPos.latitude !== nextPos.latitude ||\n prevPos.longitude !== nextPos.longitude\n ) {\n return false;\n }\n \n // 比较 cacheKey (如果提供了 cacheKey,其他属性理论上不会变)\n if (prevProps.cacheKey !== nextProps.cacheKey) {\n return false;\n }\n \n // 比较 children (如果有 children)\n if (prevProps.children !== nextProps.children) {\n return false;\n }\n\n // 比较自定义内容尺寸和图标尺寸\n if (\n prevProps.customViewWidth !== nextProps.customViewWidth ||\n prevProps.customViewHeight !== nextProps.customViewHeight ||\n prevProps.icon !== nextProps.icon ||\n prevProps.iconWidth !== nextProps.iconWidth ||\n prevProps.iconHeight !== nextProps.iconHeight\n ) {\n return false;\n }\n \n // 比较 smoothMovePath (平滑移动路径)\n if (!areSmoothMovePathsEqual(prevProps.smoothMovePath, nextProps.smoothMovePath)) {\n return false;\n }\n \n // 比较 smoothMoveDuration (平滑移动时长)\n if (prevProps.smoothMoveDuration !== nextProps.smoothMoveDuration) {\n return false;\n }\n \n // 其他属性相同,不重新渲染\n return true;\n}\n\n// 导出优化后的组件\nexport default React.memo(Marker, arePropsEqual);\n\nconst styles = StyleSheet.create({\n measureContainer: {\n alignSelf: 'flex-start',\n alignItems: 'flex-start',\n flexShrink: 0,\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAShF,MAAM,mBAAmB,GAAG,2BAA2B,CAAwB,YAAY,CAAC,CAAC;AAE7F,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAEnD;;;;;;;;;GASG;AACH,SAAS,MAAM,CAAC,KAAkB;IAChC,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,mBAAmB,EAAE,EAAE,EAAE,CAAC,CAAC;IACxE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAC3E,mCAAmC;IACnC,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IAEV,UAAU;IACV,MAAM,kBAAkB,GAAG,eAAe,CAAC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,CAAC,cAAc,CAAC,CAC1B,UAAU,CAAC,CAAC,eAAe,CAAC,CAC5B,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/C,aAAa,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CACjD,cAAc,CAAC,CAAC,wBAAwB,CAAC,CAEzC;MAAA,CAAC,WAAW,IAAI,gCAAgC,CAAC,CAAC,CAAC,CACjD,CAAC,IAAI,CACH,WAAW,CAAC,CAAC,KAAK,CAAC,CACnB,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAC5B,KAAK,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAE/B;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,QAAQ,CACd;IAAA,EAAE,gBAAgB,CAAC,CACpB,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAElC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,gBAAgB,EAAE;QAChB,SAAS,EAAE,YAAY;QACvB,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,CAAC;KACd;CACF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { StyleSheet, View } from 'react-native';\nimport type { MarkerProps } from '../../types';\nimport ExpoGaodeMapModule from '../../ExpoGaodeMapModule';\nimport { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\n\ntype NativeMarkerViewProps = Omit<MarkerProps, 'position'> & {\n latitude: number;\n longitude: number;\n contentWidth?: number;\n contentHeight?: number;\n};\n\nconst getNativeMarkerView = createLazyNativeViewManager<NativeMarkerViewProps>('MarkerView');\n\nconst AUTO_SIZE_FALLBACK = { width: 0, height: 0 };\n\n/**\n * Marker 组件 - 完全声明式 API\n *\n * 支持:\n * - 自定义图标(icon)\n * - 自定义内容(children)- 自动测量尺寸\n * - 大头针样式(pinColor)\n * - 拖拽功能\n * - 所有事件回调\n */\nfunction Marker(props: MarkerProps) {\n const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);\n const [measuredSize, setMeasuredSize] = React.useState(AUTO_SIZE_FALLBACK);\n // 从 props 中排除 position 属性,避免传递到原生层\n const {\n position,\n iconWidth,\n iconHeight,\n children,\n smoothMovePath,\n cacheKey,\n ...restProps\n } = props;\n\n // 归一化坐标处理\n const normalizedPosition = normalizeLatLng(position);\n const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;\n\n // 根据是否有 children 来决定使用哪个尺寸属性\n const hasChildren = !!children;\n const shouldWrapChildrenForMeasurement = hasChildren;\n // Android 的 children marker 之前始终透传 0 尺寸,点击后重新快照时容易直接消失。\n // 统一走自动测量后,两个平台都会拿到稳定尺寸。\n const shouldUseAutoMeasuredSize = hasChildren;\n const resolvedContentWidth = shouldUseAutoMeasuredSize ? measuredSize.width : 0;\n const resolvedContentHeight = shouldUseAutoMeasuredSize ? measuredSize.height : 0;\n\n React.useEffect(() => {\n if (\n !normalizedSmoothMovePath ||\n normalizedSmoothMovePath.length < 2 ||\n !props.smoothMoveDuration ||\n props.smoothMoveDuration <= 0\n ) {\n return undefined;\n }\n\n const totalDistance = ExpoGaodeMapModule.calculatePathLength(normalizedSmoothMovePath);\n if (totalDistance <= 0) {\n props.onSmoothMoveEnd?.({\n nativeEvent: {\n position: normalizedSmoothMovePath[normalizedSmoothMovePath.length - 1],\n angle: 0,\n totalDistance,\n },\n } as never);\n return undefined;\n }\n\n const durationMs = props.smoothMoveDuration * 1000;\n const startedAt = Date.now();\n const tick = () => {\n const progress = Math.min(1, (Date.now() - startedAt) / durationMs);\n const distance = totalDistance * progress;\n const pointInfo = ExpoGaodeMapModule.getPointAtDistance(normalizedSmoothMovePath, distance);\n const point = pointInfo\n ? { latitude: pointInfo.latitude, longitude: pointInfo.longitude }\n : normalizedSmoothMovePath[normalizedSmoothMovePath.length - 1];\n const angle = pointInfo?.angle ?? 0;\n\n props.onSmoothMoveProgress?.({\n nativeEvent: {\n position: point,\n angle,\n progress,\n distance,\n totalDistance,\n },\n } as never);\n\n if (progress >= 1) {\n props.onSmoothMoveEnd?.({\n nativeEvent: {\n position: point,\n angle,\n totalDistance,\n },\n } as never);\n }\n };\n\n tick();\n const intervalId = setInterval(() => {\n tick();\n if (Date.now() - startedAt >= durationMs) {\n clearInterval(intervalId);\n }\n }, 100);\n\n return () => clearInterval(intervalId);\n }, [\n normalizedSmoothMovePath,\n props.onSmoothMoveEnd,\n props.onSmoothMoveProgress,\n props.smoothMoveDuration,\n ]);\n\n const handleAutoMeasure = (event: LayoutChangeEvent) => {\n const nextWidth = Math.ceil(event.nativeEvent.layout.width);\n const nextHeight = Math.ceil(event.nativeEvent.layout.height);\n\n if (nextWidth === measuredSize.width && nextHeight === measuredSize.height) {\n return;\n }\n\n setMeasuredSize({\n width: nextWidth,\n height: nextHeight,\n });\n };\n\n // 智能尺寸计算\n const finalIconWidth = hasChildren\n ? resolvedContentWidth\n : (iconWidth && iconWidth > 0 ? iconWidth : 40);\n\n const finalIconHeight = hasChildren\n ? resolvedContentHeight\n : (iconHeight && iconHeight > 0 ? iconHeight : 40);\n\n const optionalNativeProps = cacheKey != null ? { cacheKey } : undefined;\n\n return (\n <NativeMarkerView\n {...restProps}\n {...optionalNativeProps}\n latitude={normalizedPosition.latitude}\n longitude={normalizedPosition.longitude}\n iconWidth={finalIconWidth}\n iconHeight={finalIconHeight}\n contentWidth={hasChildren ? finalIconWidth : 0}\n contentHeight={hasChildren ? finalIconHeight : 0}\n smoothMovePath={normalizedSmoothMovePath}\n >\n {hasChildren && shouldWrapChildrenForMeasurement ? (\n <View\n collapsable={false}\n onLayout={handleAutoMeasure}\n style={styles.measureContainer}\n >\n {children}\n </View>\n ) : children}\n </NativeMarkerView>\n );\n}\n\nexport default React.memo(Marker);\n\nconst styles = StyleSheet.create({\n measureContainer: {\n alignSelf: 'flex-start',\n alignItems: 'flex-start',\n flexShrink: 0,\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polygon.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD;;;;;GAKG;AACH,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAOnC;;
|
|
1
|
+
{"version":3,"file":"Polygon.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD;;;;;GAKG;AACH,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAOnC;;AAED,wBAAmC"}
|
|
@@ -15,29 +15,5 @@ function Polygon(props) {
|
|
|
15
15
|
const normalizedPoints = normalizeLatLngList(points);
|
|
16
16
|
return <NativePolygonView points={normalizedPoints} {...restProps}/>;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
* 🔑 性能优化:浅比较关键属性
|
|
20
|
-
*/
|
|
21
|
-
function arePropsEqual(prevProps, nextProps) {
|
|
22
|
-
// 比较 points 数组引用(最常变化)
|
|
23
|
-
if (prevProps.points !== nextProps.points) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
// 比较样式属性
|
|
27
|
-
if (prevProps.strokeWidth !== nextProps.strokeWidth ||
|
|
28
|
-
prevProps.strokeColor !== nextProps.strokeColor ||
|
|
29
|
-
prevProps.fillColor !== nextProps.fillColor ||
|
|
30
|
-
prevProps.zIndex !== nextProps.zIndex ||
|
|
31
|
-
prevProps.simplificationTolerance !== nextProps.simplificationTolerance) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
// 比较回调
|
|
35
|
-
if (prevProps.onPolygonPress !== nextProps.onPolygonPress ||
|
|
36
|
-
prevProps.onPolygonSimplified !== nextProps.onPolygonSimplified) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
// 导出优化后的组件
|
|
42
|
-
export default React.memo(Polygon, arePropsEqual);
|
|
18
|
+
export default React.memo(Polygon);
|
|
43
19
|
//# sourceMappingURL=Polygon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polygon.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,MAAM,oBAAoB,GAAG,2BAA2B,CAAe,aAAa,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,SAAS,OAAO,CAAC,KAAmB;IAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1E,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACvC,UAAU;IACV,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACxE,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"Polygon.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,MAAM,oBAAoB,GAAG,2BAA2B,CAAe,aAAa,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,SAAS,OAAO,CAAC,KAAmB;IAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1E,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACvC,UAAU;IACV,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACxE,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { PolygonProps } from '../../types';\nimport { normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\nconst getNativePolygonView = createLazyNativeViewManager<PolygonProps>('PolygonView');\n\n/**\n * 渲染一个高德地图多边形覆盖物组件\n *\n * @param props - 多边形属性配置,继承自PolygonProps类型\n * @returns 高德地图原生多边形视图组件\n */\nfunction Polygon(props: PolygonProps) {\n const NativePolygonView = React.useMemo(() => getNativePolygonView(), []);\n const { points, ...restProps } = props;\n // 归一化坐标数组\n const normalizedPoints = normalizeLatLngList(points);\n\n return <NativePolygonView points={normalizedPoints} {...restProps} />;\n}\n\nexport default React.memo(Polygon);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polyline.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,qBAOrC;;
|
|
1
|
+
{"version":3,"file":"Polyline.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,qBAOrC;;AAED,wBAAoC"}
|
|
@@ -15,35 +15,5 @@ function Polyline(props) {
|
|
|
15
15
|
const normalizedPoints = normalizeLatLngList(points);
|
|
16
16
|
return <NativePolylineView points={normalizedPoints} {...restProps}/>;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
* 🔑 性能优化:浅比较关键属性
|
|
20
|
-
*/
|
|
21
|
-
function arePropsEqual(prevProps, nextProps) {
|
|
22
|
-
// 比较 points 数组引用(最常变化)
|
|
23
|
-
if (prevProps.points !== nextProps.points) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
// 比较样式属性
|
|
27
|
-
if (prevProps.strokeWidth !== nextProps.strokeWidth ||
|
|
28
|
-
prevProps.strokeColor !== nextProps.strokeColor ||
|
|
29
|
-
prevProps.zIndex !== nextProps.zIndex ||
|
|
30
|
-
prevProps.geodesic !== nextProps.geodesic ||
|
|
31
|
-
prevProps.dotted !== nextProps.dotted ||
|
|
32
|
-
prevProps.gradient !== nextProps.gradient ||
|
|
33
|
-
prevProps.simplificationTolerance !== nextProps.simplificationTolerance ||
|
|
34
|
-
prevProps.texture !== nextProps.texture) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
// 比较 colors 数组
|
|
38
|
-
if (prevProps.colors !== nextProps.colors) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
// 比较回调
|
|
42
|
-
if (prevProps.onPolylinePress !== nextProps.onPolylinePress) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
// 导出优化后的组件
|
|
48
|
-
export default React.memo(Polyline, arePropsEqual);
|
|
18
|
+
export default React.memo(Polyline);
|
|
49
19
|
//# sourceMappingURL=Polyline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polyline.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,MAAM,qBAAqB,GAAG,2BAA2B,CAAgB,cAAc,CAAC,CAAC;AAEzF;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAoB;IACpC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5E,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACvC,UAAU;IACV,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACzE,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"Polyline.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,MAAM,qBAAqB,GAAG,2BAA2B,CAAgB,cAAc,CAAC,CAAC;AAEzF;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAoB;IACpC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5E,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACvC,UAAU;IACV,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACzE,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { PolylineProps } from '../../types';\nimport { normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\nconst getNativePolylineView = createLazyNativeViewManager<PolylineProps>('PolylineView');\n\n/**\n * 渲染高德地图上的折线覆盖物组件\n *\n * @param props - 折线属性配置,继承自PolylineProps类型\n * @returns 高德地图原生折线视图组件\n */\nfunction Polyline(props: PolylineProps) {\n const NativePolylineView = React.useMemo(() => getNativePolylineView(), []);\n const { points, ...restProps } = props;\n // 归一化坐标数组\n const normalizedPoints = normalizeLatLngList(points);\n \n return <NativePolylineView points={normalizedPoints} {...restProps} />;\n}\n\nexport default React.memo(Polyline);\n"]}
|
package/build/map/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PermissionUtils, LocationPermissionType } from './utils/PermissionUtils';
|
|
1
2
|
export * from './types';
|
|
2
3
|
export { default as ExpoGaodeMapModule } from './ExpoGaodeMapModule';
|
|
3
4
|
export { default as MapView } from './ExpoGaodeMapView';
|
|
@@ -8,8 +9,11 @@ export { ErrorHandler, ErrorLogger, GaodeMapError, ErrorType, } from './utils/Er
|
|
|
8
9
|
export type { ErrorDetails } from './utils/ErrorHandler';
|
|
9
10
|
export { PlatformDetector, DeviceType, FoldState, isAndroid14Plus, isiOS17Plus, isTablet, isFoldable, isIPad, } from './utils/PlatformDetector';
|
|
10
11
|
export type { DeviceInfo, SystemVersion } from './utils/PlatformDetector';
|
|
11
|
-
export { PermissionUtils,
|
|
12
|
-
|
|
12
|
+
export { PermissionUtils, LocationPermissionType };
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated 请使用 `PermissionUtils`
|
|
15
|
+
*/
|
|
16
|
+
export declare const PermissionManager: typeof PermissionUtils;
|
|
13
17
|
export { FoldableMapView, useFoldableMap, } from './components/FoldableMapView';
|
|
14
18
|
export type { FoldableMapViewProps, FoldableConfig, } from './components/FoldableMapView';
|
|
15
19
|
export { OfflineMapManager as ExpoGaodeMapOfflineModule } from './utils/OfflineMapManager';
|
package/build/map/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAGjC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,OAAO,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,OAAO,GACR,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,eAAe,EACf,WAAW,EACX,QAAQ,EACR,UAAU,EACV,MAAM,GACP,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,iBAAiB,wBAAkB,CAAC;AAGjD,OAAO,EACL,eAAe,EACf,cAAc,GACf,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,oBAAoB,EACpB,cAAc,GACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAE3F,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAM/B;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,wOAGjC,CAAA;AAGF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
|
package/build/map/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPermissionHook } from 'expo-modules-core';
|
|
2
2
|
import ExpoGaodeMapModuleWithHelpers from './ExpoGaodeMapModule';
|
|
3
|
+
import { PermissionUtils, LocationPermissionType, } from './utils/PermissionUtils';
|
|
3
4
|
// 导出类型定义(包含所有通用类型)
|
|
4
5
|
export * from './types';
|
|
5
6
|
// 导出原生模块
|
|
@@ -15,8 +16,11 @@ export { ErrorHandler, ErrorLogger, GaodeMapError, ErrorType, } from './utils/Er
|
|
|
15
16
|
// 导出平台检测工具
|
|
16
17
|
export { PlatformDetector, DeviceType, FoldState, isAndroid14Plus, isiOS17Plus, isTablet, isFoldable, isIPad, } from './utils/PlatformDetector';
|
|
17
18
|
// 导出权限工具类(仅提供文案和诊断,实际权限请求使用 ExpoGaodeMapModule)
|
|
18
|
-
export { PermissionUtils,
|
|
19
|
-
|
|
19
|
+
export { PermissionUtils, LocationPermissionType };
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated 请使用 `PermissionUtils`
|
|
22
|
+
*/
|
|
23
|
+
export const PermissionManager = PermissionUtils;
|
|
20
24
|
// 导出折叠屏适配组件
|
|
21
25
|
export { FoldableMapView, useFoldableMap, } from './components/FoldableMapView';
|
|
22
26
|
// 导出离线地图 API
|
package/build/map/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,6BAA6B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,6BAA6B,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,mBAAmB;AACnB,cAAc,SAAS,CAAC;AACxB,SAAS;AACT,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAErE,WAAW;AACX,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,UAAU;AACV,OAAO,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,OAAO,GACR,MAAM,uBAAuB,CAAC;AAE/B,WAAW;AACX,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,sBAAsB,CAAC;AAG9B,WAAW;AACX,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,eAAe,EACf,WAAW,EACX,QAAQ,EACR,UAAU,EACV,MAAM,GACP,MAAM,0BAA0B,CAAC;AAGlC,gDAAgD;AAChD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEjD,YAAY;AACZ,OAAO,EACL,eAAe,EACf,cAAc,GACf,MAAM,8BAA8B,CAAC;AAMtC,aAAa;AACb,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAe3F,MAAM,uBAAuB,GAAG,6BAA6B,CAAC,yBAAyB,CAAA;AACvF,MAAM,mBAAmB,GAAG,6BAA6B,CAAC,uBAAuB,CAAA;AAGjF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;IACzD,SAAS,EAAE,mBAAmB;IAC9B,aAAa,EAAE,uBAAuB;CACvC,CAAC,CAAA;AAEF,yBAAyB;AACzB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["\nimport { createPermissionHook } from 'expo-modules-core';\nimport ExpoGaodeMapModuleWithHelpers from './ExpoGaodeMapModule';\nimport {\n PermissionUtils,\n LocationPermissionType,\n} from './utils/PermissionUtils';\n\n// 导出类型定义(包含所有通用类型)\nexport * from './types';\n// 导出原生模块\nexport { default as ExpoGaodeMapModule } from './ExpoGaodeMapModule';\n\n// 导出地图视图组件\nexport { default as MapView } from './ExpoGaodeMapView';\nexport { useMap } from './components/MapContext';\nexport { MapUI } from './components/MapUI';\n\n// 导出覆盖物组件\nexport {\n Marker,\n Polyline,\n Polygon,\n Circle,\n HeatMap,\n MultiPoint,\n Cluster,\n} from './components/overlays';\n\n// 导出错误处理工具\nexport {\n ErrorHandler,\n ErrorLogger,\n GaodeMapError,\n ErrorType,\n} from './utils/ErrorHandler';\nexport type { ErrorDetails } from './utils/ErrorHandler';\n\n// 导出平台检测工具\nexport {\n PlatformDetector,\n DeviceType,\n FoldState,\n isAndroid14Plus,\n isiOS17Plus,\n isTablet,\n isFoldable,\n isIPad,\n} from './utils/PlatformDetector';\nexport type { DeviceInfo, SystemVersion } from './utils/PlatformDetector';\n\n// 导出权限工具类(仅提供文案和诊断,实际权限请求使用 ExpoGaodeMapModule)\nexport { PermissionUtils, LocationPermissionType };\n\n/**\n * @deprecated 请使用 `PermissionUtils`\n */\nexport const PermissionManager = PermissionUtils;\n\n// 导出折叠屏适配组件\nexport {\n FoldableMapView,\n useFoldableMap,\n} from './components/FoldableMapView';\nexport type {\n FoldableMapViewProps,\n FoldableConfig,\n} from './components/FoldableMapView';\n\n// 导出离线地图 API\nexport { OfflineMapManager as ExpoGaodeMapOfflineModule } from './utils/OfflineMapManager';\n\nexport type {\n OfflineMapInfo,\n OfflineMapStatus,\n OfflineMapDownloadConfig,\n OfflineMapDownloadEvent,\n OfflineMapCompleteEvent,\n OfflineMapErrorEvent,\n OfflineMapPausedEvent,\n OfflineMapCancelledEvent,\n OfflineMapStorageInfo,\n OfflineMapEvents,\n} from './types/offline.types';\n\nconst requestPermissionsAsync = ExpoGaodeMapModuleWithHelpers.requestLocationPermission\nconst getPermissionsAsync = ExpoGaodeMapModuleWithHelpers.checkLocationPermission\n\n\n/**\n * Check or request permissions to access the location.\n * This uses both `requestPermissionsAsync` and `getPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = useLocationPermissions();\n * ```\n */\nexport const useLocationPermissions = createPermissionHook({\n getMethod: getPermissionsAsync,\n requestMethod: requestPermissionsAsync,\n})\n\n// 导出便捷读取的 SDK 配置与 webKey\nexport { getSDKConfig, getWebKey } from './ExpoGaodeMapModule';\n"]}
|
|
@@ -8,6 +8,6 @@ export type { LocationEvent, CameraEvent, MapViewProps, MapViewMethods, MapViewR
|
|
|
8
8
|
export type { Coordinates, ReGeocode, LocationOptions, LocationListener, GeoLanguage, LocationProtocol, } from './location.types';
|
|
9
9
|
export { LocationAccuracy, LocationMode, CoordinateType, } from './location.types';
|
|
10
10
|
export type { MarkerProps, PolylineProps, PolygonProps, CircleProps, HeatMapProps, MultiPointItem, MultiPointProps, ClusterParams, ClusterPoint, ClusterProps, } from './overlays.types';
|
|
11
|
-
export type { ExpoGaodeMapModule } from '
|
|
12
|
-
export type { FitToCoordinatesOptions } from './route-playback.types';
|
|
11
|
+
export type { ExpoGaodeMapModule } from '../ExpoGaodeMapModule';
|
|
12
|
+
export type { FitToCoordinatesOptions, SmoothMoveEndEvent, SmoothMoveProgressEvent, } from './route-playback.types';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/map/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,KAAK,EACL,MAAM,EACN,WAAW,EACX,MAAM,EACN,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACT,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,cAAc,EACd,UAAU,EACV,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/map/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,KAAK,EACL,MAAM,EACN,WAAW,EACX,MAAM,EACN,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACT,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,cAAc,EACd,UAAU,EACV,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/map/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAsBzC,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC","sourcesContent":["/**\n * 高德地图 Expo Module 类型定义统一导出\n * 基于 Expo Modules API 重新设计\n */\n\n// 通用类型\nexport type {\n Point,\n LatLng,\n LatLngPoint,\n MapPoi,\n LatLngBounds,\n CameraPosition,\n CameraUpdate,\n ColorValue,\n SDKConfig,\n PermissionStatus,\n} from './common.types';\n\nexport { MapType } from './common.types';\n\n// 地图视图类型\nexport type {\n LocationEvent,\n CameraEvent,\n MapViewProps,\n MapViewMethods,\n MapViewRef,\n ExpoGaodeMapModuleEvents,\n} from './map-view.types';\n\n// 定位类型\nexport type {\n Coordinates,\n ReGeocode,\n LocationOptions,\n LocationListener,\n GeoLanguage,\n LocationProtocol,\n} from './location.types';\n\nexport {\n LocationAccuracy,\n LocationMode,\n CoordinateType,\n} from './location.types';\n\n// 覆盖物类型\nexport type {\n MarkerProps,\n PolylineProps,\n PolygonProps,\n CircleProps,\n HeatMapProps,\n MultiPointItem,\n MultiPointProps,\n ClusterParams,\n ClusterPoint,\n ClusterProps,\n} from './overlays.types';\n\n//
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/map/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAsBzC,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC","sourcesContent":["/**\n * 高德地图 Expo Module 类型定义统一导出\n * 基于 Expo Modules API 重新设计\n */\n\n// 通用类型\nexport type {\n Point,\n LatLng,\n LatLngPoint,\n MapPoi,\n LatLngBounds,\n CameraPosition,\n CameraUpdate,\n ColorValue,\n SDKConfig,\n PermissionStatus,\n} from './common.types';\n\nexport { MapType } from './common.types';\n\n// 地图视图类型\nexport type {\n LocationEvent,\n CameraEvent,\n MapViewProps,\n MapViewMethods,\n MapViewRef,\n ExpoGaodeMapModuleEvents,\n} from './map-view.types';\n\n// 定位类型\nexport type {\n Coordinates,\n ReGeocode,\n LocationOptions,\n LocationListener,\n GeoLanguage,\n LocationProtocol,\n} from './location.types';\n\nexport {\n LocationAccuracy,\n LocationMode,\n CoordinateType,\n} from './location.types';\n\n// 覆盖物类型\nexport type {\n MarkerProps,\n PolylineProps,\n PolygonProps,\n CircleProps,\n HeatMapProps,\n MultiPointItem,\n MultiPointProps,\n ClusterParams,\n ClusterPoint,\n ClusterProps,\n} from './overlays.types';\n\n// 模块 facade 类型\nexport type { ExpoGaodeMapModule } from '../ExpoGaodeMapModule';\nexport type {\n FitToCoordinatesOptions,\n SmoothMoveEndEvent,\n SmoothMoveProgressEvent,\n} from './route-playback.types';\n"]}
|
|
@@ -21,18 +21,7 @@ export interface ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvent
|
|
|
21
21
|
*/
|
|
22
22
|
initSDK(config: SDKConfig): void;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @deprecated 请优先使用 `setPrivacyConfig`
|
|
26
|
-
*/
|
|
27
|
-
setPrivacyShow(hasShow: boolean, hasContainsPrivacy?: boolean): void;
|
|
28
|
-
/**
|
|
29
|
-
* 设置用户是否同意隐私政策
|
|
30
|
-
* @deprecated 请优先使用 `setPrivacyConfig`
|
|
31
|
-
*/
|
|
32
|
-
setPrivacyAgree(hasAgree: boolean): void;
|
|
33
|
-
/**
|
|
34
|
-
* 一次性设置完整的隐私状态
|
|
35
|
-
* 推荐作为业务层唯一入口调用
|
|
24
|
+
* 一次性同步完整隐私状态
|
|
36
25
|
*/
|
|
37
26
|
setPrivacyConfig(config: PrivacyConfig): void;
|
|
38
27
|
/**
|
|
@@ -228,6 +217,16 @@ export interface ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvent
|
|
|
228
217
|
* @returns 两点之间的距离(单位:米)
|
|
229
218
|
*/
|
|
230
219
|
distanceBetweenCoordinates(coordinate1: LatLngPoint, coordinate2: LatLngPoint): number;
|
|
220
|
+
/**
|
|
221
|
+
* 根据多个坐标点计算可同时可见的推荐缩放级别
|
|
222
|
+
* @param points 坐标点集合(至少 1 个)
|
|
223
|
+
* @param viewportWidthPx 视口宽度(像素)
|
|
224
|
+
* @param viewportHeightPx 视口高度(像素)
|
|
225
|
+
* @param paddingPx 内边距(像素)
|
|
226
|
+
* @param minZoom 最小缩放
|
|
227
|
+
* @param maxZoom 最大缩放
|
|
228
|
+
*/
|
|
229
|
+
calculateFitZoom(points: LatLngPoint[], viewportWidthPx: number, viewportHeightPx: number, paddingPx: number, minZoom: number, maxZoom: number): number;
|
|
231
230
|
/**
|
|
232
231
|
* 判断点是否在圆内
|
|
233
232
|
* @param point 要判断的点
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-module.types.d.ts","sourceRoot":"","sources":["../../../src/map/types/native-module.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,MAAM,WAAW,kBAAmB,SAAQ,YAAY,CAAC,wBAAwB,CAAC;IAChF;;OAEG;IACH,WAAW,CAAC,CAAC,SAAS,MAAM,wBAAwB,EAClD,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CAAC,GACpC;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAC1B,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GACrC;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAG1B;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IAEjC
|
|
1
|
+
{"version":3,"file":"native-module.types.d.ts","sourceRoot":"","sources":["../../../src/map/types/native-module.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,MAAM,WAAW,kBAAmB,SAAQ,YAAY,CAAC,wBAAwB,CAAC;IAChF;;OAEG;IACH,WAAW,CAAC,CAAC,SAAS,MAAM,wBAAwB,EAClD,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CAAC,GACpC;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAC1B,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GACrC;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAG1B;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,gBAAgB,CAA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E,GAAG,IAAI,CAAC;IAEtF;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAE5E;;;;;OAKG;IACH,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,GAAG,WAAW,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;IAE/F;;;;;OAKG;IACH,mBAAmB,CACjB,MAAM,EAAE,KAAK,CAAC,WAAW,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAChD,cAAc,EAAE,MAAM,GACrB,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-module.types.js","sourceRoot":"","sources":["../../../src/map/types/native-module.types.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * 高德地图原生模块类型定义\n */\n\nimport type { NativeModule } from 'expo';\n\nimport type {\n LatLng,\n PrivacyConfig,\n PrivacyStatus,\n SDKConfig,\n PermissionStatus,\n LatLngPoint,\n} from './common.types';\nimport type {\n CoordinateType,\n Coordinates,\n ReGeocode,\n LocationMode,\n LocationAccuracy,\n LocationListener,\n} from './location.types';\nimport type { ExpoGaodeMapModuleEvents } from './map-view.types';\n\nexport interface ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {\n /**\n * 原生事件订阅方法\n */\n addListener<K extends keyof ExpoGaodeMapModuleEvents>(\n eventName: K,\n listener: ExpoGaodeMapModuleEvents[K],\n ): { remove: () => void };\n addListener(\n eventName: string,\n listener: (...args: unknown[]) => void,\n ): { remove: () => void };\n\n\n /**\n * 初始化高德地图 SDK\n * @param config SDK 配置参数,包含 Android 和 iOS 的 API Key\n */\n initSDK(config: SDKConfig): void;\n\n /**\n * 设置是否显示隐私政策弹窗\n * @deprecated 请优先使用 `setPrivacyConfig`\n */\n setPrivacyShow(hasShow: boolean, hasContainsPrivacy?: boolean): void;\n\n /**\n * 设置用户是否同意隐私政策\n * @deprecated 请优先使用 `setPrivacyConfig`\n */\n setPrivacyAgree(hasAgree: boolean): void;\n\n /**\n * 一次性设置完整的隐私状态\n * 推荐作为业务层唯一入口调用\n */\n setPrivacyConfig(config: PrivacyConfig): void;\n\n /**\n * 设置当前隐私协议版本,用于在协议变更时使旧同意失效\n */\n setPrivacyVersion(version: string): void;\n\n /**\n * 清空已持久化的隐私同意状态\n */\n resetPrivacyConsent(): void;\n\n /**\n * 获取当前隐私政策状态\n */\n getPrivacyStatus(): PrivacyStatus;\n\n /**\n * 设置是否加载世界向量地图(海外地图)\n * 必须在地图初始化之前调用\n * 世界地图为高级服务,需要开通相关权限\n */\n setLoadWorldVectorMap(enabled: boolean): void;\n\n /**\n * 获取高德地图 SDK 版本号\n * @returns SDK 版本字符串\n */\n getVersion(): string;\n\n /**\n * 开始连续定位\n * 启动后会持续接收位置更新,通过 onLocationUpdate 事件回调\n */\n start(): void;\n\n /**\n * 停止定位\n * 停止接收位置更新\n */\n stop(): void;\n\n /**\n * 检查是否正在定位\n * @returns 是否正在定位\n */\n isStarted(): Promise<boolean>;\n\n /**\n * 获取当前位置(单次定位)\n * @returns 位置信息,包含坐标和可选的逆地理编码信息\n */\n getCurrentLocation(): Promise<Coordinates | ReGeocode>;\n\n /**\n * 坐标转换\n * 将其他坐标系的坐标转换为高德地图使用的 GCJ-02 坐标系\n * @param coordinate 需要转换的坐标\n * @param type 原坐标系类型\n */\n coordinateConvert(coordinate: LatLngPoint, type: CoordinateType): Promise<LatLng>;\n\n\n /**\n * 设置是否返回逆地理编码信息\n * @param isReGeocode true: 返回地址信息; false: 只返回坐标\n */\n setLocatingWithReGeocode(isReGeocode: boolean): void;\n\n /**\n * 设置定位模式(Android)\n * @param mode 定位模式:高精度/低功耗/仅设备\n */\n setLocationMode(mode: LocationMode): void;\n\n /**\n * 设置定位间隔(毫秒)\n * @param interval 定位间隔时间,单位毫秒,默认 2000ms\n */\n setInterval(interval: number): void;\n\n /**\n * 设置是否单次定位(Android)\n * @param isOnceLocation true: 单次定位; false: 连续定位\n */\n setOnceLocation(isOnceLocation: boolean): void;\n\n /**\n * 设置是否使用设备传感器(Android)\n * @param sensorEnable true: 使用传感器; false: 不使用\n */\n setSensorEnable(sensorEnable: boolean): void;\n\n /**\n * 设置是否允许 WiFi 扫描(Android)\n * @param wifiScan true: 允许; false: 不允许\n */\n setWifiScan(wifiScan: boolean): void;\n\n /**\n * 设置是否 GPS 优先(Android)\n * @param gpsFirst true: GPS 优先; false: 网络优先\n */\n setGpsFirst(gpsFirst: boolean): void;\n\n /**\n * 设置是否等待 WiFi 列表刷新(Android)\n * @param onceLocationLatest true: 等待; false: 不等待\n */\n setOnceLocationLatest(onceLocationLatest: boolean): void;\n\n /**\n * 设置逆地理编码语言\n * @param language 语言代码,如 \"zh-CN\", \"en\"\n */\n setGeoLanguage(language: string): void;\n\n /**\n * 设置是否使用缓存策略(Android)\n * @param locationCacheEnable true: 使用缓存; false: 不使用\n */\n setLocationCacheEnable(locationCacheEnable: boolean): void;\n\n /**\n * 设置网络请求超时时间(Android)\n * @param httpTimeOut 超时时间,单位毫秒\n */\n setHttpTimeOut(httpTimeOut: number): void;\n\n /**\n * 设置期望的定位精度(iOS)\n * @param accuracy 精度级别:最佳/10米/100米/1公里/3公里\n */\n setDesiredAccuracy(accuracy: LocationAccuracy): void;\n\n /**\n * 设置定位超时时间(秒)\n * @param timeout 超时时间,单位秒,默认 10 秒\n */\n setLocationTimeout(timeout: number): void;\n\n /**\n * 设置逆地理编码超时时间(秒)\n * @param timeout 超时时间,单位秒,默认 5 秒\n */\n setReGeocodeTimeout(timeout: number): void;\n\n /**\n * 设置距离过滤器(米)(iOS)\n * 只有移动超过指定距离才会更新位置\n * @param distance 距离阈值,单位米\n */\n setDistanceFilter(distance: number): void;\n\n /**\n * 设置是否自动暂停位置更新(iOS)\n * @param pauses true: 自动暂停; false: 不暂停\n */\n setPausesLocationUpdatesAutomatically(pauses: boolean): void;\n\n /**\n * 设置是否允许后台定位(iOS)\n * @param allows true: 允许; false: 不允许\n */\n setAllowsBackgroundLocationUpdates(allows: boolean): void;\n\n /**\n * iOS 是否已启用后台定位配置\n */\n readonly isBackgroundLocationEnabled: boolean;\n\n /**\n * 设置定位协议\n * @param protocol 协议类型\n */\n setLocationProtocol(protocol: string): void;\n\n /**\n * 开始更新设备方向(罗盘朝向)(iOS)\n */\n startUpdatingHeading(): void;\n\n /**\n * 停止更新设备方向(iOS)\n */\n stopUpdatingHeading(): void;\n\n /**\n * 检查前台位置权限状态(增强版)\n * @returns 详细的权限状态信息\n */\n checkLocationPermission(): Promise<PermissionStatus>;\n\n /**\n * 请求前台位置权限(增强版)\n * @returns 请求后的权限状态\n */\n requestLocationPermission(): Promise<PermissionStatus>;\n\n /**\n * 请求后台位置权限(Android 10+、iOS)\n * 注意:必须在前台权限已授予后才能请求\n * @returns 请求后的权限状态\n */\n requestBackgroundLocationPermission(): Promise<PermissionStatus>;\n\n /**\n * 打开应用设置页面\n * 引导用户手动授予权限(当权限被永久拒绝时使用)\n */\n openAppSettings(): void;\n\n /**\n * 检查原生 SDK 是否已配置 API Key\n * @returns 是否已配置\n */\n isNativeSDKConfigured(): boolean;\n\n /**\n * 添加定位监听器(便捷方法)\n * 封装原生事件订阅,返回带 remove 的订阅对象\n */\n addLocationListener(listener: LocationListener): { remove: () => void };\n\n /**\n * 计算两个坐标点之间的距离\n * @param coordinate1 第一个坐标点\n * @param coordinate2 第二个坐标点\n * @returns 两点之间的距离(单位:米)\n */\n distanceBetweenCoordinates(coordinate1: LatLngPoint, coordinate2: LatLngPoint): number;\n\n // ==================== 几何计算 ====================\n\n /**\n * 判断点是否在圆内\n * @param point 要判断的点\n * @param center 圆心坐标\n * @param radius 圆半径(单位:米)\n * @returns 是否在圆内\n */\n isPointInCircle(point: LatLngPoint, center: LatLngPoint, radius: number): boolean;\n\n /**\n * 判断点是否在多边形内\n * @param point 要判断的点\n * @param polygon 多边形的顶点坐标数组,支持嵌套数组(多边形空洞)\n * @returns 是否在多边形内\n */\n isPointInPolygon(point: LatLngPoint, polygon: LatLngPoint[] | LatLngPoint[][]): boolean;\n\n /**\n * 计算多边形面积\n * @param polygon 多边形的顶点坐标数组,支持嵌套数组(多边形空洞,会自动展平计算)\n * @returns 面积(单位:平方米)\n */\n calculatePolygonArea(polygon: LatLngPoint[] | LatLngPoint[][]): number;\n\n /**\n * 计算矩形面积\n * @param southWest 西南角坐标\n * @param northEast 东北角坐标\n * @returns 面积(单位:平方米)\n */\n calculateRectangleArea(southWest: LatLngPoint, northEast: LatLngPoint): number;\n\n /**\n * 获取路径上距离目标点最近的点\n * @param path 路径点集合\n * @param target 目标点\n * @returns 最近点信息,包含坐标、索引和距离\n */\n getNearestPointOnPath(path: LatLngPoint[], target: LatLngPoint): {\n latitude: number;\n longitude: number;\n index: number;\n distanceMeters: number;\n } | null;\n\n /**\n * 计算多边形质心\n * @param polygon 多边形顶点坐标数组,支持嵌套数组\n * @returns 质心坐标\n */\n calculateCentroid(polygon: LatLngPoint[] | LatLngPoint[][]): LatLng | null;\n\n /**\n * 计算路径边界和中心点\n * @param points 路径点\n * @returns 边界和中心点\n */\n calculatePathBounds(points: LatLngPoint[]): {\n north: number;\n south: number;\n east: number;\n west: number;\n center: LatLngPoint;\n } | null;\n\n /**\n * GeoHash 编码\n * @param coordinate 坐标点\n * @param precision 精度 (1-12)\n * @returns GeoHash 字符串\n */\n encodeGeoHash(coordinate: LatLngPoint, precision: number): string;\n\n /**\n * 轨迹抽稀 (RDP 算法)\n * @param points 原始轨迹点\n * @param tolerance 允许误差(米)\n * @returns 简化后的轨迹点\n */\n simplifyPolyline(points: LatLngPoint[], tolerance: number): LatLng[];\n\n /**\n * 计算路径总长度\n * @param points 路径点\n * @returns 长度(米)\n */\n calculatePathLength(points: LatLngPoint[]): number;\n\n /**\n * 解析高德地图 API 返回的 Polyline 字符串\n * 格式: \"lng,lat;lng,lat;...\"\n * @param polylineStr 高德原始 polyline 字符串,或包含 polyline 属性的对象\n * @returns 解析后的点集\n */\n parsePolyline(polylineStr: string | { polyline: string }): LatLng[];\n\n /**\n * 获取路径上指定距离的点\n * @param points 路径点\n * @param distance 距离起点的米数\n * @returns 点信息(坐标+角度)\n */\n getPointAtDistance(points: LatLngPoint[], distance: number): {\n latitude: number;\n longitude: number;\n angle: number;\n } | null;\n\n /**\n * 瓦片坐标转换:经纬度 -> 瓦片坐标\n * @param coordinate 坐标点\n * @param zoom 缩放级别\n * @returns 瓦片坐标 (x, y, z)\n */\n latLngToTile(coordinate: LatLngPoint, zoom: number): { x: number; y: number; z: number } | null;\n\n /**\n * 瓦片坐标转换:瓦片坐标 -> 经纬度\n * @param tile 瓦片坐标 (x, y, z)\n * @returns 经纬度\n */\n tileToLatLng(tile: { x: number; y: number; z: number }): LatLng | null;\n\n /**\n * 像素坐标转换:经纬度 -> 像素坐标\n * @param coordinate 坐标点\n * @param zoom 缩放级别\n * @returns 像素坐标 (x, y)\n */\n latLngToPixel(coordinate: LatLngPoint, zoom: number): { x: number; y: number } | null;\n\n /**\n * 像素坐标转换:像素坐标 -> 经纬度\n * @param pixel 像素坐标 (x, y)\n * @param zoom 缩放级别\n * @returns 经纬度\n */\n pixelToLatLng(pixel: { x: number; y: number }, zoom: number): LatLng | null;\n\n /**\n * 批量地理围栏检测\n * @param point 待检测点\n * @param polygons 多边形集合 (支持嵌套)\n * @returns 包含该点的多边形索引,若不在任何多边形内返回 -1\n */\n findPointInPolygons(point: LatLngPoint, polygons: LatLngPoint[][] | LatLngPoint[][][]): number;\n\n /**\n * 生成热力图网格数据 (C++ 加速)\n * @param points 点集,包含权重\n * @param gridSizeMeters 网格大小(米)\n * @returns 聚合后的网格点\n */\n generateHeatmapGrid(\n points: Array<LatLngPoint & { weight?: number }>,\n gridSizeMeters: number\n ): Array<{ latitude: number; longitude: number; intensity: number }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"native-module.types.js","sourceRoot":"","sources":["../../../src/map/types/native-module.types.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * 高德地图原生模块类型定义\n */\n\nimport type { NativeModule } from 'expo';\n\nimport type {\n LatLng,\n PrivacyConfig,\n PrivacyStatus,\n SDKConfig,\n PermissionStatus,\n LatLngPoint,\n} from './common.types';\nimport type {\n CoordinateType,\n Coordinates,\n ReGeocode,\n LocationMode,\n LocationAccuracy,\n LocationListener,\n} from './location.types';\nimport type { ExpoGaodeMapModuleEvents } from './map-view.types';\n\nexport interface ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {\n /**\n * 原生事件订阅方法\n */\n addListener<K extends keyof ExpoGaodeMapModuleEvents>(\n eventName: K,\n listener: ExpoGaodeMapModuleEvents[K],\n ): { remove: () => void };\n addListener(\n eventName: string,\n listener: (...args: unknown[]) => void,\n ): { remove: () => void };\n\n\n /**\n * 初始化高德地图 SDK\n * @param config SDK 配置参数,包含 Android 和 iOS 的 API Key\n */\n initSDK(config: SDKConfig): void;\n\n /**\n * 一次性同步完整隐私状态\n */\n setPrivacyConfig(config: PrivacyConfig): void;\n\n /**\n * 设置当前隐私协议版本,用于在协议变更时使旧同意失效\n */\n setPrivacyVersion(version: string): void;\n\n /**\n * 清空已持久化的隐私同意状态\n */\n resetPrivacyConsent(): void;\n\n /**\n * 获取当前隐私政策状态\n */\n getPrivacyStatus(): PrivacyStatus;\n\n /**\n * 设置是否加载世界向量地图(海外地图)\n * 必须在地图初始化之前调用\n * 世界地图为高级服务,需要开通相关权限\n */\n setLoadWorldVectorMap(enabled: boolean): void;\n\n /**\n * 获取高德地图 SDK 版本号\n * @returns SDK 版本字符串\n */\n getVersion(): string;\n\n /**\n * 开始连续定位\n * 启动后会持续接收位置更新,通过 onLocationUpdate 事件回调\n */\n start(): void;\n\n /**\n * 停止定位\n * 停止接收位置更新\n */\n stop(): void;\n\n /**\n * 检查是否正在定位\n * @returns 是否正在定位\n */\n isStarted(): Promise<boolean>;\n\n /**\n * 获取当前位置(单次定位)\n * @returns 位置信息,包含坐标和可选的逆地理编码信息\n */\n getCurrentLocation(): Promise<Coordinates | ReGeocode>;\n\n /**\n * 坐标转换\n * 将其他坐标系的坐标转换为高德地图使用的 GCJ-02 坐标系\n * @param coordinate 需要转换的坐标\n * @param type 原坐标系类型\n */\n coordinateConvert(coordinate: LatLngPoint, type: CoordinateType): Promise<LatLng>;\n\n\n /**\n * 设置是否返回逆地理编码信息\n * @param isReGeocode true: 返回地址信息; false: 只返回坐标\n */\n setLocatingWithReGeocode(isReGeocode: boolean): void;\n\n /**\n * 设置定位模式(Android)\n * @param mode 定位模式:高精度/低功耗/仅设备\n */\n setLocationMode(mode: LocationMode): void;\n\n /**\n * 设置定位间隔(毫秒)\n * @param interval 定位间隔时间,单位毫秒,默认 2000ms\n */\n setInterval(interval: number): void;\n\n /**\n * 设置是否单次定位(Android)\n * @param isOnceLocation true: 单次定位; false: 连续定位\n */\n setOnceLocation(isOnceLocation: boolean): void;\n\n /**\n * 设置是否使用设备传感器(Android)\n * @param sensorEnable true: 使用传感器; false: 不使用\n */\n setSensorEnable(sensorEnable: boolean): void;\n\n /**\n * 设置是否允许 WiFi 扫描(Android)\n * @param wifiScan true: 允许; false: 不允许\n */\n setWifiScan(wifiScan: boolean): void;\n\n /**\n * 设置是否 GPS 优先(Android)\n * @param gpsFirst true: GPS 优先; false: 网络优先\n */\n setGpsFirst(gpsFirst: boolean): void;\n\n /**\n * 设置是否等待 WiFi 列表刷新(Android)\n * @param onceLocationLatest true: 等待; false: 不等待\n */\n setOnceLocationLatest(onceLocationLatest: boolean): void;\n\n /**\n * 设置逆地理编码语言\n * @param language 语言代码,如 \"zh-CN\", \"en\"\n */\n setGeoLanguage(language: string): void;\n\n /**\n * 设置是否使用缓存策略(Android)\n * @param locationCacheEnable true: 使用缓存; false: 不使用\n */\n setLocationCacheEnable(locationCacheEnable: boolean): void;\n\n /**\n * 设置网络请求超时时间(Android)\n * @param httpTimeOut 超时时间,单位毫秒\n */\n setHttpTimeOut(httpTimeOut: number): void;\n\n /**\n * 设置期望的定位精度(iOS)\n * @param accuracy 精度级别:最佳/10米/100米/1公里/3公里\n */\n setDesiredAccuracy(accuracy: LocationAccuracy): void;\n\n /**\n * 设置定位超时时间(秒)\n * @param timeout 超时时间,单位秒,默认 10 秒\n */\n setLocationTimeout(timeout: number): void;\n\n /**\n * 设置逆地理编码超时时间(秒)\n * @param timeout 超时时间,单位秒,默认 5 秒\n */\n setReGeocodeTimeout(timeout: number): void;\n\n /**\n * 设置距离过滤器(米)(iOS)\n * 只有移动超过指定距离才会更新位置\n * @param distance 距离阈值,单位米\n */\n setDistanceFilter(distance: number): void;\n\n /**\n * 设置是否自动暂停位置更新(iOS)\n * @param pauses true: 自动暂停; false: 不暂停\n */\n setPausesLocationUpdatesAutomatically(pauses: boolean): void;\n\n /**\n * 设置是否允许后台定位(iOS)\n * @param allows true: 允许; false: 不允许\n */\n setAllowsBackgroundLocationUpdates(allows: boolean): void;\n\n /**\n * iOS 是否已启用后台定位配置\n */\n readonly isBackgroundLocationEnabled: boolean;\n\n /**\n * 设置定位协议\n * @param protocol 协议类型\n */\n setLocationProtocol(protocol: string): void;\n\n /**\n * 开始更新设备方向(罗盘朝向)(iOS)\n */\n startUpdatingHeading(): void;\n\n /**\n * 停止更新设备方向(iOS)\n */\n stopUpdatingHeading(): void;\n\n /**\n * 检查前台位置权限状态(增强版)\n * @returns 详细的权限状态信息\n */\n checkLocationPermission(): Promise<PermissionStatus>;\n\n /**\n * 请求前台位置权限(增强版)\n * @returns 请求后的权限状态\n */\n requestLocationPermission(): Promise<PermissionStatus>;\n\n /**\n * 请求后台位置权限(Android 10+、iOS)\n * 注意:必须在前台权限已授予后才能请求\n * @returns 请求后的权限状态\n */\n requestBackgroundLocationPermission(): Promise<PermissionStatus>;\n\n /**\n * 打开应用设置页面\n * 引导用户手动授予权限(当权限被永久拒绝时使用)\n */\n openAppSettings(): void;\n\n /**\n * 检查原生 SDK 是否已配置 API Key\n * @returns 是否已配置\n */\n isNativeSDKConfigured(): boolean;\n\n /**\n * 添加定位监听器(便捷方法)\n * 封装原生事件订阅,返回带 remove 的订阅对象\n */\n addLocationListener(listener: LocationListener): { remove: () => void };\n\n /**\n * 计算两个坐标点之间的距离\n * @param coordinate1 第一个坐标点\n * @param coordinate2 第二个坐标点\n * @returns 两点之间的距离(单位:米)\n */\n distanceBetweenCoordinates(coordinate1: LatLngPoint, coordinate2: LatLngPoint): number;\n\n /**\n * 根据多个坐标点计算可同时可见的推荐缩放级别\n * @param points 坐标点集合(至少 1 个)\n * @param viewportWidthPx 视口宽度(像素)\n * @param viewportHeightPx 视口高度(像素)\n * @param paddingPx 内边距(像素)\n * @param minZoom 最小缩放\n * @param maxZoom 最大缩放\n */\n calculateFitZoom(\n points: LatLngPoint[],\n viewportWidthPx: number,\n viewportHeightPx: number,\n paddingPx: number,\n minZoom: number,\n maxZoom: number\n ): number;\n\n // ==================== 几何计算 ====================\n\n /**\n * 判断点是否在圆内\n * @param point 要判断的点\n * @param center 圆心坐标\n * @param radius 圆半径(单位:米)\n * @returns 是否在圆内\n */\n isPointInCircle(point: LatLngPoint, center: LatLngPoint, radius: number): boolean;\n\n /**\n * 判断点是否在多边形内\n * @param point 要判断的点\n * @param polygon 多边形的顶点坐标数组,支持嵌套数组(多边形空洞)\n * @returns 是否在多边形内\n */\n isPointInPolygon(point: LatLngPoint, polygon: LatLngPoint[] | LatLngPoint[][]): boolean;\n\n /**\n * 计算多边形面积\n * @param polygon 多边形的顶点坐标数组,支持嵌套数组(多边形空洞,会自动展平计算)\n * @returns 面积(单位:平方米)\n */\n calculatePolygonArea(polygon: LatLngPoint[] | LatLngPoint[][]): number;\n\n /**\n * 计算矩形面积\n * @param southWest 西南角坐标\n * @param northEast 东北角坐标\n * @returns 面积(单位:平方米)\n */\n calculateRectangleArea(southWest: LatLngPoint, northEast: LatLngPoint): number;\n\n /**\n * 获取路径上距离目标点最近的点\n * @param path 路径点集合\n * @param target 目标点\n * @returns 最近点信息,包含坐标、索引和距离\n */\n getNearestPointOnPath(path: LatLngPoint[], target: LatLngPoint): {\n latitude: number;\n longitude: number;\n index: number;\n distanceMeters: number;\n } | null;\n\n /**\n * 计算多边形质心\n * @param polygon 多边形顶点坐标数组,支持嵌套数组\n * @returns 质心坐标\n */\n calculateCentroid(polygon: LatLngPoint[] | LatLngPoint[][]): LatLng | null;\n\n /**\n * 计算路径边界和中心点\n * @param points 路径点\n * @returns 边界和中心点\n */\n calculatePathBounds(points: LatLngPoint[]): {\n north: number;\n south: number;\n east: number;\n west: number;\n center: LatLngPoint;\n } | null;\n\n /**\n * GeoHash 编码\n * @param coordinate 坐标点\n * @param precision 精度 (1-12)\n * @returns GeoHash 字符串\n */\n encodeGeoHash(coordinate: LatLngPoint, precision: number): string;\n\n /**\n * 轨迹抽稀 (RDP 算法)\n * @param points 原始轨迹点\n * @param tolerance 允许误差(米)\n * @returns 简化后的轨迹点\n */\n simplifyPolyline(points: LatLngPoint[], tolerance: number): LatLng[];\n\n /**\n * 计算路径总长度\n * @param points 路径点\n * @returns 长度(米)\n */\n calculatePathLength(points: LatLngPoint[]): number;\n\n /**\n * 解析高德地图 API 返回的 Polyline 字符串\n * 格式: \"lng,lat;lng,lat;...\"\n * @param polylineStr 高德原始 polyline 字符串,或包含 polyline 属性的对象\n * @returns 解析后的点集\n */\n parsePolyline(polylineStr: string | { polyline: string }): LatLng[];\n\n /**\n * 获取路径上指定距离的点\n * @param points 路径点\n * @param distance 距离起点的米数\n * @returns 点信息(坐标+角度)\n */\n getPointAtDistance(points: LatLngPoint[], distance: number): {\n latitude: number;\n longitude: number;\n angle: number;\n } | null;\n\n /**\n * 瓦片坐标转换:经纬度 -> 瓦片坐标\n * @param coordinate 坐标点\n * @param zoom 缩放级别\n * @returns 瓦片坐标 (x, y, z)\n */\n latLngToTile(coordinate: LatLngPoint, zoom: number): { x: number; y: number; z: number } | null;\n\n /**\n * 瓦片坐标转换:瓦片坐标 -> 经纬度\n * @param tile 瓦片坐标 (x, y, z)\n * @returns 经纬度\n */\n tileToLatLng(tile: { x: number; y: number; z: number }): LatLng | null;\n\n /**\n * 像素坐标转换:经纬度 -> 像素坐标\n * @param coordinate 坐标点\n * @param zoom 缩放级别\n * @returns 像素坐标 (x, y)\n */\n latLngToPixel(coordinate: LatLngPoint, zoom: number): { x: number; y: number } | null;\n\n /**\n * 像素坐标转换:像素坐标 -> 经纬度\n * @param pixel 像素坐标 (x, y)\n * @param zoom 缩放级别\n * @returns 经纬度\n */\n pixelToLatLng(pixel: { x: number; y: number }, zoom: number): LatLng | null;\n\n /**\n * 批量地理围栏检测\n * @param point 待检测点\n * @param polygons 多边形集合 (支持嵌套)\n * @returns 包含该点的多边形索引,若不在任何多边形内返回 -1\n */\n findPointInPolygons(point: LatLngPoint, polygons: LatLngPoint[][] | LatLngPoint[][][]): number;\n\n /**\n * 生成热力图网格数据 (C++ 加速)\n * @param points 点集,包含权重\n * @param gridSizeMeters 网格大小(米)\n * @returns 聚合后的网格点\n */\n generateHeatmapGrid(\n points: Array<LatLngPoint & { weight?: number }>,\n gridSizeMeters: number\n ): Array<{ latitude: number; longitude: number; intensity: number }>;\n}\n"]}
|