@heycar/heycars-map 2.14.0-walkOptimize1 → 2.15.0-domestic1
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 +47 -4
- package/dist/v2/Demo/DemoBusinessRecomendPlace.js +2 -1
- package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +2 -1
- package/dist/v2/Demo/DemoBusinessTaxiEnd.js +9 -2
- package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +4 -1
- package/dist/v2/Demo/DemoBusinessTaxiService.js +19 -1
- package/dist/v2/Demo/demo.data.mock.d.ts +4 -0
- package/dist/v2/Demo/demo.data.mock.js +1194 -0
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -0
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +2 -1
- package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +1 -1
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +1 -1
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +6 -2
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +4 -1
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +45 -7
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +6 -1
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +80 -16
- package/dist/v2/business-components/TaxiCar/RandomCars.d.ts +6 -0
- package/dist/v2/business-components/TaxiCar/RandomCars.js +47 -0
- package/dist/v2/chunks/{BusinessRecomendPlaceMap.e9166e7d.js → BusinessRecomendPlaceMap.eebd0822.js} +7 -1
- package/dist/v2/hooks/useMapCoordinatify.d.ts +2 -1
- package/dist/v2/hooks/useMapCoordinatify.js +6 -1
- package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
- package/dist/v2/index.js +1 -1
- package/dist/v2/types/interface.d.ts +12 -0
- package/dist/v2/utils/geometryPolygon.d.ts +9 -0
- package/dist/v2/utils/geometryPolygon.js +19 -0
- package/dist/v2/utils/log.js +1 -1
- package/dist/v2/utils/platform.d.ts +2 -1
- package/dist/v2/utils/platform.js +2 -1
- package/dist/v2/utils/typeChecking.d.ts +7 -1
- package/dist/v2/utils/typeChecking.js +18 -0
- package/dist/v3/Demo/DemoBusinessRecomendPlace.js +2 -1
- package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +2 -1
- package/dist/v3/Demo/DemoBusinessTaxiEnd.js +9 -2
- package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +4 -1
- package/dist/v3/Demo/DemoBusinessTaxiService.js +19 -1
- package/dist/v3/Demo/demo.data.mock.d.ts +4 -0
- package/dist/v3/Demo/demo.data.mock.js +1194 -0
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -0
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +2 -1
- package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +1 -1
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +1 -1
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +6 -2
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +4 -1
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +45 -7
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +6 -1
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +62 -16
- package/dist/v3/business-components/TaxiCar/RandomCars.d.ts +8 -0
- package/dist/v3/business-components/TaxiCar/RandomCars.js +45 -0
- package/dist/v3/chunks/{BusinessRecomendPlaceMap.c71d0b97.js → BusinessRecomendPlaceMap.71c439c6.js} +5 -1
- package/dist/v3/hooks/useMapCoordinatify.d.ts +2 -1
- package/dist/v3/hooks/useMapCoordinatify.js +6 -1
- package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
- package/dist/v3/index.js +1 -1
- package/dist/v3/types/interface.d.ts +12 -0
- package/dist/v3/utils/geometryPolygon.d.ts +9 -0
- package/dist/v3/utils/geometryPolygon.js +19 -0
- package/dist/v3/utils/log.js +1 -1
- package/dist/v3/utils/platform.d.ts +2 -1
- package/dist/v3/utils/platform.js +2 -1
- package/dist/v3/utils/typeChecking.d.ts +7 -1
- package/dist/v3/utils/typeChecking.js +18 -0
- package/package.json +1 -1
|
@@ -28,6 +28,7 @@ export interface BusinessRecomendPlaceMapProps extends CoordinatifyProps<Omit<He
|
|
|
28
28
|
emptyTitle: string;
|
|
29
29
|
queryingTitle: string;
|
|
30
30
|
recomendDescription: string;
|
|
31
|
+
enableNearbyCars?: boolean;
|
|
31
32
|
disableLocator?: boolean;
|
|
32
33
|
disableLocatorPhoto?: boolean;
|
|
33
34
|
geoErrorOnceNotificationKey?: string;
|
|
@@ -26,8 +26,9 @@ import "../DeviceOrientation/DeviceOrientation.js";
|
|
|
26
26
|
import "../GreenZone/GreenZone.js";
|
|
27
27
|
import "../PassengerCircle/PassengerCircle.js";
|
|
28
28
|
import "../PickupPoints/PickupPoints.js";
|
|
29
|
+
import "../TaxiCar/RandomCars.js";
|
|
29
30
|
import "./useCacheCenterPlace.js";
|
|
30
|
-
import { B, f, D, E, R, c, a, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.
|
|
31
|
+
import { B, f, D, E, R, c, a, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.eebd0822.js";
|
|
31
32
|
export {
|
|
32
33
|
B as BusinessRecomendPlaceMap,
|
|
33
34
|
f as BusinessRecomendPlaceMapInner,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B, f, D, E, R, c, a, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.
|
|
1
|
+
import { B, f, D, E, R, c, a, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.eebd0822.js";
|
|
2
2
|
export {
|
|
3
3
|
B as BusinessRecomendPlaceMap,
|
|
4
4
|
f as BusinessRecomendPlaceMapInner,
|
|
@@ -21,7 +21,7 @@ import { detectBrowserPlatform } from "../../utils/platform.js";
|
|
|
21
21
|
import { place2point, isPlaceEqual, isZoneEqual, geoPositionError2businessTimeout, pipeDefer } from "../../utils/transform.js";
|
|
22
22
|
import { toCoordinatePlaceType, toCoordinatePointType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
|
|
23
23
|
import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
|
|
24
|
-
import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_DRAG_LIMIT, a as RECOMMEND_PLACE_LARGE_LIMIT, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM, Z as ZONE_FITVIEW_PANDING } from "../../chunks/BusinessRecomendPlaceMap.
|
|
24
|
+
import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_DRAG_LIMIT, a as RECOMMEND_PLACE_LARGE_LIMIT, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM, Z as ZONE_FITVIEW_PANDING } from "../../chunks/BusinessRecomendPlaceMap.eebd0822.js";
|
|
25
25
|
import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
|
|
26
26
|
import { GreenZone } from "../GreenZone/GreenZone.js";
|
|
27
27
|
import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CoordinatePlace, CoordinatePoint } from "../../types/interface";
|
|
2
2
|
export interface BusinessTaxiEndMapProps {
|
|
3
|
-
from: Partial<
|
|
4
|
-
to: Partial<
|
|
3
|
+
from: Partial<CoordinatePlace>;
|
|
4
|
+
to: Partial<CoordinatePlace>;
|
|
5
|
+
path?: CoordinatePoint[];
|
|
5
6
|
}
|
|
6
7
|
export declare const BusinessTaxiEndMapInner: import("vue/types/v3-define-component").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessTaxiEndMapProps>, 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<BusinessTaxiEndMapProps, Required<BusinessTaxiEndMapProps>>, never, BusinessTaxiEndMapProps>;
|
|
7
8
|
export declare const BusinessTaxiEndMap: import("vue/types/v3-define-component").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessTaxiEndMapProps>, 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<BusinessTaxiEndMapProps, Required<BusinessTaxiEndMapProps>>, never, BusinessTaxiEndMapProps>;
|
|
@@ -8,7 +8,7 @@ import { useMapFitView } from "../../hooks/useMapFitView.js";
|
|
|
8
8
|
import { useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
9
9
|
import { defineSetup } from "../../types/helper.js";
|
|
10
10
|
import { place2point, pipeDefer } from "../../utils/transform.js";
|
|
11
|
-
import { isCoordinatePoint, toCoordinatePlaceType } from "../../utils/typeChecking.js";
|
|
11
|
+
import { isCoordinatePoint, toCoordinatePlaceType, toCoordinatePointType } from "../../utils/typeChecking.js";
|
|
12
12
|
import { SectionEndService } from "../BusinessTaxiServiceMap/BusinessTaxiServiceSection.js";
|
|
13
13
|
const BusinessTaxiEndMapInner = defineSetup("BusinessTaxiEndMapInner", function(props, {
|
|
14
14
|
attrs
|
|
@@ -18,6 +18,7 @@ const BusinessTaxiEndMapInner = defineSetup("BusinessTaxiEndMapInner", function(
|
|
|
18
18
|
setMap
|
|
19
19
|
} = useHeycarMap();
|
|
20
20
|
const {
|
|
21
|
+
unCoordinatifyPoint,
|
|
21
22
|
unCoordinatifyPlace
|
|
22
23
|
} = useMapCoordinatify();
|
|
23
24
|
const {
|
|
@@ -31,11 +32,13 @@ const BusinessTaxiEndMapInner = defineSetup("BusinessTaxiEndMapInner", function(
|
|
|
31
32
|
return () => {
|
|
32
33
|
const {
|
|
33
34
|
from: inputFrom,
|
|
34
|
-
to: inputTo
|
|
35
|
+
to: inputTo,
|
|
36
|
+
path: inputPath
|
|
35
37
|
} = props;
|
|
36
38
|
const isReady = isCoordinatePoint(inputFrom) && isCoordinatePoint(inputTo);
|
|
37
39
|
const from = unCoordinatifyPlace(toCoordinatePlaceType(inputFrom));
|
|
38
40
|
const to = unCoordinatifyPlace(toCoordinatePlaceType(inputTo));
|
|
41
|
+
const path = inputPath == null ? void 0 : inputPath.map((p) => unCoordinatifyPoint(toCoordinatePointType(p)));
|
|
39
42
|
const center = isReady ? place2point(from) : [...BEIJIN_POINT];
|
|
40
43
|
return h(HeycarMap, {
|
|
41
44
|
"class": attrs.class,
|
|
@@ -53,6 +56,7 @@ const BusinessTaxiEndMapInner = defineSetup("BusinessTaxiEndMapInner", function(
|
|
|
53
56
|
"attrs": {
|
|
54
57
|
"from": from,
|
|
55
58
|
"to": to,
|
|
59
|
+
"routePath": path,
|
|
56
60
|
"registerOverlay": registerFitVeiw
|
|
57
61
|
}
|
|
58
62
|
})]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type HeycarMapProps } from "../../components/MapProvider";
|
|
2
2
|
import type { BusinessTaxiServiceContext } from "../../hooks-business/useBusinessTaxiServiceMap";
|
|
3
3
|
import type { CoordinatifyProps } from "../../types/coordinatify";
|
|
4
|
-
import type { CoordinatePlace, CoordinateTrackPoint, DriverStatus } from "../../types/interface";
|
|
4
|
+
import type { CoordinatePlace, CoordinatePoint, CoordinateTrackPoint, DriverStatus, GetDriverRouteOrTrackOutput } from "../../types/interface";
|
|
5
5
|
export type BusinessTaxiServiceMapProps = CoordinatifyProps<Omit<HeycarMapProps, "center" | "zoom" | "mapRef">> & {
|
|
6
6
|
from: CoordinatePlace;
|
|
7
7
|
to: CoordinatePlace;
|
|
@@ -15,6 +15,8 @@ export type BusinessTaxiServiceMapProps = CoordinatifyProps<Omit<HeycarMapProps,
|
|
|
15
15
|
driverStatus: DriverStatus;
|
|
16
16
|
interval: number;
|
|
17
17
|
disablePassenger?: boolean;
|
|
18
|
+
confirmedPath?: CoordinatePoint[];
|
|
19
|
+
endServicePath?: CoordinatePoint[];
|
|
18
20
|
mapContext: CoordinatifyProps<BusinessTaxiServiceContext>;
|
|
19
21
|
renderStartSerivceTitle: (titleProps: {
|
|
20
22
|
distance: number;
|
|
@@ -25,6 +27,7 @@ export type BusinessTaxiServiceMapProps = CoordinatifyProps<Omit<HeycarMapProps,
|
|
|
25
27
|
duration: number;
|
|
26
28
|
}) => string;
|
|
27
29
|
getDriverPositionTrack?: () => Promise<CoordinateTrackPoint[]>;
|
|
30
|
+
getDriverRouteOrTrack?: () => Promise<GetDriverRouteOrTrackOutput>;
|
|
28
31
|
};
|
|
29
32
|
export declare const BusinessTaxiServiceMapInner: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessTaxiServiceMapProps>, 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<BusinessTaxiServiceMapProps, Required<BusinessTaxiServiceMapProps>>, "resize" | "dragEnd" | "zoomEnd", BusinessTaxiServiceMapProps>;
|
|
30
33
|
export declare const BusinessTaxiServiceMap: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessTaxiServiceMapProps>, 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<BusinessTaxiServiceMapProps, Required<BusinessTaxiServiceMapProps>>, "resize" | "dragEnd" | "zoomEnd", BusinessTaxiServiceMapProps>;
|
|
@@ -10,9 +10,10 @@ import { useMapFitView } from "../../hooks/useMapFitView.js";
|
|
|
10
10
|
import { useMapAssertSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
11
11
|
import { defineSetup, defineLagecySetup } from "../../types/helper.js";
|
|
12
12
|
import { MANUAL_ABORT_MESSAGE } from "../../utils/ManualAbortError.js";
|
|
13
|
+
import { computeLineAngle } from "../../utils/geometryPolygon.js";
|
|
13
14
|
import { createAbortable, assertNotEmptyArray } from "../../utils/helper.js";
|
|
14
15
|
import { place2point, pipeDefer, lnglat2point } from "../../utils/transform.js";
|
|
15
|
-
import { toCoordinatePlaceType, toCoordinateTrackPoint } from "../../utils/typeChecking.js";
|
|
16
|
+
import { toCoordinatePlaceType, toCoordinatePointType, createTypeError, toCoordinateExternalRoute, toCoordinateTrackPoint } from "../../utils/typeChecking.js";
|
|
16
17
|
import { AuxiliaryGraspRoad } from "../AuxiliaryGraspRoad/AuxiliaryGraspRoad.js";
|
|
17
18
|
import { AuxiliaryPassanger } from "../AuxiliaryPassanger/AuxiliaryPassanger.js";
|
|
18
19
|
import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
|
|
@@ -23,6 +24,7 @@ const IS_ENABLE_AUXILIARY_GRASP_ROAD = apiGetAuxiliaryGrapStatus();
|
|
|
23
24
|
const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", function(props, {
|
|
24
25
|
attrs
|
|
25
26
|
}) {
|
|
27
|
+
var _a;
|
|
26
28
|
const {
|
|
27
29
|
interval,
|
|
28
30
|
disablePassenger,
|
|
@@ -40,10 +42,17 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
40
42
|
} = useMapAssertSupplier();
|
|
41
43
|
const abortController = new AbortController();
|
|
42
44
|
const abortable = createAbortable(abortController.signal);
|
|
43
|
-
const
|
|
45
|
+
const getDriverRouteOrTrack = abortable((_a = props.getDriverRouteOrTrack) != null ? _a : async () => {
|
|
46
|
+
var _a2;
|
|
47
|
+
return {
|
|
48
|
+
tracks: await ((_a2 = props.getDriverPositionTrack) == null ? void 0 : _a2.call(props))
|
|
49
|
+
};
|
|
50
|
+
});
|
|
44
51
|
const {
|
|
52
|
+
unCoordinatifyPoint,
|
|
45
53
|
unCoordinatifyPlace,
|
|
46
|
-
unCoordinatifyTrackPoint
|
|
54
|
+
unCoordinatifyTrackPoint,
|
|
55
|
+
unCoordinatifyExternalRoute
|
|
47
56
|
} = useMapCoordinatify();
|
|
48
57
|
const {
|
|
49
58
|
registerFitVeiw: registerOverlay,
|
|
@@ -64,11 +73,27 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
64
73
|
const carPositionRef = ref();
|
|
65
74
|
const carAngleRef = ref();
|
|
66
75
|
const carTrackPositionsRef = ref([]);
|
|
76
|
+
const carRouteRef = ref();
|
|
67
77
|
watch(() => props.driverStatus, (status, _, onCleanup) => {
|
|
68
78
|
if (!STATUS_NEED_CAR_POSITION.includes(status))
|
|
69
79
|
return;
|
|
70
80
|
const update = async () => {
|
|
71
|
-
const
|
|
81
|
+
const output = await (getDriverRouteOrTrack == null ? void 0 : getDriverRouteOrTrack());
|
|
82
|
+
if (!("tracks" in output) && !("routes" in output)) {
|
|
83
|
+
throw createTypeError("GetDriverRouteOrTrackOutput", output);
|
|
84
|
+
}
|
|
85
|
+
if ("routes" in output) {
|
|
86
|
+
const routes = unCoordinatifyExternalRoute(toCoordinateExternalRoute(output.routes));
|
|
87
|
+
assertNotEmptyArray(routes.path, "routes.path");
|
|
88
|
+
carPositionRef.value = routes.path[0];
|
|
89
|
+
carAngleRef.value = computeLineAngle(routes.path[0], routes.path[1]);
|
|
90
|
+
carTrackPositionsRef.value = [];
|
|
91
|
+
carRouteRef.value = routes;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const {
|
|
95
|
+
tracks
|
|
96
|
+
} = output;
|
|
72
97
|
assertNotEmptyArray(tracks, "tracks");
|
|
73
98
|
const trackPositions = tracks.map((p) => unCoordinatifyTrackPoint(toCoordinateTrackPoint(p)));
|
|
74
99
|
const [{
|
|
@@ -77,6 +102,7 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
77
102
|
carPositionRef.value = lnglat2point(trackPositions[trackPositions.length - 1]);
|
|
78
103
|
carAngleRef.value = angle;
|
|
79
104
|
carTrackPositionsRef.value = trackPositions;
|
|
105
|
+
carRouteRef.value = void 0;
|
|
80
106
|
};
|
|
81
107
|
const timer = setInterval(update, interval);
|
|
82
108
|
update();
|
|
@@ -95,16 +121,21 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
95
121
|
dispatchingTitle,
|
|
96
122
|
bookDispatchingTitle,
|
|
97
123
|
bookDispatchedTitle,
|
|
98
|
-
driverArrivedTitle
|
|
124
|
+
driverArrivedTitle,
|
|
125
|
+
confirmedPath: inputConfirmedPath,
|
|
126
|
+
endServicePath: inputEndServicePath
|
|
99
127
|
} = props;
|
|
100
128
|
const from = unCoordinatifyPlace(toCoordinatePlaceType(inputFrom));
|
|
101
129
|
const to = unCoordinatifyPlace(toCoordinatePlaceType(inputTo));
|
|
102
130
|
const relayTo = inputRelayTo ? unCoordinatifyPlace(toCoordinatePlaceType(inputRelayTo)) : void 0;
|
|
131
|
+
const confirmedPath = inputConfirmedPath == null ? void 0 : inputConfirmedPath.map((p) => unCoordinatifyPoint(toCoordinatePointType(p)));
|
|
132
|
+
const endServicePath = inputEndServicePath == null ? void 0 : inputEndServicePath.map((p) => unCoordinatifyPoint(toCoordinatePointType(p)));
|
|
103
133
|
const carPosition = carPositionRef.value;
|
|
104
134
|
const carAngle = carAngleRef.value;
|
|
105
135
|
const carTrackPositions = carTrackPositionsRef.value;
|
|
106
136
|
const touchEnable = !["canceled", "canceling", "completed", "endService", "waitpay", "waitRechargePay", "refund", "rechargePayed", "payed"].includes(driverStatus);
|
|
107
137
|
const passengerPosition = disablePassenger || geoLoading.value || geoError.value ? void 0 : geoPosition.value;
|
|
138
|
+
const carRoute = carRouteRef.value;
|
|
108
139
|
return h(HeycarMap, {
|
|
109
140
|
"class": attrs.class,
|
|
110
141
|
"style": attrs.style,
|
|
@@ -137,6 +168,7 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
137
168
|
"attrs": {
|
|
138
169
|
"from": from,
|
|
139
170
|
"to": to,
|
|
171
|
+
"routePath": confirmedPath,
|
|
140
172
|
"passengerPosition": passengerPosition,
|
|
141
173
|
"passengerAngle": orientation == null ? void 0 : orientation.cssRotationVariableName,
|
|
142
174
|
"registerOverlay": registerOverlay
|
|
@@ -154,6 +186,7 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
154
186
|
"carPosition": carPosition,
|
|
155
187
|
"carAngle": carAngle,
|
|
156
188
|
"carTrackPositions": carTrackPositions,
|
|
189
|
+
"carRoute": carRoute,
|
|
157
190
|
"passengerPosition": passengerPosition,
|
|
158
191
|
"passengerAngle": orientation == null ? void 0 : orientation.cssRotationVariableName,
|
|
159
192
|
"relayToTitle": relayToTitle,
|
|
@@ -172,6 +205,7 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
172
205
|
"carPosition": carPosition,
|
|
173
206
|
"carAngle": carAngle,
|
|
174
207
|
"carTrackPositions": carTrackPositions,
|
|
208
|
+
"carRoute": carRoute,
|
|
175
209
|
"passengerPosition": passengerPosition,
|
|
176
210
|
"passengerAngle": orientation == null ? void 0 : orientation.cssRotationVariableName,
|
|
177
211
|
"renderTitle": renderStartSerivceTitle,
|
|
@@ -188,6 +222,7 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
188
222
|
"from": from,
|
|
189
223
|
"to": to,
|
|
190
224
|
"title": bookDispatchedTitle,
|
|
225
|
+
"routePath": confirmedPath,
|
|
191
226
|
"passengerPosition": passengerPosition,
|
|
192
227
|
"passengerAngle": orientation == null ? void 0 : orientation.cssRotationVariableName,
|
|
193
228
|
"registerOverlay": registerOverlay
|
|
@@ -200,6 +235,7 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
200
235
|
"carPosition": carPosition,
|
|
201
236
|
"carAngle": carAngle,
|
|
202
237
|
"carTrackPositions": carTrackPositions,
|
|
238
|
+
"carRoute": carRoute,
|
|
203
239
|
"renderTitle": renderInServiceTitle,
|
|
204
240
|
"registerOverlay": registerOverlay
|
|
205
241
|
},
|
|
@@ -230,6 +266,7 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
230
266
|
"attrs": {
|
|
231
267
|
"from": from,
|
|
232
268
|
"to": to,
|
|
269
|
+
"routePath": endServicePath,
|
|
233
270
|
"registerOverlay": registerOverlay
|
|
234
271
|
}
|
|
235
272
|
}) : (
|
|
@@ -238,10 +275,11 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
238
275
|
"attrs": {
|
|
239
276
|
"from": from,
|
|
240
277
|
"to": to,
|
|
278
|
+
"routePath": endServicePath,
|
|
241
279
|
"registerOverlay": registerOverlay
|
|
242
280
|
}
|
|
243
281
|
})
|
|
244
|
-
), IS_ENABLE_AUXILIARY_GRASP_ROAD && h(AuxiliaryGraspRoad, {
|
|
282
|
+
), IS_ENABLE_AUXILIARY_GRASP_ROAD && !carRoute && h(AuxiliaryGraspRoad, {
|
|
245
283
|
"attrs": {
|
|
246
284
|
"status": driverStatus,
|
|
247
285
|
"trackPoints": carTrackPositions,
|
|
@@ -271,7 +309,7 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
|
|
|
271
309
|
attrs: props,
|
|
272
310
|
key: `${payload.supplier}${instanceNo}`
|
|
273
311
|
});
|
|
274
|
-
}).props(["bookDispatchingTitle", "bookDispatchedTitle", "dispatchingTitle", "driverArrivedTitle", "driverStatus", "fallback", "from", "getDriverPositionTrack", "interval", "disablePassenger", "loading", "mapContext", "relayTo", "relayToTitle", "renderInServiceTitle", "renderStartSerivceTitle", "to"]);
|
|
312
|
+
}).props(["bookDispatchingTitle", "bookDispatchedTitle", "dispatchingTitle", "driverArrivedTitle", "driverStatus", "fallback", "from", "getDriverPositionTrack", "getDriverRouteOrTrack", "interval", "disablePassenger", "loading", "mapContext", "relayTo", "relayToTitle", "renderInServiceTitle", "renderStartSerivceTitle", "confirmedPath", "endServicePath", "to"]);
|
|
275
313
|
export {
|
|
276
314
|
BusinessTaxiServiceMap,
|
|
277
315
|
BusinessTaxiServiceMapInner
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MROP } from "../../hooks/useOverlay";
|
|
2
|
-
import type { Place, Point, TrackPoint } from "../../types/interface";
|
|
2
|
+
import type { ExternalRoute, Place, Point, TrackPoint } from "../../types/interface";
|
|
3
3
|
import { type DrivingRouteRenderProps } from "../DrivingRoute";
|
|
4
4
|
type SectionDispatchingProps = Required<MROP> & {
|
|
5
5
|
title: string;
|
|
@@ -11,6 +11,7 @@ type SectionConfirmedProps = Required<MROP> & {
|
|
|
11
11
|
passengerAngle?: string;
|
|
12
12
|
from: Place;
|
|
13
13
|
to: Place;
|
|
14
|
+
routePath?: Point[];
|
|
14
15
|
};
|
|
15
16
|
export declare const SectionConfirmed: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<SectionConfirmedProps>, 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<SectionConfirmedProps, Required<SectionConfirmedProps>>, never, SectionConfirmedProps>;
|
|
16
17
|
interface SectionDriverStartRelayServiceProps extends SectionDriverStartServiceProps {
|
|
@@ -24,6 +25,7 @@ type SectionDriverStartServiceProps = Required<MROP> & {
|
|
|
24
25
|
carPosition?: Point;
|
|
25
26
|
carAngle?: number;
|
|
26
27
|
carTrackPositions?: TrackPoint[];
|
|
28
|
+
carRoute?: ExternalRoute;
|
|
27
29
|
from: Place;
|
|
28
30
|
renderTitle: (props: Pick<DrivingRouteRenderProps, "duration" | "distance">) => string;
|
|
29
31
|
};
|
|
@@ -33,6 +35,7 @@ type SectionBookDispatchedProps = Required<MROP> & {
|
|
|
33
35
|
passengerAngle?: string;
|
|
34
36
|
from: Place;
|
|
35
37
|
to: Place;
|
|
38
|
+
routePath?: Point[];
|
|
36
39
|
title?: string;
|
|
37
40
|
};
|
|
38
41
|
export declare const SectionBookDispatched: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<SectionBookDispatchedProps>, 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<SectionBookDispatchedProps, Required<SectionBookDispatchedProps>>, never, SectionBookDispatchedProps>;
|
|
@@ -50,6 +53,7 @@ type SectionInServiceProps = Required<MROP> & {
|
|
|
50
53
|
carPosition?: Point;
|
|
51
54
|
carAngle?: number;
|
|
52
55
|
carTrackPositions?: TrackPoint[];
|
|
56
|
+
carRoute?: ExternalRoute;
|
|
53
57
|
renderTitle: (props: Pick<DrivingRouteRenderProps, "duration" | "distance">) => string;
|
|
54
58
|
};
|
|
55
59
|
export declare const SectionInService: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<SectionInServiceProps>, 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<SectionInServiceProps, Required<SectionInServiceProps>>, never, SectionInServiceProps>;
|
|
@@ -61,6 +65,7 @@ export declare const SectionCanceled: import("vue").DefineComponent<import("vue3
|
|
|
61
65
|
export type SectionEndServiceProps = Required<MROP> & {
|
|
62
66
|
from: Place;
|
|
63
67
|
to: Place;
|
|
68
|
+
routePath?: Point[];
|
|
64
69
|
};
|
|
65
70
|
export declare const SectionEndService: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<SectionEndServiceProps>, 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<SectionEndServiceProps, Required<SectionEndServiceProps>>, never, SectionEndServiceProps>;
|
|
66
71
|
export {};
|
|
@@ -77,12 +77,17 @@ const SectionConfirmed = defineSetup("SectionConfirmed", function(props) {
|
|
|
77
77
|
to: toPlace,
|
|
78
78
|
passengerPosition,
|
|
79
79
|
passengerAngle,
|
|
80
|
+
routePath,
|
|
80
81
|
registerOverlay
|
|
81
82
|
} = props;
|
|
82
83
|
const from = place2point(fromPlace);
|
|
83
84
|
const to = place2point(toPlace);
|
|
84
85
|
const passengerDistance = passengerPosition ? apiMapDistance(passengerPosition, from) : void 0;
|
|
85
|
-
return h("div", [h(
|
|
86
|
+
return h("div", [routePath ? h(DrivingLine, {
|
|
87
|
+
"attrs": {
|
|
88
|
+
"path": routePath
|
|
89
|
+
}
|
|
90
|
+
}) : h(DrivingRoute, {
|
|
86
91
|
"attrs": {
|
|
87
92
|
"to": to,
|
|
88
93
|
"from": from,
|
|
@@ -157,12 +162,14 @@ const SectionDriverStartRelayService = defineSetup("SectionDriverStartRelayServi
|
|
|
157
162
|
apiMapDistance
|
|
158
163
|
} = useMapGeometry();
|
|
159
164
|
return () => {
|
|
165
|
+
var _a;
|
|
160
166
|
const {
|
|
161
167
|
from: fromPlace,
|
|
162
168
|
relayTo: relayToPlace,
|
|
163
169
|
carPosition,
|
|
164
170
|
carAngle,
|
|
165
171
|
carTrackPositions,
|
|
172
|
+
carRoute,
|
|
166
173
|
passengerPosition,
|
|
167
174
|
passengerAngle,
|
|
168
175
|
relayToTitle,
|
|
@@ -206,7 +213,21 @@ const SectionDriverStartRelayService = defineSetup("SectionDriverStartRelayServi
|
|
|
206
213
|
"label": relayToTitle,
|
|
207
214
|
"hideIcon": true
|
|
208
215
|
}
|
|
209
|
-
}),
|
|
216
|
+
}), carRoute ? [h(DrivingLine, {
|
|
217
|
+
"attrs": {
|
|
218
|
+
"path": carRoute.path
|
|
219
|
+
}
|
|
220
|
+
}), h(TaxiCar, {
|
|
221
|
+
"attrs": {
|
|
222
|
+
"position": (_a = carRoute.path[0]) != null ? _a : carPosition,
|
|
223
|
+
"angle": carAngle,
|
|
224
|
+
"title": renderTitle({
|
|
225
|
+
distance: carRoute.distance,
|
|
226
|
+
duration: carRoute.duration
|
|
227
|
+
}),
|
|
228
|
+
"registerOverlay": fittableRegistryOverlay
|
|
229
|
+
}
|
|
230
|
+
})] : !(carTrackPositions == null ? void 0 : carTrackPositions.length) || !carDistance ? null : h(DeviationCorrectionDrivingRoute, {
|
|
210
231
|
"attrs": {
|
|
211
232
|
"tracks": carTrackPositions,
|
|
212
233
|
"to": from,
|
|
@@ -219,7 +240,7 @@ const SectionDriverStartRelayService = defineSetup("SectionDriverStartRelayServi
|
|
|
219
240
|
duration,
|
|
220
241
|
trafficJams
|
|
221
242
|
}) => {
|
|
222
|
-
var
|
|
243
|
+
var _a2;
|
|
223
244
|
return [relayTo ? h(TrafficDrivingLine, {
|
|
224
245
|
"attrs": {
|
|
225
246
|
"path": path,
|
|
@@ -227,7 +248,7 @@ const SectionDriverStartRelayService = defineSetup("SectionDriverStartRelayServi
|
|
|
227
248
|
}
|
|
228
249
|
}) : null, h(TaxiCar, {
|
|
229
250
|
"attrs": {
|
|
230
|
-
"position": (
|
|
251
|
+
"position": (_a2 = path[0]) != null ? _a2 : carPosition,
|
|
231
252
|
"angle": angle != null ? angle : carAngle,
|
|
232
253
|
"title": renderTitle({
|
|
233
254
|
distance,
|
|
@@ -278,11 +299,13 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
|
|
|
278
299
|
apiMapDistance
|
|
279
300
|
} = useMapGeometry();
|
|
280
301
|
return () => {
|
|
302
|
+
var _a;
|
|
281
303
|
const {
|
|
282
304
|
from: fromPlace,
|
|
283
305
|
carPosition,
|
|
284
306
|
carAngle,
|
|
285
307
|
carTrackPositions,
|
|
308
|
+
carRoute,
|
|
286
309
|
passengerPosition,
|
|
287
310
|
passengerAngle,
|
|
288
311
|
renderTitle
|
|
@@ -310,7 +333,21 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
|
|
|
310
333
|
"label": fromPlace.displayName,
|
|
311
334
|
"hideIcon": true
|
|
312
335
|
}
|
|
313
|
-
}),
|
|
336
|
+
}), carRoute ? [h(DrivingLine, {
|
|
337
|
+
"attrs": {
|
|
338
|
+
"path": carRoute.path
|
|
339
|
+
}
|
|
340
|
+
}), h(TaxiCar, {
|
|
341
|
+
"attrs": {
|
|
342
|
+
"position": (_a = carRoute.path[0]) != null ? _a : carPosition,
|
|
343
|
+
"angle": carAngle,
|
|
344
|
+
"title": renderTitle({
|
|
345
|
+
distance: carRoute.distance,
|
|
346
|
+
duration: carRoute.duration
|
|
347
|
+
}),
|
|
348
|
+
"registerOverlay": fittableRegistryOverlay
|
|
349
|
+
}
|
|
350
|
+
})] : !(carTrackPositions == null ? void 0 : carTrackPositions.length) || !carDistance ? null : carDistance > CAR_DISTANCE_MIN ? h(DeviationCorrectionDrivingRoute, {
|
|
314
351
|
"attrs": {
|
|
315
352
|
"tracks": carTrackPositions,
|
|
316
353
|
"to": from,
|
|
@@ -322,7 +359,7 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
|
|
|
322
359
|
duration,
|
|
323
360
|
trafficJams
|
|
324
361
|
}) => {
|
|
325
|
-
var
|
|
362
|
+
var _a2;
|
|
326
363
|
return [h(TrafficDrivingLine, {
|
|
327
364
|
"attrs": {
|
|
328
365
|
"path": path,
|
|
@@ -330,7 +367,7 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
|
|
|
330
367
|
}
|
|
331
368
|
}), h(TaxiCar, {
|
|
332
369
|
"attrs": {
|
|
333
|
-
"position": (
|
|
370
|
+
"position": (_a2 = path[0]) != null ? _a2 : carPosition,
|
|
334
371
|
"angle": angle != null ? angle : carAngle,
|
|
335
372
|
"title": renderTitle({
|
|
336
373
|
distance,
|
|
@@ -348,10 +385,10 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
|
|
|
348
385
|
path: graspRoadPath,
|
|
349
386
|
angle
|
|
350
387
|
}) => {
|
|
351
|
-
var
|
|
388
|
+
var _a2;
|
|
352
389
|
return h(TaxiCar, {
|
|
353
390
|
"attrs": {
|
|
354
|
-
"position": (
|
|
391
|
+
"position": (_a2 = graspRoadPath[graspRoadPath.length - 1]) != null ? _a2 : carPosition,
|
|
355
392
|
"angle": angle != null ? angle : carAngle,
|
|
356
393
|
"title": renderTitle({
|
|
357
394
|
distance: carDistance,
|
|
@@ -401,12 +438,17 @@ const SectionBookDispatched = defineSetup("SectionBookDispatched", function(prop
|
|
|
401
438
|
title,
|
|
402
439
|
passengerPosition,
|
|
403
440
|
passengerAngle,
|
|
441
|
+
routePath,
|
|
404
442
|
registerOverlay
|
|
405
443
|
} = props;
|
|
406
444
|
const from = place2point(fromPlace);
|
|
407
445
|
const to = place2point(toPlace);
|
|
408
446
|
const passengerDistance = passengerPosition ? apiMapDistance(passengerPosition, from) : void 0;
|
|
409
|
-
return h("div", [h(
|
|
447
|
+
return h("div", [routePath ? h(DrivingLine, {
|
|
448
|
+
"attrs": {
|
|
449
|
+
"path": routePath
|
|
450
|
+
}
|
|
451
|
+
}) : h(DrivingRoute, {
|
|
410
452
|
"attrs": {
|
|
411
453
|
"to": to,
|
|
412
454
|
"from": from,
|
|
@@ -565,11 +607,13 @@ const SectionInService = defineSetup("SectionInService", function(props) {
|
|
|
565
607
|
immediate: true
|
|
566
608
|
});
|
|
567
609
|
return () => {
|
|
610
|
+
var _a;
|
|
568
611
|
const {
|
|
569
612
|
to: toPlace,
|
|
570
613
|
carPosition,
|
|
571
614
|
carAngle,
|
|
572
615
|
carTrackPositions,
|
|
616
|
+
carRoute,
|
|
573
617
|
renderTitle
|
|
574
618
|
} = props;
|
|
575
619
|
const to = place2point(toPlace);
|
|
@@ -580,7 +624,21 @@ const SectionInService = defineSetup("SectionInService", function(props) {
|
|
|
580
624
|
apiMapDistance
|
|
581
625
|
} = useMapGeometry();
|
|
582
626
|
const carDistance = carPosition ? apiMapDistance(carPosition, to) : void 0;
|
|
583
|
-
return h("div", [
|
|
627
|
+
return h("div", [carRoute ? [h(DrivingLine, {
|
|
628
|
+
"attrs": {
|
|
629
|
+
"path": carRoute.path
|
|
630
|
+
}
|
|
631
|
+
}), h(TaxiCar, {
|
|
632
|
+
"attrs": {
|
|
633
|
+
"position": (_a = carRoute.path[0]) != null ? _a : carPosition,
|
|
634
|
+
"angle": carAngle,
|
|
635
|
+
"title": renderTitle({
|
|
636
|
+
distance: carRoute.distance,
|
|
637
|
+
duration: carRoute.duration
|
|
638
|
+
}),
|
|
639
|
+
"registerOverlay": fittableRegistryOverlay
|
|
640
|
+
}
|
|
641
|
+
})] : !(carTrackPositions == null ? void 0 : carTrackPositions.length) || !carDistance ? null : carDistance > CAR_DISTANCE_MIN ? h(DeviationCorrectionDrivingRoute, {
|
|
584
642
|
"attrs": {
|
|
585
643
|
"tracks": carTrackPositions,
|
|
586
644
|
"to": to,
|
|
@@ -592,7 +650,7 @@ const SectionInService = defineSetup("SectionInService", function(props) {
|
|
|
592
650
|
duration,
|
|
593
651
|
trafficJams
|
|
594
652
|
}) => {
|
|
595
|
-
var
|
|
653
|
+
var _a2;
|
|
596
654
|
return [h(TrafficDrivingLine, {
|
|
597
655
|
"attrs": {
|
|
598
656
|
"path": path,
|
|
@@ -600,7 +658,7 @@ const SectionInService = defineSetup("SectionInService", function(props) {
|
|
|
600
658
|
}
|
|
601
659
|
}), h(TaxiCar, {
|
|
602
660
|
"attrs": {
|
|
603
|
-
"position": (
|
|
661
|
+
"position": (_a2 = path[0]) != null ? _a2 : carPosition,
|
|
604
662
|
"angle": angle != null ? angle : carAngle,
|
|
605
663
|
"title": renderTitle({
|
|
606
664
|
distance,
|
|
@@ -618,10 +676,10 @@ const SectionInService = defineSetup("SectionInService", function(props) {
|
|
|
618
676
|
path: graspRoadPath,
|
|
619
677
|
angle
|
|
620
678
|
}) => {
|
|
621
|
-
var
|
|
679
|
+
var _a2;
|
|
622
680
|
return h(TaxiCar, {
|
|
623
681
|
"attrs": {
|
|
624
|
-
"position": (
|
|
682
|
+
"position": (_a2 = graspRoadPath[graspRoadPath.length - 1]) != null ? _a2 : carPosition,
|
|
625
683
|
"angle": angle != null ? angle : carAngle,
|
|
626
684
|
"title": renderTitle({
|
|
627
685
|
distance: carDistance,
|
|
@@ -718,11 +776,17 @@ const SectionEndService = defineSetup("SectionEndService", function(props) {
|
|
|
718
776
|
const {
|
|
719
777
|
from: fromPlace,
|
|
720
778
|
to: toPlace,
|
|
779
|
+
routePath,
|
|
721
780
|
registerOverlay
|
|
722
781
|
} = props;
|
|
723
782
|
const from = place2point(fromPlace);
|
|
724
783
|
const to = place2point(toPlace);
|
|
725
|
-
return h("div", [h(
|
|
784
|
+
return h("div", [routePath ? h(DrivingLine, {
|
|
785
|
+
"attrs": {
|
|
786
|
+
"path": routePath,
|
|
787
|
+
"status": "DONE"
|
|
788
|
+
}
|
|
789
|
+
}) : h(DrivingRoute, {
|
|
726
790
|
"attrs": {
|
|
727
791
|
"from": from,
|
|
728
792
|
"to": to,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Point } from "../../types/interface";
|
|
2
|
+
interface RandomCarsProps {
|
|
3
|
+
center: Point;
|
|
4
|
+
}
|
|
5
|
+
export declare const RandomCars: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<RandomCarsProps>, 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<RandomCarsProps, Required<RandomCarsProps>>, never, RandomCarsProps>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
import { computed } from "vue-demi";
|
|
3
|
+
import { defineSetup } from "../../types/helper.js";
|
|
4
|
+
import { TaxiCar } from "./TaxiCar.js";
|
|
5
|
+
const RANDOM_CARS_RADIUS = 300;
|
|
6
|
+
const RANDOM_CARS_COUNT = 2;
|
|
7
|
+
const createRandomPoint = (center, radius) => {
|
|
8
|
+
const [lng, lat] = center;
|
|
9
|
+
const R_EARTH_METERS = 6371e3;
|
|
10
|
+
const randomAngle = Math.random() * 2 * Math.PI;
|
|
11
|
+
const randomRadiusInMeters = radius * Math.sqrt(Math.random());
|
|
12
|
+
const dx = randomRadiusInMeters * Math.cos(randomAngle);
|
|
13
|
+
const dy = randomRadiusInMeters * Math.sin(randomAngle);
|
|
14
|
+
const dLat = dy / R_EARTH_METERS;
|
|
15
|
+
const centerLatRadians = lat * (Math.PI / 180);
|
|
16
|
+
const dLng = dx / (R_EARTH_METERS * Math.cos(centerLatRadians));
|
|
17
|
+
return [lng + dLng * (180 / Math.PI), lat + dLat * (180 / Math.PI)];
|
|
18
|
+
};
|
|
19
|
+
const useRandomCars = (center) => {
|
|
20
|
+
return computed(() => {
|
|
21
|
+
return Array.from({
|
|
22
|
+
length: RANDOM_CARS_COUNT
|
|
23
|
+
}).map(() => {
|
|
24
|
+
const position = createRandomPoint(center, RANDOM_CARS_RADIUS);
|
|
25
|
+
const angle = Math.random() * 360;
|
|
26
|
+
return {
|
|
27
|
+
position,
|
|
28
|
+
angle
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const RandomCars = defineSetup("RandomCars", function(props) {
|
|
34
|
+
const {
|
|
35
|
+
center
|
|
36
|
+
} = props;
|
|
37
|
+
const randomCarsRef = useRandomCars(center);
|
|
38
|
+
return () => h("div", [randomCarsRef.value.map((car) => h(TaxiCar, {
|
|
39
|
+
"attrs": {
|
|
40
|
+
"position": car.position,
|
|
41
|
+
"angle": car.angle
|
|
42
|
+
}
|
|
43
|
+
}))]);
|
|
44
|
+
});
|
|
45
|
+
export {
|
|
46
|
+
RandomCars
|
|
47
|
+
};
|