gisviewer-vue3-arcgis 1.0.147 → 1.0.149
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/index.mjs +1 -1
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +45 -40
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +7 -7
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -55,7 +55,7 @@ class n {
|
|
|
55
55
|
this.traceHoloFlow.updatePanelContent(o);
|
|
56
56
|
}
|
|
57
57
|
async handleSignalData(e) {
|
|
58
|
-
this.signalHoloFlow || (this.signalHoloFlow = new a(this.view)
|
|
58
|
+
this.signalHoloFlow || (this.signalHoloFlow = new a(this.view), await this.signalHoloFlow.initializeLayer()), await this.signalHoloFlow.handleSignalData(e);
|
|
59
59
|
}
|
|
60
60
|
clearHoloSignal() {
|
|
61
61
|
var e;
|
|
@@ -5,14 +5,19 @@ import u from "../../stores/index.mjs";
|
|
|
5
5
|
class f {
|
|
6
6
|
constructor(e) {
|
|
7
7
|
this.currentPhaseMap = /* @__PURE__ */ new Map(), this.countdownCanvasMap = /* @__PURE__ */ new Map(), this.lastDataTime = 0, this.isDeletingCanvas = !1, this.canvasWidth = 80, this.canvasHeight = 40, this.view = (e.type === "2d", e);
|
|
8
|
-
const
|
|
9
|
-
this.mapConfig = JSON.parse(JSON.stringify(
|
|
8
|
+
const t = u.useAppDataStore;
|
|
9
|
+
this.mapConfig = JSON.parse(JSON.stringify(t.mapConfig));
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* 初始化相位线图层
|
|
13
13
|
* */
|
|
14
14
|
async initializeLayer() {
|
|
15
|
-
|
|
15
|
+
try {
|
|
16
|
+
await this.initializePlateBackground();
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.log("倒计时背景图片加载失败", e);
|
|
19
|
+
}
|
|
20
|
+
if (this.mapConfig.phaseLineLayer)
|
|
16
21
|
if (this.phaseLineLayer)
|
|
17
22
|
this.phaseLineLayer.visible || (this.phaseLineLayer.visible = !0);
|
|
18
23
|
else {
|
|
@@ -106,22 +111,22 @@ class f {
|
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
async initializePlateBackground() {
|
|
109
|
-
return new Promise((e,
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
this.plateBackground =
|
|
113
|
-
},
|
|
114
|
-
|
|
114
|
+
return new Promise((e, t) => {
|
|
115
|
+
const a = new Image();
|
|
116
|
+
a.src = `${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`, a.onload = () => {
|
|
117
|
+
this.plateBackground = a, e();
|
|
118
|
+
}, a.onerror = (s) => {
|
|
119
|
+
t(s);
|
|
115
120
|
};
|
|
116
121
|
});
|
|
117
122
|
}
|
|
118
123
|
async handleSignalData(e) {
|
|
119
|
-
const { crossId:
|
|
120
|
-
await this.updateCountdown(
|
|
121
|
-
|
|
124
|
+
const { crossId: t, lat: a, lon: s, rtStage: n, channelsConfig: i } = e;
|
|
125
|
+
await this.updateCountdown(t, a, s, n), !(!this.phaseLineLayer || !i) && ((!this.currentPhaseMap.has(t) || this.currentPhaseMap.get(t) !== n.stagePhase) && await this.updatePhaseLine(
|
|
126
|
+
t,
|
|
122
127
|
n.channelsConfig,
|
|
123
128
|
i
|
|
124
|
-
), this.currentPhaseMap.set(
|
|
129
|
+
), this.currentPhaseMap.set(t, n.stagePhase));
|
|
125
130
|
}
|
|
126
131
|
/**
|
|
127
132
|
* 清除实时信号相关图层
|
|
@@ -134,7 +139,7 @@ class f {
|
|
|
134
139
|
/**
|
|
135
140
|
* 获取显示倒计时的canvas
|
|
136
141
|
* */
|
|
137
|
-
async updateCountdown(e,
|
|
142
|
+
async updateCountdown(e, t, a, s) {
|
|
138
143
|
if (this.isDeletingCanvas)
|
|
139
144
|
return;
|
|
140
145
|
const n = this.countdownCanvasMap.get(e);
|
|
@@ -143,8 +148,8 @@ class f {
|
|
|
143
148
|
else
|
|
144
149
|
try {
|
|
145
150
|
const i = new c({
|
|
146
|
-
longitude:
|
|
147
|
-
latitude:
|
|
151
|
+
longitude: a,
|
|
152
|
+
latitude: t,
|
|
148
153
|
z: 10
|
|
149
154
|
}), o = this.view.toScreen(i), l = this.createCountdownCanvas();
|
|
150
155
|
if (!l)
|
|
@@ -177,19 +182,19 @@ class f {
|
|
|
177
182
|
* @param rtStage.stageAllRedTime 全红时间
|
|
178
183
|
* @param rtStage.stageYellowTime 黄灯时间
|
|
179
184
|
*/
|
|
180
|
-
drawCountdownText(e,
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
`${
|
|
185
|
+
drawCountdownText(e, t) {
|
|
186
|
+
const a = e.getContext("2d");
|
|
187
|
+
a.clearRect(0, 0, e.width, e.height), a.font = "24px Digital", a.textBaseline = "middle", a.textAlign = "center", a.fillStyle = t.stageRemainingTime <= t.stageAllRedTime ? "red" : t.stageRemainingTime <= t.stageAllRedTime + t.stageYellowTime ? "yellow" : "lime", a.fillText(
|
|
188
|
+
`${t.stageID} ${t.stageRemainingTime.toFixed(0)}`,
|
|
184
189
|
e.width / 2,
|
|
185
190
|
e.height / 2
|
|
186
191
|
);
|
|
187
192
|
}
|
|
188
|
-
drawCircle(e,
|
|
189
|
-
console.log(
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
drawCircle(e, t) {
|
|
194
|
+
console.log(t);
|
|
195
|
+
const a = e.getContext("2d");
|
|
196
|
+
a.clearRect(0, 0, e.width, e.height), this.ctxDraw(
|
|
197
|
+
a,
|
|
193
198
|
"lime",
|
|
194
199
|
e.width / 2,
|
|
195
200
|
e.height / 2,
|
|
@@ -198,16 +203,16 @@ class f {
|
|
|
198
203
|
-Math.PI / 2 + 2 * 0.6 * Math.PI
|
|
199
204
|
);
|
|
200
205
|
}
|
|
201
|
-
ctxDraw(e,
|
|
202
|
-
e.save, e.beginPath(), e.lineWidth = 4, e.strokeStyle =
|
|
206
|
+
ctxDraw(e, t, a, s, n, i, o) {
|
|
207
|
+
e.save, e.beginPath(), e.lineWidth = 4, e.strokeStyle = t, e.arc(a, s, n, i, o), e.stroke(), e.closePath(), e.font = "26px Digital", e.textBaseline = "middle", e.textAlign = "center", e.fillText("A", a, s), e.restore();
|
|
203
208
|
}
|
|
204
|
-
async updatePhaseLine(e,
|
|
209
|
+
async updatePhaseLine(e, t, a) {
|
|
205
210
|
const s = this.phaseLineLayer.source.filter(
|
|
206
211
|
(n) => n.getAttribute("id").includes(e)
|
|
207
212
|
);
|
|
208
213
|
s.forEach((n) => {
|
|
209
214
|
const i = n.getAttribute("id");
|
|
210
|
-
this.isLaneInChannels(i,
|
|
215
|
+
this.isLaneInChannels(i, t) ? n.setAttribute("color", "green") : this.isLaneInChannels(i, a) ? n.setAttribute("color", "red") : n.setAttribute("color", "green");
|
|
211
216
|
}), await this.phaseLineLayer.applyEdits({ updateFeatures: s });
|
|
212
217
|
}
|
|
213
218
|
/**
|
|
@@ -216,29 +221,29 @@ class f {
|
|
|
216
221
|
* @param channels 通道列表
|
|
217
222
|
* @returns
|
|
218
223
|
*/
|
|
219
|
-
isLaneInChannels(e,
|
|
220
|
-
const
|
|
221
|
-
for (let i = 0; i <
|
|
222
|
-
for (let o = 0; o <
|
|
223
|
-
const l =
|
|
224
|
+
isLaneInChannels(e, t) {
|
|
225
|
+
const a = e.split("+"), s = a[1], n = a[2];
|
|
226
|
+
for (let i = 0; i < t.length; i++)
|
|
227
|
+
for (let o = 0; o < t[i].laneSnList.length; o++) {
|
|
228
|
+
const l = t[i].laneSnList[o].toFixed(0);
|
|
224
229
|
if (s === l[0] && n === l[1])
|
|
225
230
|
return !0;
|
|
226
231
|
}
|
|
227
232
|
return !1;
|
|
228
233
|
}
|
|
229
234
|
createCountdownCanvas() {
|
|
230
|
-
if (!this.plateBackground)
|
|
231
|
-
return;
|
|
232
235
|
const e = document.createElement("canvas");
|
|
233
|
-
e.width = this.canvasWidth, e.height = this.canvasHeight, e.style.position = "absolute", e.style.transform = "translate(-50%, -50%)"
|
|
236
|
+
e.width = this.canvasWidth, e.height = this.canvasHeight, e.style.position = "absolute", e.style.transform = "translate(-50%, -50%)";
|
|
237
|
+
const t = e.getContext("2d");
|
|
238
|
+
this.plateBackground ? t.drawImage(
|
|
234
239
|
this.plateBackground,
|
|
235
240
|
0,
|
|
236
241
|
0,
|
|
237
242
|
this.canvasWidth,
|
|
238
243
|
this.canvasHeight
|
|
239
|
-
), this.view.container.appendChild(e);
|
|
240
|
-
const
|
|
241
|
-
return
|
|
244
|
+
) : (t.strokeStyle = "rgba(0, 255, 0, 1)", t.lineWidth = 1, t.strokeRect(0, 0, this.canvasWidth, this.canvasHeight), t.fillStyle = "rgba(0, 0, 0, 1)", t.fillRect(0, 0, this.canvasWidth, this.canvasHeight)), this.view.container.appendChild(e);
|
|
245
|
+
const a = document.createElement("canvas");
|
|
246
|
+
return a.width = this.canvasWidth - 10, a.height = this.canvasHeight - 10, a.style.position = "absolute", a.style.transform = "translate(-50%, -50%)", this.view.container.appendChild(a), [e, a];
|
|
242
247
|
}
|
|
243
248
|
}
|
|
244
249
|
export {
|
|
@@ -75,7 +75,7 @@ class x {
|
|
|
75
75
|
return t ? (t.attributes.type === "cross" ? await this.view.goTo({
|
|
76
76
|
target: t.geometry,
|
|
77
77
|
scale: 1500
|
|
78
|
-
}) : await this.view.goTo(t.geometry),
|
|
78
|
+
}) : await this.view.goTo(t.geometry), { status: 0, message: "ok" }) : { status: 1, message: "未找到" };
|
|
79
79
|
}
|
|
80
80
|
showPopup(e) {
|
|
81
81
|
const t = e.geometry.type === "point" ? e.geometry : e.geometry.centroid;
|
|
@@ -91,13 +91,13 @@ class x {
|
|
|
91
91
|
).toArray().map((i) => i.clone()), s = this.crossLayer.graphics.filter(
|
|
92
92
|
(i) => i.getAttribute("id") === e.id || i.getAttribute("districtId") === e.id || i.getAttribute("subDistrictId") === e.id
|
|
93
93
|
).toArray().map((i) => i.clone());
|
|
94
|
-
return t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 &&
|
|
94
|
+
return t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 && this.highlightLayer.addMany(r), s.length > 0 && this.highlightLayer.addMany(s), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (t.length > 0 ? await this.view.goTo(t) : r.length > 0 ? await this.view.goTo(r) : s.length > 1 ? await this.view.goTo(s) : await this.view.goTo({
|
|
95
95
|
target: s[0].geometry,
|
|
96
96
|
scale: 1500
|
|
97
|
-
}),
|
|
97
|
+
}), { status: 0, message: "ok" });
|
|
98
98
|
}
|
|
99
99
|
resetHighlight() {
|
|
100
|
-
return this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0, this.crossLayer.visible = !0, { status: 0, message: "ok" };
|
|
100
|
+
return this.highlightLayer.removeAll(), this.view.closePopup(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0, this.crossLayer.visible = !0, { status: 0, message: "ok" };
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* 在区控\子区\路口图层中查找对应的graphic
|
|
@@ -126,7 +126,7 @@ class x {
|
|
|
126
126
|
i = h.lineString(r);
|
|
127
127
|
else if (r.length > 2) {
|
|
128
128
|
const n = h.featureCollection(
|
|
129
|
-
r.map((
|
|
129
|
+
r.map((p) => h.point(p))
|
|
130
130
|
);
|
|
131
131
|
t ? i = m(n) : (i = b(n, { maxEdge: 400, units: "meters" }), i || (i = m(n)));
|
|
132
132
|
}
|
|
@@ -166,7 +166,7 @@ class x {
|
|
|
166
166
|
label: "路口数量"
|
|
167
167
|
}
|
|
168
168
|
];
|
|
169
|
-
const
|
|
169
|
+
const u = {
|
|
170
170
|
type: "signalControlArea",
|
|
171
171
|
id: e.id,
|
|
172
172
|
name: e.name,
|
|
@@ -188,7 +188,7 @@ class x {
|
|
|
188
188
|
style: t ? "solid" : "long-dash"
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
|
-
attributes:
|
|
191
|
+
attributes: u,
|
|
192
192
|
popupTemplate: {
|
|
193
193
|
title: `${t ? "区控" : "子区"} ${e.name}`,
|
|
194
194
|
content: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../types/index.js"),a=require("./signal-holo-flow.js"),o=require("./trace-holo-flow.js");class i{constructor(e){this.view=e}async init(){this.traceHoloFlow=new o.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let l=t.EVehiclePlateState.None;switch(e){case"none":l=t.EVehiclePlateState.None;break;case"plateNumber":l=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":l=t.EVehiclePlateState.Id;break;case"mix":l=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(l)}async handleSignalData(e){this.signalHoloFlow||(this.signalHoloFlow=new a.default(this.view)
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../types/index.js"),a=require("./signal-holo-flow.js"),o=require("./trace-holo-flow.js");class i{constructor(e){this.view=e}async init(){this.traceHoloFlow=new o.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let l=t.EVehiclePlateState.None;switch(e){case"none":l=t.EVehiclePlateState.None;break;case"plateNumber":l=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":l=t.EVehiclePlateState.Id;break;case"mix":l=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(l)}async handleSignalData(e){this.signalHoloFlow||(this.signalHoloFlow=new a.default(this.view),await this.signalHoloFlow.initializeLayer()),await this.signalHoloFlow.handleSignalData(e)}clearHoloSignal(){var e;(e=this.signalHoloFlow)==null||e.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=i;
|
|
@@ -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(
|
|
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(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const w=y(d);class f{constructor(e){this.currentPhaseMap=new Map,this.countdownCanvasMap=new Map,this.lastDataTime=0,this.isDeletingCanvas=!1,this.canvasWidth=80,this.canvasHeight=40,this.view=(e.type==="2d",e);const t=g.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig))}async initializeLayer(){try{await this.initializePlateBackground()}catch(e){console.log("倒计时背景图片加载失败",e)}if(this.mapConfig.phaseLineLayer)if(this.phaseLineLayer)this.phaseLineLayer.visible||(this.phaseLineLayer.visible=!0);else{const e=`${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`,s=(await(await fetch(e)).json()).features.map((n,i)=>({geometry:{type:"polyline",paths:[n.geometry.coordinates]},attributes:{ObjectID:i+1,id:n.properties.id,color:"hide"}}));this.phaseLineLayer=new p({source:s,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 initializePlateBackground(){return new Promise((e,t)=>{const a=new Image;a.src=`${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`,a.onload=()=>{this.plateBackground=a,e()},a.onerror=s=>{t(s)}})}async handleSignalData(e){const{crossId:t,lat:a,lon:s,rtStage:n,channelsConfig:i}=e;await this.updateCountdown(t,a,s,n),!(!this.phaseLineLayer||!i)&&((!this.currentPhaseMap.has(t)||this.currentPhaseMap.get(t)!==n.stagePhase)&&await this.updatePhaseLine(t,n.channelsConfig,i),this.currentPhaseMap.set(t,n.stagePhase))}clearSignal(){this.phaseLineLayer&&(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,s){if(this.isDeletingCanvas)return;const n=this.countdownCanvasMap.get(e);if(n)this.drawCountdownText(n.countdownCanvas,s);else try{const i=new u.Point({longitude:a,latitude:t,z:10}),o=this.view.toScreen(i),r=this.createCountdownCanvas();if(!r)return;const c=r[0],h=r[1];c.style.left=o.x+"px",c.style.top=o.y+"px",h.style.left=o.x+"px",h.style.top=o.y+"px",this.countdownCanvasMap.set(e,{backgroundCanvas:c,countdownCanvas:h,mapPoint:i}),this.drawCountdownText(h,s)}catch(i){console.log("倒计时canvas创建失败",e,i)}this.countdownWatchHandel||(this.countdownWatchHandel=w.watch(()=>this.view.extent,()=>{this.countdownCanvasMap.forEach(i=>{const o=this.view.toScreen(i.mapPoint);i.backgroundCanvas.style.left=o.x+"px",i.backgroundCanvas.style.top=o.y+"px",i.countdownCanvas.style.left=o.x+"px",i.countdownCanvas.style.top=o.y+"px"})}))}drawCountdownText(e,t){const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),a.font="24px Digital",a.textBaseline="middle",a.textAlign="center",a.fillStyle=t.stageRemainingTime<=t.stageAllRedTime?"red":t.stageRemainingTime<=t.stageAllRedTime+t.stageYellowTime?"yellow":"lime",a.fillText(`${t.stageID} ${t.stageRemainingTime.toFixed(0)}`,e.width/2,e.height/2)}drawCircle(e,t){console.log(t);const a=e.getContext("2d");a.clearRect(0,0,e.width,e.height),this.ctxDraw(a,"lime",e.width/2,e.height/2,20,-Math.PI/2,-Math.PI/2+2*.6*Math.PI)}ctxDraw(e,t,a,s,n,i,o){e.save,e.beginPath(),e.lineWidth=4,e.strokeStyle=t,e.arc(a,s,n,i,o),e.stroke(),e.closePath(),e.font="26px Digital",e.textBaseline="middle",e.textAlign="center",e.fillText("A",a,s),e.restore()}async updatePhaseLine(e,t,a){const s=this.phaseLineLayer.source.filter(n=>n.getAttribute("id").includes(e));s.forEach(n=>{const i=n.getAttribute("id");this.isLaneInChannels(i,t)?n.setAttribute("color","green"):this.isLaneInChannels(i,a)?n.setAttribute("color","red"):n.setAttribute("color","green")}),await this.phaseLineLayer.applyEdits({updateFeatures:s})}isLaneInChannels(e,t){const a=e.split("+"),s=a[1],n=a[2];for(let i=0;i<t.length;i++)for(let o=0;o<t[i].laneSnList.length;o++){const r=t[i].laneSnList[o].toFixed(0);if(s===r[0]&&n===r[1])return!0}return!1}createCountdownCanvas(){const e=document.createElement("canvas");e.width=this.canvasWidth,e.height=this.canvasHeight,e.style.position="absolute",e.style.transform="translate(-50%, -50%)";const t=e.getContext("2d");this.plateBackground?t.drawImage(this.plateBackground,0,0,this.canvasWidth,this.canvasHeight):(t.strokeStyle="rgba(0, 255, 0, 1)",t.lineWidth=1,t.strokeRect(0,0,this.canvasWidth,this.canvasHeight),t.fillStyle="rgba(0, 0, 0, 1)",t.fillRect(0,0,this.canvasWidth,this.canvasHeight)),this.view.container.appendChild(e);const a=document.createElement("canvas");return a.width=this.canvasWidth-10,a.height=this.canvasHeight-10,a.style.position="absolute",a.style.transform="translate(-50%, -50%)",this.view.container.appendChild(a),[e,a]}}exports.default=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),L=require("@turf/concave"),m=require("@turf/convex"),v=require("@turf/helpers"),C=require("./district-controller.js");function
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),f=require("@turf/buffer"),L=require("@turf/concave"),m=require("@turf/convex"),v=require("@turf/helpers"),C=require("./district-controller.js");function g(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=g(b),c=g(v);class A{constructor(e){this.crossScale=3e3,this.view=e,this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!0},this.districtControllerLayer=new l({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new l({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new l({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new l({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}showSignalControlArea(e){this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const t of e){const r=new C.default(t);this.drawArea(r,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,r)=>{t>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"marker"))})):t<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(s=>{s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture")}),this.highlightLayer.graphics.forEach(s=>{s.getAttribute("type")==="cross"&&(s.symbol=this.getCrossGraphicSymbol(s.attributes,"picture"))}))}),{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 t=this.findAreaGraphic(e.id);return t?(t.attributes.type==="cross"?await this.view.goTo({target:t.geometry,scale:1500}):await this.view.goTo(t.geometry),{status:0,message:"ok"}):{status:1,message:"未找到"}}showPopup(e){const t=e.geometry.type==="point"?e.geometry:e.geometry.centroid;this.view.openPopup({features:[e],location:t})}async highlightSignalControlArea(e){this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;const t=this.districtControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id).toArray().map(i=>i.clone()),r=this.subDistrictControllerLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("parentId")===e.id).toArray().map(i=>i.clone()),s=this.crossLayer.graphics.filter(i=>i.getAttribute("id")===e.id||i.getAttribute("districtId")===e.id||i.getAttribute("subDistrictId")===e.id).toArray().map(i=>i.clone());return t.length>0&&this.highlightLayer.addMany(t),r.length>0&&this.highlightLayer.addMany(r),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(t.length>0?await this.view.goTo(t):r.length>0?await this.view.goTo(r):s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[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 t=this.districtControllerLayer.graphics.find(r=>r.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(r=>r.attributes.id===e)),t||(t=this.crossLayer.graphics.find(r=>r.attributes.id===e)),t}drawArea(e,t){const r=e.getAllCrossCoordinates();if(r.length>=2){let i=null;if(r.length===2)i=c.lineString(r);else if(r.length>2){const h=c.featureCollection(r.map(d=>c.point(d)));t?i=m(h):(i=L(h,{maxEdge:400,units:"meters"}),i||(i=m(h)))}if(!i){console.log("生成区控面失败",e);return}const o=f(i.geometry,t?200:30,{units:"meters"});let n;t?n=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:n=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const p={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},u=new y({geometry:{type:"polygon",rings:o.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,t?.6:.8],outline:{color:e.areaColor,width:2,style:t?"solid":"long-dash"}},attributes:p,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:n}]}});t?this.districtControllerLayer.add(u):this.subDistrictControllerLayer.add(u)}for(const i of e.subDistricts)this.drawArea(i,!1);const s=e.crosses.map(i=>{const o={type:"cross",id:i.id,name:i.name,color:e.areaColor,signalId:i.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:i.isKey};return new y({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossGraphicSymbol(o,"marker"),attributes:o,popupTemplate:{title:i.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}})});this.crossLayer.addMany(s)}getCrossGraphicSymbol(e,t){const{isKey:r,color:s}=e;if(t==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:s,size:8,outline:{color:"white",width:1}};if(t==="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?30:22,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`}]}}}}}exports.default=A;
|