gisviewer-vue3-arcgis 1.0.88 → 1.0.90
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/es/src/gis-map/gis-map.vue.d.ts +11 -17
- package/es/src/gis-map/gis-map.vue.mjs +100 -107
- package/es/src/gis-map/index.d.ts +10 -16
- package/es/src/gis-map/utils/GreenWaveline.mjs +3 -3
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +7 -5
- package/es/src/gis-map/utils/map-initializer.d.ts +2 -1
- package/es/src/gis-map/utils/map-initializer.mjs +104 -85
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +3 -2
- package/es/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -2
- package/es/src/gis-map/utils/renderer/greenWaveline.mjs +7 -7
- package/es/src/types/index.d.ts +5 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +11 -17
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +10 -16
- package/lib/src/gis-map/utils/GreenWaveline.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/map-initializer.d.ts +2 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -2
- package/lib/src/gis-map/utils/renderer/greenWaveline.js +3 -3
- package/lib/src/types/index.d.ts +5 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { ILaneNumberParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IStartCrossBufferParam } from '../types';
|
|
3
|
+
import { ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IStartCrossBufferParam } from '../types';
|
|
4
4
|
import HoloFlow from './utils/holo-flow';
|
|
5
5
|
import MapInitializer from './utils/map-initializer';
|
|
6
6
|
import OpenDriveRenderer from './utils/open-drive-renderer';
|
|
@@ -18,7 +18,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
18
18
|
required: false;
|
|
19
19
|
};
|
|
20
20
|
}, {
|
|
21
|
-
mapContainer: any
|
|
21
|
+
mapContainer: import("vue").Ref<any>;
|
|
22
22
|
view: MapView | SceneView;
|
|
23
23
|
mapInitializer: MapInitializer;
|
|
24
24
|
roadConfigTool: RoadConfigTool;
|
|
@@ -31,6 +31,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
31
31
|
setMapCenter: (params: ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
32
32
|
setMapCamera: (params: ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
33
33
|
lookAt: (params: ILookAtParams) => Promise<void>;
|
|
34
|
+
setLayerVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
|
|
34
35
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
35
36
|
handle: number;
|
|
36
37
|
points: number[][];
|
|
@@ -56,25 +57,18 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
56
57
|
visible: boolean;
|
|
57
58
|
}) => void;
|
|
58
59
|
toggleVehicleInfo: (contentType: string) => void;
|
|
59
|
-
addOverlays: (params: IOverlayParam) =>
|
|
60
|
-
removeOverlaysByType: (types: string[]) =>
|
|
61
|
-
removeOverlaysById: (ids: string[]) =>
|
|
62
|
-
removeAllOverlays: () =>
|
|
60
|
+
addOverlays: (params: IOverlayParam) => Promise<import("../types").IResult>;
|
|
61
|
+
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
62
|
+
removeOverlaysById: (ids: string[]) => import("../types").IResult;
|
|
63
|
+
removeAllOverlays: () => import("../types").IResult;
|
|
63
64
|
showAllOverlays: () => void;
|
|
64
65
|
updateQueueLength: (params: IQueueLengthParams[]) => void;
|
|
65
66
|
removeQueueLength: () => void;
|
|
66
67
|
showOpenDrive: (server: string, projectName: string) => Promise<void>;
|
|
67
68
|
hideOpenDrive: () => Promise<void>;
|
|
68
|
-
props:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
emit: {
|
|
73
|
-
(e: 'mapLoaded'): void;
|
|
74
|
-
(e: 'markerClick', type: string, id: string, detail: any, event: any): void;
|
|
75
|
-
(e: 'mapClick', mapPoint: number[], screenPoint: number[], event: any): void;
|
|
76
|
-
};
|
|
77
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
69
|
+
props: any;
|
|
70
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
71
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
78
72
|
config: {
|
|
79
73
|
type: StringConstructor;
|
|
80
74
|
required: true;
|
|
@@ -87,5 +81,5 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
87
81
|
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
88
82
|
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
89
83
|
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
90
|
-
}, {}>;
|
|
84
|
+
}, {}, {}>;
|
|
91
85
|
export default _sfc_main;
|
|
@@ -1,124 +1,117 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as ee, ref as te, onMounted as ae, getCurrentInstance as ne, computed as re, openBlock as oe, createElementBlock as se, createElementVNode as ie } from "vue";
|
|
2
|
+
import ce, { registerStore as le } from "./stores/index.mjs";
|
|
3
3
|
import "./style/index.css";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
12
|
-
|
|
4
|
+
import w from "./utils/holo-flow/index.mjs";
|
|
5
|
+
import me from "./utils/map-initializer.mjs";
|
|
6
|
+
import pe from "./utils/open-drive-renderer/index.mjs";
|
|
7
|
+
import ue from "./utils/overlay.mjs";
|
|
8
|
+
import de from "./utils/queue-length.mjs";
|
|
9
|
+
import g from "./utils/road-config-tool/index.mjs";
|
|
10
|
+
import fe from "./utils/traffic-flow.mjs";
|
|
11
|
+
const we = { class: "gis-viewer" }, be = /* @__PURE__ */ ee({
|
|
12
|
+
__name: "gis-map",
|
|
13
13
|
props: {
|
|
14
|
-
config:
|
|
15
|
-
assetsRoot:
|
|
14
|
+
config: {},
|
|
15
|
+
assetsRoot: {}
|
|
16
16
|
},
|
|
17
17
|
emits: ["mapLoaded", "markerClick", "mapClick"],
|
|
18
|
-
setup(
|
|
19
|
-
const
|
|
20
|
-
let o, s, t,
|
|
21
|
-
|
|
22
|
-
if (!
|
|
18
|
+
setup(v, { expose: h, emit: k }) {
|
|
19
|
+
const m = te(null);
|
|
20
|
+
let r, o, n, s, t, a, c, l;
|
|
21
|
+
le(), ae(async () => {
|
|
22
|
+
if (!m.value)
|
|
23
23
|
return;
|
|
24
|
-
const e =
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
container:
|
|
29
|
-
markerClickCallback: (
|
|
30
|
-
|
|
24
|
+
const e = ne(), { $gisviewerAssetsRoot: i } = e.appContext.config.globalProperties, C = await (await fetch(y.config)).json();
|
|
25
|
+
C.assetsRoot = y.assetsRoot || i;
|
|
26
|
+
const Y = ce.useAppDataStore;
|
|
27
|
+
Y.mapConfig = C, o = new me(), r = await o.initialize({
|
|
28
|
+
container: m.value,
|
|
29
|
+
markerClickCallback: (u, d, f, F) => {
|
|
30
|
+
p("markerClick", u, d, f, F);
|
|
31
31
|
},
|
|
32
|
-
mapClickCallback: (
|
|
33
|
-
|
|
32
|
+
mapClickCallback: (u, d, f) => {
|
|
33
|
+
p("mapClick", u, d, f);
|
|
34
34
|
}
|
|
35
|
-
}),
|
|
35
|
+
}), t = new w(r), p("mapLoaded");
|
|
36
36
|
});
|
|
37
|
-
const O = b(() => o)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
removeAllOverlays: () => {
|
|
63
|
-
n == null || n.removeAllOverlays();
|
|
64
|
-
},
|
|
65
|
-
showLaneNumber: (e) => (t || (t = new C(o)), t.showLaneNumber(e)),
|
|
66
|
-
clearLaneNumber: () => {
|
|
67
|
-
t == null || t.clearLaneNumber();
|
|
68
|
-
},
|
|
69
|
-
initializeAreaTool: async (e) => (t || (t = new C(o)), await t.initializeSearch(e)),
|
|
70
|
-
calCrossIndicatorArea: async () => t == null ? void 0 : t.calCrossIndicatorArea(),
|
|
71
|
-
calRoadIndicatorArea: async () => {
|
|
72
|
-
},
|
|
73
|
-
connectCarFlow: async (e, c) => {
|
|
74
|
-
r || (r = new z(o)), r.connectTrafficFlow(e, c);
|
|
75
|
-
},
|
|
76
|
-
disconnectCarFlow: () => {
|
|
77
|
-
r == null || r.disconnectTrafficFlow();
|
|
78
|
-
},
|
|
79
|
-
handleHoloVehicleTraceData: (e) => {
|
|
80
|
-
a || (a = new v(o)), a.handleVehicleTraceData(e);
|
|
81
|
-
},
|
|
82
|
-
clearHoloTrace: () => {
|
|
83
|
-
a == null || a.clearHoloTrace();
|
|
84
|
-
},
|
|
85
|
-
handleHoloSignalData: async (e) => {
|
|
86
|
-
a || (a = new v(o)), await a.handleSignalData(e);
|
|
87
|
-
},
|
|
88
|
-
clearHoloSignal: () => {
|
|
89
|
-
a == null || a.clearHoloSignal();
|
|
90
|
-
},
|
|
91
|
-
toggleTrafficInfo: (e) => {
|
|
92
|
-
switch (e.name.toLowerCase()) {
|
|
93
|
-
case "vehiclePlate".toLowerCase():
|
|
94
|
-
r == null || r.toggleVehiclePlate(e.visible);
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
toggleVehicleInfo: (e) => {
|
|
99
|
-
a == null || a.updatePanelContent(e);
|
|
100
|
-
},
|
|
101
|
-
updateQueueLength: (e) => {
|
|
102
|
-
i || (i = new _(o)), i.updateQueueLength(e);
|
|
103
|
-
},
|
|
104
|
-
removeQueueLength: () => {
|
|
105
|
-
i == null || i.removeQueueLength();
|
|
106
|
-
},
|
|
107
|
-
showOpenDrive: async (e, c) => {
|
|
108
|
-
l || (l = new N(o)), await l.showOpenDrive(e, c);
|
|
109
|
-
},
|
|
110
|
-
hideOpenDrive: async () => {
|
|
111
|
-
await (l == null ? void 0 : l.hideOpenDrive());
|
|
37
|
+
const O = re(() => r), L = async (e) => await o.setMapCenter(e), T = async (e) => await o.setMapCamera(e), A = async (e) => await o.lookAt(e), b = (e) => o.setLayerVisibility(e), I = (e, i) => o.requestCoordinateTransform(e, i), D = (e) => {
|
|
38
|
+
o.cancelCoordinateTransform(e);
|
|
39
|
+
}, S = (e) => {
|
|
40
|
+
o.setMapZoomRange(e);
|
|
41
|
+
}, _ = (e) => (n || (n = new g(r)), n.showLaneNumber(e)), M = () => {
|
|
42
|
+
n == null || n.clearLaneNumber();
|
|
43
|
+
}, R = async (e) => (n || (n = new g(r)), await n.initializeSearch(e)), V = async () => n == null ? void 0 : n.calCrossIndicatorArea(), x = async () => {
|
|
44
|
+
}, B = async (e, i) => {
|
|
45
|
+
s || (s = new fe(r)), s.connectTrafficFlow(e, i);
|
|
46
|
+
}, H = () => {
|
|
47
|
+
s == null || s.disconnectTrafficFlow();
|
|
48
|
+
}, z = (e) => {
|
|
49
|
+
t || (t = new w(r)), t.handleVehicleTraceData(e);
|
|
50
|
+
}, N = () => {
|
|
51
|
+
t == null || t.clearHoloTrace();
|
|
52
|
+
}, Q = async (e) => {
|
|
53
|
+
t || (t = new w(r)), await t.handleSignalData(e);
|
|
54
|
+
}, P = () => {
|
|
55
|
+
t == null || t.clearHoloSignal();
|
|
56
|
+
}, E = (e) => {
|
|
57
|
+
switch (e.name.toLowerCase()) {
|
|
58
|
+
case "vehiclePlate".toLowerCase():
|
|
59
|
+
s == null || s.toggleVehiclePlate(e.visible);
|
|
60
|
+
break;
|
|
112
61
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
62
|
+
}, Z = (e) => {
|
|
63
|
+
t == null || t.updatePanelContent(e);
|
|
64
|
+
}, j = async (e) => (a || (a = new ue(r)), await a.addOverlays(e)), q = (e) => a == null ? void 0 : a.removeOverlaysByType(e), $ = (e) => a == null ? void 0 : a.removeOverlaysById(e), G = () => a == null ? void 0 : a.removeAllOverlays(), J = () => {
|
|
65
|
+
a == null || a.showAllOverlays();
|
|
66
|
+
}, K = (e) => {
|
|
67
|
+
c || (c = new de(r)), c.updateQueueLength(e);
|
|
68
|
+
}, U = () => {
|
|
69
|
+
c == null || c.removeQueueLength();
|
|
70
|
+
}, W = async (e, i) => {
|
|
71
|
+
l || (l = new pe(r)), await l.showOpenDrive(e, i);
|
|
72
|
+
}, X = async () => {
|
|
73
|
+
await (l == null ? void 0 : l.hideOpenDrive());
|
|
74
|
+
}, y = v, p = k;
|
|
75
|
+
return h({
|
|
76
|
+
mapViewer: O,
|
|
77
|
+
setLayerVisibility: b,
|
|
78
|
+
setMapCenter: L,
|
|
79
|
+
lookAt: A,
|
|
80
|
+
setMapCamera: T,
|
|
81
|
+
setMapZoomRange: S,
|
|
82
|
+
requestCoordinateTransform: I,
|
|
83
|
+
cancelCoordinateTransform: D,
|
|
84
|
+
addOverlays: j,
|
|
85
|
+
showAllOverlays: J,
|
|
86
|
+
removeOverlaysByType: q,
|
|
87
|
+
removeOverlaysById: $,
|
|
88
|
+
removeAllOverlays: G,
|
|
89
|
+
showLaneNumber: _,
|
|
90
|
+
clearLaneNumber: M,
|
|
91
|
+
initializeAreaTool: R,
|
|
92
|
+
calCrossIndicatorArea: V,
|
|
93
|
+
calRoadIndicatorArea: x,
|
|
94
|
+
connectCarFlow: B,
|
|
95
|
+
disconnectCarFlow: H,
|
|
96
|
+
handleHoloVehicleTraceData: z,
|
|
97
|
+
clearHoloTrace: N,
|
|
98
|
+
handleHoloSignalData: Q,
|
|
99
|
+
clearHoloSignal: P,
|
|
100
|
+
toggleTrafficInfo: E,
|
|
101
|
+
toggleVehicleInfo: Z,
|
|
102
|
+
updateQueueLength: K,
|
|
103
|
+
removeQueueLength: U,
|
|
104
|
+
showOpenDrive: W,
|
|
105
|
+
hideOpenDrive: X
|
|
106
|
+
}), (e, i) => (oe(), se("div", we, [
|
|
107
|
+
ie("div", {
|
|
115
108
|
class: "gis-viewer-main",
|
|
116
109
|
ref_key: "mapContainer",
|
|
117
|
-
ref:
|
|
110
|
+
ref: m
|
|
118
111
|
}, null, 512)
|
|
119
112
|
]));
|
|
120
113
|
}
|
|
121
114
|
});
|
|
122
115
|
export {
|
|
123
|
-
|
|
116
|
+
be as default
|
|
124
117
|
};
|
|
@@ -8,7 +8,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
8
8
|
required: false;
|
|
9
9
|
};
|
|
10
10
|
}, {
|
|
11
|
-
mapContainer: any
|
|
11
|
+
mapContainer: import("vue").Ref<any>;
|
|
12
12
|
view: __esri.MapView | __esri.SceneView;
|
|
13
13
|
mapInitializer: import("./utils/map-initializer").default;
|
|
14
14
|
roadConfigTool: import("./utils/road-config-tool").default;
|
|
@@ -21,6 +21,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
21
21
|
setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
22
22
|
setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
23
23
|
lookAt: (params: import("../types").ILookAtParams) => Promise<void>;
|
|
24
|
+
setLayerVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
|
|
24
25
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
25
26
|
handle: number;
|
|
26
27
|
points: number[][];
|
|
@@ -46,25 +47,18 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
46
47
|
visible: boolean;
|
|
47
48
|
}) => void;
|
|
48
49
|
toggleVehicleInfo: (contentType: string) => void;
|
|
49
|
-
addOverlays: (params: import("../types").IOverlayParam) =>
|
|
50
|
-
removeOverlaysByType: (types: string[]) =>
|
|
51
|
-
removeOverlaysById: (ids: string[]) =>
|
|
52
|
-
removeAllOverlays: () =>
|
|
50
|
+
addOverlays: (params: import("../types").IOverlayParam) => Promise<import("../types").IResult>;
|
|
51
|
+
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
52
|
+
removeOverlaysById: (ids: string[]) => import("../types").IResult;
|
|
53
|
+
removeAllOverlays: () => import("../types").IResult;
|
|
53
54
|
showAllOverlays: () => void;
|
|
54
55
|
updateQueueLength: (params: import("../types").IQueueLengthParams[]) => void;
|
|
55
56
|
removeQueueLength: () => void;
|
|
56
57
|
showOpenDrive: (server: string, projectName: string) => Promise<void>;
|
|
57
58
|
hideOpenDrive: () => Promise<void>;
|
|
58
|
-
props:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
emit: {
|
|
63
|
-
(e: "mapLoaded"): void;
|
|
64
|
-
(e: "markerClick", type: string, id: string, detail: any, event: any): void;
|
|
65
|
-
(e: "mapClick", mapPoint: number[], screenPoint: number[], event: any): void;
|
|
66
|
-
};
|
|
67
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
59
|
+
props: any;
|
|
60
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
61
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
68
62
|
config: {
|
|
69
63
|
type: StringConstructor;
|
|
70
64
|
required: true;
|
|
@@ -77,5 +71,5 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
77
71
|
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
78
72
|
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
79
73
|
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
80
|
-
}, {}>>;
|
|
74
|
+
}, {}, {}>>;
|
|
81
75
|
export default GisMap;
|
|
@@ -25,7 +25,7 @@ class d {
|
|
|
25
25
|
...i.graphicsLayerOptions
|
|
26
26
|
}), this.customGreenWaveLineView = new u({
|
|
27
27
|
graphics: []
|
|
28
|
-
}), this.viewer.map.layers.add(this.
|
|
28
|
+
}), this.viewer.map.layers.add(this.overlayLayer), this.viewer.map.layers.add(this.customGreenWaveLineView);
|
|
29
29
|
}
|
|
30
30
|
addGreenWaveLine(i, t = {
|
|
31
31
|
isAnimation: !1,
|
|
@@ -75,8 +75,8 @@ class d {
|
|
|
75
75
|
createLine(i, t, e = {}, r) {
|
|
76
76
|
const a = {
|
|
77
77
|
type: "simple-line",
|
|
78
|
-
color: [
|
|
79
|
-
width:
|
|
78
|
+
color: [8, 69, 9, 0.8],
|
|
79
|
+
width: 5,
|
|
80
80
|
...t
|
|
81
81
|
}, o = new p({
|
|
82
82
|
paths: i
|
|
@@ -143,12 +143,12 @@ class f {
|
|
|
143
143
|
if (n.x > this.view.width || n.y > this.view.height)
|
|
144
144
|
return;
|
|
145
145
|
this.createCountdownCanvas((l) => {
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
backgroundCanvas:
|
|
149
|
-
countdownCanvas:
|
|
146
|
+
const h = l[0], r = l[1];
|
|
147
|
+
h.style.left = n.x + "px", h.style.top = n.y + "px", r.style.left = n.x + "px", r.style.top = n.y + "px", this.countdownCanvasMap.set(e, {
|
|
148
|
+
backgroundCanvas: h,
|
|
149
|
+
countdownCanvas: r,
|
|
150
150
|
mapPoint: s
|
|
151
|
-
}), this.drawCountdownText(
|
|
151
|
+
}), this.drawCountdownText(r, o);
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
this.countdownWatchHandel || (this.countdownWatchHandel = d.watch(
|
|
@@ -201,6 +201,8 @@ class f {
|
|
|
201
201
|
a.width = this.canvasWidth, a.height = this.canvasHeight, a.style.position = "absolute", a.style.transform = "translate(-50%, -50%)", a.getContext("2d").drawImage(t, 0, 0, this.canvasWidth, this.canvasHeight), this.view.container.appendChild(a);
|
|
202
202
|
const i = document.createElement("canvas");
|
|
203
203
|
i.width = this.canvasWidth - 10, i.height = this.canvasHeight - 10, i.style.position = "absolute", i.style.transform = "translate(-50%, -50%)", this.view.container.appendChild(i), e([a, i]);
|
|
204
|
+
}, t.onerror = () => {
|
|
205
|
+
console.error("倒计时背景图加载失败");
|
|
204
206
|
};
|
|
205
207
|
}
|
|
206
208
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { ILookAtParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
|
|
3
|
+
import { ILayerVisibleParams, ILookAtParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
|
|
4
4
|
export default class MapInitializer {
|
|
5
5
|
private view;
|
|
6
6
|
private mapConfig;
|
|
@@ -14,6 +14,7 @@ export default class MapInitializer {
|
|
|
14
14
|
markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
|
|
15
15
|
mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
|
|
16
16
|
}): Promise<MapView | SceneView>;
|
|
17
|
+
setLayerVisibility(params: ILayerVisibleParams): IResult;
|
|
17
18
|
/**
|
|
18
19
|
* 设置地图中心点
|
|
19
20
|
* @param params
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import { Point as
|
|
1
|
+
import M from "@arcgis/core/Basemap";
|
|
2
|
+
import P from "@arcgis/core/Map";
|
|
3
|
+
import g from "@arcgis/core/config";
|
|
4
|
+
import * as T from "@arcgis/core/core/reactiveUtils";
|
|
5
|
+
import { Point as k } from "@arcgis/core/geometry";
|
|
6
6
|
import * as f from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
7
|
+
import z from "@arcgis/core/layers/GeoJSONLayer";
|
|
8
|
+
import W from "@arcgis/core/layers/TileLayer";
|
|
9
|
+
import x from "@arcgis/core/layers/WebTileLayer";
|
|
10
|
+
import L from "@arcgis/core/views/MapView";
|
|
11
|
+
import R from "@arcgis/core/views/SceneView";
|
|
12
12
|
import S from "@turf/destination";
|
|
13
|
-
import * as
|
|
13
|
+
import * as H from "@turf/helpers";
|
|
14
14
|
import I from "../stores/index.mjs";
|
|
15
|
-
function
|
|
15
|
+
function v(m, e) {
|
|
16
16
|
return m.startsWith("http://") || m.startsWith("https://") ? m : e + m;
|
|
17
17
|
}
|
|
18
|
-
class
|
|
18
|
+
class D {
|
|
19
19
|
constructor() {
|
|
20
20
|
this.mapConfig = {}, this.watchHandleMap = /* @__PURE__ */ new Map(), this.handleIndex = 0, this.zoomWatchHandle = null;
|
|
21
21
|
}
|
|
@@ -25,29 +25,29 @@ class j {
|
|
|
25
25
|
* @returns view
|
|
26
26
|
*/
|
|
27
27
|
async initialize(e) {
|
|
28
|
-
const
|
|
28
|
+
const s = I.useAppDataStore, t = JSON.parse(JSON.stringify(s.mapConfig));
|
|
29
29
|
this.mapConfig = t;
|
|
30
|
-
const { container: a, markerClickCallback:
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
if ((t == null ? void 0 : t.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new
|
|
34
|
-
map:
|
|
30
|
+
const { container: a, markerClickCallback: r, mapClickCallback: d } = e;
|
|
31
|
+
g.assetsPath = `${t.assetsRoot}/ArcgisAssets`, g.fontsUrl = `${t.assetsRoot}/fonts`, g.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
|
|
32
|
+
const c = new P();
|
|
33
|
+
if ((t == null ? void 0 : t.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new L({
|
|
34
|
+
map: c,
|
|
35
35
|
container: a,
|
|
36
36
|
...t.mapOptions
|
|
37
|
-
}) : this.view = new
|
|
38
|
-
map:
|
|
37
|
+
}) : this.view = new R({
|
|
38
|
+
map: c,
|
|
39
39
|
container: a,
|
|
40
40
|
...t == null ? void 0 : t.mapOptions
|
|
41
|
-
}), this.view.on("click", async (
|
|
42
|
-
var
|
|
43
|
-
if (
|
|
44
|
-
let o =
|
|
41
|
+
}), this.view.on("click", async (i) => {
|
|
42
|
+
var y, b;
|
|
43
|
+
if (d) {
|
|
44
|
+
let o = i.mapPoint;
|
|
45
45
|
o.spatialReference.isWebMercator && (o = f.webMercatorToGeographic(
|
|
46
46
|
o
|
|
47
|
-
)),
|
|
47
|
+
)), d(
|
|
48
48
|
[o.x, o.y],
|
|
49
|
-
[
|
|
50
|
-
|
|
49
|
+
[i.screenPoint.x, i.screenPoint.y],
|
|
50
|
+
i
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
if (this.view.type === "3d") {
|
|
@@ -55,12 +55,12 @@ class j {
|
|
|
55
55
|
if (this.view.spatialReference.isWebMercator) {
|
|
56
56
|
const l = f.webMercatorToGeographic(
|
|
57
57
|
o.position
|
|
58
|
-
),
|
|
58
|
+
), w = {
|
|
59
59
|
heading: o.heading,
|
|
60
60
|
tilt: o.tilt,
|
|
61
61
|
position: l.toJSON()
|
|
62
62
|
};
|
|
63
|
-
console.log(
|
|
63
|
+
console.log(w), (y = navigator.clipboard) == null || y.writeText(JSON.stringify(w));
|
|
64
64
|
} else
|
|
65
65
|
console.log(o.toJSON());
|
|
66
66
|
} else {
|
|
@@ -72,62 +72,84 @@ class j {
|
|
|
72
72
|
zoom: this.view.zoom
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
const h = (
|
|
75
|
+
const h = (b = (await this.view.hitTest(i)).results) == null ? void 0 : b.filter(
|
|
76
76
|
(o) => o.type === "graphic"
|
|
77
77
|
);
|
|
78
78
|
h.length > 0 && h.forEach((o) => {
|
|
79
|
-
var
|
|
79
|
+
var w;
|
|
80
80
|
const l = o.graphic;
|
|
81
|
-
(
|
|
81
|
+
(w = l.attributes) != null && w.type && r && r(
|
|
82
82
|
l.attributes.type,
|
|
83
83
|
l.attributes.id,
|
|
84
84
|
l.attributes,
|
|
85
|
-
|
|
85
|
+
i
|
|
86
86
|
);
|
|
87
87
|
});
|
|
88
|
-
}), t != null && t.baseLayers ? t.baseLayers.forEach((
|
|
89
|
-
switch (
|
|
88
|
+
}), t != null && t.baseLayers ? t.baseLayers.forEach((i) => {
|
|
89
|
+
switch (i.type.toLowerCase()) {
|
|
90
90
|
case "webTile".toLowerCase(): {
|
|
91
|
-
const
|
|
92
|
-
urlTemplate:
|
|
93
|
-
...
|
|
91
|
+
const n = v(i.url, t.assetsRoot), h = new x({
|
|
92
|
+
urlTemplate: n,
|
|
93
|
+
...i.options
|
|
94
94
|
});
|
|
95
|
-
|
|
95
|
+
c.add(h);
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
case "tile": {
|
|
99
|
-
const
|
|
100
|
-
url:
|
|
101
|
-
...
|
|
99
|
+
const n = v(i.url, t.assetsRoot), h = new W({
|
|
100
|
+
url: n,
|
|
101
|
+
...i.options
|
|
102
102
|
});
|
|
103
|
-
|
|
103
|
+
c.add(h);
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
106
|
case "arcgis": {
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const n = new M(i.options);
|
|
108
|
+
c.basemap = n;
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
}) :
|
|
112
|
+
}) : c.basemap = new M({
|
|
113
113
|
style: {
|
|
114
114
|
id: "arcgis/dark-gray",
|
|
115
115
|
language: "zh-CN"
|
|
116
116
|
}
|
|
117
117
|
}), t != null && t.hdLayers) {
|
|
118
|
-
const
|
|
119
|
-
(
|
|
118
|
+
const i = t.hdLayers.map(
|
|
119
|
+
(n) => (
|
|
120
120
|
// 图层文件为GeoJson格式, renderer和symbol使用autocast配置
|
|
121
|
-
new
|
|
122
|
-
url:
|
|
123
|
-
...
|
|
124
|
-
title:
|
|
121
|
+
new z({
|
|
122
|
+
url: v(n.url, t.assetsRoot),
|
|
123
|
+
...n.options,
|
|
124
|
+
title: n.options.id
|
|
125
125
|
})
|
|
126
126
|
)
|
|
127
127
|
);
|
|
128
|
-
|
|
128
|
+
c.addMany(i);
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
this.view.ui.remove("attribution"), this.view.ui.add("compass", "top-left"), await this.view.when();
|
|
131
|
+
const p = this.mapConfig.camera;
|
|
132
|
+
let u;
|
|
133
|
+
if (this.view.type === "2d") {
|
|
134
|
+
let i = this.view.center;
|
|
135
|
+
this.view.spatialReference.isWebMercator && (i = f.webMercatorToGeographic(
|
|
136
|
+
i
|
|
137
|
+
)), u = { center: [i.x, i.y], zoom: this.view.zoom };
|
|
138
|
+
} else {
|
|
139
|
+
let i = this.view.camera.position;
|
|
140
|
+
this.view.spatialReference.isWebMercator && (i = f.webMercatorToGeographic(
|
|
141
|
+
i
|
|
142
|
+
)), u = {
|
|
143
|
+
position: i,
|
|
144
|
+
heading: this.view.camera.heading,
|
|
145
|
+
tilt: this.view.camera.tilt
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return p ? p.home = u : this.mapConfig.camera = { home: u }, this.view;
|
|
149
|
+
}
|
|
150
|
+
setLayerVisibility(e) {
|
|
151
|
+
const { id: s, visible: t } = e, a = this.view.map.findLayerById(s);
|
|
152
|
+
return a ? (a.visible = t, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
|
|
131
153
|
}
|
|
132
154
|
/**
|
|
133
155
|
* 设置地图中心点
|
|
@@ -151,8 +173,8 @@ class j {
|
|
|
151
173
|
async lookAt(e) {
|
|
152
174
|
if (this.view.type === "2d")
|
|
153
175
|
return;
|
|
154
|
-
const
|
|
155
|
-
if (
|
|
176
|
+
const s = e.tilt || 0, t = e.heading || 0;
|
|
177
|
+
if (s === 0)
|
|
156
178
|
await this.view.goTo(
|
|
157
179
|
{
|
|
158
180
|
position: {
|
|
@@ -166,8 +188,8 @@ class j {
|
|
|
166
188
|
{ duration: (e.duration || 2) * 1e3 }
|
|
167
189
|
);
|
|
168
190
|
else {
|
|
169
|
-
const a = Math.tan(
|
|
170
|
-
|
|
191
|
+
const a = Math.tan(s * Math.PI / 180) * e.height, r = S(
|
|
192
|
+
H.point(e.center),
|
|
171
193
|
a,
|
|
172
194
|
t + 180,
|
|
173
195
|
{
|
|
@@ -177,12 +199,12 @@ class j {
|
|
|
177
199
|
await this.view.goTo(
|
|
178
200
|
{
|
|
179
201
|
position: {
|
|
180
|
-
x:
|
|
181
|
-
y:
|
|
202
|
+
x: r.geometry.coordinates[0],
|
|
203
|
+
y: r.geometry.coordinates[1],
|
|
182
204
|
z: e.height
|
|
183
205
|
},
|
|
184
206
|
heading: t,
|
|
185
|
-
tilt:
|
|
207
|
+
tilt: s
|
|
186
208
|
},
|
|
187
209
|
{ duration: (e.duration || 2) * 1e3 }
|
|
188
210
|
);
|
|
@@ -191,34 +213,31 @@ class j {
|
|
|
191
213
|
async setMapCamera(e) {
|
|
192
214
|
if (!this.view)
|
|
193
215
|
return { status: -1, message: "未初始化" };
|
|
194
|
-
const {
|
|
195
|
-
|
|
196
|
-
{
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
{ duration: t * 1e3 }
|
|
201
|
-
), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" } : { status: -1, message: "未配置camera" };
|
|
216
|
+
const { name: s, duration: t = 0 } = e, { camera: a } = this.mapConfig;
|
|
217
|
+
if (!a)
|
|
218
|
+
return { status: -1, message: "未配置camera" };
|
|
219
|
+
const r = a[s];
|
|
220
|
+
return r ? (console.log("target:", r, t * 1e3), await this.view.goTo(r, { duration: t * 1e3 }), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" };
|
|
202
221
|
}
|
|
203
222
|
/**
|
|
204
223
|
* 经纬度转像素坐标,在地图移动时回调
|
|
205
224
|
* */
|
|
206
|
-
requestCoordinateTransform(e,
|
|
225
|
+
requestCoordinateTransform(e, s) {
|
|
207
226
|
let t = 0;
|
|
208
|
-
const
|
|
227
|
+
const r = 1e3 / 30, d = T.watch(
|
|
209
228
|
() => this.view.center,
|
|
210
229
|
() => {
|
|
211
|
-
const
|
|
212
|
-
|
|
230
|
+
const c = this.transformPoints(e), p = Date.now();
|
|
231
|
+
p - t > r && (s(c), t = p);
|
|
213
232
|
}
|
|
214
233
|
);
|
|
215
|
-
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex,
|
|
234
|
+
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(e) };
|
|
216
235
|
}
|
|
217
236
|
transformPoints(e) {
|
|
218
|
-
return e.map((
|
|
219
|
-
const t = new
|
|
220
|
-
x:
|
|
221
|
-
y:
|
|
237
|
+
return e.map((s) => {
|
|
238
|
+
const t = new k({
|
|
239
|
+
x: s[0],
|
|
240
|
+
y: s[1]
|
|
222
241
|
}), a = this.view.toScreen(t);
|
|
223
242
|
return [a.x, a.y];
|
|
224
243
|
});
|
|
@@ -227,22 +246,22 @@ class j {
|
|
|
227
246
|
* 停止坐标转换回调
|
|
228
247
|
* */
|
|
229
248
|
cancelCoordinateTransform(e) {
|
|
230
|
-
const
|
|
231
|
-
|
|
249
|
+
const s = this.watchHandleMap.get(e);
|
|
250
|
+
s && (s.remove(), this.watchHandleMap.delete(e));
|
|
232
251
|
}
|
|
233
252
|
/**
|
|
234
253
|
* 设置地图zoom范围
|
|
235
254
|
* */
|
|
236
255
|
setMapZoomRange(e) {
|
|
237
|
-
const { min:
|
|
238
|
-
!
|
|
256
|
+
const { min: s, max: t } = e;
|
|
257
|
+
!s && !t || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = T.watch(
|
|
239
258
|
() => this.view.zoom,
|
|
240
259
|
(a) => {
|
|
241
|
-
|
|
260
|
+
s && a <= s && (this.view.zoom = s), t && a >= t && (this.view.zoom = t);
|
|
242
261
|
}
|
|
243
262
|
));
|
|
244
263
|
}
|
|
245
264
|
}
|
|
246
265
|
export {
|
|
247
|
-
|
|
266
|
+
D as default
|
|
248
267
|
};
|
|
@@ -92,7 +92,8 @@ class I {
|
|
|
92
92
|
label: "机动车道",
|
|
93
93
|
symbol: {
|
|
94
94
|
type: "simple-fill",
|
|
95
|
-
color:
|
|
95
|
+
// color: '#2F4F4F',
|
|
96
|
+
color: [47, 79, 79, 0.5],
|
|
96
97
|
style: "solid",
|
|
97
98
|
outline: {
|
|
98
99
|
color: "white",
|
|
@@ -221,7 +222,7 @@ class I {
|
|
|
221
222
|
if (o.status !== 200)
|
|
222
223
|
throw new Error(`OpenDriveRenderer: ${o.statusText}`);
|
|
223
224
|
let l = o.data.result.json;
|
|
224
|
-
l.startsWith(window.location.protocol) || (l = `${window.location.protocol}
|
|
225
|
+
l.startsWith(window.location.protocol) || (l = `${window.location.protocol}//${e}${l}`);
|
|
225
226
|
const r = await (await fetch(l)).arrayBuffer(), n = f.inflate(r, { to: "string" }), a = JSON.parse(n);
|
|
226
227
|
this.showRoad(a);
|
|
227
228
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default
|
|
1
|
+
declare const GreenWavelineView: any;
|
|
2
|
+
export default GreenWavelineView;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import R from "@arcgis/core/
|
|
2
|
-
import
|
|
3
|
-
import U from "
|
|
1
|
+
import R from "@arcgis/core/layers/GraphicsLayer";
|
|
2
|
+
import T from "@arcgis/core/views/2d/layers/BaseLayerViewGL2D";
|
|
3
|
+
import { mat3 as h, vec2 as v, vec3 as U } from "gl-matrix";
|
|
4
4
|
import * as B from "@arcgis/core/core/reactiveUtils";
|
|
5
|
-
const V =
|
|
5
|
+
const V = T.createSubclass({
|
|
6
6
|
// Locations of the two vertex attributes that we use. They
|
|
7
7
|
// will be bound to the shader program before linking.
|
|
8
8
|
aPosition: 0,
|
|
@@ -11,7 +11,7 @@ const V = R.createSubclass({
|
|
|
11
11
|
aSide: 3,
|
|
12
12
|
aColor: 4,
|
|
13
13
|
constructor: function() {
|
|
14
|
-
this.transform = h.create(), this.extrude = h.create(), this.translationToCenter = v.create(), this.screenTranslation = v.create(), this.display = h.fromValues(NaN, 0, 0, 0, NaN, 0, -1, 1, 1), this.screenScaling =
|
|
14
|
+
this.transform = h.create(), this.extrude = h.create(), this.translationToCenter = v.create(), this.screenTranslation = v.create(), this.display = h.fromValues(NaN, 0, 0, 0, NaN, 0, -1, 1, 1), this.screenScaling = U.fromValues(NaN, NaN, 1), this.needsUpdate = !1;
|
|
15
15
|
},
|
|
16
16
|
// Called once a custom layer is added to the map.layers collection and this layer view is instantiated.
|
|
17
17
|
attach: function() {
|
|
@@ -57,7 +57,7 @@ const V = R.createSubclass({
|
|
|
57
57
|
|
|
58
58
|
const float TRAIL_SPEED = 90.0;
|
|
59
59
|
const float TRAIL_LENGTH = 300.0;
|
|
60
|
-
const float TRAIL_CYCLE =
|
|
60
|
+
const float TRAIL_CYCLE = 500.0;
|
|
61
61
|
|
|
62
62
|
void main(void) {
|
|
63
63
|
float d = mod(v_distance - u_current_time * TRAIL_SPEED, TRAIL_CYCLE);
|
|
@@ -154,7 +154,7 @@ const V = R.createSubclass({
|
|
|
154
154
|
}
|
|
155
155
|
i.bindBuffer(i.ARRAY_BUFFER, this.vertexBuffer), i.bufferData(i.ARRAY_BUFFER, A, i.STATIC_DRAW), i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, this.indexBuffer), i.bufferData(i.ELEMENT_ARRAY_BUFFER, n, i.STATIC_DRAW), this.indexBufferSize = n.length;
|
|
156
156
|
}
|
|
157
|
-
}), F =
|
|
157
|
+
}), F = R.createSubclass({
|
|
158
158
|
//@ts-ignore
|
|
159
159
|
createLayerView: function(t) {
|
|
160
160
|
if (t.type === "2d")
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ export interface ISetMapCenterParams {
|
|
|
49
49
|
zoom?: number;
|
|
50
50
|
duration?: number;
|
|
51
51
|
}
|
|
52
|
+
export interface ILayerVisibleParams {
|
|
53
|
+
id: string;
|
|
54
|
+
visible: boolean;
|
|
55
|
+
}
|
|
52
56
|
export interface ILookAtParams {
|
|
53
57
|
center: number[];
|
|
54
58
|
height: number;
|
|
@@ -120,7 +124,7 @@ export interface IOverlayParam {
|
|
|
120
124
|
visible?: boolean;
|
|
121
125
|
}
|
|
122
126
|
export interface ISetMapCameraParams {
|
|
123
|
-
|
|
127
|
+
name: string;
|
|
124
128
|
zoom?: number;
|
|
125
129
|
duration?: number;
|
|
126
130
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { ILaneNumberParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IStartCrossBufferParam } from '../types';
|
|
3
|
+
import { ILaneNumberParams, ILayerVisibleParams, ILookAtParams, IOverlayParam, IQueueLengthParams, ISetMapCameraParams, ISetMapCenterParams, IStartCrossBufferParam } from '../types';
|
|
4
4
|
import HoloFlow from './utils/holo-flow';
|
|
5
5
|
import MapInitializer from './utils/map-initializer';
|
|
6
6
|
import OpenDriveRenderer from './utils/open-drive-renderer';
|
|
@@ -18,7 +18,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
18
18
|
required: false;
|
|
19
19
|
};
|
|
20
20
|
}, {
|
|
21
|
-
mapContainer: any
|
|
21
|
+
mapContainer: import("vue").Ref<any>;
|
|
22
22
|
view: MapView | SceneView;
|
|
23
23
|
mapInitializer: MapInitializer;
|
|
24
24
|
roadConfigTool: RoadConfigTool;
|
|
@@ -31,6 +31,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
31
31
|
setMapCenter: (params: ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
32
32
|
setMapCamera: (params: ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
33
33
|
lookAt: (params: ILookAtParams) => Promise<void>;
|
|
34
|
+
setLayerVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
|
|
34
35
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
35
36
|
handle: number;
|
|
36
37
|
points: number[][];
|
|
@@ -56,25 +57,18 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
56
57
|
visible: boolean;
|
|
57
58
|
}) => void;
|
|
58
59
|
toggleVehicleInfo: (contentType: string) => void;
|
|
59
|
-
addOverlays: (params: IOverlayParam) =>
|
|
60
|
-
removeOverlaysByType: (types: string[]) =>
|
|
61
|
-
removeOverlaysById: (ids: string[]) =>
|
|
62
|
-
removeAllOverlays: () =>
|
|
60
|
+
addOverlays: (params: IOverlayParam) => Promise<import("../types").IResult>;
|
|
61
|
+
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
62
|
+
removeOverlaysById: (ids: string[]) => import("../types").IResult;
|
|
63
|
+
removeAllOverlays: () => import("../types").IResult;
|
|
63
64
|
showAllOverlays: () => void;
|
|
64
65
|
updateQueueLength: (params: IQueueLengthParams[]) => void;
|
|
65
66
|
removeQueueLength: () => void;
|
|
66
67
|
showOpenDrive: (server: string, projectName: string) => Promise<void>;
|
|
67
68
|
hideOpenDrive: () => Promise<void>;
|
|
68
|
-
props:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
emit: {
|
|
73
|
-
(e: 'mapLoaded'): void;
|
|
74
|
-
(e: 'markerClick', type: string, id: string, detail: any, event: any): void;
|
|
75
|
-
(e: 'mapClick', mapPoint: number[], screenPoint: number[], event: any): void;
|
|
76
|
-
};
|
|
77
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
69
|
+
props: any;
|
|
70
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
71
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
78
72
|
config: {
|
|
79
73
|
type: StringConstructor;
|
|
80
74
|
required: true;
|
|
@@ -87,5 +81,5 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
87
81
|
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
88
82
|
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
89
83
|
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
90
|
-
}, {}>;
|
|
84
|
+
}, {}, {}>;
|
|
91
85
|
export default _sfc_main;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),C=require("./stores/index.js");require("./style/index.css");const y=require("./utils/holo-flow/index.js"),ae=require("./utils/map-initializer.js"),ne=require("./utils/open-drive-renderer/index.js"),re=require("./utils/overlay.js"),se=require("./utils/queue-length.js"),h=require("./utils/road-config-tool/index.js"),oe=require("./utils/traffic-flow.js"),ce={class:"gis-viewer"},ie=i.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:O,emit:L}){const d=i.ref(null);let r,s,n,o,t,a,l,u;C.registerStore(),i.onMounted(async()=>{if(!d.value)return;const e=i.getCurrentInstance(),{$gisviewerAssetsRoot:c}=e.appContext.config.globalProperties,g=await(await fetch(v.config)).json();g.assetsRoot=v.assetsRoot||c;const ee=C.default.useAppDataStore;ee.mapConfig=g,s=new ae.default,r=await s.initialize({container:d.value,markerClickCallback:(p,f,w,te)=>{m("markerClick",p,f,w,te)},mapClickCallback:(p,f,w)=>{m("mapClick",p,f,w)}}),t=new y.default(r),m("mapLoaded")});const b=i.computed(()=>r),q=async e=>await s.setMapCenter(e),A=async e=>await s.setMapCamera(e),T=async e=>await s.lookAt(e),_=e=>s.setLayerVisibility(e),I=(e,c)=>s.requestCoordinateTransform(e,c),S=e=>{s.cancelCoordinateTransform(e)},D=e=>{s.setMapZoomRange(e)},M=e=>(n||(n=new h.default(r)),n.showLaneNumber(e)),x=()=>{n==null||n.clearLaneNumber()},V=async e=>(n||(n=new h.default(r)),await n.initializeSearch(e)),B=async()=>n==null?void 0:n.calCrossIndicatorArea(),H=async()=>{},R=async(e,c)=>{o||(o=new oe.default(r)),o.connectTrafficFlow(e,c)},z=()=>{o==null||o.disconnectTrafficFlow()},N=e=>{t||(t=new y.default(r)),t.handleVehicleTraceData(e)},P=()=>{t==null||t.clearHoloTrace()},Q=async e=>{t||(t=new y.default(r)),await t.handleSignalData(e)},j=()=>{t==null||t.clearHoloSignal()},E=e=>{switch(e.name.toLowerCase()){case"vehiclePlate".toLowerCase():o==null||o.toggleVehiclePlate(e.visible);break}},Z=e=>{t==null||t.updatePanelContent(e)},G=async e=>(a||(a=new re.default(r)),await a.addOverlays(e)),J=e=>a==null?void 0:a.removeOverlaysByType(e),K=e=>a==null?void 0:a.removeOverlaysById(e),U=()=>a==null?void 0:a.removeAllOverlays(),W=()=>{a==null||a.showAllOverlays()},X=e=>{l||(l=new se.default(r)),l.updateQueueLength(e)},Y=()=>{l==null||l.removeQueueLength()},F=async(e,c)=>{u||(u=new ne.default(r)),await u.showOpenDrive(e,c)},$=async()=>{await(u==null?void 0:u.hideOpenDrive())},v=k,m=L;return O({mapViewer:b,setLayerVisibility:_,setMapCenter:q,lookAt:T,setMapCamera:A,setMapZoomRange:D,requestCoordinateTransform:I,cancelCoordinateTransform:S,addOverlays:G,showAllOverlays:W,removeOverlaysByType:J,removeOverlaysById:K,removeAllOverlays:U,showLaneNumber:M,clearLaneNumber:x,initializeAreaTool:V,calCrossIndicatorArea:B,calRoadIndicatorArea:H,connectCarFlow:R,disconnectCarFlow:z,handleHoloVehicleTraceData:N,clearHoloTrace:P,handleHoloSignalData:Q,clearHoloSignal:j,toggleTrafficInfo:E,toggleVehicleInfo:Z,updateQueueLength:X,removeQueueLength:Y,showOpenDrive:F,hideOpenDrive:$}),(e,c)=>(i.openBlock(),i.createElementBlock("div",ce,[i.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:d},null,512)]))}});exports.default=ie;
|
|
@@ -8,7 +8,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
8
8
|
required: false;
|
|
9
9
|
};
|
|
10
10
|
}, {
|
|
11
|
-
mapContainer: any
|
|
11
|
+
mapContainer: import("vue").Ref<any>;
|
|
12
12
|
view: __esri.MapView | __esri.SceneView;
|
|
13
13
|
mapInitializer: import("./utils/map-initializer").default;
|
|
14
14
|
roadConfigTool: import("./utils/road-config-tool").default;
|
|
@@ -21,6 +21,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
21
21
|
setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
22
22
|
setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
23
23
|
lookAt: (params: import("../types").ILookAtParams) => Promise<void>;
|
|
24
|
+
setLayerVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
|
|
24
25
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
25
26
|
handle: number;
|
|
26
27
|
points: number[][];
|
|
@@ -46,25 +47,18 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
46
47
|
visible: boolean;
|
|
47
48
|
}) => void;
|
|
48
49
|
toggleVehicleInfo: (contentType: string) => void;
|
|
49
|
-
addOverlays: (params: import("../types").IOverlayParam) =>
|
|
50
|
-
removeOverlaysByType: (types: string[]) =>
|
|
51
|
-
removeOverlaysById: (ids: string[]) =>
|
|
52
|
-
removeAllOverlays: () =>
|
|
50
|
+
addOverlays: (params: import("../types").IOverlayParam) => Promise<import("../types").IResult>;
|
|
51
|
+
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
52
|
+
removeOverlaysById: (ids: string[]) => import("../types").IResult;
|
|
53
|
+
removeAllOverlays: () => import("../types").IResult;
|
|
53
54
|
showAllOverlays: () => void;
|
|
54
55
|
updateQueueLength: (params: import("../types").IQueueLengthParams[]) => void;
|
|
55
56
|
removeQueueLength: () => void;
|
|
56
57
|
showOpenDrive: (server: string, projectName: string) => Promise<void>;
|
|
57
58
|
hideOpenDrive: () => Promise<void>;
|
|
58
|
-
props:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
emit: {
|
|
63
|
-
(e: "mapLoaded"): void;
|
|
64
|
-
(e: "markerClick", type: string, id: string, detail: any, event: any): void;
|
|
65
|
-
(e: "mapClick", mapPoint: number[], screenPoint: number[], event: any): void;
|
|
66
|
-
};
|
|
67
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
59
|
+
props: any;
|
|
60
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
61
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
68
62
|
config: {
|
|
69
63
|
type: StringConstructor;
|
|
70
64
|
required: true;
|
|
@@ -77,5 +71,5 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
77
71
|
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
78
72
|
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
79
73
|
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
80
|
-
}, {}>>;
|
|
74
|
+
}, {}, {}>>;
|
|
81
75
|
export default GisMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),y=require("@arcgis/core/geometry"),u=require("@arcgis/core/geometry/Polyline"),p=require("@arcgis/core/geometry/support/webMercatorUtils.js"),b=require("@arcgis/core/layers/GraphicsLayer"),g=require("./renderer/greenWaveline.js");function f(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(i,t,e.get?e:{enumerable:!0,get:()=>o[t]})}}return i.default=o,Object.freeze(i)}const l=f(p);function v(...o){const i={},t=e=>{for(const r in e)e.hasOwnProperty(r)&&(Object.prototype.toString.call(e[r])==="[object Object]"?i[r]=v(i[r],e[r]):i[r]=e[r])};for(let e=0;e<o.length;e++)t(o[e]);return i}class m{constructor(i){this.defaultAnimationOptions={isAnimation:!1,positive:!0,positiveColor:[0,255,0],negative:!0,negativeColor:[0,255,0]},this.viewer=i.viewer,this.overlayLayer=new b({...i.graphicsLayerOptions}),this.customGreenWaveLineView=new g.default({graphics:[]}),this.viewer.map.layers.add(this.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),y=require("@arcgis/core/geometry"),u=require("@arcgis/core/geometry/Polyline"),p=require("@arcgis/core/geometry/support/webMercatorUtils.js"),b=require("@arcgis/core/layers/GraphicsLayer"),g=require("./renderer/greenWaveline.js");function f(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(i,t,e.get?e:{enumerable:!0,get:()=>o[t]})}}return i.default=o,Object.freeze(i)}const l=f(p);function v(...o){const i={},t=e=>{for(const r in e)e.hasOwnProperty(r)&&(Object.prototype.toString.call(e[r])==="[object Object]"?i[r]=v(i[r],e[r]):i[r]=e[r])};for(let e=0;e<o.length;e++)t(o[e]);return i}class m{constructor(i){this.defaultAnimationOptions={isAnimation:!1,positive:!0,positiveColor:[0,255,0],negative:!0,negativeColor:[0,255,0]},this.viewer=i.viewer,this.overlayLayer=new b({...i.graphicsLayerOptions}),this.customGreenWaveLineView=new g.default({graphics:[]}),this.viewer.map.layers.add(this.overlayLayer),this.viewer.map.layers.add(this.customGreenWaveLineView)}addGreenWaveLine(i,t={isAnimation:!1,positive:!0,positiveColor:[0,255,0],negative:!0,negativeColor:[0,255,0]}){const e=[],r=[];t=v(this.defaultAnimationOptions,t),i.map(a=>{const s=a.visible==null?!0:a.visible;if(t.isAnimation){const n=[...a.paths];r.push(...this.getAnimationPath(n,t))}e.push(this.createLine(a.paths,a.symbol,a.attributes,s))}),this.overlayLayer.addMany(e),t.isAnimation&&this.customGreenWaveLineView.addMany(r)}getAnimationPath(i,t={isAnimation:!1,positive:!0,positiveColor:[0,255,0],negative:!0,negativeColor:[0,255,0]}){const e=[];return t.positive&&e.push({attributes:{color:t.positiveColor},geometry:l.geographicToWebMercator({paths:[i],type:"polyline"})}),t.negative&&e.push({attributes:{color:t.negativeColor},geometry:l.geographicToWebMercator({paths:[i.reverse()],type:"polyline"})}),e}createLine(i,t,e={},r){const a={type:"simple-line",color:[8,69,9,.8],width:5,...t},s=new u({paths:i}),n=l.geographicToWebMercator(s);return new c({geometry:n,symbol:a,attributes:{type:"greenWaveLine",...e},visible:r})}addPointText(i){const t=[];i.map(e=>{const r=e.visible==null?!0:e.visible;t.push(this.createPointText(e.point,e.symbol,e.attributes,r))}),this.overlayLayer.addMany(t)}createPointText(i,t,e={},r){const a={type:"text",color:"white",haloColor:"black",haloSize:"1px",xoffset:3,yoffset:3,font:{size:12,family:"Josefin Slab",weight:"bold"},...t},s=new y.Point({x:i[0],y:i[1]}),n=l.geographicToWebMercator(s);return new c({geometry:n,symbol:a,attributes:{type:"greenWaveLine-Text",...e},visible:r})}hideWaveLine(i){i?this.overlayLayer.graphics.filter(e=>{const r=e.getAttribute("id");return i.includes(r)}).forEach(e=>{e.visible=!1}):this.overlayLayer.graphics.map(t=>{t.visible=!1})}showWaveLine(i){i?this.overlayLayer.graphics.filter(e=>{const r=e.getAttribute("id");return i.includes(r)}).forEach(e=>{e.visible=!0}):this.overlayLayer.graphics.map(t=>{t.visible=!0})}hideLayer(){this.overlayLayer.visible=!1,this.customGreenWaveLineView.visible=!1}showLayer(){this.overlayLayer.visible=!0,this.customGreenWaveLineView.visible=!0}clearGreenWaveLine(){this.overlayLayer.removeAll(),this.customGreenWaveLineView.removeAll()}destroy(){this.overlayLayer.removeAll(),this.customGreenWaveLineView.removeAll(),this.viewer.map.layers.remove(this.customGreenWaveLineView),this.viewer.map.layers.remove(this.overlayLayer)}}exports.default=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils"),u=require("@arcgis/core/geometry"),p=require("@arcgis/core/layers/FeatureLayer"),g=require("../../stores/index.js");function y(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const w=y(d);class m{constructor(e){this.currentPhaseMap=new Map,this.countdownCanvasMap=new Map,this.lastDataTime=0,this.isDeletingCanvas=!1,this.canvasWidth=80,this.canvasHeight=50,this.view=(e.type==="2d",e);const t=g.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig))}async initializeLayer(){if(this.mapConfig.phaseLineLayer)if(this.phaseLineLayer)this.phaseLineLayer.visible||(this.phaseLineLayer.visible=!0);else{const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`,o=(await(await fetch(e)).json()).features.map((i,n)=>({geometry:{type:"polyline",paths:[i.geometry.coordinates]},attributes:{ObjectID:n+1,id:i.properties.id,color:"hide"}}));this.phaseLineLayer=new p({source:o,geometryType:"polyline",objectIdField:"ObjectID",outFields:["*"],fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"color",alias:"color",type:"string"}],renderer:{type:"unique-value",field:"color",defaultSymbol:{type:"simple-line",color:"lightblue",width:"2px",style:"none"},uniqueValueInfos:[{value:"green",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[19,255,69,.8]},width:1,height:.5}]}},{value:"red",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[254,5,9,.8]},width:1,height:.5}]}},{value:"yellow",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[255,215,0,.8]},width:1,height:.5}]}}]}}),this.view.map.add(this.phaseLineLayer)}}async handleSignalData(e){const t=new Date().getTime();if(t-this.lastDataTime<100)return;this.lastDataTime=t;const{crossId:o,lat:i,lon:n,rtStage:s,channelsConfig:l}=e;await this.updateCountdown(o,i,n,s),this.phaseLineLayer&&((!this.currentPhaseMap.has(o)||this.currentPhaseMap.get(o)!==s.stagePhase)&&await this.updatePhaseLine(o,s.channelsConfig,l),this.currentPhaseMap.set(o,s.stagePhase))}clearSignal(){this.phaseLineLayer.visible=!1,this.countdownWatchHandel&&(this.countdownWatchHandel.remove(),this.countdownWatchHandel=void 0),this.countdownCanvasMap.forEach(e=>{this.view.container.removeChild(e.backgroundCanvas),this.view.container.removeChild(e.countdownCanvas)}),this.countdownCanvasMap.clear()}async updateCountdown(e,t,a,o){if(this.isDeletingCanvas)return;const i=this.countdownCanvasMap.get(e);if(i)this.drawCountdownText(i.countdownCanvas,o);else{const n=new u.Point({longitude:a,latitude:t,z:10}),s=this.view.toScreen(n);if(s.x>this.view.width||s.y>this.view.height)return;this.createCountdownCanvas(l=>{const c=l[0],h=l[1];c.style.left=s.x+"px",c.style.top=s.y+"px",h.style.left=s.x+"px",h.style.top=s.y+"px",this.countdownCanvasMap.set(e,{backgroundCanvas:c,countdownCanvas:h,mapPoint:n}),this.drawCountdownText(h,o)})}this.countdownWatchHandel||(this.countdownWatchHandel=w.watch(()=>this.view.extent,()=>{this.countdownCanvasMap.forEach(n=>{const s=this.view.toScreen(n.mapPoint);s.x>this.view.width||s.y>this.view.height?(this.isDeletingCanvas=!0,this.view.container.removeChild(n.backgroundCanvas),this.view.container.removeChild(n.countdownCanvas),this.countdownCanvasMap.delete(e),this.isDeletingCanvas=!1):(n.backgroundCanvas.style.left=s.x+"px",n.backgroundCanvas.style.top=s.y+"px",n.countdownCanvas.style.left=s.x+"px",n.countdownCanvas.style.top=s.y+"px")})}))}drawCountdownText(e,t){const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),a.font="32px LESLIE",a.textBaseline="middle",a.textAlign="center",a.fillStyle=t.stageRemainingTime<=t.stageAllRedTime?"red":t.stageRemainingTime<=t.stageAllRedTime+t.stageYellowTime?"yellow":"lime",a.fillText(t.stageRemainingTime,e.width/2,e.height/2)}async updatePhaseLine(e,t,a){const o=this.phaseLineLayer.source.filter(i=>i.getAttribute("id").includes(e));o.forEach(i=>{const n=i.getAttribute("id");this.isLaneInChannels(n,t)?i.setAttribute("color","green"):this.isLaneInChannels(n,a)?i.setAttribute("color","red"):i.setAttribute("color","green")}),await this.phaseLineLayer.applyEdits({updateFeatures:o})}isLaneInChannels(e,t){const a=e.split("+"),o=a[1],i=a[2];for(let n=0;n<t.length;n++)for(let s=0;s<t[n].laneSnList.length;s++){const l=t[n].laneSnList[s].toFixed(0);if(o===l[0]&&i===l[1])return!0}return!1}createCountdownCanvas(e){const t=new Image;t.src=`${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`,t.onload=()=>{const a=document.createElement("canvas");a.width=this.canvasWidth,a.height=this.canvasHeight,a.style.position="absolute",a.style.transform="translate(-50%, -50%)",a.getContext("2d").drawImage(t,0,0,this.canvasWidth,this.canvasHeight),this.view.container.appendChild(a);const i=document.createElement("canvas");i.width=this.canvasWidth-10,i.height=this.canvasHeight-10,i.style.position="absolute",i.style.transform="translate(-50%, -50%)",this.view.container.appendChild(i),e([a,i])}}}exports.default=m;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils"),u=require("@arcgis/core/geometry"),p=require("@arcgis/core/layers/FeatureLayer"),g=require("../../stores/index.js");function y(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const w=y(d);class m{constructor(e){this.currentPhaseMap=new Map,this.countdownCanvasMap=new Map,this.lastDataTime=0,this.isDeletingCanvas=!1,this.canvasWidth=80,this.canvasHeight=50,this.view=(e.type==="2d",e);const t=g.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig))}async initializeLayer(){if(this.mapConfig.phaseLineLayer)if(this.phaseLineLayer)this.phaseLineLayer.visible||(this.phaseLineLayer.visible=!0);else{const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`,o=(await(await fetch(e)).json()).features.map((i,n)=>({geometry:{type:"polyline",paths:[i.geometry.coordinates]},attributes:{ObjectID:n+1,id:i.properties.id,color:"hide"}}));this.phaseLineLayer=new p({source:o,geometryType:"polyline",objectIdField:"ObjectID",outFields:["*"],fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"color",alias:"color",type:"string"}],renderer:{type:"unique-value",field:"color",defaultSymbol:{type:"simple-line",color:"lightblue",width:"2px",style:"none"},uniqueValueInfos:[{value:"green",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[19,255,69,.8]},width:1,height:.5}]}},{value:"red",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[254,5,9,.8]},width:1,height:.5}]}},{value:"yellow",symbol:{type:"line-3d",symbolLayers:[{type:"path",profile:"quad",material:{color:[255,215,0,.8]},width:1,height:.5}]}}]}}),this.view.map.add(this.phaseLineLayer)}}async handleSignalData(e){const t=new Date().getTime();if(t-this.lastDataTime<100)return;this.lastDataTime=t;const{crossId:o,lat:i,lon:n,rtStage:s,channelsConfig:l}=e;await this.updateCountdown(o,i,n,s),this.phaseLineLayer&&((!this.currentPhaseMap.has(o)||this.currentPhaseMap.get(o)!==s.stagePhase)&&await this.updatePhaseLine(o,s.channelsConfig,l),this.currentPhaseMap.set(o,s.stagePhase))}clearSignal(){this.phaseLineLayer.visible=!1,this.countdownWatchHandel&&(this.countdownWatchHandel.remove(),this.countdownWatchHandel=void 0),this.countdownCanvasMap.forEach(e=>{this.view.container.removeChild(e.backgroundCanvas),this.view.container.removeChild(e.countdownCanvas)}),this.countdownCanvasMap.clear()}async updateCountdown(e,t,a,o){if(this.isDeletingCanvas)return;const i=this.countdownCanvasMap.get(e);if(i)this.drawCountdownText(i.countdownCanvas,o);else{const n=new u.Point({longitude:a,latitude:t,z:10}),s=this.view.toScreen(n);if(s.x>this.view.width||s.y>this.view.height)return;this.createCountdownCanvas(l=>{const c=l[0],h=l[1];c.style.left=s.x+"px",c.style.top=s.y+"px",h.style.left=s.x+"px",h.style.top=s.y+"px",this.countdownCanvasMap.set(e,{backgroundCanvas:c,countdownCanvas:h,mapPoint:n}),this.drawCountdownText(h,o)})}this.countdownWatchHandel||(this.countdownWatchHandel=w.watch(()=>this.view.extent,()=>{this.countdownCanvasMap.forEach(n=>{const s=this.view.toScreen(n.mapPoint);s.x>this.view.width||s.y>this.view.height?(this.isDeletingCanvas=!0,this.view.container.removeChild(n.backgroundCanvas),this.view.container.removeChild(n.countdownCanvas),this.countdownCanvasMap.delete(e),this.isDeletingCanvas=!1):(n.backgroundCanvas.style.left=s.x+"px",n.backgroundCanvas.style.top=s.y+"px",n.countdownCanvas.style.left=s.x+"px",n.countdownCanvas.style.top=s.y+"px")})}))}drawCountdownText(e,t){const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),a.font="32px LESLIE",a.textBaseline="middle",a.textAlign="center",a.fillStyle=t.stageRemainingTime<=t.stageAllRedTime?"red":t.stageRemainingTime<=t.stageAllRedTime+t.stageYellowTime?"yellow":"lime",a.fillText(t.stageRemainingTime,e.width/2,e.height/2)}async updatePhaseLine(e,t,a){const o=this.phaseLineLayer.source.filter(i=>i.getAttribute("id").includes(e));o.forEach(i=>{const n=i.getAttribute("id");this.isLaneInChannels(n,t)?i.setAttribute("color","green"):this.isLaneInChannels(n,a)?i.setAttribute("color","red"):i.setAttribute("color","green")}),await this.phaseLineLayer.applyEdits({updateFeatures:o})}isLaneInChannels(e,t){const a=e.split("+"),o=a[1],i=a[2];for(let n=0;n<t.length;n++)for(let s=0;s<t[n].laneSnList.length;s++){const l=t[n].laneSnList[s].toFixed(0);if(o===l[0]&&i===l[1])return!0}return!1}createCountdownCanvas(e){const t=new Image;t.src=`${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`,t.onload=()=>{const a=document.createElement("canvas");a.width=this.canvasWidth,a.height=this.canvasHeight,a.style.position="absolute",a.style.transform="translate(-50%, -50%)",a.getContext("2d").drawImage(t,0,0,this.canvasWidth,this.canvasHeight),this.view.container.appendChild(a);const i=document.createElement("canvas");i.width=this.canvasWidth-10,i.height=this.canvasHeight-10,i.style.position="absolute",i.style.transform="translate(-50%, -50%)",this.view.container.appendChild(i),e([a,i])},t.onerror=()=>{console.error("倒计时背景图加载失败")}}}exports.default=m;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { ILookAtParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
|
|
3
|
+
import { ILayerVisibleParams, ILookAtParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
|
|
4
4
|
export default class MapInitializer {
|
|
5
5
|
private view;
|
|
6
6
|
private mapConfig;
|
|
@@ -14,6 +14,7 @@ export default class MapInitializer {
|
|
|
14
14
|
markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
|
|
15
15
|
mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
|
|
16
16
|
}): Promise<MapView | SceneView>;
|
|
17
|
+
setLayerVisibility(params: ILayerVisibleParams): IResult;
|
|
17
18
|
/**
|
|
18
19
|
* 设置地图中心点
|
|
19
20
|
* @param params
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),k=require("@arcgis/core/Map"),g=require("@arcgis/core/config"),z=require("@arcgis/core/core/reactiveUtils"),q=require("@arcgis/core/geometry"),O=require("@arcgis/core/geometry/support/webMercatorUtils"),S=require("@arcgis/core/layers/GeoJSONLayer"),W=require("@arcgis/core/layers/TileLayer"),x=require("@arcgis/core/layers/WebTileLayer"),L=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),H=require("@turf/destination"),I=require("@turf/helpers"),_=require("../stores/index.js");function v(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const e=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,e.get?e:{enumerable:!0,get:()=>r[i]})}}return t.default=r,Object.freeze(t)}const T=v(z),p=v(O),G=v(I);function b(r,t){return r.startsWith("http://")||r.startsWith("https://")?r:t+r}class N{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null}async initialize(t){const i=_.default.useAppDataStore,e=JSON.parse(JSON.stringify(i.mapConfig));this.mapConfig=e;const{container:o,markerClickCallback:n,mapClickCallback:m}=t;g.assetsPath=`${e.assetsRoot}/ArcgisAssets`,g.fontsUrl=`${e.assetsRoot}/fonts`,g.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const h=new k;if((e==null?void 0:e.mapOptions.mode.toLowerCase())==="2d"?this.view=new L({map:h,container:o,...e.mapOptions}):this.view=new R({map:h,container:o,...e==null?void 0:e.mapOptions}),this.view.on("click",async s=>{var y,M;if(m){let a=s.mapPoint;a.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),m([a.x,a.y],[s.screenPoint.x,s.screenPoint.y],s)}if(this.view.type==="3d"){const a=this.view.camera;if(this.view.spatialReference.isWebMercator){const u=p.webMercatorToGeographic(a.position),d={heading:a.heading,tilt:a.tilt,position:u.toJSON()};console.log(d),(y=navigator.clipboard)==null||y.writeText(JSON.stringify(d))}else console.log(a.toJSON())}else{let a=this.view.center;this.view.spatialReference.isWebMercator&&(a=p.webMercatorToGeographic(a)),console.log({center:a.toJSON(),zoom:this.view.zoom})}const l=(M=(await this.view.hitTest(s)).results)==null?void 0:M.filter(a=>a.type==="graphic");l.length>0&&l.forEach(a=>{var d;const u=a.graphic;(d=u.attributes)!=null&&d.type&&n&&n(u.attributes.type,u.attributes.id,u.attributes,s)})}),e!=null&&e.baseLayers?e.baseLayers.forEach(s=>{switch(s.type.toLowerCase()){case"webTile".toLowerCase():{const c=b(s.url,e.assetsRoot),l=new x({urlTemplate:c,...s.options});h.add(l);break}case"tile":{const c=b(s.url,e.assetsRoot),l=new W({url:c,...s.options});h.add(l);break}case"arcgis":{const c=new P(s.options);h.basemap=c;break}}}):h.basemap=new P({style:{id:"arcgis/dark-gray",language:"zh-CN"}}),e!=null&&e.hdLayers){const s=e.hdLayers.map(c=>new S({url:b(c.url,e.assetsRoot),...c.options,title:c.options.id}));h.addMany(s)}this.view.ui.remove("attribution"),this.view.ui.add("compass","top-left"),await this.view.when();const w=this.mapConfig.camera;let f;if(this.view.type==="2d"){let s=this.view.center;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),f={center:[s.x,s.y],zoom:this.view.zoom}}else{let s=this.view.camera.position;this.view.spatialReference.isWebMercator&&(s=p.webMercatorToGeographic(s)),f={position:s,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return w?w.home=f:this.mapConfig.camera={home:f},this.view}setLayerVisibility(t){const{id:i,visible:e}=t,o=this.view.map.findLayerById(i);return o?(o.visible=e,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}async setMapCenter(t){return this.view?(t.center?await this.view.goTo({target:t.center,zoom:t.zoom},{duration:(t.duration||0)*1e3}):t.camera&&await this.view.goTo(t.camera,{duration:(t.duration||0)*1e3}),{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(t){if(this.view.type==="2d")return;const i=t.tilt||0,e=t.heading||0;if(i===0)await this.view.goTo({position:{x:t.center[0],y:t.center[1],z:t.height},heading:e,tilt:0},{duration:(t.duration||2)*1e3});else{const o=Math.tan(i*Math.PI/180)*t.height,n=H(G.point(t.center),o,e+180,{units:"meters"});await this.view.goTo({position:{x:n.geometry.coordinates[0],y:n.geometry.coordinates[1],z:t.height},heading:e,tilt:i},{duration:(t.duration||2)*1e3})}}async setMapCamera(t){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:e=0}=t,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const n=o[i];return n?(console.log("target:",n,e*1e3),await this.view.goTo(n,{duration:e*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(t,i){let e=0;const n=1e3/30,m=T.watch(()=>this.view.center,()=>{const h=this.transformPoints(t),w=Date.now();w-e>n&&(i(h),e=w)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,m),{handle:this.handleIndex,points:this.transformPoints(t)}}transformPoints(t){return t.map(i=>{const e=new q.Point({x:i[0],y:i[1]}),o=this.view.toScreen(e);return[o.x,o.y]})}cancelCoordinateTransform(t){const i=this.watchHandleMap.get(t);i&&(i.remove(),this.watchHandleMap.delete(t))}setMapZoomRange(t){const{min:i,max:e}=t;!i&&!e||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=T.watch(()=>this.view.zoom,o=>{i&&o<=i&&(this.view.zoom=i),e&&o>=e&&(this.view.zoom=e)}))}}exports.default=N;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),m=require("axios"),f=require("pako");class b{constructor(e){this.view=e,this.laneLayer=new w({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),m=require("axios"),f=require("pako");class b{constructor(e){this.view=e,this.laneLayer=new w({id:"OpenDriveLane",fields:[{name:"ObjectID",alias:"ObjectID",type:"oid"},{name:"id",alias:"编号",type:"string"},{name:"roadId",alias:"道路号",type:"string"},{name:"roadName",alias:"道路名称",type:"string"},{name:"sectionId",alias:"路段号",type:"string"},{name:"laneId",alias:"车道号",type:"string"},{name:"type",alias:"类型",type:"string"}],objectIdField:"ObjectID",geometryType:"polygon",spatialReference:{wkid:4326},source:[],outFields:["*"],renderer:{type:"unique-value",field:"type",defaultSymbol:{type:"simple-fill",color:[100,100,100],style:"solid",outline:{color:"white",width:1}},uniqueValueInfos:[{value:"shoulder",label:"路肩",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"border",label:"路沿",symbol:{type:"simple-fill",color:"#DCDCDC",style:"solid",outline:{color:"white",width:1}}},{value:"driving",label:"机动车道",symbol:{type:"simple-fill",color:[47,79,79,.5],style:"solid",outline:{color:"white",width:1}}},{value:"none",label:"无",symbol:{type:"simple-fill",color:[111,120,135],style:"none",outline:{color:"white",width:1}}},{value:"restricted",label:"禁行区",symbol:{type:"simple-fill",color:"yellow",style:"solid",outline:{color:"yellow",width:2}}},{value:"parking",label:"停车区",symbol:{type:"simple-fill",color:[115,115,115],style:"solid",outline:{color:"white",width:1}}},{value:"median",label:"中央隔离带",symbol:{type:"simple-fill",color:"#008000",style:"solid",outline:{color:"white",width:1}}},{value:"biking",label:"非机动车道",symbol:{type:"simple-fill",color:"#D3D3D3",style:"solid",outline:{color:"white",width:1}}},{value:"sidewalk",label:"人行道",symbol:{type:"simple-fill",color:"#C0C0C0",style:"solid",outline:{color:"white",width:1}}},{value:"junction",label:"路口区域",symbol:{type:"simple-fill",color:"#2F4F4F",style:"solid",outline:{color:"white",width:1}}},{value:"selected",label:"选中车道",symbol:{type:"simple-fill",color:[141,168,211],style:"solid",outline:{color:"white",width:1}}}]}}),this.view.map.add(this.laneLayer)}async showOpenDrive(e,i){const t=`http://${e}/api/openDrive/analyzeXodr`,o=await m.get(t,{headers:{projectName:i},params:{analyze:!1,compressed:!0}});if(o.status!==200)throw new Error(`OpenDriveRenderer: ${o.statusText}`);let l=o.data.result.json;l.startsWith(window.location.protocol)||(l=`${window.location.protocol}//${e}${l}`);const r=await(await fetch(l)).arrayBuffer(),n=f.inflate(r,{to:"string"}),a=JSON.parse(n);this.showRoad(a)}async showRoad(e){const i=await this.laneLayer.queryFeatures();i.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:i.features});for(const t of e){const o=t.id,l=[];for(const s of t.laneSections){const r=s.id;for(const n of s.lanePaths){const{id:a,type:y,innerPath:d,outerPath:p}=n,c=d.concat(p.reverse());c.push(d[0]);const u=new h({geometry:{type:"polygon",rings:[c]},attributes:{id:a,roadId:o,roadName:t.name,sectionId:r,laneId:a,type:y}});l.push(u)}}await this.laneLayer.applyEdits({addFeatures:l})}}async hideOpenDrive(){const e=await this.laneLayer.queryFeatures();e.features.length>0&&this.laneLayer.applyEdits({deleteFeatures:e.features})}}exports.default=b;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default
|
|
1
|
+
declare const GreenWavelineView: any;
|
|
2
|
+
export default GreenWavelineView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("@arcgis/core/views/2d/layers/BaseLayerViewGL2D"),o=require("gl-matrix"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("@arcgis/core/layers/GraphicsLayer"),R=require("@arcgis/core/views/2d/layers/BaseLayerViewGL2D"),o=require("gl-matrix"),T=require("@arcgis/core/core/reactiveUtils");function U(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(a,s,l.get?l:{enumerable:!0,get:()=>t[s]})}}return a.default=t,Object.freeze(a)}const B=U(T),V=R.createSubclass({aPosition:0,aOffset:1,aDistance:2,aSide:3,aColor:4,constructor:function(){this.transform=o.mat3.create(),this.extrude=o.mat3.create(),this.translationToCenter=o.vec2.create(),this.screenTranslation=o.vec2.create(),this.display=o.mat3.fromValues(NaN,0,0,0,NaN,0,-1,1,1),this.screenScaling=o.vec3.fromValues(NaN,NaN,1),this.needsUpdate=!1},attach:function(){const t=this.context,a=()=>{this.needsUpdate=!0,this.requestRender()};this.watcher=B.on(()=>this.layer.graphics,"change",a);const s=`
|
|
2
2
|
precision highp float;
|
|
3
3
|
|
|
4
4
|
uniform mat3 u_transform;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
const float TRAIL_SPEED = 90.0;
|
|
34
34
|
const float TRAIL_LENGTH = 300.0;
|
|
35
|
-
const float TRAIL_CYCLE =
|
|
35
|
+
const float TRAIL_CYCLE = 500.0;
|
|
36
36
|
|
|
37
37
|
void main(void) {
|
|
38
38
|
float d = mod(v_distance - u_current_time * TRAIL_SPEED, TRAIL_CYCLE);
|
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
float a2 = exp(-abs(v_side) * 3.0);
|
|
41
41
|
float a = a1 * a2;
|
|
42
42
|
gl_FragColor = v_color * a;
|
|
43
|
-
}`,u=t.createShader(t.VERTEX_SHADER);t.shaderSource(u,s),t.compileShader(u);const m=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(m,l),t.compileShader(m),this.program=t.createProgram(),t.attachShader(this.program,u),t.attachShader(this.program,m),t.bindAttribLocation(this.program,this.aPosition,"a_position"),t.bindAttribLocation(this.program,this.aOffset,"a_offset"),t.bindAttribLocation(this.program,this.aDistance,"a_distance"),t.bindAttribLocation(this.program,this.aSide,"a_side"),t.bindAttribLocation(this.program,this.aColor,"a_color"),t.linkProgram(this.program),t.deleteShader(u),t.deleteShader(m),this.uTransform=t.getUniformLocation(this.program,"u_transform"),this.uExtrude=t.getUniformLocation(this.program,"u_extrude"),this.uDisplay=t.getUniformLocation(this.program,"u_display"),this.uCurrentTime=t.getUniformLocation(this.program,"u_current_time"),this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.indexBufferSize=0,t.getParameter(t.VERSION).startsWith("WebGL 2.0"))this.vao=t.createVertexArray(),this.bindVertexArray=d=>t.bindVertexArray(d),this.deleteVertexArray=d=>t.deleteVertexArray(d);else{const d=t.getExtension("OES_vertex_array_object");this.vao=d.createVertexArrayOES(),this.bindVertexArray=A=>d.bindVertexArrayOES(A),this.deleteVertexArray=A=>d.deleteVertexArrayOES(A)}this.bindVertexArray(this.vao),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.enableVertexAttribArray(this.aPosition),t.enableVertexAttribArray(this.aOffset),t.enableVertexAttribArray(this.aDistance),t.enableVertexAttribArray(this.aSide),t.enableVertexAttribArray(this.aColor),t.vertexAttribPointer(this.aPosition,2,t.FLOAT,!1,28,0),t.vertexAttribPointer(this.aOffset,2,t.FLOAT,!1,28,8),t.vertexAttribPointer(this.aDistance,1,t.FLOAT,!1,28,16),t.vertexAttribPointer(this.aSide,1,t.FLOAT,!1,28,20),t.vertexAttribPointer(this.aColor,4,t.UNSIGNED_BYTE,!0,28,24),this.bindVertexArray(null),this.centerAtLastUpdate=o.vec2.fromValues(this.view.state.center[0],this.view.state.center[1])},detach:function(){this.watcher.remove();const t=this.context;t.deleteBuffer(this.vertexBuffer),t.deleteBuffer(this.indexBuffer),this.deleteVertexArray(this.vao),t.deleteProgram(this.program)},render:function(t){const a=t.context,s=t.state;if(this.updatePositions(t),this.indexBufferSize===0)return;o.mat3.identity(this.transform),this.screenTranslation[0]=s.pixelRatio*s.size[0]/2,this.screenTranslation[1]=s.pixelRatio*s.size[1]/2,o.mat3.translate(this.transform,this.transform,this.screenTranslation),o.mat3.rotate(this.transform,this.transform,Math.PI*s.rotation/180),this.screenScaling[0]=s.pixelRatio/s.resolution,this.screenScaling[1]=-s.pixelRatio/s.resolution,o.mat3.scale(this.transform,this.transform,this.screenScaling),o.mat3.translate(this.transform,this.transform,this.translationToCenter),o.mat3.identity(this.extrude),o.mat3.rotate(this.extrude,this.extrude,Math.PI*s.rotation/180);const l=8;o.mat3.scale(this.extrude,this.extrude,[l,-l,1]),this.display[0]=2/(s.pixelRatio*s.size[0]),this.display[4]=-2/(s.pixelRatio*s.size[1]),a.useProgram(this.program),a.uniformMatrix3fv(this.uTransform,!1,this.transform),a.uniformMatrix3fv(this.uExtrude,!1,this.extrude),a.uniformMatrix3fv(this.uDisplay,!1,this.display),a.uniform1f(this.uCurrentTime,performance.now()/1e3),this.bindVertexArray(this.vao),a.enable(a.BLEND),a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.drawElements(a.TRIANGLES,this.indexBufferSize,a.UNSIGNED_SHORT,0),this.requestRender()},updatePositions:function(t){const a=t.context,s=t.stationary,l=t.state;if(!s){o.vec2.sub(this.translationToCenter,this.centerAtLastUpdate,l.center),this.requestRender();return}if(!this.needsUpdate&&this.translationToCenter[0]===0&&this.translationToCenter[1]===0)return;this.centerAtLastUpdate.set(l.center),this.translationToCenter[0]=0,this.translationToCenter[1]=0,this.needsUpdate=!1;const u=this.layer.graphics;let m=0,d=0;for(let p=0;p<u.items.length;++p){const _=u.items[p].geometry.paths[0];m+=_.length*2,d+=(_.length-1)*6}const A=new ArrayBuffer(7*m*4),i=new Float32Array(A),n=new Uint8Array(A),c=new Uint16Array(d);let r=0,f=0;for(let p=0;p<u.items.length;++p){const v=u.items[p],_=v.geometry.paths[0],h=v.attributes.color,e={};for(let g=0;g<_.length;++g){const b=_[g];if(e.current){e.delta=[b[0]-e.current[0],b[1]-e.current[1]];const y=Math.sqrt(e.delta[0]*e.delta[0]+e.delta[1]*e.delta[1]);e.direction=[e.delta[0]/y,e.delta[1]/y];const x=[-e.direction[1],e.direction[0]];if(e.normal){e.offset=[e.normal[0]+x[0],e.normal[1]+x[1]];const L=Math.sqrt(e.offset[0]*e.offset[0]+e.offset[1]*e.offset[1]);e.offset[0]/=L,e.offset[1]/=L;const S=e.normal[0]*e.offset[0]+e.normal[1]*e.offset[1];e.offset[0]/=S,e.offset[1]/=S}else e.offset=[x[0],x[1]];i[r*7+0]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+1]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+2]=e.offset[0],i[r*7+3]=e.offset[1],i[r*7+4]=e.distance,i[r*7+5]=1,n[4*(r*7+6)+0]=h[0],n[4*(r*7+6)+1]=h[1],n[4*(r*7+6)+2]=h[2],n[4*(r*7+6)+3]=255,i[r*7+7]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+8]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+9]=-e.offset[0],i[r*7+10]=-e.offset[1],i[r*7+11]=e.distance,i[r*7+12]=-1,n[4*(r*7+13)+0]=h[0],n[4*(r*7+13)+1]=h[1],n[4*(r*7+13)+2]=h[2],n[4*(r*7+13)+3]=255,r+=2,g>=2&&(c[f+0]=r-4,c[f+1]=r-3,c[f+2]=r-2,c[f+3]=r-3,c[f+4]=r-1,c[f+5]=r-2,f+=6),e.normal=x,e.distance+=y}else e.distance=0;e.current=b}e.offset=[e.normal[0],e.normal[1]],i[r*7+0]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+1]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+2]=e.offset[0],i[r*7+3]=e.offset[1],i[r*7+4]=e.distance,i[r*7+5]=1,n[4*(r*7+6)+0]=h[0],n[4*(r*7+6)+1]=h[1],n[4*(r*7+6)+2]=h[2],n[4*(r*7+6)+3]=255,i[r*7+7]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+8]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+9]=-e.offset[0],i[r*7+10]=-e.offset[1],i[r*7+11]=e.distance,i[r*7+12]=-1,n[4*(r*7+13)+0]=h[0],n[4*(r*7+13)+1]=h[1],n[4*(r*7+13)+2]=h[2],n[4*(r*7+13)+3]=255,r+=2,c[f+0]=r-4,c[f+1]=r-3,c[f+2]=r-2,c[f+3]=r-3,c[f+4]=r-1,c[f+5]=r-2,f+=6,e.current=null}a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,A,a.STATIC_DRAW),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,c,a.STATIC_DRAW),this.indexBufferSize=c.length}}),C=
|
|
43
|
+
}`,u=t.createShader(t.VERTEX_SHADER);t.shaderSource(u,s),t.compileShader(u);const m=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(m,l),t.compileShader(m),this.program=t.createProgram(),t.attachShader(this.program,u),t.attachShader(this.program,m),t.bindAttribLocation(this.program,this.aPosition,"a_position"),t.bindAttribLocation(this.program,this.aOffset,"a_offset"),t.bindAttribLocation(this.program,this.aDistance,"a_distance"),t.bindAttribLocation(this.program,this.aSide,"a_side"),t.bindAttribLocation(this.program,this.aColor,"a_color"),t.linkProgram(this.program),t.deleteShader(u),t.deleteShader(m),this.uTransform=t.getUniformLocation(this.program,"u_transform"),this.uExtrude=t.getUniformLocation(this.program,"u_extrude"),this.uDisplay=t.getUniformLocation(this.program,"u_display"),this.uCurrentTime=t.getUniformLocation(this.program,"u_current_time"),this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.indexBufferSize=0,t.getParameter(t.VERSION).startsWith("WebGL 2.0"))this.vao=t.createVertexArray(),this.bindVertexArray=d=>t.bindVertexArray(d),this.deleteVertexArray=d=>t.deleteVertexArray(d);else{const d=t.getExtension("OES_vertex_array_object");this.vao=d.createVertexArrayOES(),this.bindVertexArray=A=>d.bindVertexArrayOES(A),this.deleteVertexArray=A=>d.deleteVertexArrayOES(A)}this.bindVertexArray(this.vao),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.enableVertexAttribArray(this.aPosition),t.enableVertexAttribArray(this.aOffset),t.enableVertexAttribArray(this.aDistance),t.enableVertexAttribArray(this.aSide),t.enableVertexAttribArray(this.aColor),t.vertexAttribPointer(this.aPosition,2,t.FLOAT,!1,28,0),t.vertexAttribPointer(this.aOffset,2,t.FLOAT,!1,28,8),t.vertexAttribPointer(this.aDistance,1,t.FLOAT,!1,28,16),t.vertexAttribPointer(this.aSide,1,t.FLOAT,!1,28,20),t.vertexAttribPointer(this.aColor,4,t.UNSIGNED_BYTE,!0,28,24),this.bindVertexArray(null),this.centerAtLastUpdate=o.vec2.fromValues(this.view.state.center[0],this.view.state.center[1])},detach:function(){this.watcher.remove();const t=this.context;t.deleteBuffer(this.vertexBuffer),t.deleteBuffer(this.indexBuffer),this.deleteVertexArray(this.vao),t.deleteProgram(this.program)},render:function(t){const a=t.context,s=t.state;if(this.updatePositions(t),this.indexBufferSize===0)return;o.mat3.identity(this.transform),this.screenTranslation[0]=s.pixelRatio*s.size[0]/2,this.screenTranslation[1]=s.pixelRatio*s.size[1]/2,o.mat3.translate(this.transform,this.transform,this.screenTranslation),o.mat3.rotate(this.transform,this.transform,Math.PI*s.rotation/180),this.screenScaling[0]=s.pixelRatio/s.resolution,this.screenScaling[1]=-s.pixelRatio/s.resolution,o.mat3.scale(this.transform,this.transform,this.screenScaling),o.mat3.translate(this.transform,this.transform,this.translationToCenter),o.mat3.identity(this.extrude),o.mat3.rotate(this.extrude,this.extrude,Math.PI*s.rotation/180);const l=8;o.mat3.scale(this.extrude,this.extrude,[l,-l,1]),this.display[0]=2/(s.pixelRatio*s.size[0]),this.display[4]=-2/(s.pixelRatio*s.size[1]),a.useProgram(this.program),a.uniformMatrix3fv(this.uTransform,!1,this.transform),a.uniformMatrix3fv(this.uExtrude,!1,this.extrude),a.uniformMatrix3fv(this.uDisplay,!1,this.display),a.uniform1f(this.uCurrentTime,performance.now()/1e3),this.bindVertexArray(this.vao),a.enable(a.BLEND),a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.drawElements(a.TRIANGLES,this.indexBufferSize,a.UNSIGNED_SHORT,0),this.requestRender()},updatePositions:function(t){const a=t.context,s=t.stationary,l=t.state;if(!s){o.vec2.sub(this.translationToCenter,this.centerAtLastUpdate,l.center),this.requestRender();return}if(!this.needsUpdate&&this.translationToCenter[0]===0&&this.translationToCenter[1]===0)return;this.centerAtLastUpdate.set(l.center),this.translationToCenter[0]=0,this.translationToCenter[1]=0,this.needsUpdate=!1;const u=this.layer.graphics;let m=0,d=0;for(let p=0;p<u.items.length;++p){const _=u.items[p].geometry.paths[0];m+=_.length*2,d+=(_.length-1)*6}const A=new ArrayBuffer(7*m*4),i=new Float32Array(A),n=new Uint8Array(A),c=new Uint16Array(d);let r=0,f=0;for(let p=0;p<u.items.length;++p){const v=u.items[p],_=v.geometry.paths[0],h=v.attributes.color,e={};for(let g=0;g<_.length;++g){const b=_[g];if(e.current){e.delta=[b[0]-e.current[0],b[1]-e.current[1]];const y=Math.sqrt(e.delta[0]*e.delta[0]+e.delta[1]*e.delta[1]);e.direction=[e.delta[0]/y,e.delta[1]/y];const x=[-e.direction[1],e.direction[0]];if(e.normal){e.offset=[e.normal[0]+x[0],e.normal[1]+x[1]];const L=Math.sqrt(e.offset[0]*e.offset[0]+e.offset[1]*e.offset[1]);e.offset[0]/=L,e.offset[1]/=L;const S=e.normal[0]*e.offset[0]+e.normal[1]*e.offset[1];e.offset[0]/=S,e.offset[1]/=S}else e.offset=[x[0],x[1]];i[r*7+0]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+1]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+2]=e.offset[0],i[r*7+3]=e.offset[1],i[r*7+4]=e.distance,i[r*7+5]=1,n[4*(r*7+6)+0]=h[0],n[4*(r*7+6)+1]=h[1],n[4*(r*7+6)+2]=h[2],n[4*(r*7+6)+3]=255,i[r*7+7]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+8]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+9]=-e.offset[0],i[r*7+10]=-e.offset[1],i[r*7+11]=e.distance,i[r*7+12]=-1,n[4*(r*7+13)+0]=h[0],n[4*(r*7+13)+1]=h[1],n[4*(r*7+13)+2]=h[2],n[4*(r*7+13)+3]=255,r+=2,g>=2&&(c[f+0]=r-4,c[f+1]=r-3,c[f+2]=r-2,c[f+3]=r-3,c[f+4]=r-1,c[f+5]=r-2,f+=6),e.normal=x,e.distance+=y}else e.distance=0;e.current=b}e.offset=[e.normal[0],e.normal[1]],i[r*7+0]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+1]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+2]=e.offset[0],i[r*7+3]=e.offset[1],i[r*7+4]=e.distance,i[r*7+5]=1,n[4*(r*7+6)+0]=h[0],n[4*(r*7+6)+1]=h[1],n[4*(r*7+6)+2]=h[2],n[4*(r*7+6)+3]=255,i[r*7+7]=e.current[0]-this.centerAtLastUpdate[0],i[r*7+8]=e.current[1]-this.centerAtLastUpdate[1],i[r*7+9]=-e.offset[0],i[r*7+10]=-e.offset[1],i[r*7+11]=e.distance,i[r*7+12]=-1,n[4*(r*7+13)+0]=h[0],n[4*(r*7+13)+1]=h[1],n[4*(r*7+13)+2]=h[2],n[4*(r*7+13)+3]=255,r+=2,c[f+0]=r-4,c[f+1]=r-3,c[f+2]=r-2,c[f+3]=r-3,c[f+4]=r-1,c[f+5]=r-2,f+=6,e.current=null}a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,A,a.STATIC_DRAW),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,c,a.STATIC_DRAW),this.indexBufferSize=c.length}}),C=E.createSubclass({createLayerView:function(t){if(t.type==="2d")return new V({view:t,layer:this})}});exports.default=C;
|
package/lib/src/types/index.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ export interface ISetMapCenterParams {
|
|
|
49
49
|
zoom?: number;
|
|
50
50
|
duration?: number;
|
|
51
51
|
}
|
|
52
|
+
export interface ILayerVisibleParams {
|
|
53
|
+
id: string;
|
|
54
|
+
visible: boolean;
|
|
55
|
+
}
|
|
52
56
|
export interface ILookAtParams {
|
|
53
57
|
center: number[];
|
|
54
58
|
height: number;
|
|
@@ -120,7 +124,7 @@ export interface IOverlayParam {
|
|
|
120
124
|
visible?: boolean;
|
|
121
125
|
}
|
|
122
126
|
export interface ISetMapCameraParams {
|
|
123
|
-
|
|
127
|
+
name: string;
|
|
124
128
|
zoom?: number;
|
|
125
129
|
duration?: number;
|
|
126
130
|
}
|