gisviewer-vue3-arcgis 1.0.88 → 1.0.89
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 +9 -16
- package/es/src/gis-map/gis-map.vue.mjs +99 -107
- package/es/src/gis-map/index.d.ts +9 -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/open-drive-renderer/index.mjs +3 -2
- package/es/src/gis-map/utils/renderer/greenWaveline.mjs +7 -7
- package/lib/src/gis-map/gis-map.vue.d.ts +9 -16
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +9 -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/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/renderer/greenWaveline.js +3 -3
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -56,25 +56,18 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
56
56
|
visible: boolean;
|
|
57
57
|
}) => void;
|
|
58
58
|
toggleVehicleInfo: (contentType: string) => void;
|
|
59
|
-
addOverlays: (params: IOverlayParam) =>
|
|
60
|
-
removeOverlaysByType: (types: string[]) =>
|
|
61
|
-
removeOverlaysById: (ids: string[]) =>
|
|
62
|
-
removeAllOverlays: () =>
|
|
59
|
+
addOverlays: (params: IOverlayParam) => Promise<import("../types").IResult>;
|
|
60
|
+
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
61
|
+
removeOverlaysById: (ids: string[]) => import("../types").IResult;
|
|
62
|
+
removeAllOverlays: () => import("../types").IResult;
|
|
63
63
|
showAllOverlays: () => void;
|
|
64
64
|
updateQueueLength: (params: IQueueLengthParams[]) => void;
|
|
65
65
|
removeQueueLength: () => void;
|
|
66
66
|
showOpenDrive: (server: string, projectName: string) => Promise<void>;
|
|
67
67
|
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<{
|
|
68
|
+
props: any;
|
|
69
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
70
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
78
71
|
config: {
|
|
79
72
|
type: StringConstructor;
|
|
80
73
|
required: true;
|
|
@@ -87,5 +80,5 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
87
80
|
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
88
81
|
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
89
82
|
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
90
|
-
}, {}>;
|
|
83
|
+
}, {}, {}>;
|
|
91
84
|
export default _sfc_main;
|
|
@@ -1,124 +1,116 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as F, ref as ee, onMounted as ae, getCurrentInstance as te, computed as ne, openBlock as re, createElementBlock as oe, createElementVNode as se } from "vue";
|
|
2
|
+
import ce, { registerStore as ie } 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 le from "./utils/map-initializer.mjs";
|
|
6
|
+
import me from "./utils/open-drive-renderer/index.mjs";
|
|
7
|
+
import pe from "./utils/overlay.mjs";
|
|
8
|
+
import ue from "./utils/queue-length.mjs";
|
|
9
|
+
import v from "./utils/road-config-tool/index.mjs";
|
|
10
|
+
import de from "./utils/traffic-flow.mjs";
|
|
11
|
+
const fe = { class: "gis-viewer" }, Le = /* @__PURE__ */ F({
|
|
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
|
|
21
|
-
|
|
22
|
-
if (!
|
|
18
|
+
setup(y, { expose: h, emit: k }) {
|
|
19
|
+
const m = ee(null);
|
|
20
|
+
let r, s, n, o, a, t, i, l;
|
|
21
|
+
ie(), ae(async () => {
|
|
22
|
+
if (!m.value)
|
|
23
23
|
return;
|
|
24
|
-
const e =
|
|
25
|
-
g.assetsRoot =
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
container:
|
|
29
|
-
markerClickCallback: (
|
|
30
|
-
|
|
24
|
+
const e = te(), { $gisviewerAssetsRoot: c } = e.appContext.config.globalProperties, g = await (await fetch(C.config)).json();
|
|
25
|
+
g.assetsRoot = C.assetsRoot || c;
|
|
26
|
+
const X = ce.useAppDataStore;
|
|
27
|
+
X.mapConfig = g, s = new le(), r = await s.initialize({
|
|
28
|
+
container: m.value,
|
|
29
|
+
markerClickCallback: (u, d, f, Y) => {
|
|
30
|
+
p("markerClick", u, d, f, Y);
|
|
31
31
|
},
|
|
32
|
-
mapClickCallback: (
|
|
33
|
-
|
|
32
|
+
mapClickCallback: (u, d, f) => {
|
|
33
|
+
p("mapClick", u, d, f);
|
|
34
34
|
}
|
|
35
|
-
}), a = new
|
|
35
|
+
}), a = new w(r), p("mapLoaded");
|
|
36
36
|
});
|
|
37
|
-
const 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 = ne(() => r), T = async (e) => await s.setMapCenter(e), A = async (e) => await s.setMapCamera(e), L = async (e) => await s.lookAt(e), I = (e, c) => s.requestCoordinateTransform(e, c), D = (e) => {
|
|
38
|
+
s.cancelCoordinateTransform(e);
|
|
39
|
+
}, b = (e) => {
|
|
40
|
+
s.setMapZoomRange(e);
|
|
41
|
+
}, S = (e) => (n || (n = new v(r)), n.showLaneNumber(e)), _ = () => {
|
|
42
|
+
n == null || n.clearLaneNumber();
|
|
43
|
+
}, M = async (e) => (n || (n = new v(r)), await n.initializeSearch(e)), R = async () => n == null ? void 0 : n.calCrossIndicatorArea(), x = async () => {
|
|
44
|
+
}, B = async (e, c) => {
|
|
45
|
+
o || (o = new de(r)), o.connectTrafficFlow(e, c);
|
|
46
|
+
}, H = () => {
|
|
47
|
+
o == null || o.disconnectTrafficFlow();
|
|
48
|
+
}, V = (e) => {
|
|
49
|
+
a || (a = new w(r)), a.handleVehicleTraceData(e);
|
|
50
|
+
}, z = () => {
|
|
51
|
+
a == null || a.clearHoloTrace();
|
|
52
|
+
}, N = async (e) => {
|
|
53
|
+
a || (a = new w(r)), await a.handleSignalData(e);
|
|
54
|
+
}, Q = () => {
|
|
55
|
+
a == null || a.clearHoloSignal();
|
|
56
|
+
}, P = (e) => {
|
|
57
|
+
switch (e.name.toLowerCase()) {
|
|
58
|
+
case "vehiclePlate".toLowerCase():
|
|
59
|
+
o == null || o.toggleVehiclePlate(e.visible);
|
|
60
|
+
break;
|
|
112
61
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
62
|
+
}, E = (e) => {
|
|
63
|
+
a == null || a.updatePanelContent(e);
|
|
64
|
+
}, Z = async (e) => (t || (t = new pe(r)), await t.addOverlays(e)), j = (e) => t == null ? void 0 : t.removeOverlaysByType(e), q = (e) => t == null ? void 0 : t.removeOverlaysById(e), $ = () => t == null ? void 0 : t.removeAllOverlays(), G = () => {
|
|
65
|
+
t == null || t.showAllOverlays();
|
|
66
|
+
}, J = (e) => {
|
|
67
|
+
i || (i = new ue(r)), i.updateQueueLength(e);
|
|
68
|
+
}, K = () => {
|
|
69
|
+
i == null || i.removeQueueLength();
|
|
70
|
+
}, U = async (e, c) => {
|
|
71
|
+
l || (l = new me(r)), await l.showOpenDrive(e, c);
|
|
72
|
+
}, W = async () => {
|
|
73
|
+
await (l == null ? void 0 : l.hideOpenDrive());
|
|
74
|
+
}, C = y, p = k;
|
|
75
|
+
return h({
|
|
76
|
+
mapViewer: O,
|
|
77
|
+
setMapCenter: T,
|
|
78
|
+
lookAt: L,
|
|
79
|
+
setMapCamera: A,
|
|
80
|
+
setMapZoomRange: b,
|
|
81
|
+
requestCoordinateTransform: I,
|
|
82
|
+
cancelCoordinateTransform: D,
|
|
83
|
+
addOverlays: Z,
|
|
84
|
+
showAllOverlays: G,
|
|
85
|
+
removeOverlaysByType: j,
|
|
86
|
+
removeOverlaysById: q,
|
|
87
|
+
removeAllOverlays: $,
|
|
88
|
+
showLaneNumber: S,
|
|
89
|
+
clearLaneNumber: _,
|
|
90
|
+
initializeAreaTool: M,
|
|
91
|
+
calCrossIndicatorArea: R,
|
|
92
|
+
calRoadIndicatorArea: x,
|
|
93
|
+
connectCarFlow: B,
|
|
94
|
+
disconnectCarFlow: H,
|
|
95
|
+
handleHoloVehicleTraceData: V,
|
|
96
|
+
clearHoloTrace: z,
|
|
97
|
+
handleHoloSignalData: N,
|
|
98
|
+
clearHoloSignal: Q,
|
|
99
|
+
toggleTrafficInfo: P,
|
|
100
|
+
toggleVehicleInfo: E,
|
|
101
|
+
updateQueueLength: J,
|
|
102
|
+
removeQueueLength: K,
|
|
103
|
+
showOpenDrive: U,
|
|
104
|
+
hideOpenDrive: W
|
|
105
|
+
}), (e, c) => (re(), oe("div", fe, [
|
|
106
|
+
se("div", {
|
|
115
107
|
class: "gis-viewer-main",
|
|
116
108
|
ref_key: "mapContainer",
|
|
117
|
-
ref:
|
|
109
|
+
ref: m
|
|
118
110
|
}, null, 512)
|
|
119
111
|
]));
|
|
120
112
|
}
|
|
121
113
|
});
|
|
122
114
|
export {
|
|
123
|
-
|
|
115
|
+
Le as default
|
|
124
116
|
};
|
|
@@ -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;
|
|
@@ -46,25 +46,18 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
46
46
|
visible: boolean;
|
|
47
47
|
}) => void;
|
|
48
48
|
toggleVehicleInfo: (contentType: string) => void;
|
|
49
|
-
addOverlays: (params: import("../types").IOverlayParam) =>
|
|
50
|
-
removeOverlaysByType: (types: string[]) =>
|
|
51
|
-
removeOverlaysById: (ids: string[]) =>
|
|
52
|
-
removeAllOverlays: () =>
|
|
49
|
+
addOverlays: (params: import("../types").IOverlayParam) => Promise<import("../types").IResult>;
|
|
50
|
+
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
51
|
+
removeOverlaysById: (ids: string[]) => import("../types").IResult;
|
|
52
|
+
removeAllOverlays: () => import("../types").IResult;
|
|
53
53
|
showAllOverlays: () => void;
|
|
54
54
|
updateQueueLength: (params: import("../types").IQueueLengthParams[]) => void;
|
|
55
55
|
removeQueueLength: () => void;
|
|
56
56
|
showOpenDrive: (server: string, projectName: string) => Promise<void>;
|
|
57
57
|
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<{
|
|
58
|
+
props: any;
|
|
59
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
60
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
68
61
|
config: {
|
|
69
62
|
type: StringConstructor;
|
|
70
63
|
required: true;
|
|
@@ -77,5 +70,5 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
77
70
|
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
78
71
|
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
79
72
|
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
80
|
-
}, {}>>;
|
|
73
|
+
}, {}, {}>>;
|
|
81
74
|
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: 10,
|
|
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
|
}
|
|
@@ -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,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")
|
|
@@ -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;
|
|
@@ -56,25 +56,18 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
56
56
|
visible: boolean;
|
|
57
57
|
}) => void;
|
|
58
58
|
toggleVehicleInfo: (contentType: string) => void;
|
|
59
|
-
addOverlays: (params: IOverlayParam) =>
|
|
60
|
-
removeOverlaysByType: (types: string[]) =>
|
|
61
|
-
removeOverlaysById: (ids: string[]) =>
|
|
62
|
-
removeAllOverlays: () =>
|
|
59
|
+
addOverlays: (params: IOverlayParam) => Promise<import("../types").IResult>;
|
|
60
|
+
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
61
|
+
removeOverlaysById: (ids: string[]) => import("../types").IResult;
|
|
62
|
+
removeAllOverlays: () => import("../types").IResult;
|
|
63
63
|
showAllOverlays: () => void;
|
|
64
64
|
updateQueueLength: (params: IQueueLengthParams[]) => void;
|
|
65
65
|
removeQueueLength: () => void;
|
|
66
66
|
showOpenDrive: (server: string, projectName: string) => Promise<void>;
|
|
67
67
|
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<{
|
|
68
|
+
props: any;
|
|
69
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
70
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
78
71
|
config: {
|
|
79
72
|
type: StringConstructor;
|
|
80
73
|
required: true;
|
|
@@ -87,5 +80,5 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
87
80
|
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
88
81
|
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
89
82
|
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
90
|
-
}, {}>;
|
|
83
|
+
}, {}, {}>;
|
|
91
84
|
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"),y=require("./stores/index.js");require("./style/index.css");const v=require("./utils/holo-flow/index.js"),te=require("./utils/map-initializer.js"),ae=require("./utils/open-drive-renderer/index.js"),ne=require("./utils/overlay.js"),re=require("./utils/queue-length.js"),h=require("./utils/road-config-tool/index.js"),se=require("./utils/traffic-flow.js"),oe={class:"gis-viewer"},ce=i.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:O,emit:q}){const d=i.ref(null);let r,o,n,s,t,a,l,u;y.registerStore(),i.onMounted(async()=>{if(!d.value)return;const e=i.getCurrentInstance(),{$gisviewerAssetsRoot:c}=e.appContext.config.globalProperties,C=await(await fetch(g.config)).json();C.assetsRoot=g.assetsRoot||c;const $=y.default.useAppDataStore;$.mapConfig=C,o=new te.default,r=await o.initialize({container:d.value,markerClickCallback:(p,f,w,ee)=>{m("markerClick",p,f,w,ee)},mapClickCallback:(p,f,w)=>{m("mapClick",p,f,w)}}),t=new v.default(r),m("mapLoaded")});const A=i.computed(()=>r),L=async e=>await o.setMapCenter(e),T=async e=>await o.setMapCamera(e),b=async e=>await o.lookAt(e),_=(e,c)=>o.requestCoordinateTransform(e,c),I=e=>{o.cancelCoordinateTransform(e)},S=e=>{o.setMapZoomRange(e)},D=e=>(n||(n=new h.default(r)),n.showLaneNumber(e)),M=()=>{n==null||n.clearLaneNumber()},x=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)=>{s||(s=new se.default(r)),s.connectTrafficFlow(e,c)},V=()=>{s==null||s.disconnectTrafficFlow()},z=e=>{t||(t=new v.default(r)),t.handleVehicleTraceData(e)},N=()=>{t==null||t.clearHoloTrace()},P=async e=>{t||(t=new v.default(r)),await t.handleSignalData(e)},Q=()=>{t==null||t.clearHoloSignal()},j=e=>{switch(e.name.toLowerCase()){case"vehiclePlate".toLowerCase():s==null||s.toggleVehiclePlate(e.visible);break}},E=e=>{t==null||t.updatePanelContent(e)},Z=async e=>(a||(a=new ne.default(r)),await a.addOverlays(e)),G=e=>a==null?void 0:a.removeOverlaysByType(e),J=e=>a==null?void 0:a.removeOverlaysById(e),K=()=>a==null?void 0:a.removeAllOverlays(),U=()=>{a==null||a.showAllOverlays()},W=e=>{l||(l=new re.default(r)),l.updateQueueLength(e)},X=()=>{l==null||l.removeQueueLength()},Y=async(e,c)=>{u||(u=new ae.default(r)),await u.showOpenDrive(e,c)},F=async()=>{await(u==null?void 0:u.hideOpenDrive())},g=k,m=q;return O({mapViewer:A,setMapCenter:L,lookAt:b,setMapCamera:T,setMapZoomRange:S,requestCoordinateTransform:_,cancelCoordinateTransform:I,addOverlays:Z,showAllOverlays:U,removeOverlaysByType:G,removeOverlaysById:J,removeAllOverlays:K,showLaneNumber:D,clearLaneNumber:M,initializeAreaTool:x,calCrossIndicatorArea:B,calRoadIndicatorArea:H,connectCarFlow:R,disconnectCarFlow:V,handleHoloVehicleTraceData:z,clearHoloTrace:N,handleHoloSignalData:P,clearHoloSignal:Q,toggleTrafficInfo:j,toggleVehicleInfo:E,updateQueueLength:W,removeQueueLength:X,showOpenDrive:Y,hideOpenDrive:F}),(e,c)=>(i.openBlock(),i.createElementBlock("div",oe,[i.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:d},null,512)]))}});exports.default=ce;
|
|
@@ -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;
|
|
@@ -46,25 +46,18 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
46
46
|
visible: boolean;
|
|
47
47
|
}) => void;
|
|
48
48
|
toggleVehicleInfo: (contentType: string) => void;
|
|
49
|
-
addOverlays: (params: import("../types").IOverlayParam) =>
|
|
50
|
-
removeOverlaysByType: (types: string[]) =>
|
|
51
|
-
removeOverlaysById: (ids: string[]) =>
|
|
52
|
-
removeAllOverlays: () =>
|
|
49
|
+
addOverlays: (params: import("../types").IOverlayParam) => Promise<import("../types").IResult>;
|
|
50
|
+
removeOverlaysByType: (types: string[]) => import("../types").IResult;
|
|
51
|
+
removeOverlaysById: (ids: string[]) => import("../types").IResult;
|
|
52
|
+
removeAllOverlays: () => import("../types").IResult;
|
|
53
53
|
showAllOverlays: () => void;
|
|
54
54
|
updateQueueLength: (params: import("../types").IQueueLengthParams[]) => void;
|
|
55
55
|
removeQueueLength: () => void;
|
|
56
56
|
showOpenDrive: (server: string, projectName: string) => Promise<void>;
|
|
57
57
|
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<{
|
|
58
|
+
props: any;
|
|
59
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick", ...args: any[]) => void;
|
|
60
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick")[], "mapLoaded" | "markerClick" | "mapClick", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
68
61
|
config: {
|
|
69
62
|
type: StringConstructor;
|
|
70
63
|
required: true;
|
|
@@ -77,5 +70,5 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
77
70
|
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
78
71
|
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
79
72
|
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
80
|
-
}, {}>>;
|
|
73
|
+
}, {}, {}>>;
|
|
81
74
|
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:10,...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 +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,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;
|