gisviewer-vue3-arcgis 1.0.156 → 1.0.158
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/utils/holo-flow/trace-holo-flow.mjs +20 -19
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +41 -36
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +33 -9
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -2
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
class
|
|
1
|
+
import * as f from "@arcgis/core/views/3d/externalRenderers";
|
|
2
|
+
import R from "./trace-renderer-external.mjs";
|
|
3
|
+
import T from "./trace-renderer-layer.mjs";
|
|
4
|
+
class L {
|
|
5
5
|
constructor(e) {
|
|
6
|
-
e.type === "3d" ? (this.traceRenderer = new
|
|
6
|
+
e.type === "3d" ? (this.traceRenderer = new R(e), f.add(
|
|
7
7
|
e,
|
|
8
8
|
this.traceRenderer
|
|
9
|
-
)) : this.traceRenderer = new
|
|
9
|
+
)) : this.traceRenderer = new T(e);
|
|
10
10
|
}
|
|
11
11
|
async init() {
|
|
12
12
|
await this.traceRenderer.init();
|
|
13
13
|
}
|
|
14
14
|
downloadLog() {
|
|
15
|
-
const e = this.traceRenderer.getLog().map((
|
|
16
|
-
`).replace(/null/g, ""), o = new Blob([e], { type: "text/csv;charset=utf-8;" }),
|
|
17
|
-
r.setAttribute("href",
|
|
15
|
+
const e = this.traceRenderer.getLog().map((i) => i.join(",")).join(`
|
|
16
|
+
`).replace(/null/g, ""), o = new Blob([e], { type: "text/csv;charset=utf-8;" }), s = URL.createObjectURL(o), r = document.createElement("a");
|
|
17
|
+
r.setAttribute("href", s), r.setAttribute("download", "trace-log.csv"), r.style.visibility = "hidden", document.body.appendChild(r), r.click(), document.body.removeChild(r);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* 处理全息流轨迹数据
|
|
21
21
|
* */
|
|
22
22
|
async handleVehicleTraceData(e) {
|
|
23
|
-
const { newVehList: o, updateVehList:
|
|
23
|
+
const { newVehList: o, updateVehList: s, deleteVehList: r, jgsj: i } = e, n = e.crossId || "", l = [], a = [];
|
|
24
24
|
if (o && o.length > 0) {
|
|
25
25
|
for (const c of o) {
|
|
26
|
-
c.localTimestamp || (c.localTimestamp =
|
|
26
|
+
c.localTimestamp || (c.localTimestamp = i || Date.now());
|
|
27
27
|
const t = this.buildVehicleTrackData(c, n);
|
|
28
28
|
t && l.push(t);
|
|
29
29
|
}
|
|
30
30
|
await this.traceRenderer.addVehicles(l);
|
|
31
31
|
}
|
|
32
|
-
if (
|
|
33
|
-
for (const c of
|
|
32
|
+
if (s && s.length > 0) {
|
|
33
|
+
for (const c of s) {
|
|
34
34
|
const t = this.buildVehicleTrackData(c, n);
|
|
35
35
|
t && a.push(t);
|
|
36
36
|
}
|
|
@@ -75,13 +75,13 @@ class V {
|
|
|
75
75
|
this.traceRenderer.setInterpolate(e);
|
|
76
76
|
}
|
|
77
77
|
buildVehicleTrackData(e, o) {
|
|
78
|
-
const
|
|
78
|
+
const s = e.longitude, r = e.latitude, i = e.ptcId, n = Number(e.ptcType), l = e.heading, a = Number(e.vehicleType), c = Number(e.vehicleColor), t = e.plateNo || e.plateno, h = Number(e.plateColor), d = e.timestamp, p = e.localTimestamp, u = e.roadLayer ? String(e.roadLayer) : "1", g = e.step, m = e.speed;
|
|
79
79
|
if (!(n < 0 || n > 8))
|
|
80
80
|
return {
|
|
81
|
-
ptcId:
|
|
81
|
+
ptcId: i,
|
|
82
82
|
crossId: o,
|
|
83
|
-
vehicleId: o + "-" +
|
|
84
|
-
x:
|
|
83
|
+
vehicleId: o + "-" + i,
|
|
84
|
+
x: s,
|
|
85
85
|
y: r,
|
|
86
86
|
ptcType: n,
|
|
87
87
|
vehicleType: a,
|
|
@@ -93,10 +93,11 @@ class V {
|
|
|
93
93
|
timestamp: d,
|
|
94
94
|
localTimestamp: p,
|
|
95
95
|
roadLayer: u,
|
|
96
|
-
step: g
|
|
96
|
+
step: g,
|
|
97
|
+
speed: m
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
export {
|
|
101
|
-
|
|
102
|
+
L as default
|
|
102
103
|
};
|
|
@@ -45,27 +45,28 @@ class f {
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
const t = i.map((s) => {
|
|
48
|
-
const { vehicleId:
|
|
49
|
-
this.historyPositionMap.set(
|
|
50
|
-
{ pos: [
|
|
48
|
+
const { vehicleId: r, heading: a, localTimestamp: h } = s, l = Number(s.x), n = Number(s.y);
|
|
49
|
+
this.historyPositionMap.set(r, [
|
|
50
|
+
{ pos: [l, n, 0], heading: a, time: h }
|
|
51
51
|
]);
|
|
52
|
-
const
|
|
52
|
+
const o = new c({
|
|
53
53
|
geometry: {
|
|
54
54
|
type: "point",
|
|
55
|
-
x:
|
|
56
|
-
y:
|
|
55
|
+
x: l,
|
|
56
|
+
y: n
|
|
57
57
|
},
|
|
58
58
|
attributes: {
|
|
59
|
-
...s
|
|
59
|
+
...s,
|
|
60
|
+
type: "trackVehicle"
|
|
60
61
|
},
|
|
61
62
|
symbol: this.createCIMSymbol(s)
|
|
62
63
|
});
|
|
63
|
-
return
|
|
64
|
-
graphic:
|
|
64
|
+
return o.visible = !1, this.vehicleObjectMap.set(r, {
|
|
65
|
+
graphic: o,
|
|
65
66
|
data: s,
|
|
66
67
|
waitForDelete: !1,
|
|
67
68
|
isMoving: !1
|
|
68
|
-
}),
|
|
69
|
+
}), o;
|
|
69
70
|
});
|
|
70
71
|
this.vehicleLayer.addMany(t), e();
|
|
71
72
|
});
|
|
@@ -78,11 +79,14 @@ class f {
|
|
|
78
79
|
}
|
|
79
80
|
const t = [];
|
|
80
81
|
i.forEach((s) => {
|
|
81
|
-
const { vehicleId:
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
const { vehicleId: r, heading: a, localTimestamp: h } = s, l = Number(s.x), n = Number(s.y), o = this.vehicleObjectMap.get(r);
|
|
83
|
+
o ? (o.data = s, o.graphic.attributes = {
|
|
84
|
+
...s,
|
|
85
|
+
type: "trackVehicle"
|
|
86
|
+
}, this.historyPositionMap.get(
|
|
87
|
+
r
|
|
84
88
|
).push({
|
|
85
|
-
pos: [
|
|
89
|
+
pos: [l, n, 0],
|
|
86
90
|
heading: a,
|
|
87
91
|
time: h
|
|
88
92
|
})) : t.push(s);
|
|
@@ -134,9 +138,9 @@ class f {
|
|
|
134
138
|
if (!e || !t || !t.isMoving && e.length <= 2)
|
|
135
139
|
return;
|
|
136
140
|
t.isMoving = !0, (t.graphic.getAttribute("roadLayer") || "1") === "1" ? t.graphic.visible = this.showGroundVehicle : t.graphic.visible = this.showElevatedVehicle, t.segmentStartTime || (t.segmentStartTime = Date.now(), t.segmentTotalTime = e[1].time - e[0].time);
|
|
137
|
-
const
|
|
141
|
+
const r = Date.now() - t.segmentStartTime, a = Math.min(
|
|
138
142
|
1,
|
|
139
|
-
|
|
143
|
+
r / t.segmentTotalTime
|
|
140
144
|
);
|
|
141
145
|
if (a === 1)
|
|
142
146
|
if (e.shift(), e.length === 1) {
|
|
@@ -149,12 +153,12 @@ class f {
|
|
|
149
153
|
y: e[0].pos[1]
|
|
150
154
|
};
|
|
151
155
|
else {
|
|
152
|
-
const h = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * a,
|
|
156
|
+
const h = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * a, l = e[0].pos[1] + (e[1].pos[1] - e[0].pos[1]) * a, n = e[0].heading + (e[1].heading - e[0].heading) * a;
|
|
153
157
|
t.graphic.geometry = {
|
|
154
158
|
type: "point",
|
|
155
159
|
x: h,
|
|
156
|
-
y:
|
|
157
|
-
}, t.data.heading =
|
|
160
|
+
y: l
|
|
161
|
+
}, t.data.heading = n, t.graphic.symbol = this.createCIMSymbol(t.data);
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
164
|
/**
|
|
@@ -246,8 +250,9 @@ class f {
|
|
|
246
250
|
rotation: i.heading,
|
|
247
251
|
rotateClockwise: !0,
|
|
248
252
|
textureFilter: "Picture",
|
|
249
|
-
url: `${this.mapConfig.assetsRoot}Images
|
|
250
|
-
i.vehicleColor
|
|
253
|
+
url: `${this.mapConfig.assetsRoot}Images/${this.getCarPic(
|
|
254
|
+
i.vehicleColor,
|
|
255
|
+
i.speed
|
|
251
256
|
)}`
|
|
252
257
|
}
|
|
253
258
|
]
|
|
@@ -260,53 +265,53 @@ class f {
|
|
|
260
265
|
* @param carColor
|
|
261
266
|
* @returns
|
|
262
267
|
*/
|
|
263
|
-
getCarPic(i) {
|
|
264
|
-
if (this.view.
|
|
265
|
-
return "
|
|
266
|
-
let
|
|
268
|
+
getCarPic(i, e) {
|
|
269
|
+
if (this.view.scale >= 1e3)
|
|
270
|
+
return e ? e <= 4.2 ? "point_red.png" : e <= 8.4 ? "point_yellow.png" : "point_green.png" : "point_green.png";
|
|
271
|
+
let t = "grey";
|
|
267
272
|
switch (typeof i == "string" && (i = i.toLowerCase()), i) {
|
|
268
273
|
case "a":
|
|
269
274
|
case 1:
|
|
270
|
-
|
|
275
|
+
t = "white";
|
|
271
276
|
break;
|
|
272
277
|
case "b":
|
|
273
278
|
case 2:
|
|
274
|
-
|
|
279
|
+
t = "grey";
|
|
275
280
|
break;
|
|
276
281
|
case "c":
|
|
277
282
|
case 3:
|
|
278
|
-
|
|
283
|
+
t = "yellow";
|
|
279
284
|
break;
|
|
280
285
|
case "d":
|
|
281
286
|
case 4:
|
|
282
|
-
|
|
287
|
+
t = "pink";
|
|
283
288
|
break;
|
|
284
289
|
case "e":
|
|
285
290
|
case 5:
|
|
286
|
-
|
|
291
|
+
t = "red";
|
|
287
292
|
break;
|
|
288
293
|
case "f":
|
|
289
294
|
case 10:
|
|
290
|
-
|
|
295
|
+
t = "purple";
|
|
291
296
|
break;
|
|
292
297
|
case "g":
|
|
293
298
|
case 6:
|
|
294
|
-
|
|
299
|
+
t = "green";
|
|
295
300
|
break;
|
|
296
301
|
case "h":
|
|
297
302
|
case 7:
|
|
298
|
-
|
|
303
|
+
t = "blue";
|
|
299
304
|
break;
|
|
300
305
|
case "i":
|
|
301
306
|
case 8:
|
|
302
|
-
|
|
307
|
+
t = "brown";
|
|
303
308
|
break;
|
|
304
309
|
case "j":
|
|
305
310
|
case 9:
|
|
306
|
-
|
|
311
|
+
t = "black";
|
|
307
312
|
break;
|
|
308
313
|
}
|
|
309
|
-
return
|
|
314
|
+
return "/car/" + t + ".png";
|
|
310
315
|
}
|
|
311
316
|
/**
|
|
312
317
|
* 根据号牌颜色属性获取填充色和背景色
|
|
@@ -160,7 +160,7 @@ class k {
|
|
|
160
160
|
fieldName: "subDistrictCount",
|
|
161
161
|
label: "子区数量"
|
|
162
162
|
}
|
|
163
|
-
],
|
|
163
|
+
], c = {
|
|
164
164
|
type: "signalControlArea",
|
|
165
165
|
id: e.id,
|
|
166
166
|
name: e.name,
|
|
@@ -168,7 +168,7 @@ class k {
|
|
|
168
168
|
parentName: e.parentName,
|
|
169
169
|
crossCount: e.crossCount,
|
|
170
170
|
subDistrictCount: e.subDistrictCount
|
|
171
|
-
},
|
|
171
|
+
}, h = new a({
|
|
172
172
|
geometry: {
|
|
173
173
|
type: "polygon",
|
|
174
174
|
rings: s.geometry.coordinates
|
|
@@ -181,7 +181,7 @@ class k {
|
|
|
181
181
|
width: 2
|
|
182
182
|
}
|
|
183
183
|
},
|
|
184
|
-
attributes:
|
|
184
|
+
attributes: c,
|
|
185
185
|
popupTemplate: {
|
|
186
186
|
title: `区控 ${e.name}`,
|
|
187
187
|
content: [
|
|
@@ -192,7 +192,7 @@ class k {
|
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
|
-
this.districtControllerLayer.add(
|
|
195
|
+
this.districtControllerLayer.add(h);
|
|
196
196
|
}
|
|
197
197
|
for (let t = 0; t < e.subDistricts.length; t++) {
|
|
198
198
|
const s = e.subDistricts[t];
|
|
@@ -273,7 +273,7 @@ class k {
|
|
|
273
273
|
symbol: this.getCrossGraphicSymbol(t, "marker"),
|
|
274
274
|
attributes: t,
|
|
275
275
|
popupTemplate: {
|
|
276
|
-
title: i.name
|
|
276
|
+
title: `${i.name}`,
|
|
277
277
|
content: [
|
|
278
278
|
{
|
|
279
279
|
type: "fields",
|
|
@@ -316,13 +316,13 @@ class k {
|
|
|
316
316
|
if (r.status === 200) {
|
|
317
317
|
const i = r.data.result;
|
|
318
318
|
if (i.length > 0) {
|
|
319
|
-
const t = i.map((
|
|
319
|
+
const t = i.map((h) => new g({ paths: [h] })), s = y.geodesicBuffer(
|
|
320
320
|
t,
|
|
321
321
|
5,
|
|
322
322
|
"meters"
|
|
323
323
|
), o = y.union(
|
|
324
324
|
s
|
|
325
|
-
),
|
|
325
|
+
), c = new a({
|
|
326
326
|
geometry: o,
|
|
327
327
|
symbol: {
|
|
328
328
|
type: "simple-fill",
|
|
@@ -333,13 +333,37 @@ class k {
|
|
|
333
333
|
}
|
|
334
334
|
},
|
|
335
335
|
attributes: {
|
|
336
|
+
type: "subDistrict",
|
|
336
337
|
districtId: e.parentId,
|
|
337
338
|
districtName: e.parentName,
|
|
338
339
|
subDistrictId: e.id,
|
|
339
|
-
subDistrictName: e.name
|
|
340
|
+
subDistrictName: e.name,
|
|
341
|
+
crossCount: e.crosses.length
|
|
342
|
+
},
|
|
343
|
+
popupTemplate: {
|
|
344
|
+
title: `子区 ${e.name}`,
|
|
345
|
+
content: [
|
|
346
|
+
{
|
|
347
|
+
type: "fields",
|
|
348
|
+
fieldInfos: [
|
|
349
|
+
{
|
|
350
|
+
fieldName: "districtName",
|
|
351
|
+
label: "区控名称"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
fieldName: "subDistrictName",
|
|
355
|
+
label: "子区名称"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
fieldName: "crossCount",
|
|
359
|
+
label: "路口数量"
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
}
|
|
363
|
+
]
|
|
340
364
|
}
|
|
341
365
|
});
|
|
342
|
-
this.subDistrictControllerLayer.add(
|
|
366
|
+
this.subDistrictControllerLayer.add(c);
|
|
343
367
|
}
|
|
344
368
|
}
|
|
345
369
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
`).replace(/null/g,""),r=new Blob([e],{type:"text/csv;charset=utf-8;"}),n=URL.createObjectURL(r),c=document.createElement("a");c.setAttribute("href",n),c.setAttribute("download","trace-log.csv"),c.style.visibility="hidden",document.body.appendChild(c),c.click(),document.body.removeChild(c)}async handleVehicleTraceData(e){const{newVehList:r,updateVehList:n,deleteVehList:c,jgsj:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/views/3d/externalRenderers"),y=require("./trace-renderer-external.js"),R=require("./trace-renderer-layer.js");function T(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>l[r]})}}return e.default=l,Object.freeze(e)}const v=T(b);class V{constructor(e){e.type==="3d"?(this.traceRenderer=new y.default(e),v.add(e,this.traceRenderer)):this.traceRenderer=new R.default(e)}async init(){await this.traceRenderer.init()}downloadLog(){const e=this.traceRenderer.getLog().map(i=>i.join(",")).join(`
|
|
2
|
+
`).replace(/null/g,""),r=new Blob([e],{type:"text/csv;charset=utf-8;"}),n=URL.createObjectURL(r),c=document.createElement("a");c.setAttribute("href",n),c.setAttribute("download","trace-log.csv"),c.style.visibility="hidden",document.body.appendChild(c),c.click(),document.body.removeChild(c)}async handleVehicleTraceData(e){const{newVehList:r,updateVehList:n,deleteVehList:c,jgsj:i}=e,s=e.crossId||"",a=[],d=[];if(r&&r.length>0){for(const o of r){o.localTimestamp||(o.localTimestamp=i||Date.now());const t=this.buildVehicleTrackData(o,s);t&&a.push(t)}await this.traceRenderer.addVehicles(a)}if(n&&n.length>0){for(const o of n){const t=this.buildVehicleTrackData(o,s);t&&d.push(t)}await this.traceRenderer.updateVehicles(d)}if(c&&c.length>0){const o=c.map(t=>s+"-"+(t.ptcId||t.vehno||t.vehNo));this.traceRenderer.deleteVehicles(o)}}toggleTrafficInfo(e){this.traceRenderer.toggleTrafficInfo(e)}clearTrace(){this.traceRenderer.clearVehicles()}togglePause(e){this.traceRenderer.togglePause(e)}updatePanelContent(e){this.traceRenderer.updatePanelContent(e)}toggleGroundVehicle(e){this.traceRenderer.toggleGroundVehicle(e)}toggleElevatedVehicle(e){this.traceRenderer.toggleElevatedVehicle(e)}setInterpolate(e){this.traceRenderer.setInterpolate(e)}buildVehicleTrackData(e,r){const n=e.longitude,c=e.latitude,i=e.ptcId,s=Number(e.ptcType),a=e.heading,d=Number(e.vehicleType),o=Number(e.vehicleColor),t=e.plateNo||e.plateno,h=Number(e.plateColor),u=e.timestamp,p=e.localTimestamp,g=e.roadLayer?String(e.roadLayer):"1",f=e.step,m=e.speed;if(!(s<0||s>8))return{ptcId:i,crossId:r,vehicleId:r+"-"+i,x:n,y:c,ptcType:s,vehicleType:d,heading:s===2?-a:a,vehicleColor:o,showName:t&&t!==""&&t!=="0"&&t!=="000000"?t:"",plateNo:t,plateColor:h,timestamp:u,localTimestamp:p,roadLayer:g,step:f,speed:m}}}exports.default=V;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer"),g=require("../../stores/index.js");class m{constructor(i){this.appDataStore=g.default.useAppDataStore,this.logTable=[["uuid","ptcId","plateno","timestamp","localTimestamp","timestamp_str","speed","laneNo","objHeight","objLength","latitude","longitude","ptcType","vehicleType","vehicleColor","plateColor","sbdm","heading","fixAngle","roadLayer","status","step","receiveTimestamp"]],this.needInterpolate=!0,this.isPaused=!1,this.showVehiclePlate=!1,this.showGroundVehicle=!0,this.showElevatedVehicle=!0,this.historyPositionMap=new Map,this.vehicleObjectMap=new Map,this.view=i,this.mapConfig=JSON.parse(JSON.stringify(this.appDataStore.mapConfig)),this.vehicleLayer=new p({id:"vehicleLayer"}),this.view.map.add(this.vehicleLayer),this.rafSignal=requestAnimationFrame(()=>this.render())}getLog(){return this.logTable}async init(){}addVehicles(i){return new Promise(e=>{if(this.isPaused){e();return}const t=i.map(s=>{const{vehicleId:r,heading:a,localTimestamp:h}=s,l=Number(s.x),n=Number(s.y);this.historyPositionMap.set(r,[{pos:[l,n,0],heading:a,time:h}]);const o=new c({geometry:{type:"point",x:l,y:n},attributes:{...s,type:"trackVehicle"},symbol:this.createCIMSymbol(s)});return o.visible=!1,this.vehicleObjectMap.set(r,{graphic:o,data:s,waitForDelete:!1,isMoving:!1}),o});this.vehicleLayer.addMany(t),e()})}updateVehicles(i){return new Promise(e=>{if(this.isPaused){e();return}const t=[];i.forEach(s=>{const{vehicleId:r,heading:a,localTimestamp:h}=s,l=Number(s.x),n=Number(s.y),o=this.vehicleObjectMap.get(r);o?(o.data=s,o.graphic.attributes={...s,type:"trackVehicle"},this.historyPositionMap.get(r).push({pos:[l,n,0],heading:a,time:h})):t.push(s)}),this.addVehicles(t),e()})}deleteVehicles(i){this.isPaused||i.forEach(e=>{const t=this.vehicleObjectMap.get(e);t&&(t.waitForDelete=!0)})}clearVehicles(){this.vehicleLayer.removeAll(),this.vehicleObjectMap.clear(),this.historyPositionMap.clear()}toggleGroundVehicle(i){this.showGroundVehicle=i}toggleElevatedVehicle(i){this.showElevatedVehicle=i}toggleTrafficInfo(i){i.name==="vehiclePlate"&&(this.showVehiclePlate=i.visible)}togglePause(i){this.isPaused=i,this.isPaused?cancelAnimationFrame(this.rafSignal):this.rafSignal=requestAnimationFrame(()=>this.render())}updatePanelContent(i){console.log(i)}setInterpolate(i){this.needInterpolate=i}render(){this.isPaused||this.vehicleObjectMap.forEach((i,e)=>{this.updatePosition(e)}),this.rafSignal=requestAnimationFrame(()=>this.render())}updatePosition(i){const e=this.historyPositionMap.get(i),t=this.vehicleObjectMap.get(i);if(!e||!t||!t.isMoving&&e.length<=2)return;t.isMoving=!0,(t.graphic.getAttribute("roadLayer")||"1")==="1"?t.graphic.visible=this.showGroundVehicle:t.graphic.visible=this.showElevatedVehicle,t.segmentStartTime||(t.segmentStartTime=Date.now(),t.segmentTotalTime=e[1].time-e[0].time);const r=Date.now()-t.segmentStartTime,a=Math.min(1,r/t.segmentTotalTime);if(a===1)if(e.shift(),e.length===1){t.waitForDelete?(this.vehicleLayer.remove(t.graphic),this.vehicleObjectMap.delete(i),this.historyPositionMap.delete(i)):(t.segmentStartTime=void 0,t.segmentTotalTime=void 0,t.graphic.visible=!1,t.isMoving=!1);return}else t.segmentStartTime=Date.now(),t.segmentTotalTime=e[1].time-e[0].time,(e[1].heading>=270&&e[0].heading<=90||e[1].heading<=90&&e[0].heading>=270)&&(e[1].heading>e[0].heading?e[0].heading+=360:e[1].heading+=360),t.graphic.geometry={type:"point",x:e[0].pos[0],y:e[0].pos[1]};else{const h=e[0].pos[0]+(e[1].pos[0]-e[0].pos[0])*a,l=e[0].pos[1]+(e[1].pos[1]-e[0].pos[1])*a,n=e[0].heading+(e[1].heading-e[0].heading)*a;t.graphic.geometry={type:"point",x:h,y:l},t.data.heading=n,t.graphic.symbol=this.createCIMSymbol(t.data)}}createCIMSymbol(i){const e=this.getPlateFontColor(i.plateColor);return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.showName",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:this.showVehiclePlate,size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-8,ymin:-8,xmax:8,ymax:8},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:4,horizontalAlignment:"Center",offsetX:0,offsetY:8,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:e.backgroundColor}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:e.fillColor}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:30,rotation:i.heading,rotateClockwise:!0,textureFilter:"Picture",url:`${this.mapConfig.assetsRoot}Images/${this.getCarPic(i.vehicleColor,i.speed)}`}]}}}}getCarPic(i,e){if(this.view.scale>=1e3)return e?e<=4.2?"point_red.png":e<=8.4?"point_yellow.png":"point_green.png":"point_green.png";let t="grey";switch(typeof i=="string"&&(i=i.toLowerCase()),i){case"a":case 1:t="white";break;case"b":case 2:t="grey";break;case"c":case 3:t="yellow";break;case"d":case 4:t="pink";break;case"e":case 5:t="red";break;case"f":case 10:t="purple";break;case"g":case 6:t="green";break;case"h":case 7:t="blue";break;case"i":case 8:t="brown";break;case"j":case 9:t="black";break}return"/car/"+t+".png"}getPlateFontColor(i){let e=[255,255,255,255],t=[169,169,169,255];switch(i){case 0:e=[0,0,0,255],t=[255,255,255,255];break;case 1:e=[0,0,0,255],t=[244,164,96,255];break;case 2:e=[255,255,255,255],t=[65,105,225,255];break;case 3:e=[255,255,255,255],t=[0,0,0,255];break;case 15:e=[244,164,96,255],t=[0,250,154,255];break;case 16:e=[0,0,0,255],t=[0,250,154,255];break}return{fillColor:e,backgroundColor:t}}}exports.default=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/core/reactiveUtils.js"),b=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/geometryEngine.js"),l=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer"),v=require("@turf/buffer"),S=require("@turf/concave"),L=require("@turf/helpers"),w=require("axios"),I=require("../../stores/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/core/reactiveUtils.js"),b=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/geometryEngine.js"),l=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer"),v=require("@turf/buffer"),S=require("@turf/concave"),L=require("@turf/helpers"),w=require("axios"),I=require("../../stores/index.js"),d=require("../common-utils.js"),A=require("./district-controller.js");function y(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const i in a)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(a,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:()=>a[i]})}}return e.default=a,Object.freeze(e)}const D=y(f),m=y(C),c=y(L);class N{constructor(e){this.districtControllers=[],this.crossScale=5e3,this.loadedSubDistricts=[],this.view=e;const r=I.default.useAppDataStore.mapConfig;this.openDriveServerUrl=r.openDriveServer.url,this.districtControllerLayer=new n({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new n({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new n({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new n({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}async showSignalControlArea(e){console.time("showSignalControlArea"),this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const i of e){const r=new A.default(i);this.showDistrict(r),this.districtControllers.push(r)}this.watchHandle=D.watch(()=>this.view.scale,(i,r)=>{i>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(t=>{t.symbol=this.getCrossGraphicSymbol(t.attributes,"marker")}),this.highlightLayer.graphics.forEach(t=>{t.getAttribute("type")==="cross"&&(t.symbol=this.getCrossGraphicSymbol(t.attributes,"marker"))})):i<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(t=>{t.symbol=this.getCrossGraphicSymbol(t.attributes,"picture")}),this.highlightLayer.graphics.forEach(t=>{t.getAttribute("type")==="cross"&&(t.symbol=this.getCrossGraphicSymbol(t.attributes,"picture"))}))});for(const i of this.districtControllers)for(const r of i.subDistricts)await this.showSubDistrictRoad(r);return console.timeEnd("showSignalControlArea"),{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.watchHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const i=this.findAreaGraphic(e.id);return i?(i[0].attributes.type==="cross"?await this.view.goTo({target:i,scale:1500}):await this.view.goTo(i),{status:0,message:"ok"}):{status:1,message:"未找到"}}showPopup(e){const i=e.geometry.type==="point"?e.geometry:e.geometry.centroid;this.view.openPopup({features:[e],location:i})}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;for(const s of this.districtControllers)for(const o of s.subDistricts)(o.id===e.id||o.parentId===e.id)&&await this.showSubDistrictRoad(o);const i=this.districtControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id).toArray().map(s=>s.clone()),r=this.subDistrictControllerLayer.graphics.filter(s=>s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone()),t=this.crossLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone());return i.length>0&&this.highlightLayer.addMany(i),r.length>0&&this.highlightLayer.addMany(r),t.length>0&&this.highlightLayer.addMany(t),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(i.length>0?await this.view.goTo(i):r.length>0?await this.view.goTo({target:r,scale:this.crossScale-500}):t.length>1?await this.view.goTo(t):await this.view.goTo({target:t[0].geometry,scale:1500}),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let i=this.districtControllerLayer.graphics.filter(r=>r.attributes.id===e);if(i||(i=this.subDistrictControllerLayer.graphics.filter(r=>r.attributes.getAttribute("subDistrictId")===e)),i||(i=this.crossLayer.graphics.filter(r=>r.attributes.id===e)),i.length!==0)return i.toArray()}showDistrict(e){const i=e.getAllCrossCoordinates();if(i.length>=2){let t=null;if(i.length===2)t=c.lineString(i);else if(i.length>2){const p=c.featureCollection(i.map(g=>c.point(g)));t=S(p)}t||(t=c.lineString(i));const s=v(t.geometry,200,{units:"meters"}),o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}],h={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},u=new l({geometry:{type:"polygon",rings:s.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.1],outline:{color:e.areaColor,width:2}},attributes:h,popupTemplate:{title:`区控 ${e.name}`,content:[{type:"fields",fieldInfos:o}]}});this.districtControllerLayer.add(u)}for(let t=0;t<e.subDistricts.length;t++){const s=e.subDistricts[t];this.showSubDistrictCross(s)}const r=[];e.crosses=e.crosses.filter(t=>d.default.isCoordinateValid(t)),e.crosses.forEach(t=>{if(d.default.isCoordinateValid(t)){const s={type:"cross",id:t.id,name:t.name,color:e.areaColor,signalId:t.signalId,districtId:e.id,districtName:e.name,isKey:t.isKey},o=new l({geometry:{type:"point",x:t.longitude,y:t.latitude},symbol:this.getCrossGraphicSymbol(s,"marker"),attributes:s,popupTemplate:{title:t.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});r.push(o)}else console.log("路口坐标无效",t)}),this.crossLayer.addMany(r)}showSubDistrictCross(e){const i=[];e.crosses=e.crosses.filter(r=>d.default.isCoordinateValid(r)),e.crosses.forEach(r=>{const t={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:e.parentId,districtName:e.parentName,subDistrictId:e.id,subDistrictName:e.name,isKey:r.isKey},s=new l({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(t,"marker"),attributes:t,popupTemplate:{title:`${r.name}`,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});i.push(s)}),this.crossLayer.addMany(i)}async showSubDistrictRoad(e){if(e.crosses.length>1&&!this.loadedSubDistricts.includes(e.id)&&this.openDriveServerUrl&&this.openDriveServerUrl!==""){this.loadedSubDistricts.push(e.id);const i=await w.get(`http://${this.openDriveServerUrl}/api/computable/getRoadsectWithinJunctions`,{params:{junctionIds:e.crosses.map(r=>r.id).join(",")}});if(i.status===200){const r=i.data.result;if(r.length>0){const t=r.map(u=>new b.Polyline({paths:[u]})),s=m.geodesicBuffer(t,5,"meters"),o=m.union(s),h=new l({geometry:o,symbol:{type:"simple-fill",color:[...e.areaColor,.8],outline:{color:e.areaColor,width:1}},attributes:{type:"subDistrict",districtId:e.parentId,districtName:e.parentName,subDistrictId:e.id,subDistrictName:e.name,crossCount:e.crosses.length},popupTemplate:{title:`子区 ${e.name}`,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"crossCount",label:"路口数量"}]}]}});this.subDistrictControllerLayer.add(h)}}}}getCrossGraphicSymbol(e,i){const{isKey:r,color:t}=e;if(i==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:t,size:8,outline:{color:"white",width:1}};if(i==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:r?60:40,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${r?4:1}.png`,offsetY:r?22:15}]}}}}}exports.default=N;
|