@heycar/heycars-map 2.13.0-relay2 → 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.
Files changed (92) hide show
  1. package/README.md +47 -4
  2. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +2 -1
  3. package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +2 -1
  4. package/dist/v2/Demo/DemoBusinessTaxiEnd.js +9 -2
  5. package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +4 -1
  6. package/dist/v2/Demo/DemoBusinessTaxiService.js +19 -1
  7. package/dist/v2/Demo/demo.data.mock.d.ts +4 -0
  8. package/dist/v2/Demo/demo.data.mock.js +1194 -0
  9. package/dist/v2/api/contants.d.ts +3 -0
  10. package/dist/v2/api/contants.js +6 -0
  11. package/dist/v2/business-components/AuxiliaryPassanger/AuxiliaryPassanger.d.ts +6 -0
  12. package/dist/v2/business-components/AuxiliaryPassanger/AuxiliaryPassanger.js +50 -0
  13. package/dist/v2/business-components/AuxiliaryPassanger/index.d.ts +1 -0
  14. package/dist/v2/business-components/AuxiliaryPassanger/index.js +4 -0
  15. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -0
  16. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +2 -1
  17. package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +1 -1
  18. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +1 -1
  19. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
  20. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +6 -2
  21. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +4 -1
  22. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +51 -7
  23. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +6 -1
  24. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +81 -19
  25. package/dist/v2/business-components/TaxiCar/RandomCars.d.ts +6 -0
  26. package/dist/v2/business-components/TaxiCar/RandomCars.js +47 -0
  27. package/dist/v2/chunks/{BusinessRecomendPlaceMap.e9166e7d.js → BusinessRecomendPlaceMap.eebd0822.js} +7 -1
  28. package/dist/v2/hooks/useMapCoordinatify.d.ts +2 -1
  29. package/dist/v2/hooks/useMapCoordinatify.js +6 -1
  30. package/dist/v2/hooks/useMapGeometry.d.ts +3 -3
  31. package/dist/v2/hooks/useMapGeometry.js +3 -3
  32. package/dist/v2/hooks/useWalkingRoute.js +46 -4
  33. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  34. package/dist/v2/index.js +1 -1
  35. package/dist/v2/types/interface.d.ts +12 -0
  36. package/dist/v2/utils/geometry.d.ts +1 -0
  37. package/dist/v2/utils/geometry.js +4 -2
  38. package/dist/v2/utils/geometryPolygon.d.ts +14 -0
  39. package/dist/v2/utils/geometryPolygon.js +46 -0
  40. package/dist/v2/utils/log.js +11 -3
  41. package/dist/v2/utils/platform.d.ts +2 -1
  42. package/dist/v2/utils/platform.js +2 -1
  43. package/dist/v2/utils/ttlCache.d.ts +34 -0
  44. package/dist/v2/utils/ttlCache.js +64 -0
  45. package/dist/v2/utils/typeChecking.d.ts +7 -1
  46. package/dist/v2/utils/typeChecking.js +18 -0
  47. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +2 -1
  48. package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +2 -1
  49. package/dist/v3/Demo/DemoBusinessTaxiEnd.js +9 -2
  50. package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +4 -1
  51. package/dist/v3/Demo/DemoBusinessTaxiService.js +19 -1
  52. package/dist/v3/Demo/demo.data.mock.d.ts +4 -0
  53. package/dist/v3/Demo/demo.data.mock.js +1194 -0
  54. package/dist/v3/api/contants.d.ts +3 -0
  55. package/dist/v3/api/contants.js +6 -0
  56. package/dist/v3/business-components/AuxiliaryPassanger/AuxiliaryPassanger.d.ts +8 -0
  57. package/dist/v3/business-components/AuxiliaryPassanger/AuxiliaryPassanger.js +46 -0
  58. package/dist/v3/business-components/AuxiliaryPassanger/index.d.ts +1 -0
  59. package/dist/v3/business-components/AuxiliaryPassanger/index.js +4 -0
  60. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -0
  61. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +2 -1
  62. package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +1 -1
  63. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +1 -1
  64. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
  65. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +6 -2
  66. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +4 -1
  67. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +49 -7
  68. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +6 -1
  69. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +63 -19
  70. package/dist/v3/business-components/TaxiCar/RandomCars.d.ts +8 -0
  71. package/dist/v3/business-components/TaxiCar/RandomCars.js +45 -0
  72. package/dist/v3/chunks/{BusinessRecomendPlaceMap.c71d0b97.js → BusinessRecomendPlaceMap.71c439c6.js} +5 -1
  73. package/dist/v3/hooks/useMapCoordinatify.d.ts +2 -1
  74. package/dist/v3/hooks/useMapCoordinatify.js +6 -1
  75. package/dist/v3/hooks/useMapGeometry.d.ts +3 -3
  76. package/dist/v3/hooks/useMapGeometry.js +3 -3
  77. package/dist/v3/hooks/useWalkingRoute.js +46 -4
  78. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  79. package/dist/v3/index.js +1 -1
  80. package/dist/v3/types/interface.d.ts +12 -0
  81. package/dist/v3/utils/geometry.d.ts +1 -0
  82. package/dist/v3/utils/geometry.js +4 -2
  83. package/dist/v3/utils/geometryPolygon.d.ts +14 -0
  84. package/dist/v3/utils/geometryPolygon.js +46 -0
  85. package/dist/v3/utils/log.js +11 -3
  86. package/dist/v3/utils/platform.d.ts +2 -1
  87. package/dist/v3/utils/platform.js +2 -1
  88. package/dist/v3/utils/ttlCache.d.ts +34 -0
  89. package/dist/v3/utils/ttlCache.js +64 -0
  90. package/dist/v3/utils/typeChecking.d.ts +7 -1
  91. package/dist/v3/utils/typeChecking.js +18 -0
  92. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { createVNode } from "vue";
