@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
package/dist/v2/App.js
CHANGED
|
@@ -4,8 +4,8 @@ import { DemoBusinessRecomendPlace } from "./Demo/DemoBusinessRecomendPlace.js";
|
|
|
4
4
|
import { MapProvider } from "./components/MapProvider/MapProvider.js";
|
|
5
5
|
const gmapApiKey = "AIzaSyCCOe8MAeS3EYvSraKsBX6ztVyLxj69z94";
|
|
6
6
|
const gmapId = "d0af0c05331af64a";
|
|
7
|
-
const amapApiKey = "
|
|
8
|
-
const amapApiSecret = "
|
|
7
|
+
const amapApiKey = "fcb7b14c930354a248e21f4031dfa179";
|
|
8
|
+
const amapApiSecret = "11ad0e3d585b80d18b1ada5b0d947c4a";
|
|
9
9
|
const App = defineComponent({
|
|
10
10
|
setup() {
|
|
11
11
|
const supplierRef = ref("amap");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { gaodePointsStringify, gaodePolyline2amapLngLat } from "../utils/transform.js";
|
|
2
2
|
import { createTypeError, isProxyServiceError } from "../utils/typeChecking.js";
|
|
3
|
-
const GAODE_POLYLINE_REGEX = /^(
|
|
3
|
+
const GAODE_POLYLINE_REGEX = /^(?:-?\d*\.\d+,-?\d*\.\d+)?(?:;-?\d*\.\d+,-?\d*\.\d+)*$/;
|
|
4
4
|
var GaodeDirectionStatus = /* @__PURE__ */ ((GaodeDirectionStatus2) => {
|
|
5
5
|
GaodeDirectionStatus2["SUCCESS"] = "1";
|
|
6
6
|
GaodeDirectionStatus2["FAIL"] = "0";
|
|
@@ -35,10 +35,19 @@ function isGaodeDirectionBasicStep(value) {
|
|
|
35
35
|
function isGaodeEmptyValue(value) {
|
|
36
36
|
return Array.isArray(value) && value.length === 0;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
38
|
+
function isAmapTmcStatus(value) {
|
|
39
|
+
return value === "未知" || value === "畅通" || value === "缓行" || value === "拥堵" || value === "严重拥堵";
|
|
40
|
+
}
|
|
41
|
+
function assertGaodeDirectionDrivingTmc(value) {
|
|
42
|
+
if (typeof value === "object" && value !== null && "status" in value && isAmapTmcStatus(value.status) && "polyline" in value && isGaodeDirectionPolyline(value.polyline))
|
|
40
43
|
return;
|
|
41
|
-
throw createTypeError("
|
|
44
|
+
throw createTypeError("GaodeDirectionDrivingTmc", value);
|
|
45
|
+
}
|
|
46
|
+
function assertGaodoDirectionDrivingStep(value) {
|
|
47
|
+
if (!isGaodeDirectionBasicStep(value) || !("tmcs" in value) || !Array.isArray(value.tmcs)) {
|
|
48
|
+
throw createTypeError("GaodeDirectionDrivingStep", value);
|
|
49
|
+
}
|
|
50
|
+
value.tmcs.forEach(assertGaodeDirectionDrivingTmc);
|
|
42
51
|
}
|
|
43
52
|
function assertGaodeDirectionDrivingRoutePath(value) {
|
|
44
53
|
if (!isGaodeMeasurableObject(value) || !("tolls" in value) || !isGaodeNumberableString(value.tolls) || !("steps" in value) || !Array.isArray(value.steps)) {
|
|
@@ -63,15 +72,21 @@ function assertGaodeDirectionDrivingResponse(value) {
|
|
|
63
72
|
throw createTypeError("GaodeDirectionDrivingResponse", value, detail);
|
|
64
73
|
}
|
|
65
74
|
}
|
|
75
|
+
function gaodeDirectionDrivingTmc2amapTmc(gaodeTmc) {
|
|
76
|
+
const { status, polyline } = gaodeTmc;
|
|
77
|
+
const path = gaodePolyline2amapLngLat(String(polyline));
|
|
78
|
+
return { status, path };
|
|
79
|
+
}
|
|
66
80
|
function gaodeDirectionDrivingRoute2amapDrivingRoute(gaodeRoute) {
|
|
67
81
|
return gaodeRoute.paths.map((routePath) => {
|
|
68
82
|
const { distance, duration, tolls, steps: godeDirectionSteps } = routePath;
|
|
69
83
|
const steps = godeDirectionSteps.map((directionStep) => {
|
|
70
|
-
const { distance: distance2, duration: duration2, polyline } = directionStep;
|
|
84
|
+
const { distance: distance2, duration: duration2, polyline, tmcs } = directionStep;
|
|
71
85
|
return {
|
|
72
86
|
distance: Number(distance2),
|
|
73
87
|
time: Number(duration2),
|
|
74
|
-
path: gaodePolyline2amapLngLat(String(polyline))
|
|
88
|
+
path: gaodePolyline2amapLngLat(String(polyline)),
|
|
89
|
+
tmcs: tmcs.map(gaodeDirectionDrivingTmc2amapTmc)
|
|
75
90
|
};
|
|
76
91
|
});
|
|
77
92
|
return {
|
|
@@ -9,10 +9,10 @@ import { defineSetup, defineLagecySetup } from "../../types/helper.js";
|
|
|
9
9
|
import { generateCreateElementV2PropsOn } from "../../utils/compare.js";
|
|
10
10
|
import { place2point, pipeDefer } from "../../utils/transform.js";
|
|
11
11
|
import { toCoordinatePlaceType } from "../../utils/typeChecking.js";
|
|
12
|
-
import { DrivingLine } from "../DrivingLine/DrivingLine.js";
|
|
13
12
|
import { DrivingRoute } from "../DrivingRoute/DrivingRoute.js";
|
|
14
13
|
import { FitViewOnce, createFittableRegisterOverlay } from "../FitView/FitView.js";
|
|
15
14
|
import { StartEndPoint } from "../StartEndPoint/StartEndPoint.js";
|
|
15
|
+
import { TrafficDrivingLine } from "../TrafficDrivingLine/TrafficDrivingLine.js";
|
|
16
16
|
const BUSINESS_QUOTING_FITVIEW_PANDING = [26, 26, 19, 26];
|
|
17
17
|
const BusinessQuotingMapInner = defineSetup("BusinessQuotingMapInner", function(props, {
|
|
18
18
|
emit,
|
|
@@ -91,10 +91,12 @@ const BusinessQuotingMapInner = defineSetup("BusinessQuotingMapInner", function(
|
|
|
91
91
|
path,
|
|
92
92
|
distance,
|
|
93
93
|
duration,
|
|
94
|
-
tolls
|
|
95
|
-
|
|
94
|
+
tolls,
|
|
95
|
+
trafficJams
|
|
96
|
+
}) => [h(TrafficDrivingLine, {
|
|
96
97
|
"attrs": {
|
|
97
|
-
"path": path
|
|
98
|
+
"path": path,
|
|
99
|
+
"trafficJams": trafficJams
|
|
98
100
|
}
|
|
99
101
|
}), h(StartEndPoint, {
|
|
100
102
|
"attrs": {
|
|
@@ -14,6 +14,7 @@ import { ConditionalFittablePassengerCircle } from "../PassengerCircle/Passenger
|
|
|
14
14
|
import { PlaceCircle } from "../PlaceCircle/PlaceCircle.js";
|
|
15
15
|
import { StartEndPoint } from "../StartEndPoint/StartEndPoint.js";
|
|
16
16
|
import { TaxiCar } from "../TaxiCar/TaxiCar.js";
|
|
17
|
+
import { TrafficDrivingLine } from "../TrafficDrivingLine/TrafficDrivingLine.js";
|
|
17
18
|
import { WalkingLine } from "../WalkingLine/WalkingLine.js";
|
|
18
19
|
import { WalkingRoute } from "../WalkingRoute/WalkingRoute.js";
|
|
19
20
|
import { WaveCircle } from "../WaveCircle/WaveCircle.js";
|
|
@@ -88,10 +89,12 @@ const SectionConfirmed = defineSetup("SectionConfirmed", function(props) {
|
|
|
88
89
|
"to": to,
|
|
89
90
|
"from": from,
|
|
90
91
|
"render": ({
|
|
91
|
-
path
|
|
92
|
-
|
|
92
|
+
path,
|
|
93
|
+
trafficJams
|
|
94
|
+
}) => h(TrafficDrivingLine, {
|
|
93
95
|
"attrs": {
|
|
94
|
-
"path": path
|
|
96
|
+
"path": path,
|
|
97
|
+
"trafficJams": trafficJams
|
|
95
98
|
}
|
|
96
99
|
})
|
|
97
100
|
}
|
|
@@ -197,12 +200,14 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
|
|
|
197
200
|
path,
|
|
198
201
|
angle,
|
|
199
202
|
distance,
|
|
200
|
-
duration
|
|
203
|
+
duration,
|
|
204
|
+
trafficJams
|
|
201
205
|
}) => {
|
|
202
206
|
var _a;
|
|
203
|
-
return [h(
|
|
207
|
+
return [h(TrafficDrivingLine, {
|
|
204
208
|
"attrs": {
|
|
205
|
-
"path": path
|
|
209
|
+
"path": path,
|
|
210
|
+
"trafficJams": trafficJams
|
|
206
211
|
}
|
|
207
212
|
}), h(TaxiCar, {
|
|
208
213
|
"attrs": {
|
|
@@ -286,10 +291,12 @@ const SectionBookDispatched = defineSetup("SectionBookDispatched", function(prop
|
|
|
286
291
|
"to": to,
|
|
287
292
|
"from": from,
|
|
288
293
|
"render": ({
|
|
289
|
-
path
|
|
290
|
-
|
|
294
|
+
path,
|
|
295
|
+
trafficJams
|
|
296
|
+
}) => h(TrafficDrivingLine, {
|
|
291
297
|
"attrs": {
|
|
292
|
-
"path": path
|
|
298
|
+
"path": path,
|
|
299
|
+
"trafficJams": trafficJams
|
|
293
300
|
}
|
|
294
301
|
})
|
|
295
302
|
}
|
|
@@ -461,12 +468,14 @@ const SectionInService = defineSetup("SectionInService", function(props) {
|
|
|
461
468
|
path,
|
|
462
469
|
angle,
|
|
463
470
|
distance,
|
|
464
|
-
duration
|
|
471
|
+
duration,
|
|
472
|
+
trafficJams
|
|
465
473
|
}) => {
|
|
466
474
|
var _a;
|
|
467
|
-
return [h(
|
|
475
|
+
return [h(TrafficDrivingLine, {
|
|
468
476
|
"attrs": {
|
|
469
|
-
"path": path
|
|
477
|
+
"path": path,
|
|
478
|
+
"trafficJams": trafficJams
|
|
470
479
|
}
|
|
471
480
|
}), h(TaxiCar, {
|
|
472
481
|
"attrs": {
|
|
@@ -601,7 +610,7 @@ const SectionEndService = defineSetup("SectionEndService", function(props) {
|
|
|
601
610
|
}) => h(DrivingLine, {
|
|
602
611
|
"attrs": {
|
|
603
612
|
"path": path,
|
|
604
|
-
"
|
|
613
|
+
"status": "DONE"
|
|
605
614
|
}
|
|
606
615
|
})
|
|
607
616
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { TrafficStatus } from "../../types/interface";
|
|
2
|
+
type DrivingLineStatus = TrafficStatus | "DONE";
|
|
1
3
|
export interface DrivingLineProps {
|
|
2
|
-
|
|
4
|
+
status?: DrivingLineStatus;
|
|
3
5
|
path: [number, number][];
|
|
6
|
+
lineCap?: AMap.LineSharedOptions["lineCap"];
|
|
4
7
|
}
|
|
5
8
|
export declare const ADrivingLine: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<DrivingLineProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<DrivingLineProps, Required<DrivingLineProps>>, never, DrivingLineProps>;
|
|
6
9
|
export declare const GDrivingLine: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<DrivingLineProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<DrivingLineProps, Required<DrivingLineProps>>, never, DrivingLineProps>;
|
|
7
10
|
export declare const DrivingLine: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<DrivingLineProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<DrivingLineProps, Required<DrivingLineProps>>, never, DrivingLineProps>;
|
|
11
|
+
export {};
|
|
@@ -7,17 +7,48 @@ import { createElement } from "../../demi-polyfill/demi-polyfill.js";
|
|
|
7
7
|
import { useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
8
8
|
import { defineSetup } from "../../types/helper.js";
|
|
9
9
|
import { vec2lnglat } from "../../utils/transform.js";
|
|
10
|
+
const trafficInnerColors = {
|
|
11
|
+
// UNKNOWN: "#487BF4",
|
|
12
|
+
UNKNOWN: "#00C875",
|
|
13
|
+
NORMAL: "#00C875",
|
|
14
|
+
SLOW: "#F9D100",
|
|
15
|
+
TRAFFIC_JAM: "#EB0E33",
|
|
16
|
+
HEAVY_TRAFFIC_JAM: "#99001A",
|
|
17
|
+
DONE: "#96B2CA"
|
|
18
|
+
};
|
|
19
|
+
const trafficOuterColors = {
|
|
20
|
+
// UNKNOWN: "#4175F1",
|
|
21
|
+
UNKNOWN: "#008559",
|
|
22
|
+
NORMAL: "#008559",
|
|
23
|
+
SLOW: "#B29400",
|
|
24
|
+
TRAFFIC_JAM: "#990D24",
|
|
25
|
+
HEAVY_TRAFFIC_JAM: "#4D000D",
|
|
26
|
+
DONE: "#7693AF"
|
|
27
|
+
};
|
|
28
|
+
const trafficBorderColors = {
|
|
29
|
+
// UNKNOWN: "#6C95F5",
|
|
30
|
+
UNKNOWN: "#00C875",
|
|
31
|
+
NORMAL: "#00C875",
|
|
32
|
+
SLOW: "#F9D100",
|
|
33
|
+
TRAFFIC_JAM: "#EB0E33",
|
|
34
|
+
HEAVY_TRAFFIC_JAM: "#99001A",
|
|
35
|
+
DONE: "#7693AF"
|
|
36
|
+
};
|
|
10
37
|
const ADrivingLine = defineSetup("ADrivingLine", function(props) {
|
|
11
38
|
return () => {
|
|
39
|
+
const {
|
|
40
|
+
status = "UNKNOWN",
|
|
41
|
+
lineCap = "round"
|
|
42
|
+
} = props;
|
|
12
43
|
const vw = window.innerWidth * 0.01;
|
|
13
44
|
const strokeWidth = 1 * vw;
|
|
14
45
|
const borderWidth = 0.13 * vw;
|
|
15
46
|
const dirWidth = 0.24 * vw;
|
|
16
47
|
const outlineWidth = 0.4 * vw;
|
|
17
48
|
const dashLength = 0.3 * vw;
|
|
18
|
-
const strokeColorInner =
|
|
19
|
-
const strokeColorOuter =
|
|
20
|
-
const strokeColorBorder =
|
|
49
|
+
const strokeColorInner = trafficInnerColors[status];
|
|
50
|
+
const strokeColorOuter = trafficOuterColors[status];
|
|
51
|
+
const strokeColorBorder = trafficBorderColors[status];
|
|
21
52
|
return h("div", [h(AmapPolyline, {
|
|
22
53
|
"attrs": {
|
|
23
54
|
"path": props.path,
|
|
@@ -25,7 +56,7 @@ const ADrivingLine = defineSetup("ADrivingLine", function(props) {
|
|
|
25
56
|
"strokeOpacity": 1,
|
|
26
57
|
"strokeColor": strokeColorOuter,
|
|
27
58
|
"lineJoin": "round",
|
|
28
|
-
"lineCap":
|
|
59
|
+
"lineCap": lineCap,
|
|
29
60
|
"zIndex": ZINDEX_LINE_LAYER
|
|
30
61
|
}
|
|
31
62
|
}), h(AmapPolyline, {
|
|
@@ -35,7 +66,7 @@ const ADrivingLine = defineSetup("ADrivingLine", function(props) {
|
|
|
35
66
|
"strokeOpacity": 1,
|
|
36
67
|
"strokeColor": strokeColorBorder,
|
|
37
68
|
"lineJoin": "round",
|
|
38
|
-
"lineCap":
|
|
69
|
+
"lineCap": lineCap,
|
|
39
70
|
"strokeStyle": "dashed",
|
|
40
71
|
"strokeDasharray": [dashLength, dashLength * 0.5],
|
|
41
72
|
"zIndex": ZINDEX_LINE_LAYER
|
|
@@ -47,7 +78,7 @@ const ADrivingLine = defineSetup("ADrivingLine", function(props) {
|
|
|
47
78
|
"strokeOpacity": 1,
|
|
48
79
|
"strokeColor": strokeColorInner,
|
|
49
80
|
"lineJoin": "round",
|
|
50
|
-
"lineCap":
|
|
81
|
+
"lineCap": lineCap,
|
|
51
82
|
"zIndex": ZINDEX_LINE_LAYER
|
|
52
83
|
}
|
|
53
84
|
}), h(AmapPolyline, {
|
|
@@ -58,7 +89,7 @@ const ADrivingLine = defineSetup("ADrivingLine", function(props) {
|
|
|
58
89
|
"strokeOpacity": 1,
|
|
59
90
|
"strokeColor": "transparent",
|
|
60
91
|
"lineJoin": "round",
|
|
61
|
-
"lineCap":
|
|
92
|
+
"lineCap": lineCap,
|
|
62
93
|
"zIndex": ZINDEX_LINE_LAYER
|
|
63
94
|
}
|
|
64
95
|
})]);
|
|
@@ -67,15 +98,18 @@ const ADrivingLine = defineSetup("ADrivingLine", function(props) {
|
|
|
67
98
|
const GDrivingLine = defineSetup("GDrivingLine", function(props) {
|
|
68
99
|
const pathRef = computed(() => props.path.map(vec2lnglat));
|
|
69
100
|
return () => {
|
|
101
|
+
const {
|
|
102
|
+
status = "UNKNOWN"
|
|
103
|
+
} = props;
|
|
70
104
|
const vw = window.innerWidth * 0.01;
|
|
71
105
|
const repeat = 10 * vw;
|
|
72
106
|
const strokeWidth = 1.25 * vw * 0.65;
|
|
73
107
|
const borderWidth = 0.175 * vw * 0.65;
|
|
74
108
|
const dirStrokeWeight = 0.375 * vw * 0.65;
|
|
75
109
|
const outlineWidth = 0.45 * vw * 0.65;
|
|
76
|
-
const strokeColorInner =
|
|
77
|
-
const strokeColorOuter =
|
|
78
|
-
const strokeColorBorder =
|
|
110
|
+
const strokeColorInner = trafficInnerColors[status];
|
|
111
|
+
const strokeColorOuter = trafficOuterColors[status];
|
|
112
|
+
const strokeColorBorder = trafficBorderColors[status];
|
|
79
113
|
return h("div", [h(GmapPolyline, {
|
|
80
114
|
"attrs": {
|
|
81
115
|
"path": pathRef.value,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type VNodeChild } from "../../demi-polyfill";
|
|
2
2
|
import { type UseDrivingRouteProps } from "../../hooks/useDrivingRoute";
|
|
3
|
-
import type { Point } from "../../types/interface";
|
|
3
|
+
import type { Point, TrafficJams } from "../../types/interface";
|
|
4
4
|
export type DrivingRouteRenderProps = {
|
|
5
5
|
path: Point[];
|
|
6
6
|
angle?: number;
|
|
7
7
|
distance: number;
|
|
8
8
|
duration: number;
|
|
9
9
|
tolls?: number;
|
|
10
|
+
trafficJams?: TrafficJams;
|
|
10
11
|
};
|
|
11
12
|
export interface DrivingRouteProps extends UseDrivingRouteProps {
|
|
12
13
|
render?: (props: DrivingRouteRenderProps) => VNodeChild;
|
|
@@ -14,7 +14,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
|
|
|
14
14
|
path,
|
|
15
15
|
distance,
|
|
16
16
|
duration,
|
|
17
|
-
tolls
|
|
17
|
+
tolls,
|
|
18
|
+
trafficJams
|
|
18
19
|
} = toRefs(useADrivingRoute(props).route);
|
|
19
20
|
const {
|
|
20
21
|
angleRef
|
|
@@ -29,7 +30,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
|
|
|
29
30
|
angle: angleRef,
|
|
30
31
|
distance,
|
|
31
32
|
duration,
|
|
32
|
-
tolls
|
|
33
|
+
tolls,
|
|
34
|
+
trafficJams
|
|
33
35
|
}))]);
|
|
34
36
|
};
|
|
35
37
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Point, TrafficJams } from "../../types/interface";
|
|
2
|
+
export interface TrafficDrivingLineProps {
|
|
3
|
+
path: Point[];
|
|
4
|
+
trafficJams?: TrafficJams;
|
|
5
|
+
}
|
|
6
|
+
export declare const TrafficDrivingLine: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<TrafficDrivingLineProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<TrafficDrivingLineProps, Required<TrafficDrivingLineProps>>, never, TrafficDrivingLineProps>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
import { defineSetup } from "../../types/helper.js";
|
|
3
|
+
import { stringifyPoint } from "../../utils/transform.js";
|
|
4
|
+
import { DrivingLine } from "../DrivingLine/DrivingLine.js";
|
|
5
|
+
const justifyFirstPointStatus = (firstPointStatus, secondPointStatus) => {
|
|
6
|
+
return (firstPointStatus === void 0 || firstPointStatus === "UNKNOWN") && !!secondPointStatus && secondPointStatus !== "UNKNOWN" ? secondPointStatus : firstPointStatus != null ? firstPointStatus : "UNKNOWN";
|
|
7
|
+
};
|
|
8
|
+
const createMulitpleLineByTrafficJams = (path, trafficJams) => {
|
|
9
|
+
var _a;
|
|
10
|
+
if (!trafficJams)
|
|
11
|
+
return [{
|
|
12
|
+
path,
|
|
13
|
+
status: "UNKNOWN"
|
|
14
|
+
}];
|
|
15
|
+
const firstPoint = path[0];
|
|
16
|
+
if (!firstPoint)
|
|
17
|
+
return [];
|
|
18
|
+
const multipleLines = [];
|
|
19
|
+
let line = {
|
|
20
|
+
path: [firstPoint],
|
|
21
|
+
status: justifyFirstPointStatus(trafficJams[stringifyPoint(firstPoint)], trafficJams[stringifyPoint(path[1])])
|
|
22
|
+
};
|
|
23
|
+
for (let idx = 2; idx < path.length; idx++) {
|
|
24
|
+
const point = path[idx];
|
|
25
|
+
const traffic = (_a = trafficJams[stringifyPoint(point)]) != null ? _a : "UNKNOWN";
|
|
26
|
+
line.path.push(point);
|
|
27
|
+
if (traffic === line.status)
|
|
28
|
+
continue;
|
|
29
|
+
multipleLines.push(line);
|
|
30
|
+
line = {
|
|
31
|
+
path: [point],
|
|
32
|
+
status: traffic
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
multipleLines.push(line);
|
|
36
|
+
return multipleLines;
|
|
37
|
+
};
|
|
38
|
+
const beautifyMultipleLines = (lines) => {
|
|
39
|
+
const max = lines.length - 1;
|
|
40
|
+
if (max === 0)
|
|
41
|
+
return [{
|
|
42
|
+
...lines[0],
|
|
43
|
+
lineCap: "round"
|
|
44
|
+
}];
|
|
45
|
+
const totalPath = lines.flatMap((line) => line.path);
|
|
46
|
+
const totalLine = {
|
|
47
|
+
path: totalPath,
|
|
48
|
+
status: "NORMAL",
|
|
49
|
+
lineCap: "round"
|
|
50
|
+
};
|
|
51
|
+
const coveredLines = [];
|
|
52
|
+
for (const line of lines) {
|
|
53
|
+
const {
|
|
54
|
+
path,
|
|
55
|
+
status
|
|
56
|
+
} = line;
|
|
57
|
+
if (status !== "SLOW" && status !== "TRAFFIC_JAM" && status !== "HEAVY_TRAFFIC_JAM")
|
|
58
|
+
continue;
|
|
59
|
+
coveredLines.push({
|
|
60
|
+
status,
|
|
61
|
+
path,
|
|
62
|
+
lineCap: "butt"
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const first = lines[0];
|
|
66
|
+
const ignoredLine = {
|
|
67
|
+
status: first.status,
|
|
68
|
+
path: first.path.slice(0, 2),
|
|
69
|
+
lineCap: "butt"
|
|
70
|
+
};
|
|
71
|
+
return [ignoredLine, totalLine, ...coveredLines];
|
|
72
|
+
};
|
|
73
|
+
const TrafficDrivingLine = defineSetup("TrafficDrivingLine", function(props) {
|
|
74
|
+
return () => {
|
|
75
|
+
const {
|
|
76
|
+
path,
|
|
77
|
+
trafficJams
|
|
78
|
+
} = props;
|
|
79
|
+
const multipleLines = createMulitpleLineByTrafficJams(path, trafficJams);
|
|
80
|
+
console.log("multipleLines = ", multipleLines);
|
|
81
|
+
const beautifiedLines = beautifyMultipleLines(multipleLines);
|
|
82
|
+
return h("div", [beautifiedLines.map((line) => h(DrivingLine, {
|
|
83
|
+
"attrs": {
|
|
84
|
+
"path": line.path,
|
|
85
|
+
"status": line.status,
|
|
86
|
+
"lineCap": line.lineCap
|
|
87
|
+
}
|
|
88
|
+
}))]);
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
export {
|
|
92
|
+
TrafficDrivingLine
|
|
93
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TrafficDrivingLine";
|
|
@@ -1,10 +1,9 @@
|
|
|
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
|
-
|
|
5
|
-
export interface AmapProps extends Omit<AMap.MapOptions, "vectorMapForeign"> {
|
|
6
|
-
vectorMapForeign?: VectorMapForeign;
|
|
4
|
+
export interface AmapProps extends Omit<AMap.MapOptions, "viewMode"> {
|
|
7
5
|
mapRef?: SetMap<AmapMap>;
|
|
6
|
+
viewMode?: "2D" | "3D";
|
|
8
7
|
dragEnable?: boolean;
|
|
9
8
|
zoomEnable?: boolean;
|
|
10
9
|
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";
|
|
@@ -162,7 +162,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
162
162
|
}, [h(Amap, {
|
|
163
163
|
"attrs": {
|
|
164
164
|
"mapRef": setMap,
|
|
165
|
-
"
|
|
165
|
+
"showOversea": true,
|
|
166
166
|
"center": center,
|
|
167
167
|
"zoom": zoom,
|
|
168
168
|
"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
|
+
|