expo-gaode-map 2.2.32 → 2.2.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +2 -3
  2. package/android/src/main/cpp/cluster_jni.cpp +56 -0
  3. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapModule.kt +45 -6
  4. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapOfflineModule.kt +1 -1
  5. package/android/src/main/java/expo/modules/gaodemap/modules/SDKInitializer.kt +23 -17
  6. package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerBitmapRenderer.kt +30 -16
  7. package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerView.kt +36 -31
  8. package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerViewModule.kt +6 -6
  9. package/android/src/main/java/expo/modules/gaodemap/utils/GeometryUtils.kt +103 -0
  10. package/build/ExpoGaodeMapModule.d.ts +9 -259
  11. package/build/ExpoGaodeMapModule.d.ts.map +1 -1
  12. package/build/ExpoGaodeMapModule.js +19 -910
  13. package/build/ExpoGaodeMapModule.js.map +1 -1
  14. package/build/ExpoGaodeMapView.d.ts +3 -4
  15. package/build/ExpoGaodeMapView.d.ts.map +1 -1
  16. package/build/ExpoGaodeMapView.js +28 -25
  17. package/build/ExpoGaodeMapView.js.map +1 -1
  18. package/build/components/overlays/Circle.d.ts.map +1 -1
  19. package/build/components/overlays/Circle.js +1 -30
  20. package/build/components/overlays/Circle.js.map +1 -1
  21. package/build/components/overlays/Cluster.d.ts.map +1 -1
  22. package/build/components/overlays/Cluster.js +1 -42
  23. package/build/components/overlays/Cluster.js.map +1 -1
  24. package/build/components/overlays/HeatMap.d.ts.map +1 -1
  25. package/build/components/overlays/HeatMap.js +1 -20
  26. package/build/components/overlays/HeatMap.js.map +1 -1
  27. package/build/components/overlays/Marker.d.ts.map +1 -1
  28. package/build/components/overlays/Marker.js +14 -80
  29. package/build/components/overlays/Marker.js.map +1 -1
  30. package/build/components/overlays/Polygon.d.ts.map +1 -1
  31. package/build/components/overlays/Polygon.js +1 -25
  32. package/build/components/overlays/Polygon.js.map +1 -1
  33. package/build/components/overlays/Polyline.d.ts.map +1 -1
  34. package/build/components/overlays/Polyline.js +1 -31
  35. package/build/components/overlays/Polyline.js.map +1 -1
  36. package/build/index.d.ts +6 -2
  37. package/build/index.d.ts.map +1 -1
  38. package/build/index.js +6 -2
  39. package/build/index.js.map +1 -1
  40. package/build/module/geometry.d.ts +183 -0
  41. package/build/module/geometry.d.ts.map +1 -0
  42. package/build/module/geometry.js +374 -0
  43. package/build/module/geometry.js.map +1 -0
  44. package/build/module/location.d.ts +49 -0
  45. package/build/module/location.d.ts.map +1 -0
  46. package/build/module/location.js +257 -0
  47. package/build/module/location.js.map +1 -0
  48. package/build/module/nativeModule.d.ts +5 -0
  49. package/build/module/nativeModule.d.ts.map +1 -0
  50. package/build/module/nativeModule.js +34 -0
  51. package/build/module/nativeModule.js.map +1 -0
  52. package/build/module/normalizers.d.ts +9 -0
  53. package/build/module/normalizers.d.ts.map +1 -0
  54. package/build/module/normalizers.js +109 -0
  55. package/build/module/normalizers.js.map +1 -0
  56. package/build/module/privacy.d.ts +20 -0
  57. package/build/module/privacy.d.ts.map +1 -0
  58. package/build/module/privacy.js +59 -0
  59. package/build/module/privacy.js.map +1 -0
  60. package/build/module/sdk.d.ts +20 -0
  61. package/build/module/sdk.d.ts.map +1 -0
  62. package/build/module/sdk.js +82 -0
  63. package/build/module/sdk.js.map +1 -0
  64. package/build/types/index.d.ts +1 -1
  65. package/build/types/index.js.map +1 -1
  66. package/build/types/native-module.types.d.ts +12 -16
  67. package/build/types/native-module.types.d.ts.map +1 -1
  68. package/build/types/native-module.types.js.map +1 -1
  69. package/build/types/overlays.types.d.ts +0 -16
  70. package/build/types/overlays.types.d.ts.map +1 -1
  71. package/build/types/overlays.types.js.map +1 -1
  72. package/build/types/route-playback.types.d.ts +3 -0
  73. package/build/types/route-playback.types.d.ts.map +1 -1
  74. package/build/types/route-playback.types.js.map +1 -1
  75. package/build/utils/RouteUtils.d.ts +1 -1
  76. package/build/utils/RouteUtils.d.ts.map +1 -1
  77. package/build/utils/RouteUtils.js +35 -1
  78. package/build/utils/RouteUtils.js.map +1 -1
  79. package/ios/ExpoGaodeMapModule.swift +38 -6
  80. package/ios/ExpoGaodeMapView.swift +10 -3
  81. package/ios/GaodeMapPrivacyManager.swift +26 -18
  82. package/ios/modules/LocationManager.swift +1 -1
  83. package/ios/overlays/MarkerView.swift +36 -25
  84. package/ios/overlays/MarkerViewModule.swift +4 -4
  85. package/ios/utils/ClusterNative.h +8 -0
  86. package/ios/utils/ClusterNative.mm +27 -0
  87. package/package.json +3 -1
  88. package/scripts/check-expo-modules.js +68 -0
  89. package/shared/cpp/GeometryEngine.cpp +112 -0
  90. package/shared/cpp/GeometryEngine.hpp +21 -0
  91. package/shared/cpp/tests/test_main.cpp +15 -0
