expo-gaode-map-navigation 1.0.1-next.0 → 1.0.1-next.2
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/README.md +117 -28
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapModule.kt +7 -0
- package/android/src/main/java/expo/modules/gaodemap/map/modules/SDKInitializer.kt +38 -3
- package/build/map/ExpoGaodeMapModule.js +5 -5
- package/ios/map/ExpoGaodeMapModule.swift +22 -6
- package/package.json +13 -6
- package/package.json.backup +0 -47
- package/plugin/README.md +0 -52
- package/plugin/build/withGaodeMap.d.ts +0 -22
- package/plugin/build/withGaodeMap.js +0 -169
- package/plugin/src/withGaodeMap.ts +0 -231
- package/plugin/tsconfig.tsbuildinfo +0 -1
- package/src/ExpoGaodeMapNaviView.tsx +0 -94
- package/src/ExpoGaodeMapNavigation.types.ts +0 -3
- package/src/ExpoGaodeMapNavigationModule.ts +0 -11
- package/src/index.ts +0 -262
- package/src/map/ExpoGaodeMap.types.ts +0 -46
- package/src/map/ExpoGaodeMapModule.ts +0 -315
- package/src/map/ExpoGaodeMapView.tsx +0 -120
- package/src/map/components/overlays/Circle.tsx +0 -20
- package/src/map/components/overlays/Cluster.tsx +0 -26
- package/src/map/components/overlays/HeatMap.tsx +0 -27
- package/src/map/components/overlays/Marker.tsx +0 -88
- package/src/map/components/overlays/MultiPoint.tsx +0 -27
- package/src/map/components/overlays/Polygon.tsx +0 -19
- package/src/map/components/overlays/Polyline.tsx +0 -19
- package/src/map/components/overlays/index.ts +0 -7
- package/src/map/index.ts +0 -37
- package/src/map/types/common.types.ts +0 -126
- package/src/map/types/index.ts +0 -55
- package/src/map/types/location.types.ts +0 -368
- package/src/map/types/map-view.types.ts +0 -281
- package/src/map/types/overlays.types.ts +0 -404
- package/src/map/utils/EventManager.ts +0 -23
- package/src/map/utils/ModuleLoader.ts +0 -115
- package/src/types/coordinates.types.ts +0 -25
- package/src/types/independent.types.ts +0 -288
- package/src/types/index.ts +0 -5
- package/src/types/naviview.types.ts +0 -330
- package/src/types/route.types.ts +0 -305
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 模块检测器 - 用于检测可选模块是否已安装
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 可选模块名称常量
|
|
7
|
-
*/
|
|
8
|
-
export const OptionalModules = {
|
|
9
|
-
SEARCH: 'expo-gaode-map-search',
|
|
10
|
-
NAVIGATION: 'expo-gaode-map-navigation',
|
|
11
|
-
ROUTE: 'expo-gaode-map-route',
|
|
12
|
-
GEOCODER: 'expo-gaode-map-geocoder',
|
|
13
|
-
} as const;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 延迟加载可选模块
|
|
17
|
-
* 使用示例:
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* import { OptionalModules, lazyLoad } from 'expo-gaode-map';
|
|
22
|
-
*
|
|
23
|
-
* let SearchModule = null;
|
|
24
|
-
*
|
|
25
|
-
* function loadSearch() {
|
|
26
|
-
* if (SearchModule == null) {
|
|
27
|
-
* try {
|
|
28
|
-
* SearchModule = require('expo-gaode-map-search');
|
|
29
|
-
* } catch (error) {
|
|
30
|
-
* console.warn('搜索模块未安装');
|
|
31
|
-
* return null;
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
* return SearchModule;
|
|
35
|
-
* }
|
|
36
|
-
*
|
|
37
|
-
* // 使用
|
|
38
|
-
* const search = loadSearch();
|
|
39
|
-
* if (search) {
|
|
40
|
-
* const results = await search.searchPOI({ keyword: '餐厅' });
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 检查必需模块,如果未安装则抛出错误
|
|
47
|
-
* @param moduleName 模块名称
|
|
48
|
-
* @param featureName 功能名称(用于错误提示)
|
|
49
|
-
*/
|
|
50
|
-
export function requireModule(moduleName: string, featureName: string): void {
|
|
51
|
-
console.warn(
|
|
52
|
-
`[expo-gaode-map] 使用 ${featureName} 需要安装 ${moduleName}。\n` +
|
|
53
|
-
`请运行: npm install ${moduleName}\n` +
|
|
54
|
-
`然后使用 try-catch 包裹 require('${moduleName}') 来加载`
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 获取已安装的可选模块列表
|
|
60
|
-
* 注意: 此函数无法在运行时准确检测,仅作为文档说明
|
|
61
|
-
*/
|
|
62
|
-
export function getInstalledModules(): string[] {
|
|
63
|
-
console.warn(
|
|
64
|
-
'[expo-gaode-map] getInstalledModules() 无法在运行时检测。\n' +
|
|
65
|
-
'请在编译时检查 package.json 中安装的模块'
|
|
66
|
-
);
|
|
67
|
-
return [];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 打印已安装模块信息(用于调试)
|
|
72
|
-
*/
|
|
73
|
-
export function printModuleInfo(): void {
|
|
74
|
-
console.log('[expo-gaode-map] 核心模块: 已加载');
|
|
75
|
-
console.log('[expo-gaode-map] 可选模块检测:');
|
|
76
|
-
console.log(' - 使用 try-catch 包裹 require() 来检测可选模块');
|
|
77
|
-
console.log(' - 可用的可选模块:');
|
|
78
|
-
Object.entries(OptionalModules).forEach(([key, value]) => {
|
|
79
|
-
console.log(` - ${key}: ${value}`);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* 创建延迟加载器
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* import { createLazyLoader } from 'expo-gaode-map';
|
|
89
|
-
*
|
|
90
|
-
* const loadSearch = createLazyLoader(() => require('expo-gaode-map-search'));
|
|
91
|
-
*
|
|
92
|
-
* // 使用时
|
|
93
|
-
* const SearchModule = loadSearch();
|
|
94
|
-
* if (SearchModule) {
|
|
95
|
-
* const results = await SearchModule.searchPOI({ keyword: '餐厅' });
|
|
96
|
-
* }
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
export function createLazyLoader<T>(loader: () => T): () => T | null {
|
|
100
|
-
let cached: T | null = null;
|
|
101
|
-
let attempted = false;
|
|
102
|
-
|
|
103
|
-
return () => {
|
|
104
|
-
if (!attempted) {
|
|
105
|
-
attempted = true;
|
|
106
|
-
try {
|
|
107
|
-
cached = loader();
|
|
108
|
-
} catch (error) {
|
|
109
|
-
console.warn('[expo-gaode-map] 模块加载失败:', error);
|
|
110
|
-
cached = null;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return cached;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 导航模块坐标类型定义
|
|
3
|
-
* 简化版本,仅包含导航所需的基础坐标
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 导航坐标点(简化版)
|
|
8
|
-
*/
|
|
9
|
-
export interface NaviPoint {
|
|
10
|
-
latitude: number;
|
|
11
|
-
longitude: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 带名称的坐标点(POI)
|
|
16
|
-
*/
|
|
17
|
-
export interface NamedCoordinates extends NaviPoint {
|
|
18
|
-
/** 名称 */
|
|
19
|
-
name?: string;
|
|
20
|
-
/** POI ID */
|
|
21
|
-
poiId?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// 为了向后兼容,导出 NaviPoint 作为 Coordinates 别名
|
|
25
|
-
export type Coordinates = NaviPoint;
|
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import type { RouteResult } from './route.types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 独立路径规划返回结构(不会影响当前导航状态)
|
|
5
|
-
*
|
|
6
|
-
* - routes: 可直接用于路线预览(与普通算路的 RouteResult 结构一致)
|
|
7
|
-
* - mainPathIndex: 主路线索引(调用 startNaviWithPath 前可选路)
|
|
8
|
-
*/
|
|
9
|
-
export interface IndependentRouteResult {
|
|
10
|
-
independent: true;
|
|
11
|
-
token: number;
|
|
12
|
-
count: number;
|
|
13
|
-
mainPathIndex: number;
|
|
14
|
-
routeIds: number[];
|
|
15
|
-
routes: RouteResult[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 独立驾车路径规划参数
|
|
20
|
-
*
|
|
21
|
-
* 说明:
|
|
22
|
-
* - strategy 仍使用 DriveStrategy 即可;也可改用布尔组合标志(下方四个),原生会在未传 strategy 时走 strategyConvert
|
|
23
|
-
* - restriction:是否考虑限行(与 carNumber 搭配)
|
|
24
|
-
*/
|
|
25
|
-
export interface IndependentDriveRouteOptions {
|
|
26
|
-
/** 起点坐标 */
|
|
27
|
-
from: {
|
|
28
|
-
latitude: number;
|
|
29
|
-
longitude: number;
|
|
30
|
-
name?: string;
|
|
31
|
-
poiId?: string;
|
|
32
|
-
};
|
|
33
|
-
/** 终点坐标 */
|
|
34
|
-
to: {
|
|
35
|
-
latitude: number;
|
|
36
|
-
longitude: number;
|
|
37
|
-
name?: string;
|
|
38
|
-
poiId?: string;
|
|
39
|
-
};
|
|
40
|
-
/** 途经点列表 */
|
|
41
|
-
waypoints?: Array<{
|
|
42
|
-
latitude: number;
|
|
43
|
-
longitude: number;
|
|
44
|
-
name?: string;
|
|
45
|
-
poiId?: string;
|
|
46
|
-
}>;
|
|
47
|
-
/** 驾车策略 */
|
|
48
|
-
strategy?: number;
|
|
49
|
-
/** 避免拥堵 */
|
|
50
|
-
avoidCongestion?: boolean;
|
|
51
|
-
/** 避免高速 */
|
|
52
|
-
avoidHighway?: boolean;
|
|
53
|
-
/** 避免收费 */
|
|
54
|
-
avoidCost?: boolean;
|
|
55
|
-
/** 优先高速 */
|
|
56
|
-
prioritiseHighway?: boolean;
|
|
57
|
-
/** 车牌号 */
|
|
58
|
-
carNumber?: string;
|
|
59
|
-
/** 是否考虑限行 */
|
|
60
|
-
restriction?: boolean;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 独立货车路径规划参数
|
|
65
|
-
*
|
|
66
|
-
* 说明:
|
|
67
|
-
* - 默认 carType=1,支持 carNumber / restriction;可在原生侧扩展轴数/长宽高/载重等
|
|
68
|
-
* - 同样支持布尔组合标志以计算策略
|
|
69
|
-
*/
|
|
70
|
-
export interface IndependentTruckRouteOptions {
|
|
71
|
-
/** 起点坐标 */
|
|
72
|
-
from: {
|
|
73
|
-
latitude: number;
|
|
74
|
-
longitude: number;
|
|
75
|
-
name?: string;
|
|
76
|
-
poiId?: string;
|
|
77
|
-
};
|
|
78
|
-
/** 终点坐标 */
|
|
79
|
-
to: {
|
|
80
|
-
latitude: number;
|
|
81
|
-
longitude: number;
|
|
82
|
-
name?: string;
|
|
83
|
-
poiId?: string;
|
|
84
|
-
};
|
|
85
|
-
/** 途经点列表 */
|
|
86
|
-
waypoints?: Array<{
|
|
87
|
-
latitude: number;
|
|
88
|
-
longitude: number;
|
|
89
|
-
name?: string;
|
|
90
|
-
poiId?: string;
|
|
91
|
-
}>;
|
|
92
|
-
/** 驾车策略 */
|
|
93
|
-
strategy?: number;
|
|
94
|
-
/** 避免拥堵 */
|
|
95
|
-
avoidCongestion?: boolean;
|
|
96
|
-
/** 避免高速 */
|
|
97
|
-
avoidHighway?: boolean;
|
|
98
|
-
/** 避免收费 */
|
|
99
|
-
avoidCost?: boolean;
|
|
100
|
-
/** 优先高速 */
|
|
101
|
-
prioritiseHighway?: boolean;
|
|
102
|
-
/** 车牌号 */
|
|
103
|
-
carNumber?: string;
|
|
104
|
-
/** 是否考虑限行 */
|
|
105
|
-
restriction?: boolean;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* 摩托车路径规划参数
|
|
110
|
-
*
|
|
111
|
-
* 说明:
|
|
112
|
-
* - 与驾车算路一致,但需在原生侧设置 AMapCarInfo.carType=11,并可传 motorcycleCC(排量)
|
|
113
|
-
* - carNumber 可用于限行策略参考
|
|
114
|
-
*/
|
|
115
|
-
export interface MotorcycleRouteOptions {
|
|
116
|
-
/** 起点坐标 */
|
|
117
|
-
from: {
|
|
118
|
-
latitude: number;
|
|
119
|
-
longitude: number;
|
|
120
|
-
};
|
|
121
|
-
/** 终点坐标 */
|
|
122
|
-
to: {
|
|
123
|
-
latitude: number;
|
|
124
|
-
longitude: number;
|
|
125
|
-
};
|
|
126
|
-
/** 途经点列表 */
|
|
127
|
-
waypoints?: Array<{
|
|
128
|
-
latitude: number;
|
|
129
|
-
longitude: number;
|
|
130
|
-
}>;
|
|
131
|
-
/** 驾车策略 */
|
|
132
|
-
strategy?: number;
|
|
133
|
-
/** 避免拥堵 */
|
|
134
|
-
avoidCongestion?: boolean;
|
|
135
|
-
/** 避免高速 */
|
|
136
|
-
avoidHighway?: boolean;
|
|
137
|
-
/** 避免收费 */
|
|
138
|
-
avoidCost?: boolean;
|
|
139
|
-
/** 优先高速 */
|
|
140
|
-
prioritiseHighway?: boolean;
|
|
141
|
-
/** 车牌号(可选) */
|
|
142
|
-
carNumber?: string;
|
|
143
|
-
/** 摩托车排量(单位:cc,可选) */
|
|
144
|
-
motorcycleCC?: number;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* 独立摩托车路径规划参数
|
|
149
|
-
*
|
|
150
|
-
* 说明:
|
|
151
|
-
* - 与独立驾车一致,但需在原生侧设置 carType=11,并可传 motorcycleCC
|
|
152
|
-
*/
|
|
153
|
-
export interface IndependentMotorcycleRouteOptions {
|
|
154
|
-
/** 起点坐标 */
|
|
155
|
-
from: {
|
|
156
|
-
latitude: number;
|
|
157
|
-
longitude: number;
|
|
158
|
-
name?: string;
|
|
159
|
-
poiId?: string;
|
|
160
|
-
};
|
|
161
|
-
/** 终点坐标 */
|
|
162
|
-
to: {
|
|
163
|
-
latitude: number;
|
|
164
|
-
longitude: number;
|
|
165
|
-
name?: string;
|
|
166
|
-
poiId?: string;
|
|
167
|
-
};
|
|
168
|
-
/** 途经点列表 */
|
|
169
|
-
waypoints?: Array<{
|
|
170
|
-
latitude: number;
|
|
171
|
-
longitude: number;
|
|
172
|
-
name?: string;
|
|
173
|
-
poiId?: string;
|
|
174
|
-
}>;
|
|
175
|
-
/** 驾车策略 */
|
|
176
|
-
strategy?: number;
|
|
177
|
-
/** 避免拥堵 */
|
|
178
|
-
avoidCongestion?: boolean;
|
|
179
|
-
/** 避免高速 */
|
|
180
|
-
avoidHighway?: boolean;
|
|
181
|
-
/** 避免收费 */
|
|
182
|
-
avoidCost?: boolean;
|
|
183
|
-
/** 优先高速 */
|
|
184
|
-
prioritiseHighway?: boolean;
|
|
185
|
-
/** 车牌号(可选) */
|
|
186
|
-
carNumber?: string;
|
|
187
|
-
/** 摩托车排量(单位:cc,可选) */
|
|
188
|
-
motorcycleCC?: number;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* 独立步行路径规划参数
|
|
193
|
-
*
|
|
194
|
-
* 说明:
|
|
195
|
-
* - 通过 travelStrategy 指定 SINGLE/MULTIPLE;或使用 multiple=true 开启多路线
|
|
196
|
-
*/
|
|
197
|
-
export interface IndependentWalkRouteOptions {
|
|
198
|
-
/** 起点坐标 */
|
|
199
|
-
from: {
|
|
200
|
-
latitude: number;
|
|
201
|
-
longitude: number;
|
|
202
|
-
name?: string;
|
|
203
|
-
poiId?: string;
|
|
204
|
-
};
|
|
205
|
-
/** 终点坐标 */
|
|
206
|
-
to: {
|
|
207
|
-
latitude: number;
|
|
208
|
-
longitude: number;
|
|
209
|
-
name?: string;
|
|
210
|
-
poiId?: string;
|
|
211
|
-
};
|
|
212
|
-
/** 途经点列表 */
|
|
213
|
-
waypoints?: Array<{
|
|
214
|
-
latitude: number;
|
|
215
|
-
longitude: number;
|
|
216
|
-
name?: string;
|
|
217
|
-
poiId?: string;
|
|
218
|
-
}>;
|
|
219
|
-
/** 出行策略(单路线/多路线),对齐原生 TravelStrategy:1000/1001 */
|
|
220
|
-
travelStrategy?: number;
|
|
221
|
-
/** 是否返回多路线(等价于 travelStrategy=TravelStrategy.MULTIPLE) */
|
|
222
|
-
multiple?: boolean;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* 独立骑行路径规划参数
|
|
227
|
-
*
|
|
228
|
-
* 说明:
|
|
229
|
-
* - 通过 travelStrategy 指定 SINGLE/MULTIPLE;或使用 multiple=true 开启多路线
|
|
230
|
-
*/
|
|
231
|
-
export interface IndependentRideRouteOptions {
|
|
232
|
-
/** 起点坐标 */
|
|
233
|
-
from: {
|
|
234
|
-
latitude: number;
|
|
235
|
-
longitude: number;
|
|
236
|
-
name?: string;
|
|
237
|
-
poiId?: string;
|
|
238
|
-
};
|
|
239
|
-
/** 终点坐标 */
|
|
240
|
-
to: {
|
|
241
|
-
latitude: number;
|
|
242
|
-
longitude: number;
|
|
243
|
-
name?: string;
|
|
244
|
-
poiId?: string;
|
|
245
|
-
};
|
|
246
|
-
/** 途经点列表 */
|
|
247
|
-
waypoints?: Array<{
|
|
248
|
-
latitude: number;
|
|
249
|
-
longitude: number;
|
|
250
|
-
name?: string;
|
|
251
|
-
poiId?: string;
|
|
252
|
-
}>;
|
|
253
|
-
/** 出行策略(单路线/多路线),对齐原生 TravelStrategy:1000/1001 */
|
|
254
|
-
travelStrategy?: number;
|
|
255
|
-
/** 是否返回多路线(等价于 travelStrategy=TravelStrategy.MULTIPLE) */
|
|
256
|
-
multiple?: boolean;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* 选择独立路径组中的主路线参数
|
|
261
|
-
* - token: 独立算路返回的 token
|
|
262
|
-
* - routeId/routeIndex: 选路(优先使用 routeId;未提供则保持当前主路线)
|
|
263
|
-
*/
|
|
264
|
-
export interface SelectIndependentRouteOptions {
|
|
265
|
-
token: number;
|
|
266
|
-
routeId?: number;
|
|
267
|
-
routeIndex?: number;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* 使用独立路径组启动导航参数
|
|
272
|
-
* - token: 独立算路返回的 token
|
|
273
|
-
* - naviType: 0=GPS; 1=EMULATOR(默认 0)
|
|
274
|
-
* - routeId/routeIndex: 启动前可选路
|
|
275
|
-
*/
|
|
276
|
-
export interface StartNaviWithIndependentPathOptions {
|
|
277
|
-
token: number;
|
|
278
|
-
naviType?: number;
|
|
279
|
-
routeId?: number;
|
|
280
|
-
routeIndex?: number;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* 清理独立路径组
|
|
285
|
-
*/
|
|
286
|
-
export interface ClearIndependentRouteOptions {
|
|
287
|
-
token: number;
|
|
288
|
-
}
|