@heycar/heycars-map 2.7.1 → 2.8.0
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/dist/v2/App.js +2 -2
- package/dist/v2/api/gaodeDirectionDriving.js +21 -6
- package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +6 -4
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +22 -13
- package/dist/v2/business-components/DrivingLine/DrivingLine.d.ts +5 -1
- package/dist/v2/business-components/DrivingLine/DrivingLine.js +44 -10
- package/dist/v2/business-components/DrivingRoute/DrivingRoute.d.ts +2 -1
- package/dist/v2/business-components/DrivingRoute/DrivingRoute.js +4 -2
- package/dist/v2/business-components/TrafficDrivingLine/TrafficDrivingLine.d.ts +6 -0
- package/dist/v2/business-components/TrafficDrivingLine/TrafficDrivingLine.js +93 -0
- package/dist/v2/business-components/TrafficDrivingLine/index.d.ts +1 -0
- package/dist/v2/business-components/TrafficDrivingLine/index.js +4 -0
- package/dist/v2/components/Amap/Amap.d.ts +2 -3
- package/dist/v2/components/Amap/Amap.js +2 -11
- package/dist/v2/components/AmapMarker/AmapMarker.js +12 -3
- package/dist/v2/components/MapProvider/MapProvider.js +2 -2
- package/dist/v2/hooks/useDeviationCorrectionDrivingRoute.d.ts +2 -0
- package/dist/v2/hooks/useDrivingRoute.d.ts +3 -0
- package/dist/v2/hooks/useDrivingRoute.js +2 -1
- package/dist/v2/hooks/useDrivingTrackCorrection.d.ts +1 -0
- package/dist/v2/types/amap/driving.d.ts +2 -1
- package/dist/v2/types/amap/index.d.ts +1 -0
- package/dist/v2/types/amap/options.d.ts +8 -0
- package/dist/v2/types/amap/options.js +1 -0
- package/dist/v2/types/interface.d.ts +3 -0
- package/dist/v2/utils/compatibleDrivingRoute.js +21 -2
- package/dist/v2/utils/log.js +1 -1
- package/dist/v2/utils/platform.d.ts +1 -0
- package/dist/v2/utils/platform.js +4 -0
- package/dist/v2/utils/transform.d.ts +3 -3
- package/dist/v2/utils/transform.js +19 -11
- package/dist/v3/App.js +2 -2
- package/dist/v3/api/gaodeDirectionDriving.js +21 -6
- package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +6 -4
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +22 -13
- package/dist/v3/business-components/DrivingLine/DrivingLine.d.ts +5 -1
- package/dist/v3/business-components/DrivingLine/DrivingLine.js +44 -10
- package/dist/v3/business-components/DrivingRoute/DrivingRoute.d.ts +2 -1
- package/dist/v3/business-components/DrivingRoute/DrivingRoute.js +4 -2
- package/dist/v3/business-components/TrafficDrivingLine/TrafficDrivingLine.d.ts +8 -0
- package/dist/v3/business-components/TrafficDrivingLine/TrafficDrivingLine.js +91 -0
- package/dist/v3/business-components/TrafficDrivingLine/index.d.ts +1 -0
- package/dist/v3/business-components/TrafficDrivingLine/index.js +4 -0
- package/dist/v3/components/Amap/Amap.d.ts +2 -3
- package/dist/v3/components/Amap/Amap.js +2 -11
- package/dist/v3/components/AmapMarker/AmapMarker.js +12 -3
- package/dist/v3/components/MapProvider/MapProvider.js +2 -2
- package/dist/v3/hooks/useDeviationCorrectionDrivingRoute.d.ts +2 -0
- package/dist/v3/hooks/useDrivingRoute.d.ts +3 -0
- package/dist/v3/hooks/useDrivingRoute.js +2 -1
- package/dist/v3/hooks/useDrivingTrackCorrection.d.ts +1 -0
- package/dist/v3/types/amap/driving.d.ts +2 -1
- package/dist/v3/types/amap/index.d.ts +1 -0
- package/dist/v3/types/amap/options.d.ts +8 -0
- package/dist/v3/types/amap/options.js +1 -0
- package/dist/v3/types/interface.d.ts +3 -0
- package/dist/v3/utils/compatibleDrivingRoute.js +21 -2
- package/dist/v3/utils/log.js +1 -1
- package/dist/v3/utils/platform.d.ts +1 -0
- package/dist/v3/utils/platform.js +4 -0
- package/dist/v3/utils/transform.d.ts +3 -3
- package/dist/v3/utils/transform.js +19 -11
- package/package.json +1 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { SetMap } from "../../hooks/useHeycarMap";
|
|
2
2
|
import type { AmapMap } from "../../types/interface";
|
|
3
3
|
import type { MapEventHandler } from "../../types/mapHelper";
|
|
4
|
-
import { type VectorMapForeign } from "../../utils/transform";
|
|
5
4
|
import { SafeAmap } from "./SafeAmap";
|
|
6
|
-
export interface AmapProps extends Omit<AMap.MapOptions, "
|
|
7
|
-
vectorMapForeign?: VectorMapForeign;
|
|
5
|
+
export interface AmapProps extends Omit<AMap.MapOptions, "viewMode"> {
|
|
8
6
|
mapRef?: SetMap<AmapMap>;
|
|
7
|
+
viewMode?: "2D" | "3D";
|
|
9
8
|
dragEnable?: boolean;
|
|
10
9
|
zoomEnable?: boolean;
|
|
11
10
|
rotateEnable?: boolean;
|
|
@@ -14,15 +14,7 @@ import { SafeAmap } from "./SafeAmap.js";
|
|
|
14
14
|
const Amap_css_ts_vanilla = "";
|
|
15
15
|
var amap = "_1d8ur7t0";
|
|
16
16
|
const Amap = defineSetup("Amap", function(props, { slots, emit, attrs }) {
|
|
17
|
-
const {
|
|
18
|
-
onDragStart,
|
|
19
|
-
onDragEnd,
|
|
20
|
-
onZoomEnd,
|
|
21
|
-
onResize,
|
|
22
|
-
mapRef: setMap,
|
|
23
|
-
vectorMapForeign = "style_zh_cn",
|
|
24
|
-
...defaultOptions
|
|
25
|
-
} = props;
|
|
17
|
+
const { onDragStart, onDragEnd, onZoomEnd, onResize, mapRef: setMap, ...defaultOptions } = props;
|
|
26
18
|
const statusOptions = computed(() => {
|
|
27
19
|
const {
|
|
28
20
|
dragEnable = true,
|
|
@@ -65,8 +57,7 @@ const Amap = defineSetup("Amap", function(props, { slots, emit, attrs }) {
|
|
|
65
57
|
const map = new SafeAmap(elementRef.value, {
|
|
66
58
|
...defaultOptions,
|
|
67
59
|
scrollWheel: defaultOptions.touchZoomCenter ? false : defaultOptions.scrollWheel,
|
|
68
|
-
doubleClickZoom: defaultOptions.touchZoomCenter ? false : defaultOptions.doubleClickZoom
|
|
69
|
-
vectorMapForeign
|
|
60
|
+
doubleClickZoom: defaultOptions.touchZoomCenter ? false : defaultOptions.doubleClickZoom
|
|
70
61
|
});
|
|
71
62
|
window.GlobalAmap = map;
|
|
72
63
|
mapRef.value = map;
|
|
@@ -3,12 +3,22 @@ import { useAmap } from "../../hooks/useMap.js";
|
|
|
3
3
|
import { useMapOverlay } from "../../hooks/useOverlay.js";
|
|
4
4
|
import { defineSetup } from "../../types/helper.js";
|
|
5
5
|
import { watchNoneImmediatePostEffectForMapProperty, watchPostEffectForAMapEvent } from "../../utils/compare.js";
|
|
6
|
+
import { detectTouchDevice } from "../../utils/platform.js";
|
|
6
7
|
import { referenceCount } from "../../utils/referenceCount.js";
|
|
7
|
-
|
|
8
|
+
const isTouchDevice = detectTouchDevice();
|
|
9
|
+
const shouldSkipByAmapClickDoubleTriggerBug = (e) => {
|
|
10
|
+
return isTouchDevice && e.originEvent.type === "mouseup";
|
|
11
|
+
};
|
|
8
12
|
const AmapMarker = defineSetup("AmapMarker", function(props, { emit }) {
|
|
9
13
|
const { registerOverlay } = props;
|
|
10
14
|
const markerRef = shallowRef();
|
|
11
15
|
const mapRef = useAmap();
|
|
16
|
+
const emitClick = (_, e) => {
|
|
17
|
+
const event = e;
|
|
18
|
+
if (shouldSkipByAmapClickDoubleTriggerBug(event))
|
|
19
|
+
return;
|
|
20
|
+
emit("click", event);
|
|
21
|
+
};
|
|
12
22
|
onMounted(() => {
|
|
13
23
|
referenceCount.add();
|
|
14
24
|
const { registerOverlay: registerOverlay2, onClick, ...option } = props;
|
|
@@ -22,7 +32,6 @@ const AmapMarker = defineSetup("AmapMarker", function(props, { emit }) {
|
|
|
22
32
|
(_b = markerRef.value) == null ? void 0 : _b.destroy();
|
|
23
33
|
markerRef.value = void 0;
|
|
24
34
|
});
|
|
25
|
-
useAmapFixBugOverlayDrag(markerRef);
|
|
26
35
|
watchPostEffect((onCleanup) => {
|
|
27
36
|
var _a;
|
|
28
37
|
const map = mapRef == null ? void 0 : mapRef.value;
|
|
@@ -49,7 +58,7 @@ const AmapMarker = defineSetup("AmapMarker", function(props, { emit }) {
|
|
|
49
58
|
{ name: "title", defaultValue: "" },
|
|
50
59
|
{ name: "extData", defaultValue: "" }
|
|
51
60
|
]);
|
|
52
|
-
watchPostEffectForAMapEvent(markerRef, props,
|
|
61
|
+
watchPostEffectForAMapEvent(markerRef, props, emitClick, ["onClick"]);
|
|
53
62
|
return () => null;
|
|
54
63
|
});
|
|
55
64
|
export {
|
|
@@ -8,7 +8,7 @@ import { defineLagecySetup } from "../../types/helper.js";
|
|
|
8
8
|
import "../../utils/alipayPolyfill.js";
|
|
9
9
|
import { loadTraditionalChineseConvertOnce } from "../../utils/cn2tw.js";
|
|
10
10
|
import { detectWebGL, WEBGL_STATUS, detectBrowserPlatform, OS_PLATFORM, BRWOSER_PLATFORM, detectOSPlatform } from "../../utils/platform.js";
|
|
11
|
-
import {
|
|
11
|
+
import { vec2lnglat } from "../../utils/transform.js";
|
|
12
12
|
import { Amap } from "../Amap/Amap.js";
|
|
13
13
|
import { Gmap } from "../Gmap/Gmap.js";
|
|
14
14
|
import { t as throttle } from "../../chunks/throttle.8bdd8d3b.js";
|
|
@@ -154,7 +154,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
154
154
|
"style": attrs.style
|
|
155
155
|
}, [createVNode(Amap, {
|
|
156
156
|
"mapRef": setMap,
|
|
157
|
-
"
|
|
157
|
+
"showOversea": true,
|
|
158
158
|
"center": center,
|
|
159
159
|
"zoom": zoom,
|
|
160
160
|
"dragEnable": touchEnable,
|
|
@@ -27,6 +27,7 @@ export declare const useDeviationCorrectionDrivingRoute: (props?: UseDeviationCo
|
|
|
27
27
|
duration: number;
|
|
28
28
|
distance: number;
|
|
29
29
|
}[];
|
|
30
|
+
trafficJams?: import("../types/interface").TrafficJams | undefined;
|
|
30
31
|
};
|
|
31
32
|
index: number;
|
|
32
33
|
path: [number, number][];
|
|
@@ -38,6 +39,7 @@ export declare const useDeviationCorrectionDrivingRoute: (props?: UseDeviationCo
|
|
|
38
39
|
duration: number;
|
|
39
40
|
distance: number;
|
|
40
41
|
}[];
|
|
42
|
+
trafficJams?: import("../types/interface").TrafficJams | undefined;
|
|
41
43
|
};
|
|
42
44
|
angleRef: import("vue-demi").Ref<number>;
|
|
43
45
|
graspRoadPathRef: import("vue-demi").Ref<Point[] | undefined>;
|
|
@@ -14,6 +14,7 @@ export declare const useADrivingRoute: (props?: UseDrivingRouteProps) => {
|
|
|
14
14
|
duration: number;
|
|
15
15
|
distance: number;
|
|
16
16
|
}[];
|
|
17
|
+
trafficJams?: import("../types/interface").TrafficJams | undefined;
|
|
17
18
|
};
|
|
18
19
|
apiMapDrivingRoute: (from: Point, to: Point) => Promise<Route>;
|
|
19
20
|
};
|
|
@@ -28,6 +29,7 @@ export declare const useGDrivingRoute: (props?: UseDrivingRouteProps) => {
|
|
|
28
29
|
duration: number;
|
|
29
30
|
distance: number;
|
|
30
31
|
}[];
|
|
32
|
+
trafficJams?: import("../types/interface").TrafficJams | undefined;
|
|
31
33
|
};
|
|
32
34
|
apiMapDrivingRoute: (from: Point, to: Point) => Promise<Route>;
|
|
33
35
|
};
|
|
@@ -42,6 +44,7 @@ export declare const useDrivingRoute: (props?: UseDrivingRouteProps) => {
|
|
|
42
44
|
duration: number;
|
|
43
45
|
distance: number;
|
|
44
46
|
}[];
|
|
47
|
+
trafficJams?: import("../types/interface").TrafficJams | undefined;
|
|
45
48
|
};
|
|
46
49
|
apiMapDrivingRoute: (from: Point, to: Point) => Promise<Route>;
|
|
47
50
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -78,6 +78,7 @@ export interface Route {
|
|
|
78
78
|
duration: number;
|
|
79
79
|
tolls?: number;
|
|
80
80
|
steps: RouteStep[];
|
|
81
|
+
trafficJams?: TrafficJams;
|
|
81
82
|
}
|
|
82
83
|
export interface TrackPoint {
|
|
83
84
|
lng: number;
|
|
@@ -105,3 +106,5 @@ export type ProxyServiceError = {
|
|
|
105
106
|
code: number;
|
|
106
107
|
msg: string;
|
|
107
108
|
};
|
|
109
|
+
export type TrafficStatus = "UNKNOWN" | "NORMAL" | "SLOW" | "TRAFFIC_JAM" | "HEAVY_TRAFFIC_JAM";
|
|
110
|
+
export type TrafficJams = Record<`${number},${number}`, TrafficStatus>;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { apiGaodeDirectionDriving } from "../api/gaodeDirectionDriving.js";
|
|
2
2
|
import { apiGoogleDirections } from "../api/googleDirections.js";
|
|
3
|
+
import { stringifyPoint, amapTraffic2trafficStatus } from "./transform.js";
|
|
4
|
+
const amapTmcs2trafficJams = (tmcs) => {
|
|
5
|
+
const trafficJams = {};
|
|
6
|
+
for (const tmc of tmcs) {
|
|
7
|
+
const { path } = tmc;
|
|
8
|
+
if (!path)
|
|
9
|
+
continue;
|
|
10
|
+
for (const { lng, lat } of path) {
|
|
11
|
+
trafficJams[stringifyPoint([lng, lat])] = amapTraffic2trafficStatus(tmc.status);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return trafficJams;
|
|
15
|
+
};
|
|
3
16
|
function amapJsApiDrivingRoute(from, to, amapDriving) {
|
|
4
17
|
return new Promise((resolve, reject) => {
|
|
5
18
|
amapDriving.search(
|
|
@@ -7,6 +20,7 @@ function amapJsApiDrivingRoute(from, to, amapDriving) {
|
|
|
7
20
|
AMap.LngLat.from(to),
|
|
8
21
|
{ waypoints: [] },
|
|
9
22
|
(status, result) => {
|
|
23
|
+
const trafficJams = {};
|
|
10
24
|
switch (status) {
|
|
11
25
|
case "complete": {
|
|
12
26
|
let path = [];
|
|
@@ -19,6 +33,7 @@ function amapJsApiDrivingRoute(from, to, amapDriving) {
|
|
|
19
33
|
const basicStep = step;
|
|
20
34
|
const stepPath = basicStep.path.map(({ lng, lat }) => [lng, lat]);
|
|
21
35
|
path = path.concat(stepPath);
|
|
36
|
+
Object.assign(trafficJams, amapTmcs2trafficJams(basicStep.tmcs));
|
|
22
37
|
routeSteps.push({
|
|
23
38
|
path: basicStep.path.map(({ lng, lat }) => [lng, lat]),
|
|
24
39
|
duration: basicStep.time,
|
|
@@ -30,7 +45,8 @@ function amapJsApiDrivingRoute(from, to, amapDriving) {
|
|
|
30
45
|
distance: firstRoute.distance,
|
|
31
46
|
duration: firstRoute.time,
|
|
32
47
|
tolls: firstRoute.tolls,
|
|
33
|
-
steps: routeSteps
|
|
48
|
+
steps: routeSteps,
|
|
49
|
+
trafficJams
|
|
34
50
|
});
|
|
35
51
|
}
|
|
36
52
|
case "no_data":
|
|
@@ -48,6 +64,7 @@ async function gaodeServiceApiDrivingRoute(from, to, proxyUrl) {
|
|
|
48
64
|
origin: [from],
|
|
49
65
|
destination: to
|
|
50
66
|
});
|
|
67
|
+
const trafficJams = {};
|
|
51
68
|
switch (status) {
|
|
52
69
|
case "complete": {
|
|
53
70
|
let path = [];
|
|
@@ -59,6 +76,7 @@ async function gaodeServiceApiDrivingRoute(from, to, proxyUrl) {
|
|
|
59
76
|
const basicStep = step;
|
|
60
77
|
const stepPath = basicStep.path.map(({ lng, lat }) => [lng, lat]);
|
|
61
78
|
path = path.concat(stepPath);
|
|
79
|
+
Object.assign(trafficJams, amapTmcs2trafficJams(basicStep.tmcs));
|
|
62
80
|
routeSteps.push({
|
|
63
81
|
path: basicStep.path.map(({ lng, lat }) => [lng, lat]),
|
|
64
82
|
duration: basicStep.time,
|
|
@@ -70,7 +88,8 @@ async function gaodeServiceApiDrivingRoute(from, to, proxyUrl) {
|
|
|
70
88
|
distance: firstRoute.distance,
|
|
71
89
|
duration: firstRoute.time,
|
|
72
90
|
tolls: firstRoute.tolls,
|
|
73
|
-
steps: routeSteps
|
|
91
|
+
steps: routeSteps,
|
|
92
|
+
trafficJams
|
|
74
93
|
};
|
|
75
94
|
}
|
|
76
95
|
case "no_data":
|
package/dist/v3/utils/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const availableLogKeys = /* @__PURE__ */ new Set();
|
|
2
2
|
const pkgName = "@heycar/heycars-map";
|
|
3
|
-
const pkgVersion = "2.
|
|
3
|
+
const pkgVersion = "2.8.0";
|
|
4
4
|
const isEnableLog = (name) => {
|
|
5
5
|
const searchParam = new URLSearchParams(location.search);
|
|
6
6
|
return searchParam.has(`log-${name}`);
|
|
@@ -80,6 +80,9 @@ function detectWebGL() {
|
|
|
80
80
|
}
|
|
81
81
|
return "NOT_SUPPORTED";
|
|
82
82
|
}
|
|
83
|
+
function detectTouchDevice() {
|
|
84
|
+
return "ontouchend" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
85
|
+
}
|
|
83
86
|
export {
|
|
84
87
|
ALIPAY_WALLET,
|
|
85
88
|
BRWOSER_PLATFORM,
|
|
@@ -88,5 +91,6 @@ export {
|
|
|
88
91
|
detectAlipayWallet,
|
|
89
92
|
detectBrowserPlatform,
|
|
90
93
|
detectOSPlatform,
|
|
94
|
+
detectTouchDevice,
|
|
91
95
|
detectWebGL
|
|
92
96
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { LngLatLiterial, Place, Point, TrackPoint, TrafficStatus, Zone } from "../types/interface";
|
|
3
3
|
import type { AlipayMyGetLocationSuccessResponse } from "../types/my";
|
|
4
4
|
import type { WxGetLocationSuccessResponse } from "../types/wx";
|
|
5
5
|
import { BRWOSER_PLATFORM } from "./platform";
|
|
@@ -9,6 +9,7 @@ export declare const lnglat2point: ({ lng, lat }: {
|
|
|
9
9
|
lng: number;
|
|
10
10
|
lat: number;
|
|
11
11
|
}) => Point;
|
|
12
|
+
export declare const stringifyPoint: (p: Point) => `${number},${number}`;
|
|
12
13
|
export declare const googlePointsStringify: (points: Point[]) => string;
|
|
13
14
|
export declare const gaodePointsStringify: (points: Point[]) => string;
|
|
14
15
|
export interface AsteriskItem {
|
|
@@ -18,8 +19,6 @@ export interface AsteriskItem {
|
|
|
18
19
|
export declare const decodeAsterisk: (encodedValue: string) => AsteriskItem[];
|
|
19
20
|
export declare const property2emitEventName: (propertyName: string) => string;
|
|
20
21
|
export declare const property2mapEventName: (propertyName: string) => string;
|
|
21
|
-
export type VectorMapForeign = "style_en" | "style_local" | "style_zh_cn";
|
|
22
|
-
export declare const language2vectorMapForeign: (lang: Language) => VectorMapForeign;
|
|
23
22
|
export declare const place2point: (place: Place) => Point;
|
|
24
23
|
export declare const combineHandler: <P extends any[], R>(fn1: ((...args: P) => any) | undefined, fn2: (...args: P) => R) => (...args: P) => R;
|
|
25
24
|
export declare const pipeAsync: <P extends any[]>(fn?: ((...args: P) => any) | undefined) => (...args: P) => void;
|
|
@@ -47,4 +46,5 @@ export declare const maybeFunctionToFunction: <T>(value: T) => MaybeFunctionToFu
|
|
|
47
46
|
export declare const signal2promise: (signal?: AbortSignal) => Promise<any>;
|
|
48
47
|
export declare const googleEncodedPolyline2googleLatLng: (value: string) => google.maps.LatLng[];
|
|
49
48
|
export declare const gaodePolyline2amapLngLat: (value: string) => AMap.LngLat[];
|
|
49
|
+
export declare const amapTraffic2trafficStatus: (value?: AMap.TMC["status"]) => TrafficStatus;
|
|
50
50
|
export {};
|
|
@@ -42,8 +42,9 @@ const vec2lnglat = ([lng, lat]) => ({
|
|
|
42
42
|
lat: Number(lat)
|
|
43
43
|
});
|
|
44
44
|
const lnglat2point = ({ lng, lat }) => [lng, lat];
|
|
45
|
+
const stringifyPoint = (p) => `${p[0]},${p[1]}`;
|
|
45
46
|
const googlePointsStringify = (points) => points.map(([lng, lat]) => `${lat},${lng}`).join("|");
|
|
46
|
-
const gaodePointsStringify = (points) => points.map(
|
|
47
|
+
const gaodePointsStringify = (points) => points.map(stringifyPoint).join(";");
|
|
47
48
|
const decodeAsterisk = (encodedValue) => {
|
|
48
49
|
const result = [];
|
|
49
50
|
const tokens = encodedValue.split("*");
|
|
@@ -61,15 +62,6 @@ const property2emitEventName = (propertyName) => {
|
|
|
61
62
|
const property2mapEventName = (propertyName) => {
|
|
62
63
|
return propertyName.slice(2).toLowerCase();
|
|
63
64
|
};
|
|
64
|
-
const language2vectorMapForeign = (lang) => {
|
|
65
|
-
switch (lang) {
|
|
66
|
-
case "en":
|
|
67
|
-
return "style_en";
|
|
68
|
-
case "zh-TW":
|
|
69
|
-
case "zh":
|
|
70
|
-
return "style_zh_cn";
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
65
|
const place2point = (place) => [Number(place.lng), Number(place.lat)];
|
|
74
66
|
const combineHandler = (fn1, fn2) => {
|
|
75
67
|
return (...args) => {
|
|
@@ -296,10 +288,26 @@ const gaodePolyline2amapLngLat = (value) => {
|
|
|
296
288
|
return { lng, lat };
|
|
297
289
|
});
|
|
298
290
|
};
|
|
291
|
+
const amapTraffic2trafficStatus = (value) => {
|
|
292
|
+
switch (value) {
|
|
293
|
+
case void 0:
|
|
294
|
+
case "未知":
|
|
295
|
+
return "UNKNOWN";
|
|
296
|
+
case "畅通":
|
|
297
|
+
return "NORMAL";
|
|
298
|
+
case "缓行":
|
|
299
|
+
return "SLOW";
|
|
300
|
+
case "拥堵":
|
|
301
|
+
return "TRAFFIC_JAM";
|
|
302
|
+
case "严重拥堵":
|
|
303
|
+
return "HEAVY_TRAFFIC_JAM";
|
|
304
|
+
}
|
|
305
|
+
};
|
|
299
306
|
export {
|
|
300
307
|
alipayMyGetLocationError2GeolocationPositionErrorCode,
|
|
301
308
|
alipayMyGetLocationSuccessResponse2GeolocationPosition,
|
|
302
309
|
amapPlaceName2DisplayName,
|
|
310
|
+
amapTraffic2trafficStatus,
|
|
303
311
|
businessCandidatesToAdsorptionPlace,
|
|
304
312
|
combineHandler,
|
|
305
313
|
decodeAsterisk,
|
|
@@ -316,7 +324,6 @@ export {
|
|
|
316
324
|
isPlaceEqual,
|
|
317
325
|
isPointEqual,
|
|
318
326
|
isZoneEqual,
|
|
319
|
-
language2vectorMapForeign,
|
|
320
327
|
lnglat2point,
|
|
321
328
|
maybeFunctionToFunction,
|
|
322
329
|
pipeAsync,
|
|
@@ -326,6 +333,7 @@ export {
|
|
|
326
333
|
property2emitEventName,
|
|
327
334
|
property2mapEventName,
|
|
328
335
|
signal2promise,
|
|
336
|
+
stringifyPoint,
|
|
329
337
|
trackPoints2amapGraspRoadPoints,
|
|
330
338
|
vec2lnglat,
|
|
331
339
|
wxGetLocationSuccessResponse2GeolocationPosition
|