@@ -1,30 +1,10 @@
1
1
  import * as React from 'react';
2
- import { Platform, StyleSheet, View } from 'react-native';
2
+ import { StyleSheet, View } from 'react-native';
3
3
  import ExpoGaodeMapModule from '../../ExpoGaodeMapModule';
4
4
  import { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';
5
5
  import { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';
6
6
  const getNativeMarkerView = createLazyNativeViewManager('MarkerView');
7
7
  const AUTO_SIZE_FALLBACK = { width: 0, height: 0 };
8
- function areSmoothMovePathsEqual(prevPath, nextPath) {
9
- if (prevPath === nextPath) {
10
- return true;
11
- }
12
- if (!prevPath || !nextPath) {
13
- return prevPath === nextPath;
14
- }
15
- if (prevPath.length !== nextPath.length) {
16
- return false;
17
- }
18
- for (let index = 0; index < prevPath.length; index += 1) {
19
- const prevPoint = normalizeLatLng(prevPath[index]);
20
- const nextPoint = normalizeLatLng(nextPath[index]);
21
- if (prevPoint.latitude !== nextPoint.latitude ||
22
- prevPoint.longitude !== nextPoint.longitude) {
23
- return false;
24
- }
25
- }
26
- return true;
27
- }
28
8
  /**
29
9
  * Marker 组件 - 完全声明式 API
30
10
  *
@@ -39,20 +19,18 @@ function Marker(props) {
39
19
  const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);
40
20
  const [measuredSize, setMeasuredSize] = React.useState(AUTO_SIZE_FALLBACK);
41
21
  // 从 props 中排除 position 属性,避免传递到原生层
42
- const { position, customViewWidth, customViewHeight, iconWidth, iconHeight, children, smoothMovePath, cacheKey, ...restProps } = props;
22
+ const { position, iconWidth, iconHeight, children, smoothMovePath, cacheKey, ...restProps } = props;
43
23
  // 归一化坐标处理
44
24
  const normalizedPosition = normalizeLatLng(position);
45
25
  const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;
46
26
  // 根据是否有 children 来决定使用哪个尺寸属性
47
27
  const hasChildren = !!children;
48
28
  const shouldWrapChildrenForMeasurement = hasChildren;
49
- const shouldUseAutoMeasuredSize = Platform.OS === 'ios';
50
- const resolvedCustomViewWidth = customViewWidth && customViewWidth > 0
51
- ? customViewWidth
52
- : (shouldUseAutoMeasuredSize ? measuredSize.width : 0);
53
- const resolvedCustomViewHeight = customViewHeight && customViewHeight > 0
54
- ? customViewHeight
55
- : (shouldUseAutoMeasuredSize ? measuredSize.height : 0);
29
+ // Android children marker 之前始终透传 0 尺寸,点击后重新快照时容易直接消失。
30
+ // 统一走自动测量后,两个平台都会拿到稳定尺寸。
31
+ const shouldUseAutoMeasuredSize = hasChildren;
32
+ const resolvedContentWidth = shouldUseAutoMeasuredSize ? measuredSize.width : 0;
33
+ const resolvedContentHeight = shouldUseAutoMeasuredSize ? measuredSize.height : 0;
56
34
  React.useEffect(() => {
57
35
  if (!normalizedSmoothMovePath ||
58
36
  normalizedSmoothMovePath.length < 2 ||
@@ -115,12 +93,8 @@ function Marker(props) {
115
93
  props.smoothMoveDuration,
116
94
  ]);
117
95
  const handleAutoMeasure = (event) => {
118
- const nextWidth = customViewWidth && customViewWidth > 0
119
- ? customViewWidth
120
- : Math.ceil(event.nativeEvent.layout.width);
121
- const nextHeight = customViewHeight && customViewHeight > 0
122
- ? customViewHeight
123
- : Math.ceil(event.nativeEvent.layout.height);
96
+ const nextWidth = Math.ceil(event.nativeEvent.layout.width);
97
+ const nextHeight = Math.ceil(event.nativeEvent.layout.height);
124
98
  if (nextWidth === measuredSize.width && nextHeight === measuredSize.height) {
125
99
  return;
126
100
  }
@@ -131,59 +105,19 @@ function Marker(props) {
131
105
  };
132
106
  // 智能尺寸计算
133
107
  const finalIconWidth = hasChildren
134
- ? resolvedCustomViewWidth
108
+ ? resolvedContentWidth
135
109
  : (iconWidth && iconWidth > 0 ? iconWidth : 40);
136
110
  const finalIconHeight = hasChildren
137
- ? resolvedCustomViewHeight
111
+ ? resolvedContentHeight
138
112
  : (iconHeight && iconHeight > 0 ? iconHeight : 40);
139
113
  const optionalNativeProps = cacheKey != null ? { cacheKey } : undefined;
140
- return (<NativeMarkerView latitude={normalizedPosition.latitude} longitude={normalizedPosition.longitude} iconWidth={finalIconWidth} iconHeight={finalIconHeight} customViewWidth={finalIconWidth} customViewHeight={finalIconHeight} smoothMovePath={normalizedSmoothMovePath} {...optionalNativeProps} {...restProps}>
141
- {hasChildren && shouldWrapChildrenForMeasurement ? (<View collapsable={false} onLayout={Platform.OS === 'ios' ? handleAutoMeasure : undefined} style={styles.measureContainer}>
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}>
142
116
  {children}
143
117
  </View>) : children}
144
118
  </NativeMarkerView>);
145
119
  }
146
- /**
147
- * 🔑 性能优化:极简比较函数
148
- * 只检查最常变化的关键属性,减少 JS 线程开销
149
- */
150
- function arePropsEqual(prevProps, nextProps) {
151
- // 快速路径:比较 position (最常变化)
152
- const prevPos = normalizeLatLng(prevProps.position);
153
- const nextPos = normalizeLatLng(nextProps.position);
154
- if (prevPos.latitude !== nextPos.latitude ||
155
- prevPos.longitude !== nextPos.longitude) {
156
- return false;
157
- }
158
- // 比较 cacheKey (如果提供了 cacheKey,其他属性理论上不会变)
159
- if (prevProps.cacheKey !== nextProps.cacheKey) {
160
- return false;
161
- }
162
- // 比较 children (如果有 children)
163
- if (prevProps.children !== nextProps.children) {
164
- return false;
165
- }
166
- // 比较自定义内容尺寸和图标尺寸
167
- if (prevProps.customViewWidth !== nextProps.customViewWidth ||
168
- prevProps.customViewHeight !== nextProps.customViewHeight ||
169
- prevProps.icon !== nextProps.icon ||
170
- prevProps.iconWidth !== nextProps.iconWidth ||
171
- prevProps.iconHeight !== nextProps.iconHeight) {
172
- return false;
173
- }
174
- // 比较 smoothMovePath (平滑移动路径)
175
- if (!areSmoothMovePathsEqual(prevProps.smoothMovePath, nextProps.smoothMovePath)) {
176
- return false;
177
- }
178
- // 比较 smoothMoveDuration (平滑移动时长)
179
- if (prevProps.smoothMoveDuration !== nextProps.smoothMoveDuration) {
180
- return false;
181
- }
182
- // 其他属性相同,不重新渲染
183
- return true;
184
- }
185
- // 导出优化后的组件
186
- export default React.memo(Marker, arePropsEqual);
120
+ export default React.memo(Marker);
187
121
  const styles = StyleSheet.create({
188
122
  measureContainer: {
189
123
  alignSelf: 'flex-start',
@@ -1 +1 @@
1
- {"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../src/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,mBAAm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M,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 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};\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 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 = 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/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,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AY;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/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;;AA8BD,wBAAkD"}
1
+ {"version":3,"file":"Polygon.d.ts","sourceRoot":"","sources":["../../../src/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/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;;GAEG;AACH,SAAS,aAAa,CAAC,SAAuB,EAAE,SAAuB;IACrE,uBAAuB;IACvB,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS;IACT,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,CAAC,WAAW;QAC/C,SAAS,CAAC,WAAW,KAAK,SAAS,CAAC,WAAW;QAC/C,SAAS,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS;QAC3C,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;QACrC,SAAS,CAAC,uBAAuB,KAAK,SAAS,CAAC,uBAAuB,EAAE,CAAC;QAC5E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO;IACP,IAAI,SAAS,CAAC,cAAc,KAAK,SAAS,CAAC,cAAc;QACrD,SAAS,CAAC,mBAAmB,KAAK,SAAS,CAAC,mBAAmB,EAAE,CAAC;QACpE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,eAAe,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,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\n/**\n * 🔑 性能优化:浅比较关键属性\n */\nfunction arePropsEqual(prevProps: PolygonProps, nextProps: PolygonProps): boolean {\n // 比较 points 数组引用(最常变化)\n if (prevProps.points !== nextProps.points) {\n return false;\n }\n \n // 比较样式属性\n if (prevProps.strokeWidth !== nextProps.strokeWidth ||\n prevProps.strokeColor !== nextProps.strokeColor ||\n prevProps.fillColor !== nextProps.fillColor ||\n prevProps.zIndex !== nextProps.zIndex ||\n prevProps.simplificationTolerance !== nextProps.simplificationTolerance) {\n return false;\n }\n \n // 比较回调\n if (prevProps.onPolygonPress !== nextProps.onPolygonPress ||\n prevProps.onPolygonSimplified !== nextProps.onPolygonSimplified) {\n return false;\n }\n \n return true;\n}\n\n// 导出优化后的组件\nexport default React.memo(Polygon, arePropsEqual);\n"]}
1
+ {"version":3,"file":"Polygon.js","sourceRoot":"","sources":["../../../src/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/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;;AAqCD,wBAAmD"}
1
+ {"version":3,"file":"Polyline.d.ts","sourceRoot":"","sources":["../../../src/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/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;;GAEG;AACH,SAAS,aAAa,CAAC,SAAwB,EAAE,SAAwB;IACvE,uBAAuB;IACvB,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS;IACT,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,CAAC,WAAW;QAC/C,SAAS,CAAC,WAAW,KAAK,SAAS,CAAC,WAAW;QAC/C,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;QACrC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;QACzC,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;QACrC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;QACzC,SAAS,CAAC,uBAAuB,KAAK,SAAS,CAAC,uBAAuB;QACvE,SAAS,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe;IACf,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO;IACP,IAAI,SAAS,CAAC,eAAe,KAAK,SAAS,CAAC,eAAe,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,eAAe,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,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\n/**\n * 🔑 性能优化:浅比较关键属性\n */\nfunction arePropsEqual(prevProps: PolylineProps, nextProps: PolylineProps): boolean {\n // 比较 points 数组引用(最常变化)\n if (prevProps.points !== nextProps.points) {\n return false;\n }\n \n // 比较样式属性\n if (prevProps.strokeWidth !== nextProps.strokeWidth ||\n prevProps.strokeColor !== nextProps.strokeColor ||\n prevProps.zIndex !== nextProps.zIndex ||\n prevProps.geodesic !== nextProps.geodesic ||\n prevProps.dotted !== nextProps.dotted ||\n prevProps.gradient !== nextProps.gradient ||\n prevProps.simplificationTolerance !== nextProps.simplificationTolerance ||\n prevProps.texture !== nextProps.texture) {\n return false;\n }\n\n // 比较 colors 数组\n if (prevProps.colors !== nextProps.colors) {\n return false;\n }\n \n // 比较回调\n if (prevProps.onPolylinePress !== nextProps.onPolylinePress) {\n return false;\n }\n \n return true;\n}\n\n// 导出优化后的组件\nexport default React.memo(Polyline, arePropsEqual);\n"]}
1
+ {"version":3,"file":"Polyline.js","sourceRoot":"","sources":["../../../src/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/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';
@@ -11,8 +12,11 @@ export { ErrorHandler, ErrorLogger, GaodeMapError, ErrorType, } from './utils/Er
11
12
  export type { ErrorDetails } from './utils/ErrorHandler';
12
13
  export { PlatformDetector, DeviceType, FoldState, isAndroid14Plus, isiOS17Plus, isTablet, isFoldable, isIPad, } from './utils/PlatformDetector';
13
14
  export type { DeviceInfo, SystemVersion } from './utils/PlatformDetector';
14
- export { PermissionUtils, PermissionManager, // 向后兼容的别名
15
- LocationPermissionType, } from './utils/PermissionUtils';
15
+ export { PermissionUtils, LocationPermissionType };
16
+ /**
17
+ * @deprecated 请使用 `PermissionUtils`
18
+ */
19
+ export declare const PermissionManager: typeof PermissionUtils;
16
20
  export { FoldableMapView, useFoldableMap, } from './components/FoldableMapView';
17
21
  export type { FoldableMapViewProps, FoldableConfig, } from './components/FoldableMapView';
18
22
  export { default as ExpoGaodeMapOfflineModule } from './utils/OfflineMapManager';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,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;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,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,CA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/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
  // 导出原生模块
@@ -18,8 +19,11 @@ export { ErrorHandler, ErrorLogger, GaodeMapError, ErrorType, } from './utils/Er
18
19
  // 导出平台检测工具
19
20
  export { PlatformDetector, DeviceType, FoldState, isAndroid14Plus, isiOS17Plus, isTablet, isFoldable, isIPad, } from './utils/PlatformDetector';
20
21
  // 导出权限工具类(仅提供文案和诊断,实际权限请求使用 ExpoGaodeMapModule)
21
- export { PermissionUtils, PermissionManager, // 向后兼容的别名
22
- LocationPermissionType, } from './utils/PermissionUtils';
22
+ export { PermissionUtils, LocationPermissionType };
23
+ /**
24
+ * @deprecated 请使用 `PermissionUtils`
25
+ */
26
+ export const PermissionManager = PermissionUtils;
23
27
  // 导出折叠屏适配组件
24
28
  export { FoldableMapView, useFoldableMap, } from './components/FoldableMapView';
25
29
  // 导出离线地图 API
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,6BAA6B,MAAM,sBAAsB,CAAC;AAEjE,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;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OA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-modules-core';\nimport ExpoGaodeMapModuleWithHelpers from './ExpoGaodeMapModule';\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';\nexport { RouteOverlay } from './components/RouteOverlay';\nexport { AreaMaskOverlay } from './components/AreaMaskOverlay';\nexport { useRoutePlayback } from './hooks/useRoutePlayback';\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 {\n PermissionUtils,\n PermissionManager, // 向后兼容的别名\n LocationPermissionType,\n} from './utils/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 { default 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';\nexport {\n buildLatLngBounds,\n fitCameraToCoordinates,\n getRouteBounds,\n parseMultiRingPolyline,\n} from './utils/RouteUtils';\n\n// 默认导出原生模块\nexport { default } from './ExpoGaodeMapModule';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/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;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,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,OAAO,IAAI,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAejF,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;AAC/D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,EACd,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,WAAW;AACX,OAAO,EAAE,OAAO,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';\nexport { RouteOverlay } from './components/RouteOverlay';\nexport { AreaMaskOverlay } from './components/AreaMaskOverlay';\nexport { useRoutePlayback } from './hooks/useRoutePlayback';\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 { default 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';\nexport {\n buildLatLngBounds,\n fitCameraToCoordinates,\n getRouteBounds,\n parseMultiRingPolyline,\n} from './utils/RouteUtils';\n\n// 默认导出原生模块\nexport { default } from './ExpoGaodeMapModule';\n"]}
@@ -0,0 +1,183 @@
1
+ import type { LatLng, LatLngPoint } from '../types';
2
+ export declare const geometryMethods: {
3
+ /**
4
+ * 计算两个坐标点之间的距离
5
+ * @param coordinate1 第一个坐标点
6
+ * @param coordinate2 第二个坐标点
7
+ * @returns 两点之间的距离(单位:米)
8
+ */
9
+ distanceBetweenCoordinates(coordinate1: LatLngPoint, coordinate2: LatLngPoint): number;
10
+ /**
11
+ * 根据多个坐标点计算可同时可见的推荐缩放级别
12
+ * @param points 坐标点集合(至少 1 个)
13
+ * @param options 视口与缩放边界选项
14
+ * @returns 推荐 zoom
15
+ */
16
+ calculateFitZoom(points: LatLngPoint[], options?: {
17
+ viewportWidthPx?: number;
18
+ viewportHeightPx?: number;
19
+ paddingPx?: number;
20
+ minZoom?: number;
21
+ maxZoom?: number;
22
+ }): number;
23
+ /**
24
+ * 判断点是否在圆内
25
+ * @param point 要判断的点
26
+ * @param center 圆心坐标
27
+ * @param radius 圆半径(单位:米)
28
+ * @returns 是否在圆内
29
+ */
30
+ isPointInCircle(point: LatLngPoint, center: LatLngPoint, radius: number): boolean;
31
+ /**
32
+ * 判断点是否在多边形内
33
+ * @param point 要判断的点
34
+ * @param polygon 多边形的顶点坐标数组,支持嵌套数组(多边形空洞)
35
+ * @returns 是否在多边形内
36
+ */
37
+ isPointInPolygon(point: LatLngPoint, polygon: LatLngPoint[] | LatLngPoint[][]): boolean;
38
+ /**
39
+ * 计算多边形面积
40
+ * @param polygon 多边形的顶点坐标数组,支持嵌套数组(多边形空洞)
41
+ * @returns 面积(单位:平方米)
42
+ */
43
+ calculatePolygonArea(polygon: LatLngPoint[] | LatLngPoint[][]): number;
44
+ /**
45
+ * 计算矩形面积
46
+ * @param southWest 西南角坐标
47
+ * @param northEast 东北角坐标
48
+ * @returns 面积(单位:平方米)
49
+ */
50
+ calculateRectangleArea(southWest: LatLngPoint, northEast: LatLngPoint): number;
51
+ /**
52
+ * 获取路径上距离目标点最近的点
53
+ * @param path 路径点集合
54
+ * @param target 目标点
55
+ * @returns 最近点信息,包含坐标、索引和距离
56
+ */
57
+ getNearestPointOnPath(path: LatLngPoint[], target: LatLngPoint): {
58
+ latitude: number;
59
+ longitude: number;
60
+ index: number;
61
+ distanceMeters: number;
62
+ } | null;
63
+ /**
64
+ * 计算多边形质心
65
+ * @param polygon 多边形顶点坐标数组,支持嵌套数组
66
+ * @returns 质心坐标
67
+ */
68
+ calculateCentroid(polygon: LatLngPoint[] | LatLngPoint[][]): LatLng | null;
69
+ /**
70
+ * 计算路径边界和中心点
71
+ * @param points 路径点集合
72
+ * @returns 边界信息,包含 north, south, east, west 和 center
73
+ */
74
+ calculatePathBounds(points: LatLngPoint[]): {
75
+ north: number;
76
+ south: number;
77
+ east: number;
78
+ west: number;
79
+ center: LatLngPoint;
80
+ } | null;
81
+ /**
82
+ * GeoHash 编码
83
+ * @param coordinate 坐标点
84
+ * @param precision 精度 (1-12)
85
+ * @returns GeoHash 字符串
86
+ */
87
+ encodeGeoHash(coordinate: LatLngPoint, precision: number): string;
88
+ /**
89
+ * 轨迹抽稀 (RDP 算法)
90
+ * @param points 原始轨迹点
91
+ * @param tolerance 允许误差(米)
92
+ * @returns 简化后的轨迹点
93
+ */
94
+ simplifyPolyline(points: LatLngPoint[], tolerance: number): LatLng[];
95
+ /**
96
+ * 计算路径总长度
97
+ * @param points 路径点
98
+ * @returns 长度(米)
99
+ */
100
+ calculatePathLength(points: LatLngPoint[]): number;
101
+ /**
102
+ * 解析高德地图 API 返回的 Polyline 字符串
103
+ * 格式: "lng,lat;lng,lat;..."
104
+ * @param polylineStr 高德原始 polyline 字符串,或包含 polyline 属性的对象
105
+ * @returns 解析后的点集
106
+ */
107
+ parsePolyline(polylineStr: string | {
108
+ polyline: string;
109
+ }): LatLng[];
110
+ /**
111
+ * 获取路径上指定距离的点
112
+ * @param points 路径点
113
+ * @param distance 距离起点的米数
114
+ * @returns 点信息(坐标+角度)
115
+ */
116
+ getPointAtDistance(points: LatLngPoint[], distance: number): {
117
+ latitude: number;
118
+ longitude: number;
119
+ angle: number;
120
+ } | null;
121
+ /**
122
+ * 经纬度转换为地图瓦片坐标
123
+ * @param coordinate 经纬度点
124
+ * @param zoom 缩放级别
125
+ * @returns 瓦片坐标(x, y, z)
126
+ */
127
+ latLngToTile(coordinate: LatLngPoint, zoom: number): {
128
+ x: number;
129
+ y: number;
130
+ z: number;
131
+ } | null;
132
+ /**
133
+ * 地图瓦片坐标转换为经纬度
134
+ * @param tile 瓦片坐标(x, y, z)
135
+ * @returns 经纬度点
136
+ */
137
+ tileToLatLng(tile: {
138
+ x: number;
139
+ y: number;
140
+ z: number;
141
+ }): LatLng | null;
142
+ /**
143
+ * 经纬度转换为地图像素坐标
144
+ * @param coordinate 经纬度点
145
+ * @param zoom 缩放级别
146
+ * @returns 像素坐标(x, y)
147
+ */
148
+ latLngToPixel(coordinate: LatLngPoint, zoom: number): {
149
+ x: number;
150
+ y: number;
151
+ } | null;
152
+ /**
153
+ * 地图像素坐标转换为经纬度
154
+ * @param pixel 像素坐标(x, y)
155
+ * @param zoom 缩放级别
156
+ * @returns 经纬度点
157
+ */
158
+ pixelToLatLng(pixel: {
159
+ x: number;
160
+ y: number;
161
+ }, zoom: number): LatLng | null;
162
+ /**
163
+ * 批量地理围栏检测
164
+ * @param point 待检查的点
165
+ * @param polygons 多边形数组,格式为 LatLngPoint[][] 或 LatLngPoint[][][]
166
+ * @returns 包含点索引的数组(-1 表示不在任何多边形内)
167
+ */
168
+ findPointInPolygons(point: LatLngPoint, polygons: LatLngPoint[][] | LatLngPoint[][][]): number;
169
+ /**
170
+ * 生成网格聚合数据 (常用于展示网格聚合图或大规模点数据处理)
171
+ * @param points 包含经纬度和权重的点数组
172
+ * @param gridSizeMeters 网格大小(米)
173
+ * @returns 包含经纬度和强度的网格点数组
174
+ */
175
+ generateHeatmapGrid(points: Array<LatLngPoint & {
176
+ weight?: number;
177
+ }>, gridSizeMeters: number): Array<{
178
+ latitude: number;
179
+ longitude: number;
180
+ intensity: number;
181
+ }>;
182
+ };
183
+ //# sourceMappingURL=geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/module/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKpD,eAAO,MAAM,eAAe;IAG1B;;;;;OAKG;4CACqC,WAAW,eAAe,WAAW,GAAG,MAAM;IActF;;;;;OAKG;6BAEO,WAAW,EAAE,YACZ;QACP,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GACA,MAAM;IA0BT;;;;;;OAMG;2BACoB,WAAW,UAAU,WAAW,UAAU,MAAM,GAAG,OAAO;IAejF;;;;;OAKG;4BACqB,WAAW,WAAW,WAAW,EAAE,GAAG,WAAW,EAAE,EAAE,GAAG,OAAO;IAcvF;;;;OAIG;kCAC2B,WAAW,EAAE,GAAG,WAAW,EAAE,EAAE,GAAG,MAAM;IAWtE;;;;;OAKG;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