2
2
  import { apiGetAuxiliaryGrapStatus } from "../../api/browser.js";
3
- import { MAX_DEVIATION_DISTANCE, CAR_DISTANCE_MIN } from "../../api/contants.js";
3
+ import { PASSENGER_DISTANCE_MAX, MAX_DEVIATION_DISTANCE, PASSENGER_DISTANCE_MIN, CAR_DISTANCE_MIN } from "../../api/contants.js";
4
4
  import { useMapGeometry } from "../../hooks/useMapGeometry.js";
5
5
  import { useMapSupplier } from "../../hooks/useMapSupplier.js";
6
6
  import { defineSetup } from "../../types/helper.js";
@@ -19,8 +19,6 @@ import { WalkingLine } from "../WalkingLine/WalkingLine.js";
19
19
  import { WalkingRoute } from "../WalkingRoute/WalkingRoute.js";
20
20
  import { WaveCircle } from "../WaveCircle/WaveCircle.js";
21
21
  const IS_ENABLE_AUXILIARY_GRASP_ROAD = apiGetAuxiliaryGrapStatus();
22
- const PASSENGER_DISTANCE_MAX = 2e3;
23
- const PASSENGER_DISTANCE_MIN = 20;
24
22
  const AUTO_FIT_VIEW_INTERVAL = IS_ENABLE_AUXILIARY_GRASP_ROAD ? 24 * 3600 * 1e3 : 15e3;
25
23
  const carDurationWithinMinDistance = (distance) => Math.floor(distance / 5);
