expo-gaode-map-navigation 1.1.5 → 1.1.7
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 +213 -73
- package/android/build.gradle +10 -0
- package/android/src/main/cpp/CMakeLists.txt +24 -0
- package/android/src/main/cpp/cluster_jni.cpp +848 -0
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapModule.kt +616 -92
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapOfflineModule.kt +493 -0
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapView.kt +230 -14
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapViewModule.kt +37 -27
- package/android/src/main/java/expo/modules/gaodemap/map/MapPreloadManager.kt +494 -0
- package/android/src/main/java/expo/modules/gaodemap/map/companion/BitmapDescriptorCache.kt +30 -0
- package/android/src/main/java/expo/modules/gaodemap/map/companion/IconBitmapCache.kt +37 -0
- package/android/src/main/java/expo/modules/gaodemap/map/managers/UIManager.kt +76 -0
- package/android/src/main/java/expo/modules/gaodemap/map/modules/LocationManager.kt +15 -3
- package/android/src/main/java/expo/modules/gaodemap/map/modules/SDKInitializer.kt +4 -59
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/CircleView.kt +9 -12
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/CircleViewModule.kt +5 -6
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/ClusterView.kt +539 -66
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/ClusterViewModule.kt +17 -1
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapView.kt +165 -33
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapViewModule.kt +15 -3
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerView.kt +1249 -672
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerViewModule.kt +40 -17
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MultiPointView.kt +177 -22
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MultiPointViewModule.kt +11 -3
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolygonView.kt +57 -14
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolygonViewModule.kt +9 -5
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolylineView.kt +90 -63
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/PolylineViewModule.kt +7 -3
- package/android/src/main/java/expo/modules/gaodemap/map/services/LocationForegroundService.kt +3 -2
- package/android/src/main/java/expo/modules/gaodemap/map/utils/BitmapDescriptorCache.kt +20 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/ClusterNative.kt +13 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/ColorParser.kt +20 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/GeometryUtils.kt +515 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/LatLngParser.kt +91 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/PermissionHelper.kt +248 -0
- package/build/ExpoGaodeMapNaviView.d.ts +7 -7
- package/build/ExpoGaodeMapNaviView.js +10 -11
- package/build/ExpoGaodeMapNavigationModule.d.ts +2 -1
- package/build/index.d.ts +35 -33
- package/build/index.js +70 -106
- package/build/map/ExpoGaodeMapModule.d.ts +2 -201
- package/build/map/ExpoGaodeMapModule.js +586 -18
- package/build/map/ExpoGaodeMapOfflineModule.d.ts +139 -0
- package/build/map/ExpoGaodeMapOfflineModule.js +8 -0
- package/build/map/ExpoGaodeMapView.js +66 -58
- package/build/map/components/FoldableMapView.d.ts +38 -0
- package/build/map/components/FoldableMapView.js +209 -0
- package/build/map/components/MapContext.d.ts +12 -0
- package/build/map/components/MapContext.js +54 -0
- package/build/map/components/MapUI.d.ts +18 -0
- package/build/map/components/MapUI.js +29 -0
- package/build/map/components/overlays/Circle.js +34 -3
- package/build/map/components/overlays/Cluster.d.ts +3 -1
- package/build/map/components/overlays/Cluster.js +31 -2
- package/build/map/components/overlays/HeatMap.d.ts +3 -1
- package/build/map/components/overlays/HeatMap.js +33 -3
- package/build/map/components/overlays/Marker.d.ts +1 -1
- package/build/map/components/overlays/Marker.js +37 -32
- package/build/map/components/overlays/MultiPoint.js +1 -1
- package/build/map/components/overlays/Polygon.js +30 -3
- package/build/map/components/overlays/Polyline.js +36 -3
- package/build/map/index.d.ts +25 -5
- package/build/map/index.js +59 -18
- package/build/map/types/common.types.d.ts +40 -0
- package/build/map/types/common.types.js +0 -4
- package/build/map/types/index.d.ts +3 -2
- package/build/map/types/map-view.types.d.ts +108 -3
- package/build/map/types/native-module.types.d.ts +363 -0
- package/build/map/types/native-module.types.js +5 -0
- package/build/map/types/offline.types.d.ts +132 -0
- package/build/map/types/offline.types.js +5 -0
- package/build/map/types/overlays.types.d.ts +137 -24
- package/build/map/utils/ErrorHandler.d.ts +110 -0
- package/build/map/utils/ErrorHandler.js +421 -0
- package/build/map/utils/GeoUtils.d.ts +20 -0
- package/build/map/utils/GeoUtils.js +76 -0
- package/build/map/utils/OfflineMapManager.d.ts +148 -0
- package/build/map/utils/OfflineMapManager.js +217 -0
- package/build/map/utils/PermissionUtils.d.ts +91 -0
- package/build/map/utils/PermissionUtils.js +255 -0
- package/build/map/utils/PlatformDetector.d.ts +102 -0
- package/build/map/utils/PlatformDetector.js +186 -0
- package/build/types/index.d.ts +1 -0
- package/build/types/index.js +1 -0
- package/build/types/native-module.types.d.ts +69 -0
- package/build/types/native-module.types.js +2 -0
- package/build/types/naviview.types.d.ts +1 -1
- package/expo-module.config.json +12 -10
- package/ios/ExpoGaodeMapNavigation.podspec +9 -0
- package/ios/map/ExpoGaodeMapModule.swift +485 -75
- package/ios/map/ExpoGaodeMapOfflineModule.swift +479 -0
- package/ios/map/ExpoGaodeMapView.swift +611 -62
- package/ios/map/ExpoGaodeMapViewModule.swift +48 -26
- package/ios/map/MapPreloadManager.swift +348 -0
- package/ios/map/cpp/ClusterEngine.cpp +110 -0
- package/ios/map/cpp/ClusterEngine.hpp +20 -0
- package/ios/map/cpp/ColorParser.cpp +135 -0
- package/ios/map/cpp/ColorParser.hpp +14 -0
- package/ios/map/cpp/GeometryEngine.cpp +574 -0
- package/ios/map/cpp/GeometryEngine.hpp +159 -0
- package/ios/map/cpp/QuadTree.cpp +92 -0
- package/ios/map/cpp/QuadTree.hpp +42 -0
- package/ios/map/cpp/README.md +55 -0
- package/ios/map/managers/UIManager.swift +72 -1
- package/ios/map/modules/LocationManager.swift +123 -166
- package/ios/map/overlays/CircleView.swift +16 -32
- package/ios/map/overlays/CircleViewModule.swift +12 -12
- package/ios/map/overlays/ClusterAnnotation.swift +32 -0
- package/ios/map/overlays/ClusterView.swift +331 -45
- package/ios/map/overlays/ClusterViewModule.swift +20 -6
- package/ios/map/overlays/HeatMapView.swift +135 -32
- package/ios/map/overlays/HeatMapViewModule.swift +20 -8
- package/ios/map/overlays/MarkerView.swift +613 -130
- package/ios/map/overlays/MarkerViewModule.swift +38 -18
- package/ios/map/overlays/MultiPointView.swift +168 -10
- package/ios/map/overlays/MultiPointViewModule.swift +27 -5
- package/ios/map/overlays/PolygonView.swift +62 -23
- package/ios/map/overlays/PolygonViewModule.swift +18 -12
- package/ios/map/overlays/PolylineView.swift +21 -13
- package/ios/map/overlays/PolylineViewModule.swift +18 -12
- package/ios/map/utils/ClusterNative.h +96 -0
- package/ios/map/utils/ClusterNative.mm +377 -0
- package/ios/map/utils/ColorParser.swift +12 -1
- package/ios/map/utils/CppBridging.mm +13 -0
- package/ios/map/utils/GeometryUtils.swift +34 -0
- package/ios/map/utils/LatLngParser.swift +87 -0
- package/ios/map/utils/PermissionManager.swift +135 -6
- package/package.json +3 -2
- package/shared/cpp/ClusterEngine.cpp +110 -0
- package/shared/cpp/ClusterEngine.hpp +20 -0
- package/shared/cpp/ColorParser.cpp +135 -0
- package/shared/cpp/ColorParser.hpp +14 -0
- package/shared/cpp/GeometryEngine.cpp +574 -0
- package/shared/cpp/GeometryEngine.hpp +159 -0
- package/shared/cpp/QuadTree.cpp +92 -0
- package/shared/cpp/QuadTree.hpp +42 -0
- package/shared/cpp/README.md +55 -0
- package/shared/cpp/tests/benchmark_js.js +41 -0
- package/shared/cpp/tests/run.sh +17 -0
- package/shared/cpp/tests/test_main.cpp +276 -0
- package/build/map/ExpoGaodeMap.types.d.ts +0 -41
- package/build/map/ExpoGaodeMap.types.js +0 -24
- package/build/map/utils/EventManager.d.ts +0 -10
- package/build/map/utils/EventManager.js +0 -26
- package/build/map/utils/ModuleLoader.d.ts +0 -73
- package/build/map/utils/ModuleLoader.js +0 -112
package/build/index.js
CHANGED
|
@@ -17,25 +17,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.TravelStrategy = exports.TruckSize = exports.RideStrategy = exports.WalkStrategy = exports.DriveStrategy = exports.RouteType = exports.NaviView = void 0;
|
|
21
|
-
exports.initNavigation = initNavigation;
|
|
22
|
-
exports.destroyAllCalculators = destroyAllCalculators;
|
|
20
|
+
exports.ExpoGaodeMapNavigationModule = exports.TravelStrategy = exports.TruckSize = exports.RideStrategy = exports.WalkStrategy = exports.DriveStrategy = exports.RouteType = exports.clearIndependentRoute = exports.startNaviWithIndependentPath = exports.selectIndependentRoute = exports.independentMotorcycleRoute = exports.independentRideRoute = exports.independentWalkRoute = exports.independentTruckRoute = exports.independentDriveRoute = exports.calculateMotorcycleRoute = exports.calculateTruckRoute = exports.calculateEBikeRoute = exports.calculateRideRoute = exports.calculateWalkRoute = exports.calculateDriveRoute = exports.destroyAllCalculators = exports.initNavigation = exports.NaviView = exports.ExpoGaodeMapNaviView = void 0;
|
|
23
21
|
exports.calculateRoute = calculateRoute;
|
|
24
|
-
exports.calculateDriveRoute = calculateDriveRoute;
|
|
25
|
-
exports.calculateWalkRoute = calculateWalkRoute;
|
|
26
|
-
exports.calculateRideRoute = calculateRideRoute;
|
|
27
|
-
exports.calculateEBikeRoute = calculateEBikeRoute;
|
|
28
|
-
exports.calculateTruckRoute = calculateTruckRoute;
|
|
29
|
-
exports.calculateMotorcycleRoute = calculateMotorcycleRoute;
|
|
30
|
-
exports.independentDriveRoute = independentDriveRoute;
|
|
31
|
-
exports.independentTruckRoute = independentTruckRoute;
|
|
32
|
-
exports.independentWalkRoute = independentWalkRoute;
|
|
33
|
-
exports.independentRideRoute = independentRideRoute;
|
|
34
|
-
exports.independentMotorcycleRoute = independentMotorcycleRoute;
|
|
35
|
-
exports.selectIndependentRoute = selectIndependentRoute;
|
|
36
|
-
exports.startNaviWithIndependentPath = startNaviWithIndependentPath;
|
|
37
|
-
exports.clearIndependentRoute = clearIndependentRoute;
|
|
38
22
|
const ExpoGaodeMapNavigationModule_1 = __importDefault(require("./ExpoGaodeMapNavigationModule"));
|
|
23
|
+
exports.ExpoGaodeMapNavigationModule = ExpoGaodeMapNavigationModule_1.default;
|
|
39
24
|
// 重新导出地图模块的所有内容
|
|
40
25
|
__exportStar(require("./map"), exports);
|
|
41
26
|
const types_1 = require("./types");
|
|
@@ -47,150 +32,129 @@ Object.defineProperty(exports, "TruckSize", { enumerable: true, get: function ()
|
|
|
47
32
|
Object.defineProperty(exports, "TravelStrategy", { enumerable: true, get: function () { return types_1.TravelStrategy; } });
|
|
48
33
|
// 导出官方导航界面组件
|
|
49
34
|
var ExpoGaodeMapNaviView_1 = require("./ExpoGaodeMapNaviView");
|
|
50
|
-
Object.defineProperty(exports, "
|
|
35
|
+
Object.defineProperty(exports, "ExpoGaodeMapNaviView", { enumerable: true, get: function () { return ExpoGaodeMapNaviView_1.ExpoGaodeMapNaviView; } });
|
|
36
|
+
// 兼容旧版本名称
|
|
37
|
+
Object.defineProperty(exports, "NaviView", { enumerable: true, get: function () { return ExpoGaodeMapNaviView_1.ExpoGaodeMapNaviView; } });
|
|
51
38
|
/**
|
|
52
39
|
* 初始化导航模块(可选)
|
|
53
40
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
41
|
+
const initNavigation = () => ExpoGaodeMapNavigationModule_1.default.initNavigation();
|
|
42
|
+
exports.initNavigation = initNavigation;
|
|
57
43
|
/**
|
|
58
44
|
* 销毁所有路径计算器实例
|
|
59
45
|
* 用于页面切换时释放资源,避免"Another route calculation is in progress"错误
|
|
60
46
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
47
|
+
const destroyAllCalculators = () => ExpoGaodeMapNavigationModule_1.default.destroyAllCalculators();
|
|
48
|
+
exports.destroyAllCalculators = destroyAllCalculators;
|
|
64
49
|
/**
|
|
65
50
|
* 路径规划(通用方法)
|
|
66
51
|
* 注意:公交路径规划暂未实现
|
|
67
52
|
*/
|
|
68
53
|
async function calculateRoute(options) {
|
|
69
|
-
//
|
|
70
|
-
if ('
|
|
71
|
-
|
|
72
|
-
return await calculateDriveRoute(options);
|
|
54
|
+
// 1. 货车
|
|
55
|
+
if ('size' in options) {
|
|
56
|
+
return (0, exports.calculateTruckRoute)(options);
|
|
73
57
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
return await calculateEBikeRoute(options);
|
|
83
|
-
}
|
|
84
|
-
else if (options.strategy === 0 || options.strategy === 1) {
|
|
85
|
-
// 骑行
|
|
86
|
-
return await calculateRideRoute(options);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
// 步行
|
|
90
|
-
return await calculateWalkRoute(options);
|
|
58
|
+
// 2. 步行、骑行、电动车
|
|
59
|
+
if ('multiple' in options || 'travelStrategy' in options) {
|
|
60
|
+
if ('usePoi' in options)
|
|
61
|
+
return (0, exports.calculateEBikeRoute)(options);
|
|
62
|
+
// 策略判断:0 或 1 通常为骑行策略,其余默认步行
|
|
63
|
+
const strategy = options.strategy;
|
|
64
|
+
if (strategy === 0 || strategy === 1) {
|
|
65
|
+
return (0, exports.calculateRideRoute)(options);
|
|
91
66
|
}
|
|
67
|
+
return (0, exports.calculateWalkRoute)(options);
|
|
92
68
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return
|
|
69
|
+
// 3. 摩托车 (通过 carType 或 motorcycleCC 判断)
|
|
70
|
+
if ('motorcycleCC' in options || options.carType === 11) {
|
|
71
|
+
return (0, exports.calculateMotorcycleRoute)(options);
|
|
96
72
|
}
|
|
73
|
+
// 4. 默认驾车
|
|
74
|
+
return (0, exports.calculateDriveRoute)(options);
|
|
97
75
|
}
|
|
98
76
|
/**
|
|
99
77
|
* 驾车路径规划
|
|
100
78
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
79
|
+
const calculateDriveRoute = (options) => ExpoGaodeMapNavigationModule_1.default.calculateDriveRoute(options);
|
|
80
|
+
exports.calculateDriveRoute = calculateDriveRoute;
|
|
104
81
|
/**
|
|
105
82
|
* 步行路径规划
|
|
106
83
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
84
|
+
const calculateWalkRoute = (options) => ExpoGaodeMapNavigationModule_1.default.calculateWalkRoute(options);
|
|
85
|
+
exports.calculateWalkRoute = calculateWalkRoute;
|
|
110
86
|
/**
|
|
111
87
|
* 骑行路径规划
|
|
112
88
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
89
|
+
const calculateRideRoute = (options) => ExpoGaodeMapNavigationModule_1.default.calculateRideRoute(options);
|
|
90
|
+
exports.calculateRideRoute = calculateRideRoute;
|
|
116
91
|
/**
|
|
117
92
|
* 骑行电动车路径规划
|
|
118
93
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
94
|
+
const calculateEBikeRoute = (options) => ExpoGaodeMapNavigationModule_1.default.calculateEBikeRoute(options);
|
|
95
|
+
exports.calculateEBikeRoute = calculateEBikeRoute;
|
|
122
96
|
/**
|
|
123
97
|
* 货车路径规划
|
|
124
98
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
99
|
+
const calculateTruckRoute = (options) => ExpoGaodeMapNavigationModule_1.default.calculateTruckRoute(options);
|
|
100
|
+
exports.calculateTruckRoute = calculateTruckRoute;
|
|
128
101
|
/**
|
|
129
102
|
* 摩托车路径规划(车类型为 11,支持传入排量)
|
|
130
103
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
104
|
+
const calculateMotorcycleRoute = (options) => ExpoGaodeMapNavigationModule_1.default.calculateMotorcycleRoute(options);
|
|
105
|
+
exports.calculateMotorcycleRoute = calculateMotorcycleRoute;
|
|
134
106
|
/**
|
|
135
107
|
* 独立路径规划(不会影响当前导航;适合路线预览/行前选路)
|
|
136
108
|
*/
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
async function independentRideRoute(options) {
|
|
147
|
-
return await ExpoGaodeMapNavigationModule_1.default.independentRideRoute(options);
|
|
148
|
-
}
|
|
109
|
+
const independentDriveRoute = (options) => ExpoGaodeMapNavigationModule_1.default.independentDriveRoute(options);
|
|
110
|
+
exports.independentDriveRoute = independentDriveRoute;
|
|
111
|
+
const independentTruckRoute = (options) => ExpoGaodeMapNavigationModule_1.default.independentTruckRoute(options);
|
|
112
|
+
exports.independentTruckRoute = independentTruckRoute;
|
|
113
|
+
const independentWalkRoute = (options) => ExpoGaodeMapNavigationModule_1.default.independentWalkRoute(options);
|
|
114
|
+
exports.independentWalkRoute = independentWalkRoute;
|
|
115
|
+
const independentRideRoute = (options) => ExpoGaodeMapNavigationModule_1.default.independentRideRoute(options);
|
|
116
|
+
exports.independentRideRoute = independentRideRoute;
|
|
149
117
|
/**
|
|
150
118
|
* 独立摩托车路径规划(不干扰当前导航)
|
|
151
119
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
120
|
+
const independentMotorcycleRoute = (options) => ExpoGaodeMapNavigationModule_1.default.independentMotorcycleRoute(options);
|
|
121
|
+
exports.independentMotorcycleRoute = independentMotorcycleRoute;
|
|
155
122
|
/**
|
|
156
123
|
* 独立路径组:选主路线
|
|
157
124
|
*/
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
125
|
+
const selectIndependentRoute = (options) => ExpoGaodeMapNavigationModule_1.default.selectIndependentRoute(options);
|
|
126
|
+
exports.selectIndependentRoute = selectIndependentRoute;
|
|
161
127
|
/**
|
|
162
128
|
* 独立路径组:使用指定路线启动导航
|
|
163
129
|
*/
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
130
|
+
const startNaviWithIndependentPath = (options) => ExpoGaodeMapNavigationModule_1.default.startNaviWithIndependentPath(options);
|
|
131
|
+
exports.startNaviWithIndependentPath = startNaviWithIndependentPath;
|
|
167
132
|
/**
|
|
168
133
|
* 独立路径组:清理
|
|
169
134
|
*/
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
135
|
+
const clearIndependentRoute = (options) => ExpoGaodeMapNavigationModule_1.default.clearIndependentRoute(options);
|
|
136
|
+
exports.clearIndependentRoute = clearIndependentRoute;
|
|
173
137
|
// 精简后的默认导出
|
|
174
138
|
exports.default = {
|
|
175
139
|
// 初始化
|
|
176
|
-
initNavigation,
|
|
177
|
-
destroyAllCalculators,
|
|
140
|
+
initNavigation: exports.initNavigation,
|
|
141
|
+
destroyAllCalculators: exports.destroyAllCalculators,
|
|
178
142
|
// 路径规划
|
|
179
143
|
calculateRoute,
|
|
180
|
-
calculateDriveRoute,
|
|
181
|
-
calculateWalkRoute,
|
|
182
|
-
calculateRideRoute,
|
|
183
|
-
calculateEBikeRoute,
|
|
184
|
-
calculateTruckRoute,
|
|
185
|
-
calculateMotorcycleRoute,
|
|
144
|
+
calculateDriveRoute: exports.calculateDriveRoute,
|
|
145
|
+
calculateWalkRoute: exports.calculateWalkRoute,
|
|
146
|
+
calculateRideRoute: exports.calculateRideRoute,
|
|
147
|
+
calculateEBikeRoute: exports.calculateEBikeRoute,
|
|
148
|
+
calculateTruckRoute: exports.calculateTruckRoute,
|
|
149
|
+
calculateMotorcycleRoute: exports.calculateMotorcycleRoute,
|
|
186
150
|
// 独立路径规划
|
|
187
|
-
independentDriveRoute,
|
|
188
|
-
independentTruckRoute,
|
|
189
|
-
independentWalkRoute,
|
|
190
|
-
independentRideRoute,
|
|
191
|
-
independentMotorcycleRoute,
|
|
151
|
+
independentDriveRoute: exports.independentDriveRoute,
|
|
152
|
+
independentTruckRoute: exports.independentTruckRoute,
|
|
153
|
+
independentWalkRoute: exports.independentWalkRoute,
|
|
154
|
+
independentRideRoute: exports.independentRideRoute,
|
|
155
|
+
independentMotorcycleRoute: exports.independentMotorcycleRoute,
|
|
192
156
|
// 独立路径组操作
|
|
193
|
-
selectIndependentRoute,
|
|
194
|
-
startNaviWithIndependentPath,
|
|
195
|
-
clearIndependentRoute,
|
|
157
|
+
selectIndependentRoute: exports.selectIndependentRoute,
|
|
158
|
+
startNaviWithIndependentPath: exports.startNaviWithIndependentPath,
|
|
159
|
+
clearIndependentRoute: exports.clearIndependentRoute,
|
|
196
160
|
};
|
|
@@ -1,204 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* 提供 SDK 初始化、定位、权限管理等功能
|
|
4
|
-
*/
|
|
5
|
-
import { NativeModule } from 'expo';
|
|
6
|
-
import type { ExpoGaodeMapModuleEvents } from './ExpoGaodeMap.types';
|
|
7
|
-
import type { LatLng, CoordinateType, Coordinates, ReGeocode, LocationMode, LocationAccuracy, LocationListener } from './types';
|
|
8
|
-
/**
|
|
9
|
-
* SDK 配置参数
|
|
10
|
-
*/
|
|
11
|
-
export interface SDKConfig {
|
|
12
|
-
/** Android 平台的高德地图 API Key */
|
|
13
|
-
androidKey?: string;
|
|
14
|
-
/** iOS 平台的高德地图 API Key */
|
|
15
|
-
iosKey?: string;
|
|
16
|
-
/** web api key:若要使用 web-api 相关功能,建议在初始化时提供 */
|
|
17
|
-
webKey?: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* 权限状态
|
|
21
|
-
*/
|
|
22
|
-
export interface PermissionStatus {
|
|
23
|
-
/** 是否已授权 */
|
|
24
|
-
granted: boolean;
|
|
25
|
-
/** iOS 权限状态字符串 */
|
|
26
|
-
status?: 'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'unknown';
|
|
27
|
-
/** Android 精确位置权限 */
|
|
28
|
-
fineLocation?: boolean;
|
|
29
|
-
/** Android 粗略位置权限 */
|
|
30
|
-
coarseLocation?: boolean;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* 高德地图原生模块类声明
|
|
34
|
-
*/
|
|
35
|
-
declare class ExpoGaodeMapModule extends NativeModule<ExpoGaodeMapModuleEvents> {
|
|
36
|
-
/**
|
|
37
|
-
* 更新隐私合规状态
|
|
38
|
-
* 必须在用户同意隐私协议后调用
|
|
39
|
-
* @param hasAgreed 用户是否已同意隐私协议
|
|
40
|
-
*/
|
|
41
|
-
updatePrivacyCompliance(hasAgreed: boolean): void;
|
|
42
|
-
/**
|
|
43
|
-
* 初始化高德地图 SDK
|
|
44
|
-
* @param config SDK 配置参数,包含 Android 和 iOS 的 API Key
|
|
45
|
-
*/
|
|
46
|
-
initSDK(config: SDKConfig): void;
|
|
47
|
-
/**
|
|
48
|
-
* 获取高德地图 SDK 版本号
|
|
49
|
-
* @returns SDK 版本字符串
|
|
50
|
-
*/
|
|
51
|
-
getVersion(): string;
|
|
52
|
-
/**
|
|
53
|
-
* 开始连续定位
|
|
54
|
-
* 启动后会持续接收位置更新,通过 onLocationUpdate 事件回调
|
|
55
|
-
*/
|
|
56
|
-
start(): void;
|
|
57
|
-
/**
|
|
58
|
-
* 停止定位
|
|
59
|
-
* 停止接收位置更新
|
|
60
|
-
*/
|
|
61
|
-
stop(): void;
|
|
62
|
-
/**
|
|
63
|
-
* 检查是否正在定位
|
|
64
|
-
* @returns Promise<boolean> 是否正在定位
|
|
65
|
-
*/
|
|
66
|
-
isStarted(): Promise<boolean>;
|
|
67
|
-
/**
|
|
68
|
-
* 获取当前位置(单次定位)
|
|
69
|
-
* @returns Promise<Coordinates | ReGeocode> 位置信息,包含坐标和可选的逆地理编码信息
|
|
70
|
-
*/
|
|
71
|
-
getCurrentLocation(): Promise<Coordinates | ReGeocode>;
|
|
72
|
-
/**
|
|
73
|
-
* 坐标转换
|
|
74
|
-
* 将其他坐标系的坐标转换为高德地图使用的 GCJ-02 坐标系
|
|
75
|
-
* @param coordinate 需要转换的坐标
|
|
76
|
-
* @param type 原坐标系类型
|
|
77
|
-
* @returns Promise<LatLng> 转换后的 GCJ-02 坐标
|
|
78
|
-
*/
|
|
79
|
-
coordinateConvert(coordinate: LatLng, type: CoordinateType): Promise<LatLng>;
|
|
80
|
-
/**
|
|
81
|
-
* 设置是否返回逆地理编码信息
|
|
82
|
-
* @param isReGeocode true: 返回地址信息; false: 只返回坐标
|
|
83
|
-
*/
|
|
84
|
-
setLocatingWithReGeocode(isReGeocode: boolean): void;
|
|
85
|
-
/**
|
|
86
|
-
* 设置定位模式(Android)
|
|
87
|
-
* @param mode 定位模式:0-低功耗, 1-仅设备, 2-高精度
|
|
88
|
-
*/
|
|
89
|
-
setLocationMode(mode: LocationMode): void;
|
|
90
|
-
/**
|
|
91
|
-
* 设置定位间隔(毫秒)
|
|
92
|
-
* @param interval 定位间隔时间,单位毫秒,默认 2000ms
|
|
93
|
-
*/
|
|
94
|
-
setInterval(interval: number): void;
|
|
95
|
-
/**
|
|
96
|
-
* 设置是否单次定位(Android)
|
|
97
|
-
* @param isOnceLocation true: 单次定位; false: 连续定位
|
|
98
|
-
*/
|
|
99
|
-
setOnceLocation(isOnceLocation: boolean): void;
|
|
100
|
-
/**
|
|
101
|
-
* 设置是否使用设备传感器(Android)
|
|
102
|
-
* @param sensorEnable true: 使用传感器; false: 不使用
|
|
103
|
-
*/
|
|
104
|
-
setSensorEnable(sensorEnable: boolean): void;
|
|
105
|
-
/**
|
|
106
|
-
* 设置是否允许 WiFi 扫描(Android)
|
|
107
|
-
* @param wifiScan true: 允许; false: 不允许
|
|
108
|
-
*/
|
|
109
|
-
setWifiScan(wifiScan: boolean): void;
|
|
110
|
-
/**
|
|
111
|
-
* 设置是否 GPS 优先(Android)
|
|
112
|
-
* @param gpsFirst true: GPS 优先; false: 网络优先
|
|
113
|
-
*/
|
|
114
|
-
setGpsFirst(gpsFirst: boolean): void;
|
|
115
|
-
/**
|
|
116
|
-
* 设置是否等待 WiFi 列表刷新(Android)
|
|
117
|
-
* @param onceLocationLatest true: 等待; false: 不等待
|
|
118
|
-
*/
|
|
119
|
-
setOnceLocationLatest(onceLocationLatest: boolean): void;
|
|
120
|
-
/**
|
|
121
|
-
* 设置逆地理编码语言
|
|
122
|
-
* @param language 语言代码,如 "zh-CN", "en"
|
|
123
|
-
*/
|
|
124
|
-
setGeoLanguage(language: string): void;
|
|
125
|
-
/**
|
|
126
|
-
* 设置是否使用缓存策略(Android)
|
|
127
|
-
* @param locationCacheEnable true: 使用缓存; false: 不使用
|
|
128
|
-
*/
|
|
129
|
-
setLocationCacheEnable(locationCacheEnable: boolean): void;
|
|
130
|
-
/**
|
|
131
|
-
* 设置网络请求超时时间(Android)
|
|
132
|
-
* @param httpTimeOut 超时时间,单位毫秒
|
|
133
|
-
*/
|
|
134
|
-
setHttpTimeOut(httpTimeOut: number): void;
|
|
135
|
-
/**
|
|
136
|
-
* 设置期望的定位精度(iOS)
|
|
137
|
-
* @param accuracy 精度级别:0-最佳, 1-10米, 2-100米, 3-1公里, 4-3公里
|
|
138
|
-
*/
|
|
139
|
-
setDesiredAccuracy(accuracy: LocationAccuracy): void;
|
|
140
|
-
/**
|
|
141
|
-
* 设置定位超时时间(秒)
|
|
142
|
-
* @param timeout 超时时间,单位秒,默认 10 秒
|
|
143
|
-
*/
|
|
144
|
-
setLocationTimeout(timeout: number): void;
|
|
145
|
-
/**
|
|
146
|
-
* 设置逆地理编码超时时间(秒)
|
|
147
|
-
* @param timeout 超时时间,单位秒,默认 5 秒
|
|
148
|
-
*/
|
|
149
|
-
setReGeocodeTimeout(timeout: number): void;
|
|
150
|
-
/**
|
|
151
|
-
* 设置距离过滤器(米)(iOS)
|
|
152
|
-
* 只有移动超过指定距离才会更新位置
|
|
153
|
-
* @param distance 距离阈值,单位米
|
|
154
|
-
*/
|
|
155
|
-
setDistanceFilter(distance: number): void;
|
|
156
|
-
/**
|
|
157
|
-
* 设置是否自动暂停位置更新(iOS)
|
|
158
|
-
* @param pauses true: 自动暂停; false: 不暂停
|
|
159
|
-
*/
|
|
160
|
-
setPausesLocationUpdatesAutomatically(pauses: boolean): void;
|
|
161
|
-
/**
|
|
162
|
-
* 设置是否允许后台定位(iOS)
|
|
163
|
-
* @param allows true: 允许; false: 不允许
|
|
164
|
-
*/
|
|
165
|
-
setAllowsBackgroundLocationUpdates(allows: boolean): void;
|
|
166
|
-
/**
|
|
167
|
-
* 设置定位协议
|
|
168
|
-
* @param protocol 协议类型
|
|
169
|
-
*/
|
|
170
|
-
setLocationProtocol(protocol: string): void;
|
|
171
|
-
/**
|
|
172
|
-
* 开始更新设备方向(罗盘朝向)
|
|
173
|
-
* 通过 onHeadingUpdate 事件接收方向更新
|
|
174
|
-
* @platform ios
|
|
175
|
-
*/
|
|
176
|
-
startUpdatingHeading(): void;
|
|
177
|
-
/**
|
|
178
|
-
* 停止更新设备方向
|
|
179
|
-
* @platform ios
|
|
180
|
-
*/
|
|
181
|
-
stopUpdatingHeading(): void;
|
|
182
|
-
/**
|
|
183
|
-
* 检查位置权限状态
|
|
184
|
-
* @returns Promise<PermissionStatus> 权限状态
|
|
185
|
-
*/
|
|
186
|
-
checkLocationPermission(): Promise<PermissionStatus>;
|
|
187
|
-
/**
|
|
188
|
-
* 请求位置权限
|
|
189
|
-
* @returns Promise<PermissionStatus> 请求后的权限状态
|
|
190
|
-
*/
|
|
191
|
-
requestLocationPermission(): Promise<PermissionStatus>;
|
|
192
|
-
/**
|
|
193
|
-
* 添加定位监听器(便捷方法)
|
|
194
|
-
* 封装了 addListener,提供更简洁的 API
|
|
195
|
-
* @param listener 定位回调函数
|
|
196
|
-
* @returns 订阅对象,调用 remove() 取消监听
|
|
197
|
-
*/
|
|
198
|
-
addLocationListener(listener: LocationListener): {
|
|
199
|
-
remove: () => void;
|
|
200
|
-
};
|
|
201
|
-
}
|
|
1
|
+
import type { ExpoGaodeMapModule } from './types/native-module.types';
|
|
2
|
+
import { SDKConfig } from './types/common.types';
|
|
202
3
|
/**
|
|
203
4
|
* 获取最近一次 initSDK 的配置
|
|
204
5
|
*/
|