@heycar/heycars-map 1.0.0-coordinate7 → 2.0.0-switchMap10
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 +45 -52
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/v2/App.js +8 -4
- package/dist/v2/Demo/DemoBusinessQuoting.js +6 -12
- package/dist/v2/Demo/DemoBusinessRecomendPlace.js +3 -8
- package/dist/v2/Demo/DemoBusinessReselectPlace.js +2 -7
- package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
- package/dist/v2/Demo/DemoBusinessTaxiEnd.js +2 -18
- package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +1 -2392
- package/dist/v2/Demo/DemoBusinessTaxiService.js +6 -19
- package/dist/v2/api/cdn.d.ts +1 -0
- package/dist/v2/api/cdn.js +2 -0
- package/dist/v2/api/googleSnapRoad.js +7 -2
- package/dist/v2/api/pingConnection.d.ts +9 -0
- package/dist/v2/api/pingConnection.js +111 -0
- package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +5 -5
- package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +46 -12
- package/dist/v2/business-components/BusinessQuotingMap/index.js +3 -2
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -3
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +7 -4
- package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +4 -3
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +3 -2
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +60 -24
- package/dist/v2/business-components/BusinessReselectPlaceMap/index.js +3 -2
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +2 -3
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
- package/dist/v2/business-components/BusinessTaxiEndMap/index.js +3 -2
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +5 -5
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +52 -21
- package/dist/v2/business-components/BusinessTaxiServiceMap/index.js +3 -2
- package/dist/v2/chunks/{BusinessRecomendPlaceMap.87ea3b2f.js → BusinessRecomendPlaceMap.b4d45108.js} +65 -30
- package/dist/v2/chunks/{Loading.fc6e75d0.js → Loading.492acbc2.js} +30 -2
- package/dist/v2/components/AmapMarker/AmapMarker.js +2 -1
- package/dist/v2/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
- package/dist/v2/components/Loading/Loading.css.d.ts +5 -0
- package/dist/v2/components/Loading/Loading.d.ts +6 -0
- package/dist/v2/components/Loading/Loading.js +4 -2
- package/dist/v2/components/Loading/index.js +3 -2
- package/dist/v2/components/MapProvider/MapProvider.d.ts +2 -2
- package/dist/v2/components/MapProvider/MapProvider.js +24 -13
- package/dist/v2/css/Loading-49e58ced.css +46 -0
- package/dist/v2/demi-polyfill/demi-polyfill.d.ts +1 -0
- package/dist/v2/hooks/useDrivingRoute.js +4 -0
- package/dist/v2/hooks/useMapGCJ02.js +4 -37
- package/dist/v2/hooks/useMapGeometry.d.ts +1 -3
- package/dist/v2/hooks/useMapGeometry.js +4 -4
- package/dist/v2/hooks/useMapGraspRoad.js +1 -2
- package/dist/v2/hooks/useMapInChina.d.ts +3 -15
- package/dist/v2/hooks/useMapInChina.js +11 -16
- package/dist/v2/hooks/useMapLoader.d.ts +18 -10
- package/dist/v2/hooks/useMapLoader.js +159 -82
- package/dist/v2/hooks/useMapPlace.d.ts +1 -0
- package/dist/v2/hooks/useMapPlace.js +52 -44
- package/dist/v2/hooks/useMapRecomendPlace.d.ts +1 -0
- package/dist/v2/hooks/useMapRecomendPlace.js +75 -67
- package/dist/v2/hooks/useMapSupplier.d.ts +8 -0
- package/dist/v2/hooks/useMapSupplier.js +17 -0
- package/dist/v2/hooks/usePingConnection.d.ts +10 -0
- package/dist/v2/hooks/usePingConnection.js +26 -0
- package/dist/v2/hooks-business/useBusinessAlarm.d.ts +3 -0
- package/dist/v2/hooks-business/useBusinessQuotingMap.d.ts +7 -2393
- package/dist/v2/hooks-business/useBusinessQuotingMap.js +10 -10
- package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
- package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +8 -34
- package/dist/v2/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
- package/dist/v2/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
- package/dist/v2/hooks-business/useBusinessTaxiServiceMap.js +5 -10
- package/dist/v2/index.js +1 -1
- package/dist/v2/types/global.d.ts +3 -0
- package/dist/v2/types/interface.d.ts +1 -1
- package/dist/v2/utils/ManualAbortError.d.ts +3 -0
- package/dist/v2/utils/ManualAbortError.js +14 -0
- package/dist/v2/utils/compare.d.ts +4 -0
- package/dist/v2/utils/compare.js +6 -0
- package/dist/v2/utils/helper.d.ts +6 -0
- package/dist/v2/utils/helper.js +43 -0
- package/dist/v2/utils/log.js +1 -1
- package/dist/v2/utils/patchGoogleMapLoader.d.ts +2 -0
- package/dist/v2/utils/patchGoogleMapLoader.js +64 -0
- package/dist/v3/App.js +8 -4
- package/dist/v3/Demo/DemoBusinessQuoting.js +7 -13
- package/dist/v3/Demo/DemoBusinessRecomendPlace.js +3 -8
- package/dist/v3/Demo/DemoBusinessReselectPlace.js +2 -7
- package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
- package/dist/v3/Demo/DemoBusinessTaxiEnd.js +3 -17
- package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +1 -2392
- package/dist/v3/Demo/DemoBusinessTaxiService.js +6 -17
- package/dist/v3/api/cdn.d.ts +1 -0
- package/dist/v3/api/cdn.js +2 -0
- package/dist/v3/api/googleSnapRoad.js +7 -2
- package/dist/v3/api/pingConnection.d.ts +9 -0
- package/dist/v3/api/pingConnection.js +111 -0
- package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +16 -7
- package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +46 -12
- package/dist/v3/business-components/BusinessQuotingMap/index.js +3 -2
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +10 -3
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +7 -4
- package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +4 -3
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +10 -2
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +60 -24
- package/dist/v3/business-components/BusinessReselectPlaceMap/index.js +3 -2
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
- package/dist/v3/business-components/BusinessTaxiEndMap/index.js +3 -2
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +19 -7
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +52 -21
- package/dist/v3/business-components/BusinessTaxiServiceMap/index.js +3 -2
- package/dist/v3/chunks/{BusinessRecomendPlaceMap.57b15c64.js → BusinessRecomendPlaceMap.6ba5dbb1.js} +65 -30
- package/dist/v3/chunks/{Loading.a8e2f26a.js → Loading.21d8e759.js} +26 -2
- package/dist/v3/components/AmapMarker/AmapMarker.js +2 -1
- package/dist/v3/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
- package/dist/v3/components/Loading/Loading.css.d.ts +5 -0
- package/dist/v3/components/Loading/Loading.d.ts +8 -0
- package/dist/v3/components/Loading/Loading.js +4 -2
- package/dist/v3/components/Loading/index.js +3 -2
- package/dist/v3/components/MapProvider/MapProvider.d.ts +6 -3
- package/dist/v3/components/MapProvider/MapProvider.js +22 -13
- package/dist/v3/css/Loading-49e58ced.css +46 -0
- package/dist/v3/demi-polyfill/demi-polyfill.d.ts +1 -0
- package/dist/v3/hooks/useDrivingRoute.js +4 -0
- package/dist/v3/hooks/useMapGCJ02.js +4 -37
- package/dist/v3/hooks/useMapGeometry.d.ts +1 -3
- package/dist/v3/hooks/useMapGeometry.js +4 -4
- package/dist/v3/hooks/useMapGraspRoad.js +1 -2
- package/dist/v3/hooks/useMapInChina.d.ts +3 -15
- package/dist/v3/hooks/useMapInChina.js +11 -16
- package/dist/v3/hooks/useMapLoader.d.ts +18 -10
- package/dist/v3/hooks/useMapLoader.js +159 -82
- package/dist/v3/hooks/useMapPlace.d.ts +1 -0
- package/dist/v3/hooks/useMapPlace.js +52 -44
- package/dist/v3/hooks/useMapRecomendPlace.d.ts +1 -0
- package/dist/v3/hooks/useMapRecomendPlace.js +75 -67
- package/dist/v3/hooks/useMapSupplier.d.ts +8 -0
- package/dist/v3/hooks/useMapSupplier.js +17 -0
- package/dist/v3/hooks/usePingConnection.d.ts +10 -0
- package/dist/v3/hooks/usePingConnection.js +26 -0
- package/dist/v3/hooks-business/useBusinessAlarm.d.ts +3 -0
- package/dist/v3/hooks-business/useBusinessQuotingMap.d.ts +7 -2393
- package/dist/v3/hooks-business/useBusinessQuotingMap.js +10 -10
- package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
- package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +8 -34
- package/dist/v3/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
- package/dist/v3/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
- package/dist/v3/hooks-business/useBusinessTaxiServiceMap.js +5 -10
- package/dist/v3/index.js +1 -1
- package/dist/v3/types/global.d.ts +3 -0
- package/dist/v3/types/interface.d.ts +1 -1
- package/dist/v3/utils/ManualAbortError.d.ts +3 -0
- package/dist/v3/utils/ManualAbortError.js +14 -0
- package/dist/v3/utils/compare.d.ts +4 -0
- package/dist/v3/utils/compare.js +6 -0
- package/dist/v3/utils/helper.d.ts +6 -0
- package/dist/v3/utils/helper.js +43 -0
- package/dist/v3/utils/log.js +1 -1
- package/dist/v3/utils/patchGoogleMapLoader.d.ts +2 -0
- package/dist/v3/utils/patchGoogleMapLoader.js +64 -0
- package/package.json +2 -2
- package/dist/v2/Demo/Demo.d.ts +0 -3
- package/dist/v2/Demo/Demo.js +0 -1634
- package/dist/v2/api/googleConnection.d.ts +0 -5
- package/dist/v2/api/googleConnection.js +0 -51
- package/dist/v2/components/AmapLoader/AmapLoader.d.ts +0 -5
- package/dist/v2/components/AmapLoader/AmapLoader.js +0 -21
- package/dist/v2/components/AmapLoader/index.d.ts +0 -1
- package/dist/v2/components/AmapLoader/index.js +0 -4
- package/dist/v2/components/GmapLoader/GmapLoader.d.ts +0 -5
- package/dist/v2/components/GmapLoader/GmapLoader.js +0 -21
- package/dist/v2/components/GmapLoader/index.d.ts +0 -1
- package/dist/v2/components/GmapLoader/index.js +0 -4
- package/dist/v2/css/Loading-523061b9.css +0 -9
- package/dist/v2/hooks/useGoogleConnection.d.ts +0 -7
- package/dist/v2/hooks/useGoogleConnection.js +0 -15
- package/dist/v2/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
- package/dist/v2/hooks-business/useBusinessTaxiEndMap.js +0 -7
- package/dist/v3/Demo/Demo.d.ts +0 -9
- package/dist/v3/Demo/Demo.js +0 -1612
- package/dist/v3/api/googleConnection.d.ts +0 -5
- package/dist/v3/api/googleConnection.js +0 -51
- package/dist/v3/components/AmapLoader/AmapLoader.d.ts +0 -10
- package/dist/v3/components/AmapLoader/AmapLoader.js +0 -21
- package/dist/v3/components/AmapLoader/index.d.ts +0 -1
- package/dist/v3/components/AmapLoader/index.js +0 -4
- package/dist/v3/components/GmapLoader/GmapLoader.d.ts +0 -10
- package/dist/v3/components/GmapLoader/GmapLoader.js +0 -21
- package/dist/v3/components/GmapLoader/index.d.ts +0 -1
- package/dist/v3/components/GmapLoader/index.js +0 -4
- package/dist/v3/css/Loading-523061b9.css +0 -9
- package/dist/v3/hooks/useGoogleConnection.d.ts +0 -7
- package/dist/v3/hooks/useGoogleConnection.js +0 -15
- package/dist/v3/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
- package/dist/v3/hooks-business/useBusinessTaxiEndMap.js +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../css/MapProvider-156bfd53.css";
|
|
2
2
|
import { h } from "vue";
|
|
3
|
-
import { L as Loading, i as imgGrid } from "../../chunks/Loading.
|
|
3
|
+
import { L as LoadFailed, a as Loading, i as imgGrid } from "../../chunks/Loading.492acbc2.js";
|
|
4
4
|
import { useMapLoader, Status } from "../../hooks/useMapLoader.js";
|
|
5
5
|
import { provideMapSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
6
6
|
import { defineLagecySetup } from "../../types/helper.js";
|
|
@@ -21,16 +21,15 @@ if (detectWebGL() === WEBGL_STATUS.ENABLED) {
|
|
|
21
21
|
const MapProvider = defineLagecySetup("MapProvider", function(props, {
|
|
22
22
|
slots
|
|
23
23
|
}) {
|
|
24
|
-
const
|
|
25
|
-
statusRef,
|
|
26
|
-
readyPromise
|
|
27
|
-
} = useMapLoader(props);
|
|
24
|
+
const payload = useMapLoader(props);
|
|
28
25
|
const context = new Proxy(props, {
|
|
29
26
|
get(target, name, receiver) {
|
|
30
27
|
if (name === "status")
|
|
31
|
-
return statusRef.value;
|
|
28
|
+
return payload.statusRef.value;
|
|
29
|
+
if (name === "pingStatus")
|
|
30
|
+
return payload.pingStatusRef.value;
|
|
32
31
|
if (name === "readyPromise")
|
|
33
|
-
return readyPromise;
|
|
32
|
+
return payload.readyPromise;
|
|
34
33
|
return Reflect.get(target, name, receiver);
|
|
35
34
|
}
|
|
36
35
|
});
|
|
@@ -39,7 +38,7 @@ const MapProvider = defineLagecySetup("MapProvider", function(props, {
|
|
|
39
38
|
var _a;
|
|
40
39
|
return h("div", [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
41
40
|
};
|
|
42
|
-
}).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language"]);
|
|
41
|
+
}).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language", "renderLoadFailedTitle", "renderLoadFailedDescription"]);
|
|
43
42
|
const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
44
43
|
slots,
|
|
45
44
|
emit,
|
|
@@ -73,7 +72,8 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
73
72
|
gmapId,
|
|
74
73
|
gmapRasterId,
|
|
75
74
|
language = "zh",
|
|
76
|
-
status
|
|
75
|
+
status,
|
|
76
|
+
pingStatus
|
|
77
77
|
} = payload;
|
|
78
78
|
const {
|
|
79
79
|
mapRef: setMap,
|
|
@@ -82,10 +82,21 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
82
82
|
touchEnable = true,
|
|
83
83
|
touchZoomCenter
|
|
84
84
|
} = props;
|
|
85
|
-
if (status === Status.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
if (status === Status.FAILURE || pingStatus === "unconnected") {
|
|
86
|
+
const node = (_a = slots.fallback) == null ? void 0 : _a.call(slots);
|
|
87
|
+
const title = (_b = payload.renderLoadFailedTitle) == null ? void 0 : _b.call(payload, status);
|
|
88
|
+
const description = (_c = payload.renderLoadFailedDescription) == null ? void 0 : _c.call(payload, status);
|
|
89
|
+
return node ? h("div", [node]) : h(LoadFailed, {
|
|
90
|
+
"attrs": {
|
|
91
|
+
"title": title,
|
|
92
|
+
"description": description
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (status === Status.LOADING || status === Status.SUCCESS && pingStatus === "pending") {
|
|
97
|
+
const node = (_d = slots.loading) == null ? void 0 : _d.call(slots);
|
|
98
|
+
return node ? h("div", [node]) : h(Loading);
|
|
99
|
+
}
|
|
89
100
|
const children = (_e = slots.default) == null ? void 0 : _e.call(slots);
|
|
90
101
|
const outArea = (_f = slots.outerArea) == null ? void 0 : _f.call(slots);
|
|
91
102
|
const mapId = patchGmapIdForAlipayCompatible({
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
._17ify490 {
|
|
2
|
+
position: relative;
|
|
3
|
+
background-color: #EDF1F5;
|
|
4
|
+
}
|
|
5
|
+
._17ify491 {
|
|
6
|
+
position: absolute;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
object-fit: cover;
|
|
10
|
+
}
|
|
11
|
+
._17ify492 {
|
|
12
|
+
position: absolute;
|
|
13
|
+
margin: auto;
|
|
14
|
+
top: -5vh;
|
|
15
|
+
left: 0;
|
|
16
|
+
right: 0;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
width: fit-content;
|
|
19
|
+
height: fit-content;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
align-items: center;
|
|
23
|
+
}
|
|
24
|
+
._17ify493 {
|
|
25
|
+
width: 40.8vw;
|
|
26
|
+
height: 24.53vw;
|
|
27
|
+
}
|
|
28
|
+
._17ify494 {
|
|
29
|
+
margin-top: 1.6vw;
|
|
30
|
+
}
|
|
31
|
+
._17ify495 {
|
|
32
|
+
font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
font-size: 4vw;
|
|
35
|
+
color: #1E1E1E;
|
|
36
|
+
line-height: 6.4vw;
|
|
37
|
+
}
|
|
38
|
+
._17ify496 {
|
|
39
|
+
font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
|
|
40
|
+
font-weight: 400;
|
|
41
|
+
font-size: 3.73vw;
|
|
42
|
+
color: #999BA1;
|
|
43
|
+
line-height: 6.4vw;
|
|
44
|
+
white-space: pre-line;
|
|
45
|
+
text-align: center;
|
|
46
|
+
}
|
|
@@ -6,6 +6,7 @@ import type { Slot as Slot_V2 } from "vue2/types/v3-setup-context";
|
|
|
6
6
|
import type { ScopedSlot as ScopedSlot_V2 } from "vue2/types/vnode";
|
|
7
7
|
import type { DefineComponent as DefineComponent_V3, HTMLAttributes as HTMLAttributes_V3, ImgHTMLAttributes as ImgHTMLAttributes_V3, Ref as Ref_V3, Slot as Slot_V3, StyleValue as StyleValue_V3, VNodeArrayChildren as VNodeArrayChildren_V3, VNodeChild as VNodeChild_V3, VNode as VNode_V3, WatchOptions as WatchOptions_V3 } from "vue3";
|
|
8
8
|
export * from "vue-demi";
|
|
9
|
+
export type { StyleValue_V2 };
|
|
9
10
|
export type { Data } from "vue2";
|
|
10
11
|
export type { EmitFn } from "vue2/types/v3-setup-context";
|
|
11
12
|
export type { ComponentObjectPropsOptions, ObjectEmitsOptions, PublicProps, SlotsType } from "vue3";
|
|
@@ -23,6 +23,8 @@ const useADrivingRoute = (props) => {
|
|
|
23
23
|
const drivingResult = result;
|
|
24
24
|
const routeSteps = [];
|
|
25
25
|
const firstRoute = drivingResult.routes[0];
|
|
26
|
+
if (!firstRoute)
|
|
27
|
+
return resolve({ path: [], distance: 0, duration: 0, steps: [] });
|
|
26
28
|
for (const step of firstRoute.steps) {
|
|
27
29
|
const basicStep = step;
|
|
28
30
|
const stepPath = basicStep.path.map(({ lng, lat }) => [lng, lat]);
|
|
@@ -83,6 +85,8 @@ const useGDrivingRoute = (props) => {
|
|
|
83
85
|
let duration = 0;
|
|
84
86
|
const routeSteps = [];
|
|
85
87
|
const firstRoute = result.routes[0];
|
|
88
|
+
if (!firstRoute)
|
|
89
|
+
return resolve({ path: [], distance: 0, duration: 0, steps: [] });
|
|
86
90
|
for (const leg of firstRoute.legs) {
|
|
87
91
|
distance += (_b = (_a = leg.distance) == null ? void 0 : _a.value) != null ? _b : 0;
|
|
88
92
|
duration += (_d = (_c = leg.duration) == null ? void 0 : _c.value) != null ? _d : 0;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { lnglat2point } from "../utils/transform.js";
|
|
3
|
-
import { useMapInChina } from "./useMapInChina.js";
|
|
1
|
+
import { inChina, inHongkong, inMacau } from "./useMapInChina.js";
|
|
4
2
|
import { useMapSupplier } from "./useMapSupplier.js";
|
|
5
3
|
/**
|
|
6
4
|
* @preserve
|
|
@@ -514,8 +512,6 @@ const exported = Object.assign(Object.assign({}, CRSTypes), {
|
|
|
514
512
|
transform
|
|
515
513
|
});
|
|
516
514
|
const useAmapGCJ02 = () => {
|
|
517
|
-
const { readyPromise } = useMapSupplier();
|
|
518
|
-
const { inChina } = useMapInChina();
|
|
519
515
|
const toCoordinateType = (p) => {
|
|
520
516
|
return inChina(p) ? "gcj02" : "wgs84";
|
|
521
517
|
};
|
|
@@ -532,42 +528,15 @@ const useAmapGCJ02 = () => {
|
|
|
532
528
|
}
|
|
533
529
|
};
|
|
534
530
|
const toLocalGcj02Points = (points) => points.map(toLocalGcj02);
|
|
535
|
-
async
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
let isHandled = false;
|
|
539
|
-
AMap.convertFrom(
|
|
540
|
-
[...points],
|
|
541
|
-
"gps",
|
|
542
|
-
(_, result) => {
|
|
543
|
-
if (isHandled)
|
|
544
|
-
return;
|
|
545
|
-
isHandled = true;
|
|
546
|
-
if (result.info === "ok") {
|
|
547
|
-
resolve(result.locations.map(lnglat2point));
|
|
548
|
-
} else {
|
|
549
|
-
console.warn("警告: 高德坐标转换请求失败,启用本地转换");
|
|
550
|
-
resolve(toLocalGcj02Points(points));
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
);
|
|
554
|
-
setTimeout(() => {
|
|
555
|
-
if (isHandled)
|
|
556
|
-
return;
|
|
557
|
-
isHandled = true;
|
|
558
|
-
console.warn("警告: 高德坐标转换请求超时,启用本地转换");
|
|
559
|
-
resolve(toLocalGcj02Points(points));
|
|
560
|
-
}, AMAP_TO_GCJ02_TIMEOUT);
|
|
561
|
-
});
|
|
562
|
-
}
|
|
531
|
+
const toGcj02Points = async (points) => {
|
|
532
|
+
return toLocalGcj02Points(points);
|
|
533
|
+
};
|
|
563
534
|
function toGcj02(point) {
|
|
564
535
|
return toGcj02Points([point]).then(([result]) => result);
|
|
565
536
|
}
|
|
566
537
|
return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
|
|
567
538
|
};
|
|
568
539
|
const useGmapGCJ02 = () => {
|
|
569
|
-
const { readyPromise } = useMapSupplier();
|
|
570
|
-
const { inChina, inHongkong, inMacau } = useMapInChina();
|
|
571
540
|
const toCoordinateType = (p) => {
|
|
572
541
|
return inChina(p) && !inHongkong(p) && !inMacau(p) ? "gcj02" : "wgs84";
|
|
573
542
|
};
|
|
@@ -585,11 +554,9 @@ const useGmapGCJ02 = () => {
|
|
|
585
554
|
};
|
|
586
555
|
const toLocalGcj02Points = (points) => points.map(toLocalGcj02);
|
|
587
556
|
const toGcj02 = async (point) => {
|
|
588
|
-
await readyPromise;
|
|
589
557
|
return toLocalGcj02Points([point])[0];
|
|
590
558
|
};
|
|
591
559
|
const toGcj02Points = async (points) => {
|
|
592
|
-
await readyPromise;
|
|
593
560
|
return toLocalGcj02Points(points);
|
|
594
561
|
};
|
|
595
562
|
return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import type { Point } from "../types/interface";
|
|
2
|
+
export declare const apiLocalIsPointInRing: (point: Point, path: Point[]) => boolean;
|
|
2
3
|
export declare const useAmapGeometry: () => {
|
|
3
4
|
apiMapDistance: (from: Point, to: Point) => number | undefined;
|
|
4
5
|
apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
|
|
5
|
-
apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
|
|
6
6
|
apiMapDistanceOfLine: (line: Point[]) => number | undefined;
|
|
7
7
|
};
|
|
8
8
|
export declare const useGmapGeometry: () => {
|
|
9
9
|
apiMapDistance: (from: Point, to: Point) => number | undefined;
|
|
10
10
|
apiMapDistanceToLine: (from: Point, line: Point[]) => 0 | undefined;
|
|
11
|
-
apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
|
|
12
11
|
apiMapDistanceOfLine: (line: Point[]) => number | undefined;
|
|
13
12
|
};
|
|
14
13
|
export declare const useMapGeometry: () => {
|
|
15
14
|
apiMapDistance: (from: Point, to: Point) => number | undefined;
|
|
16
15
|
apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
|
|
17
|
-
apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
|
|
18
16
|
apiMapDistanceOfLine: (line: Point[]) => number | undefined;
|
|
19
17
|
};
|
|
@@ -2,6 +2,7 @@ import { pointInPolygon } 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";
|
|
5
|
+
const apiLocalIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
|
|
5
6
|
const useAmapGeometry = () => {
|
|
6
7
|
const payload = useMapSupplier();
|
|
7
8
|
const apiMapDistance = (from, to) => {
|
|
@@ -19,8 +20,7 @@ const useAmapGeometry = () => {
|
|
|
19
20
|
return void 0;
|
|
20
21
|
return AMap.GeometryUtil.distanceOfLine(line);
|
|
21
22
|
};
|
|
22
|
-
|
|
23
|
-
return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
|
|
23
|
+
return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
|
|
24
24
|
};
|
|
25
25
|
const useGmapGeometry = () => {
|
|
26
26
|
const payload = useMapSupplier();
|
|
@@ -39,14 +39,14 @@ const useGmapGeometry = () => {
|
|
|
39
39
|
return void 0;
|
|
40
40
|
return google.maps.geometry.spherical.computeLength(line.map(vec2lnglat));
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
|
|
42
|
+
return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
|
|
44
43
|
};
|
|
45
44
|
const useMapGeometry = () => {
|
|
46
45
|
const { supplier } = useMapSupplier();
|
|
47
46
|
return supplier === "gmap" ? useGmapGeometry() : useAmapGeometry();
|
|
48
47
|
};
|
|
49
48
|
export {
|
|
49
|
+
apiLocalIsPointInRing,
|
|
50
50
|
useAmapGeometry,
|
|
51
51
|
useGmapGeometry,
|
|
52
52
|
useMapGeometry
|
|
@@ -3,7 +3,7 @@ import { apiGoogleSnapRoad } from "../api/googleSnapRoad.js";
|
|
|
3
3
|
import { watchEffectForDeepOption } from "../utils/compare.js";
|
|
4
4
|
import { lnglat2point, trackPoints2amapGraspRoadPoints } from "../utils/transform.js";
|
|
5
5
|
import { useMapAngle } from "./useMapAngle.js";
|
|
6
|
-
import {
|
|
6
|
+
import { inChina } from "./useMapInChina.js";
|
|
7
7
|
import { useMapSupplier } from "./useMapSupplier.js";
|
|
8
8
|
const GRASP_ROAD_INPUT_MIN_AMOUNT = 2;
|
|
9
9
|
const GRASP_ROAD_INPUT_MAX_AMOUNT = 500;
|
|
@@ -12,7 +12,6 @@ const useAmapGraspRoad = (props) => {
|
|
|
12
12
|
const pathRef = ref([]);
|
|
13
13
|
const angleRef = ref(0);
|
|
14
14
|
const { apiMapComputeHeading } = useMapAngle();
|
|
15
|
-
const { inChina } = useMapInChina();
|
|
16
15
|
const apiMapToGraspRoadPath = (tracks) => {
|
|
17
16
|
return new Promise((resolve) => {
|
|
18
17
|
var _a, _b, _c;
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import { type Point } from "../types/interface";
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
inMacau: (point: Point) => boolean;
|
|
6
|
-
};
|
|
7
|
-
export declare const useAmapInChina: () => {
|
|
8
|
-
inChina: (point: Point) => boolean;
|
|
9
|
-
inHongkong: (point: Point) => boolean;
|
|
10
|
-
inMacau: (point: Point) => boolean;
|
|
11
|
-
};
|
|
12
|
-
export declare const useGmapInChina: () => {
|
|
13
|
-
inChina: (point: Point) => boolean;
|
|
14
|
-
inHongkong: (point: Point) => boolean;
|
|
15
|
-
inMacau: (point: Point) => boolean;
|
|
16
|
-
};
|
|
2
|
+
export declare const inChina: (point: Point) => boolean;
|
|
3
|
+
export declare const inHongkong: (point: Point) => boolean;
|
|
4
|
+
export declare const inMacau: (point: Point) => boolean;
|
|
@@ -2593,22 +2593,17 @@ const macauBounds = [
|
|
|
2593
2593
|
22.19885
|
|
2594
2594
|
]
|
|
2595
2595
|
];
|
|
2596
|
-
const
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
return pointInPolygon(point, macauBounds) >= 0;
|
|
2605
|
-
};
|
|
2606
|
-
return { inChina, inHongkong, inMacau };
|
|
2596
|
+
const inChina = (point) => {
|
|
2597
|
+
return pointInPolygon(point, chinaBounds) >= 0;
|
|
2598
|
+
};
|
|
2599
|
+
const inHongkong = (point) => {
|
|
2600
|
+
return pointInPolygon(point, hongkongBounds) >= 0;
|
|
2601
|
+
};
|
|
2602
|
+
const inMacau = (point) => {
|
|
2603
|
+
return pointInPolygon(point, macauBounds) >= 0;
|
|
2607
2604
|
};
|
|
2608
|
-
const useAmapInChina = useMapInChina;
|
|
2609
|
-
const useGmapInChina = useMapInChina;
|
|
2610
2605
|
export {
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2606
|
+
inChina,
|
|
2607
|
+
inHongkong,
|
|
2608
|
+
inMacau
|
|
2614
2609
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { load as loadAmap } from "@amap/amap-jsapi-loader";
|
|
2
2
|
import { type LoaderOptions } from "@googlemaps/js-api-loader";
|
|
3
3
|
import { type Ref } from "vue-demi";
|
|
4
|
-
import type {
|
|
5
|
-
import type { Language } from "../types/interface";
|
|
4
|
+
import type { VNodeChild } from "../demi-polyfill";
|
|
5
|
+
import type { ConnectionStatus, Language } from "../types/interface";
|
|
6
6
|
export declare const DEFAULT_AMAP_PLUGINS: AmapLoaderProps["plugins"];
|
|
7
7
|
export declare const DEFAULT_GMAP_LIBRARIES: LoaderOptions["libraries"];
|
|
8
8
|
export declare enum Status {
|
|
@@ -19,40 +19,47 @@ declare global {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
export interface AmapLoaderProps extends Pick<GmapLoaderProps, "fallback" | "loading" | "
|
|
22
|
+
export interface AmapLoaderProps extends Pick<GmapLoaderProps, "fallback" | "loading" | "onSuccess" | "onFail">, Omit<AMapLoaderOptions, "key" | "version" | "plugins"> {
|
|
23
23
|
apiKey: string;
|
|
24
24
|
apiSecret?: string;
|
|
25
25
|
apiServiceHost?: string;
|
|
26
26
|
version?: string;
|
|
27
27
|
plugins?: `AMap.${AMap.PluginName}`[];
|
|
28
|
+
disableRef?: Ref<boolean>;
|
|
28
29
|
}
|
|
29
30
|
export declare const useAmapLoader: (props: AmapLoaderProps) => {
|
|
30
31
|
statusRef: import("vue-demi").ShallowRef<Status>;
|
|
32
|
+
pingStatusRef: import("vue-demi").ShallowRef<ConnectionStatus>;
|
|
31
33
|
readyPromise: Promise<undefined>;
|
|
32
34
|
};
|
|
33
35
|
export interface GmapLoaderProps extends LoaderOptions {
|
|
36
|
+
disableRef?: Ref<boolean>;
|
|
34
37
|
/**
|
|
35
38
|
* Render prop used to switch to loading component.
|
|
36
39
|
*/
|
|
37
|
-
loading?: () =>
|
|
40
|
+
loading?: () => VNodeChild;
|
|
38
41
|
/**
|
|
39
42
|
* Render prop used to switch to error fallback component.
|
|
40
43
|
*/
|
|
41
|
-
fallback?: () =>
|
|
44
|
+
fallback?: () => VNodeChild;
|
|
42
45
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* Note: The callback be executed multiple times in the lifecycle of the component.
|
|
46
|
+
* 成功回调只会触发一次
|
|
46
47
|
*/
|
|
47
|
-
|
|
48
|
+
onSuccess?: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* 失败回调可能会触发多次
|
|
51
|
+
*/
|
|
52
|
+
onFail?: () => void;
|
|
48
53
|
}
|
|
49
54
|
export declare const useGmapLoader: (props: GmapLoaderProps) => {
|
|
50
55
|
statusRef: import("vue-demi").ShallowRef<Status>;
|
|
56
|
+
pingStatusRef: import("vue-demi").ShallowRef<ConnectionStatus>;
|
|
51
57
|
readyPromise: Promise<undefined>;
|
|
52
58
|
};
|
|
53
59
|
export type MapSupplier = "gmap" | "amap";
|
|
54
60
|
export interface UseMapLoaderOutput {
|
|
55
61
|
statusRef: Ref<Status>;
|
|
62
|
+
pingStatusRef: Ref<ConnectionStatus>;
|
|
56
63
|
readyPromise: Promise<undefined>;
|
|
57
64
|
}
|
|
58
65
|
export interface UseMapLoaderProps {
|
|
@@ -62,7 +69,8 @@ export interface UseMapLoaderProps {
|
|
|
62
69
|
amapServiceHost?: string;
|
|
63
70
|
supplier: MapSupplier;
|
|
64
71
|
language: Language;
|
|
65
|
-
|
|
72
|
+
onSuccess?: () => void;
|
|
73
|
+
onFail?: () => void;
|
|
66
74
|
}
|
|
67
75
|
export declare const useMapLoader: (props: UseMapLoaderProps) => UseMapLoaderOutput;
|
|
68
76
|
export {};
|