26
24
  const SectionDispatching = defineSetup("SectionDispatching", function(props) {
@@ -69,12 +67,15 @@ const SectionConfirmed = defineSetup("SectionConfirmed", function(props) {
69
67
  to: toPlace,
70
68
  passengerPosition,
71
69
  passengerAngle,
70
+ routePath,
72
71
  registerOverlay
73
72
  } = props;
74
73
  const from = place2point(fromPlace);
75
74
  const to = place2point(toPlace);
76
75
  const passengerDistance = passengerPosition ? apiMapDistance(passengerPosition, from) : void 0;
77
- return createVNode("div", null, [createVNode(DrivingRoute, {
76
+ return createVNode("div", null, [routePath ? createVNode(DrivingLine, {
77
+ "path": routePath
78
+ }, null) : createVNode(DrivingRoute, {
78
79
  "to": to,
79
80
  "from": from,
80
81
  "render": ({
@@ -131,12 +132,14 @@ const SectionDriverStartRelayService = defineSetup("SectionDriverStartRelayServi
131
132
  apiMapDistance
132
133
  } = useMapGeometry();
133
134
  return () => {
135
+ var _a;
134
136
  const {
135
137
  from: fromPlace,
136
138
  relayTo: relayToPlace,
137
139
  carPosition,
138
140
  carAngle,
139
141
  carTrackPositions,
142
+ carRoute,
140
143
  passengerPosition,
141
144
  passengerAngle,
142
145
  relayToTitle,
@@ -170,7 +173,17 @@ const SectionDriverStartRelayService = defineSetup("SectionDriverStartRelayServi
170
173
  "position": relayTo,
171
174
  "label": relayToTitle,
172
175
  "hideIcon": true
173
- }, null), !(carTrackPositions == null ? void 0 : carTrackPositions.length) || !carDistance ? null : createVNode(DeviationCorrectionDrivingRoute, {
176
+ }, null), carRoute ? [createVNode(DrivingLine, {
177
+ "path": carRoute.path
178
+ }, null), createVNode(TaxiCar, {
179
+ "position": (_a = carRoute.path[0]) != null ? _a : carPosition,
180
+ "angle": carAngle,
181
+ "title": renderTitle({
182
+ distance: carRoute.distance,
183
+ duration: carRoute.duration
184
+ }),
185
+ "registerOverlay": fittableRegistryOverlay
186
+ }, null)] : !(carTrackPositions == null ? void 0 : carTrackPositions.length) || !carDistance ? null : createVNode(DeviationCorrectionDrivingRoute, {
174
187
  "tracks": carTrackPositions,
175
188
  "to": from,
176
189
  "waypoints": waypoints,
@@ -182,12 +195,12 @@ const SectionDriverStartRelayService = defineSetup("SectionDriverStartRelayServi
182
195
  duration,
183
196
  trafficJams
184
197
  }) => {
185
- var _a;
198
+ var _a2;
186
199
  return [relayTo ? createVNode(TrafficDrivingLine, {
187
200
  "path": path,
188
201
  "trafficJams": trafficJams
189
202
  }, null) : null, createVNode(TaxiCar, {
190
- "position": (_a = path[0]) != null ? _a : carPosition,
203
+ "position": (_a2 = path[0]) != null ? _a2 : carPosition,
191
204
  "angle": angle != null ? angle : carAngle,
192
205
  "title": renderTitle({
193
206
  distance,
@@ -228,11 +241,13 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
228
241
  apiMapDistance
229
242
  } = useMapGeometry();
230
243
  return () => {
244
+ var _a;
231
245
  const {
232
246
  from: fromPlace,
233
247
  carPosition,
234
248
  carAngle,
235
249
  carTrackPositions,
250
+ carRoute,
236
251
  passengerPosition,
237
252
  passengerAngle,
238
253
  renderTitle
@@ -254,7 +269,17 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
254
269
  "position": from,
255
270
  "label": fromPlace.displayName,
256
271
  "hideIcon": true
257
- }, null), !(carTrackPositions == null ? void 0 : carTrackPositions.length) || !carDistance ? null : carDistance > CAR_DISTANCE_MIN ? createVNode(DeviationCorrectionDrivingRoute, {
272
+ }, null), carRoute ? [createVNode(DrivingLine, {
273
+ "path": carRoute.path
274
+ }, null), createVNode(TaxiCar, {
275
+ "position": (_a = carRoute.path[0]) != null ? _a : carPosition,
276
+ "angle": carAngle,
277
+ "title": renderTitle({
278
+ distance: carRoute.distance,
279
+ duration: carRoute.duration
280
+ }),
281
+ "registerOverlay": fittableRegistryOverlay
282
+ }, null)] : !(carTrackPositions == null ? void 0 : carTrackPositions.length) || !carDistance ? null : carDistance > CAR_DISTANCE_MIN ? createVNode(DeviationCorrectionDrivingRoute, {
258
283
  "tracks": carTrackPositions,
259
284
  "to": from,
260
285
  "deviation": MAX_DEVIATION_DISTANCE,
@@ -265,12 +290,12 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
265
290
  duration,
266
291
  trafficJams
267
292
  }) => {
268
- var _a;
293
+ var _a2;
269
294
  return [createVNode(TrafficDrivingLine, {
270
295
  "path": path,
271
296
  "trafficJams": trafficJams
272
297
  }, null), createVNode(TaxiCar, {
273
- "position": (_a = path[0]) != null ? _a : carPosition,
298
+ "position": (_a2 = path[0]) != null ? _a2 : carPosition,
274
299
  "angle": angle != null ? angle : carAngle,
275
300
  "title": renderTitle({
276
301
  distance,
@@ -285,9 +310,9 @@ const SectionDriverStartService = defineSetup("SectionDriverStartService", funct
285
310
  path: graspRoadPath,
286
311
  angle
287
312
  }) => {
288
- var _a;
313
+ var _a2;
289
314
  return createVNode(TaxiCar, {
290
- "position": (_a = graspRoadPath[graspRoadPath.length - 1]) != null ? _a : carPosition,
315
+ "position": (_a2 = graspRoadPath[graspRoadPath.length - 1]) != null ? _a2 : carPosition,
291
316
  "angle": angle != null ? angle : carAngle,
292
317
  "title": renderTitle({
293
318
  distance: carDistance,
@@ -327,12 +352,15 @@ const SectionBookDispatched = defineSetup("SectionBookDispatched", function(prop
327
352
  title,
328
353
  passengerPosition,
329
354
  passengerAngle,
355
+ routePath,
330
356
  registerOverlay
331
357
  } = props;
332
358
  const from = place2point(fromPlace);
333
359
  const to = place2point(toPlace);
334
360
  const passengerDistance = passengerPosition ? apiMapDistance(passengerPosition, from) : void 0;
335
- return createVNode("div", null, [createVNode(DrivingRoute, {
361
+ return createVNode("div", null, [routePath ? createVNode(DrivingLine, {
362
+ "path": routePath
363
+ }, null) : createVNode(DrivingRoute, {
336
364
  "to": to,
337
365
  "from": from,
338
366
  "render": ({
@@ -453,11 +481,13 @@ const SectionInService = defineSetup("SectionInService", function(props) {
453
481
  immediate: true
454
482
  });
455
483
  return () => {
484
+ var _a;
456
485
  const {
457
486
  to: toPlace,
458
487
  carPosition,
459
488
  carAngle,
460
489
  carTrackPositions,
490
+ carRoute,
461
491
  renderTitle
462
492
  } = props;
463
493
  const to = place2point(toPlace);
@@ -468,7 +498,17 @@ const SectionInService = defineSetup("SectionInService", function(props) {
468
498
  apiMapDistance
469
499
  } = useMapGeometry();
470
500
  const carDistance = carPosition ? apiMapDistance(carPosition, to) : void 0;
471
- return createVNode("div", null, [!(carTrackPositions == null ? void 0 : carTrackPositions.length) || !carDistance ? null : carDistance > CAR_DISTANCE_MIN ? createVNode(DeviationCorrectionDrivingRoute, {
501
+ return createVNode("div", null, [carRoute ? [createVNode(DrivingLine, {
502
+ "path": carRoute.path
503
+ }, null), createVNode(TaxiCar, {
504
+ "position": (_a = carRoute.path[0]) != null ? _a : carPosition,
505
+ "angle": carAngle,
506
+ "title": renderTitle({
507
+ distance: carRoute.distance,
508
+ duration: carRoute.duration
509
+ }),
510
+ "registerOverlay": fittableRegistryOverlay
511
+ }, null)] : !(carTrackPositions == null ? void 0 : carTrackPositions.length) || !carDistance ? null : carDistance > CAR_DISTANCE_MIN ? createVNode(DeviationCorrectionDrivingRoute, {
472
512
  "tracks": carTrackPositions,
473
513
  "to": to,
474
514
  "deviation": MAX_DEVIATION_DISTANCE,
@@ -479,12 +519,12 @@ const SectionInService = defineSetup("SectionInService", function(props) {
479
519
  duration,
480
520
  trafficJams
481
521
  }) => {
482
- var _a;
522
+ var _a2;
483
523
  return [createVNode(TrafficDrivingLine, {
484
524
  "path": path,
485
525
  "trafficJams": trafficJams
486
526
  }, null), createVNode(TaxiCar, {
487
- "position": (_a = path[0]) != null ? _a : carPosition,
527
+ "position": (_a2 = path[0]) != null ? _a2 : carPosition,
488
528
  "angle": angle != null ? angle : carAngle,
489
529
  "title": renderTitle({
490
530
  distance,
@@ -499,9 +539,9 @@ const SectionInService = defineSetup("SectionInService", function(props) {
499
539
  path: graspRoadPath,
500
540
  angle
501
541
  }) => {
502
- var _a;
542
+ var _a2;
503
543
  return createVNode(TaxiCar, {
504
- "position": (_a = graspRoadPath[graspRoadPath.length - 1]) != null ? _a : carPosition,
544
+ "position": (_a2 = graspRoadPath[graspRoadPath.length - 1]) != null ? _a2 : carPosition,
505
545
  "angle": angle != null ? angle : carAngle,
506
546
  "title": renderTitle({
507
547
  distance: carDistance,
@@ -576,11 +616,15 @@ const SectionEndService = defineSetup("SectionEndService", function(props) {
576
616
  const {
577
617
  from: fromPlace,
578
618
  to: toPlace,
619
+ routePath,
579
620
  registerOverlay
580
621
  } = props;
581
622
  const from = place2point(fromPlace);
582
623
  const to = place2point(toPlace);
583
- return createVNode("div", null, [createVNode(DrivingRoute, {
624
+ return createVNode("div", null, [routePath ? createVNode(DrivingLine, {
625
+ "path": routePath,
626
+ "status": "DONE"
627
+ }, null) : createVNode(DrivingRoute, {
584
628
  "from": from,
585
629
  "to": to,
586
630
  "render": ({
@@ -0,0 +1,8 @@
1
+ import type { Point } from "../../types/interface";
2
+ interface RandomCarsProps {
3
+ center: Point;
4
+ }
5
+ export declare const RandomCars: import("vue-demi").DefineComponent<import("vue-demi").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, import("vue-demi").PublicProps, RandomCarsProps, RandomCarsProps, import("vue-demi").SlotsType<{} & {
6
+ default?: import("../../demi-polyfill").Slot | undefined;
7
+ }>>;
8
+ export {};
@@ -0,0 +1,45 @@
1
+ import { createVNode } 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 () => createVNode("div", null, [randomCarsRef.value.map((car) => createVNode(TaxiCar, {
39
+ "position": car.position,
40
+ "angle": car.angle
41
+ }, null))]);
42
+ });
43
+ export {
44
+ RandomCars
45
+ };
@@ -26,6 +26,7 @@ import { DeviceOrientation } from "../business-components/DeviceOrientation/Devi
26
26
  import { GreenZone } from "../business-components/GreenZone/GreenZone.js";
27
27
  import { PassengerCircle } from "../business-components/PassengerCircle/PassengerCircle.js";
28
28
  import { PickupPoints } from "../business-components/PickupPoints/PickupPoints.js";
29
+ import { RandomCars } from "../business-components/TaxiCar/RandomCars.js";
29
30
  import { useCacheCenterPlace } from "../business-components/BusinessRecomendPlaceMap/useCacheCenterPlace.js";
30
31
  import { b as baseGetTag, r as root } from "./isSymbol.555c14bf.js";
31
32
  import { i as isObject } from "./debounce.5afe7867.js";
@@ -556,6 +557,7 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
556
557
  recomendDescription,
557
558
  unavailableTitle,
558
559
  forbiddenTitle,
560
+ enableNearbyCars,
559
561
  disableLocator,
560
562
  renderPlacePhoto,
561
563
  renderPlaceTag
@@ -603,6 +605,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
603
605
  "zoomIconMin": zoneRef.value ? RECOMMEND_PLACE_ZONE_ICON_MIN : RECOMMEND_PLACE_ICON_ZOOM_MIN,
604
606
  "zoomTextMin": zoneRef.value ? RECOMMEND_PLACE_ZONE_TEXT_MIN : RECOMMEND_PLACE_TEXT_ZOOM_MIN,
605
607
  "onClick": panToCenterByPlace
608
+ }, null), !!enableNearbyCars && zoomRef.value >= RECOMMEND_PLACE_ZONE_ICON_MIN && createVNode(RandomCars, {
609
+ "center": [centerPlace.lng, centerPlace.lat]
606
610
  }, null)];
607
611
  }
608
612
  });
@@ -627,7 +631,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
627
631
  key: `${payload.supplier}${instanceNo}`,
628
632
  on: generateCreateElementV2PropsOn(props, emit, ["loadGeoLocation", "loadDefaultGeoLocation", "changeByDrag", "changeGeoLocation", "changePlace", "changeRecomandPlace", "geoError", "geoErrorOnce", "clickLocatorText", "clickLocatorPhoto"])
629
633
  });
630
- }).props(["log", "geoLoadingTitle", "emptyTitle", "queryingTitle", "defaultCenterPlace", "geoErrorOnceNotificationKey", "unavailableTitle", "forbiddenTitle", "recomendDescription", "disableLocator", "fallback", "getRecomendPlace", "getAvailable", "renderPlacePhoto", "renderPlaceTag", "loading", "mapContext"]);
634
+ }).props(["log", "geoLoadingTitle", "emptyTitle", "queryingTitle", "defaultCenterPlace", "geoErrorOnceNotificationKey", "unavailableTitle", "forbiddenTitle", "recomendDescription", "enableNearbyCars", "disableLocator", "fallback", "getRecomendPlace", "getAvailable", "renderPlacePhoto", "renderPlaceTag", "loading", "mapContext"]);
631
635
  export {
632
636
  BusinessRecomendPlaceMap as B,
633
637
  DEFAULT_ZOOM as D,
@@ -1,4 +1,4 @@
1
- import { type CoordinateGeoPosition, type CoordinatePlace, type CoordinatePoint, type CoordinateRecommendZonePlaces, type CoordinateTrackPoint, type CoordinateValueOfOnChangeRecommendPlace, type CoordinateZone, type GeoPosition, type Place, type Point, type RecommendZonePlaces, type TrackPoint, type ValueOfOnChangeRecommendPlace, type Zone } from "../types/interface";
1
+ import { type CoordinateExternalRoute, type CoordinateGeoPosition, type CoordinatePlace, type CoordinatePoint, type CoordinateRecommendZonePlaces, type CoordinateTrackPoint, type CoordinateValueOfOnChangeRecommendPlace, type CoordinateZone, type ExternalRoute, type GeoPosition, type Place, type Point, type RecommendZonePlaces, type TrackPoint, type ValueOfOnChangeRecommendPlace, type Zone } from "../types/interface";
2
2
  export declare function useMapCoordinatify(): {
3
3
  coordinatifyPoint: (value: Point) => CoordinatePoint;
4
4
  unCoordinatifyPoint: (value: CoordinatePoint) => Point;
@@ -12,4 +12,5 @@ export declare function useMapCoordinatify(): {
12
12
  unCoordinatifyValueOfOnChangeRecommendPlace: (value: CoordinateValueOfOnChangeRecommendPlace) => ValueOfOnChangeRecommendPlace;
13
13
  coordinatifyGeoPosition: (value: GeoPosition) => CoordinateGeoPosition;
14
14
  unCoordinatifyTrackPoint: (value: CoordinateTrackPoint) => TrackPoint;
15
+ unCoordinatifyExternalRoute: (value: CoordinateExternalRoute) => ExternalRoute;
15
16
  };
@@ -74,6 +74,10 @@ function useMapCoordinatify() {
74
74
  const [lng, lat] = unCoordinatifyPoint(value);
75
75
  return { ...others, lng, lat };
76
76
  };
77
+ const unCoordinatifyExternalRoute = (value) => {
78
+ const { path, duration, distance } = value;
79
+ return { path: path.map(unCoordinatifyPoint), duration, distance };
80
+ };
77
81
  const coordinatifyGeoPosition = (value) => {
78
82
  return {
79
83
  ...value,
@@ -92,7 +96,8 @@ function useMapCoordinatify() {
92
96
  coordinatifyValueOfOnChangeRecommendPlace,
93
97
  unCoordinatifyValueOfOnChangeRecommendPlace,
94
98
  coordinatifyGeoPosition,
95
- unCoordinatifyTrackPoint
99
+ unCoordinatifyTrackPoint,
100
+ unCoordinatifyExternalRoute
96
101
  };
97
102
  }
98
103
  export {
@@ -1,17 +1,17 @@
1
1
  import type { Point } from "../types/interface";
2
2
  export declare const apiLocalIsPointInRing: (point: Point, path: Point[]) => boolean;
3
3
  export declare const useAmapGeometry: () => {
4
- apiMapDistance: (from: Point, to: Point) => number | undefined;
4
+ apiMapDistance: (from: Point, to: Point) => number;
5
5
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
6
6
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
7
7
  };
8
8
  export declare const useGmapGeometry: () => {
9
- apiMapDistance: (from: Point, to: Point) => number | undefined;
9
+ apiMapDistance: (from: Point, to: Point) => number;
10
10
  apiMapDistanceToLine: (from: Point, line: Point[]) => 0 | undefined;
11
11
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
12
12
  };
13
13
  export declare const useMapGeometry: () => {
14
- apiMapDistance: (from: Point, to: Point) => number | undefined;
14
+ apiMapDistance: (from: Point, to: Point) => number;
15
15
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
16
16
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
17
17
  };
@@ -1,4 +1,4 @@
1
- import { pointInPolygon } from "../utils/geometryPolygon.js";
1
+ import { pointInPolygon, distanceBetweenTwoPoints } from "../utils/geometryPolygon.js";
2
2
  import { vec2lnglat } from "../utils/transform.js";
3
3
  import { Status } from "./useMapLoader.js";
4
4
  import { useMapSupplier } from "./useMapSupplier.js";
@@ -7,7 +7,7 @@ const useAmapGeometry = () => {
7
7
  const payload = useMapSupplier();
8
8
  const apiMapDistance = (from, to) => {
9
9
  if (payload.status !== Status.SUCCESS)
10
- return void 0;
10
+ return distanceBetweenTwoPoints(from, to);
11
11
  return AMap.GeometryUtil.distance(from, to);
12
12
  };
13
13
  const apiMapDistanceToLine = (from, line) => {
@@ -26,7 +26,7 @@ const useGmapGeometry = () => {
26
26
  const payload = useMapSupplier();
27
27
  const apiMapDistance = (from, to) => {
28
28
  if (payload.status !== Status.SUCCESS)
29
- return void 0;
29
+ return distanceBetweenTwoPoints(from, to);
30
30
  return google.maps.geometry.spherical.computeDistanceBetween(vec2lnglat(from), vec2lnglat(to));
31
31
  };
32
32
  const apiMapDistanceToLine = (from, line) => {
@@ -1,15 +1,56 @@
1
1
  import { shallowRef } from "vue-demi";
2
+ import { MAX_DEVIATION_DISTANCE_WALKING } from "../api/contants.js";
2
3
  import { watchPostEffectForDeepOption } from "../utils/compare.js";
3
4
  import { googleServiceApiWalkingRoute, amapJsApiWalkingRoute, gaodeServiceApiWalkingRoute, gmapJsApiWalkingRoute } from "../utils/compatibleWalkingRoute.js";
5
+ import { findClosestPointInLine } from "../utils/geometry.js";
6
+ import { distanceBetweenTwoPoints } from "../utils/geometryPolygon.js";
7
+ import { spaceLog } from "../utils/log.js";
8
+ import { createMemoizeWithTTL } from "../utils/ttlCache.js";
4
9
  import { inTaiwan, inKorean } from "./useMapInChina.js";
5
10
  import { useMapSupplier } from "./useMapSupplier.js";
11
+ const WALKING_ROUTE_CACHE_TTL = 30 * 60 * 1e3;
12
+ const findBestContinuation = (args, cacheEntries) => {
13
+ const [from, to] = args;
14
+ let bestPath;
15
+ for (const [[cacheFrom, cacheTo], path] of cacheEntries) {
16
+ if (!path || path.length < 2)
17
+ continue;
18
+ const deviationOfEndPoint = distanceBetweenTwoPoints(cacheTo, to);
19
+ if (deviationOfEndPoint > MAX_DEVIATION_DISTANCE_WALKING)
20
+ continue;
21
+ {
22
+ const { distance: deviationOfStartPoint } = findClosestPointInLine(
23
+ from,
24
+ [cacheFrom, ...path],
25
+ distanceBetweenTwoPoints
26
+ );
27
+ if (deviationOfStartPoint > MAX_DEVIATION_DISTANCE_WALKING)
28
+ continue;
29
+ }
30
+ const { point: projectedPoint, index } = findClosestPointInLine(
31
+ from,
32
+ path,
33
+ distanceBetweenTwoPoints
34
+ );
35
+ const trimmedPath = [projectedPoint, ...path.slice(index + 1)];
36
+ if (trimmedPath.length < 2)
37
+ continue;
38
+ if (!bestPath || trimmedPath.length < bestPath.length) {
39
+ bestPath = trimmedPath;
40
+ }
41
+ }
42
+ return bestPath;
43
+ };
44
+ const memoizeAmapWalkingRoute = createMemoizeWithTTL(WALKING_ROUTE_CACHE_TTL, findBestContinuation);
45
+ const memoizeGmapWalkingRoute = createMemoizeWithTTL(WALKING_ROUTE_CACHE_TTL, findBestContinuation);
6
46
  const useAWalkingRoute = (props) => {
7
47
  const { googleRoutesProxyUrl } = useMapSupplier();
8
48
  const pathRef = shallowRef([]);
9
49
  const amapWalking = new AMap.Walking({});
10
- const apiMapWalkingRoute = (from, to) => {
50
+ const apiMapWalkingRoute = memoizeAmapWalkingRoute((from, to) => {
51
+ spaceLog("apiMapWalkingRoute", `amap from = ${from} to = ${to}`);
11
52
  return googleRoutesProxyUrl && inTaiwan(from) ? googleServiceApiWalkingRoute(from, to, googleRoutesProxyUrl) : amapJsApiWalkingRoute(from, to, amapWalking);
12
- };
53
+ });
13
54
  watchPostEffectForDeepOption(
14
55
  () => {
15
56
  const { from, to } = props;
@@ -27,11 +68,12 @@ const useGWalkingRoute = (props) => {
27
68
  const { gaodeDirectionWalkingProxyUrl, googleRoutesProxyUrl } = useMapSupplier();
28
69
  const pathRef = shallowRef([]);
29
70
  const gmapDirectionsService = new google.maps.DirectionsService();
30
- const apiMapWalkingRoute = (from, to) => {
71
+ const apiMapWalkingRoute = memoizeGmapWalkingRoute((from, to) => {
72
+ spaceLog("apiMapWalkingRoute", `gmap from = ${from} to = ${to}`);
31
73
  if (inKorean(from))
32
74
  return Promise.resolve([]);
33
75
  return gaodeDirectionWalkingProxyUrl && inKorean(from) ? gaodeServiceApiWalkingRoute(from, to, gaodeDirectionWalkingProxyUrl) : googleRoutesProxyUrl ? googleServiceApiWalkingRoute(from, to, googleRoutesProxyUrl) : gmapJsApiWalkingRoute(from, to, gmapDirectionsService);
34
- };
76
+ });
35
77
  watchPostEffectForDeepOption(
36
78
  () => {
37
79
  const { from, to } = props;
@@ -1,5 +1,5 @@
1
1
  import { reactive, ref, readonly } from "vue-demi";
2
- import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.c71d0b97.js";
2
+ import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.71c439c6.js";
3
3
  import { CenterPlaceStatus } from "../types/interface.js";
4
4
  import { proxyFunctionalProperty, assertAssingedBeforeUsed } from "../utils/helper.js";
5
5
  const useBusinessRecomendPlaceMap = () => {
package/dist/v3/index.js CHANGED
@@ -2,7 +2,7 @@ import "./utils/alipayPolyfill.js";
2
2
  import { isCoordinatePointEqual } from "./api/geometry.js";
3
3
  import { AbsoluteAddressBox } from "./business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
4
4
  import { BusinessQuotingMap } from "./business-components/BusinessQuotingMap/BusinessQuotingMap.js";
5
- import { B } from "./chunks/BusinessRecomendPlaceMap.c71d0b97.js";
5
+ import { B } from "./chunks/BusinessRecomendPlaceMap.71c439c6.js";
6
6
  import { BusinessReselectPlaceMap } from "./business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js";
7
7
  import { BusinessTaxiEndMap } from "./business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js";
8
8
  import { BusinessTaxiServiceMap } from "./business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js";
@@ -80,6 +80,11 @@ export interface Route {
80
80
  steps: RouteStep[];
81
81
  trafficJams?: TrafficJams;
82
82
  }
83
+ export interface ExternalRoute {
84
+ path: Point[];
85
+ duration: number;
86
+ distance: number;
87
+ }
83
88
  export interface TrackPoint {
84
89
  lng: number;
85
90
  lat: number;
@@ -90,6 +95,13 @@ export interface TrackPoint {
90
95
  export interface CoordinateTrackPoint extends TrackPoint {
91
96
  type: CoordinateType;
92
97
  }
98
+ export interface CoordinateExternalRoute extends Omit<ExternalRoute, "path"> {
99
+ path: CoordinatePoint[];
100
+ }
101
+ export type GetDriverRouteOrTrackOutput = {
102
+ routes?: CoordinateExternalRoute;
103
+ tracks?: CoordinateTrackPoint[];
104
+ };
93
105
  export type RecommendType = "Restricted" | "Forbidden" | "Recommend";
94
106
  export type DriverStatus = "dispatching" | "book-dispatching" | "dispatched" | "driverStartService" | "driverStartRelayService" | "book-driverStartService" | "book-dispatched" | "driverArrived" | "inService" | "canceled" | "endService" | "completed" | "canceling" | "banlanceRefund" | "waitBanlanceRefund" | "rechargePayed" | "waitRechargePay" | "payed" | "waitpay" | "refund" | "confirmed" | "assign" | "orderReassigned";
95
107
  export declare enum CenterPlaceStatus {
@@ -4,6 +4,7 @@ export declare const findClosestPointInSegment: (point: Point, segment: [Point,
4
4
  export declare const findClosestPointInLine: (point: Point, path: Point[], distanceFn: DistanceFn) => {
5
5
  point: Point;
6
6
  distance: number;
7
+ index: number;
7
8
  };
8
9
  export declare const isPointInSegment: (point: Point, segment: [Point, Point]) => boolean;
9
10
  export declare const isPointInHalfOpenSegment: (point: Point, segment: [Point, Point]) => boolean;
@@ -23,9 +23,10 @@ const findClosestPointInLine = (point, path, distanceFn) => {
23
23
  var _a, _b;
24
24
  let min = Infinity;
25
25
  let target;
26
+ let idx;
26
27
  assertPropNoEmptyArray(path, "findClosestPointInLine", "path");
27
28
  if (path.length === 1)
28
- return { point: path[0], distance: (_a = distanceFn(point, path[0])) != null ? _a : 0 };
29
+ return { point: path[0], distance: (_a = distanceFn(point, path[0])) != null ? _a : 0, index: 0 };
29
30
  for (let index = 0; index < path.length - 1; index++) {
30
31
  const closestPoint = findClosestPointInSegment(point, [path[index], path[index + 1]]);
31
32
  const distance = (_b = distanceFn(point, closestPoint)) != null ? _b : 0;
@@ -33,8 +34,9 @@ const findClosestPointInLine = (point, path, distanceFn) => {
33
34
  continue;
34
35
  target = closestPoint;
35
36
  min = distance;
37
+ idx = index;
36
38
  }
37
- return { point: target, distance: min };
39
+ return { point: target, distance: min, index: idx };
38
40
  };
39
41
  const floatEqual = (x1, x2) => {
40
42
  return Math.abs(x1 - x2) < 1e4 * Number.EPSILON;
@@ -4,3 +4,17 @@ import type { Point } from "../types/interface";
4
4
  * @returns 1 在内部, 0 边界上 , -1 在外部
5
5
  */
6
6
  export declare function pointInPolygon(point: Point, polygon: Point[]): 1 | 0 | -1;
7
+ export declare const distanceBetweenTwoPoints: (from: Point, to: Point) => number;
8
+ /**
9
+ * 计算折线(按顺序连接各点)总长度。
10
+ */
11
+ export declare const computeLineLength: (line: Point[]) => number;
12
+ /**
13
+ * 计算从起点指向终点的初始方位角(heading)。
14
+ * 说明:
15
+ * - 基于球面大圆航线计算(WGS84 半径近似),与常见地图 SDK 的 heading 含义一致
16
+ * - 返回范围为 [-180, 180](度):0 表示正北,正值为东偏北,负值为西偏南
17
+ * - 起终点经纬完全相同返回 0
18
+ * @returns 初始方位角(度)
19
+ */
20
+ export declare const computeLineAngle: (from: Point, to: Point) => number;
@@ -22,6 +22,52 @@ function pointInPolygon(point, polygon) {
22
22
  }
23
23
  return inside ? 1 : -1;
24
24
  }
25
+ const distanceBetweenTwoPoints = (from, to) => {
26
+ const [lng1, lat1] = from;
27
+ const [lng2, lat2] = to;
28
+ if (lng1 === lng2 && lat1 === lat2)
29
+ return 0;
30
+ const toRad = (deg) => deg * Math.PI / 180;
31
+ const R = 6378137;
32
+ const phi1 = toRad(lat1);
33
+ const phi2 = toRad(lat2);
34
+ const dPhi = toRad(lat2 - lat1);
35
+ const dLambda = toRad(lng2 - lng1);
36
+ const a = Math.sin(dPhi / 2) * Math.sin(dPhi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(dLambda / 2) * Math.sin(dLambda / 2);
37
+ const c = 2 * Math.asin(Math.min(1, Math.sqrt(a)));
38
+ return R * c;
39
+ };
40
+ const computeLineLength = (line) => {
41
+ var _a;
42
+ if (!Array.isArray(line) || line.length < 2)
43
+ return 0;
44
+ let totalLength = 0;
45
+ for (let i = 1; i < line.length; i++) {
46
+ totalLength += (_a = distanceBetweenTwoPoints(line[i - 1], line[i])) != null ? _a : 0;
47
+ }
48
+ return totalLength;
49
+ };
50
+ const computeLineAngle = (from, to) => {
51
+ const [lng1, lat1] = from;
52
+ const [lng2, lat2] = to;
53
+ if (lng1 === lng2 && lat1 === lat2)
54
+ return 0;
55
+ const toRad = (deg) => deg * Math.PI / 180;
56
+ const toDeg = (rad) => rad * 180 / Math.PI;
57
+ const phi1 = toRad(lat1);
58
+ const phi2 = toRad(lat2);
59
+ const lambda1 = toRad(lng1);
60
+ const lambda2 = toRad(lng2);
61
+ const deltaLambda = lambda2 - lambda1;
62
+ const y = Math.sin(deltaLambda) * Math.cos(phi2);
63
+ const x = Math.cos(phi1) * Math.sin(phi2) - Math.sin(phi1) * Math.cos(phi2) * Math.cos(deltaLambda);
64
+ let heading = toDeg(Math.atan2(y, x));
65
+ heading = (heading + 540) % 360 - 180;
66
+ return heading;
67
+ };
25
68
  export {
69
+ computeLineAngle,
70
+ computeLineLength,
71
+ distanceBetweenTwoPoints,
26
72
  pointInPolygon
27
73
  };
@@ -1,11 +1,19 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.13.0-relay2";
3
+ const pkgVersion = "2.15.0-domestic1";
4
+ const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
5
+ const enableSessionLogKey = (key) => {
6
+ const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
7
+ sessionParam.set(`log-${key}`, "true");
8
+ sessionStorage.setItem(spaceLogSessionKey, sessionParam.toString());
9
+ };
4
10
  const isEnableLog = (name) => {
5
11
  const searchParam = new URLSearchParams(location.search);
6
- return searchParam.has(`log-${name}`);
12
+ const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
13
+ return searchParam.has(`log-${name}`) || sessionParam.has(`log-${name}`);
7
14
  };
8
- window.availableLogKeys = availableLogKeys;
15
+ window.heycarMapAvailableLogKeys = availableLogKeys;
16
+ window.heycarMapEnableSessionLogKey = enableSessionLogKey;
9
17
  const spaceLog = (logKey, ...args) => {
10
18
  availableLogKeys.add(logKey);
11
19
  if (!isEnableLog(logKey))