gisviewer-vue3-arcgis 1.0.215 → 1.0.217

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.
@@ -48,11 +48,11 @@ class v {
48
48
  return;
49
49
  }
50
50
  const e = i.map((s) => {
51
- const { vehicleId: o, heading: r, localTimestamp: h } = s, l = Number(s.x), n = Number(s.y), a = new p({
51
+ const { vehicleId: r, heading: o, localTimestamp: l } = s, n = Number(s.x), h = Number(s.y), a = new p({
52
52
  geometry: {
53
53
  type: "point",
54
- x: l,
55
- y: n
54
+ x: n,
55
+ y: h
56
56
  },
57
57
  attributes: {
58
58
  ...s,
@@ -60,9 +60,9 @@ class v {
60
60
  },
61
61
  symbol: this.hasGpu ? this.createCIMSymbol(s) : this.createMarkerSymbol()
62
62
  });
63
- return this.hasGpu && (a.visible = !1, this.historyPositionMap.set(o, [
64
- { pos: [l, n, 0], heading: r, time: h }
65
- ]), this.vehicleObjectMap.set(o, {
63
+ return this.hasGpu && (a.visible = !1, this.historyPositionMap.set(r, [
64
+ { pos: [n, h, 0], heading: o, time: l }
65
+ ]), this.vehicleObjectMap.set(r, {
66
66
  graphic: a,
67
67
  data: s,
68
68
  waitForDelete: !1,
@@ -80,18 +80,18 @@ class v {
80
80
  }
81
81
  const e = [];
82
82
  i.forEach((s) => {
83
- const { vehicleId: o, heading: r, localTimestamp: h } = s, l = Number(s.x), n = Number(s.y);
83
+ const { vehicleId: r, heading: o, localTimestamp: l } = s, n = Number(s.x), h = Number(s.y);
84
84
  if (this.hasGpu) {
85
- const a = this.vehicleObjectMap.get(o);
85
+ const a = this.vehicleObjectMap.get(r);
86
86
  a ? (a.data = s, a.graphic.attributes = {
87
87
  ...s,
88
88
  type: "trackVehicle"
89
89
  }, this.historyPositionMap.get(
90
- o
90
+ r
91
91
  ).push({
92
- pos: [l, n, 0],
93
- heading: r,
94
- time: h
92
+ pos: [n, h, 0],
93
+ heading: o,
94
+ time: l
95
95
  })) : e.push(s);
96
96
  } else {
97
97
  const a = this.vehicleLayer.graphics.find(
@@ -99,8 +99,8 @@ class v {
99
99
  );
100
100
  a ? a.geometry = {
101
101
  type: "point",
102
- x: l,
103
- y: n
102
+ x: n,
103
+ y: h
104
104
  } : e.push(s);
105
105
  }
106
106
  }), this.addVehicles(e), t();
@@ -156,27 +156,30 @@ class v {
156
156
  if (!t || !e || !e.isMoving && t.length <= 2)
157
157
  return;
158
158
  e.isMoving = !0, (e.graphic.getAttribute("roadLayer") || "1") === "1" ? e.graphic.visible = this.showGroundVehicle : e.graphic.visible = this.showElevatedVehicle, e.segmentStartTime || (e.segmentStartTime = Date.now(), e.segmentTotalTime = t[1].time - t[0].time);
159
- const o = Date.now() - e.segmentStartTime, r = Math.min(
159
+ const r = Date.now() - e.segmentStartTime, o = Math.min(
160
160
  1,
161
- o / e.segmentTotalTime
161
+ r / e.segmentTotalTime
162
162
  );
163
- if (r === 1)
163
+ if (o === 1)
164
164
  if (t.shift(), t.length === 1) {
165
165
  e.waitForDelete ? (this.vehicleLayer.remove(e.graphic), this.vehicleObjectMap.delete(i), this.historyPositionMap.delete(i)) : (e.segmentStartTime = void 0, e.segmentTotalTime = void 0, e.graphic.visible = !1, e.isMoving = !1);
166
166
  return;
167
- } else
168
- e.segmentStartTime = Date.now(), e.segmentTotalTime = t[1].time - t[0].time, Math.abs(t[1].heading - t[0].heading) > 180 && (t[1].heading > t[0].heading ? t[0].heading += 360 : t[1].heading += 360), e.graphic.geometry = {
167
+ } else {
168
+ e.segmentStartTime = Date.now();
169
+ const l = r - e.segmentTotalTime;
170
+ e.segmentTotalTime = t[1].time - t[0].time - l, Math.abs(t[1].heading - t[0].heading) > 180 && (t[1].heading > t[0].heading ? t[0].heading += 360 : t[1].heading += 360), e.graphic.geometry = {
169
171
  type: "point",
170
172
  x: t[0].pos[0],
171
173
  y: t[0].pos[1]
172
174
  };
175
+ }
173
176
  else {
174
- const h = t[0].pos[0] + (t[1].pos[0] - t[0].pos[0]) * r, l = t[0].pos[1] + (t[1].pos[1] - t[0].pos[1]) * r, n = t[0].heading + (t[1].heading - t[0].heading) * r;
177
+ const l = t[0].pos[0] + (t[1].pos[0] - t[0].pos[0]) * o, n = t[0].pos[1] + (t[1].pos[1] - t[0].pos[1]) * o, h = t[0].heading + (t[1].heading - t[0].heading) * o;
175
178
  e.graphic.geometry = {
176
179
  type: "point",
177
- x: h,
178
- y: l
179
- }, e.data.heading = n, e.graphic.symbol = this.hasGpu ? this.createCIMSymbol(e.data) : this.createMarkerSymbol();
180
+ x: l,
181
+ y: n
182
+ }, e.data.heading = h, e.graphic.symbol = this.hasGpu ? this.createCIMSymbol(e.data) : this.createMarkerSymbol();
180
183
  }
181
184
  }
182
185
  /**
@@ -6,7 +6,7 @@ import f from "@turf/convex";
6
6
  import * as d from "@turf/helpers";
7
7
  import L from "concaveman";
8
8
  import b from "./district-controller.mjs";
9
- import { districtDashLineLayerOptions as C, districtSolidLineLayerOptions as w, subDistrictLayerOptions as E, signalMarkerLayerOptions as D, signalPictureLayerOptions as k, signalClusterLayerOptions as F } from "./layer-symbol.mjs";
9
+ import { districtDashLineLayerOptions as C, districtSolidLineLayerOptions as w, subDistrictLayerOptions as E, signalMarkerLayerOptions as D, signalPictureLayerOptions as F, signalClusterLayerOptions as k } from "./layer-symbol.mjs";
10
10
  class P {
11
11
  constructor(t) {
12
12
  this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0, this.popupEnabled = !0, this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.view = t, this.hasGpu = localStorage.getItem("gpu") !== "Unknown", this.districtControllerDashLayer = new c(
@@ -18,9 +18,9 @@ class P {
18
18
  ), this.subDistrictControllerLayer.spatialReference = t.spatialReference, this.subDistrictControllerLayer.popupEnabled = this.popupEnabled, this.signalMarkerLayer = new c(
19
19
  D
20
20
  ), this.signalMarkerLayer.spatialReference = t.spatialReference, this.signalMarkerLayer.popupEnabled = this.popupEnabled, this.signalPictureLayer = new c(
21
- k
22
- ), this.signalPictureLayer.spatialReference = t.spatialReference, this.signalPictureLayer.popupEnabled = this.popupEnabled, this.signalClusterLayer = new c(
23
21
  F
22
+ ), this.signalPictureLayer.spatialReference = t.spatialReference, this.signalPictureLayer.popupEnabled = this.popupEnabled, this.signalClusterLayer = new c(
23
+ k
24
24
  ), this.signalClusterLayer.spatialReference = t.spatialReference, this.signalClusterLayer.popupEnabled = this.popupEnabled, this.view.map.addMany([
25
25
  this.districtControllerSolidLayer,
26
26
  this.districtControllerDashLayer,
@@ -28,7 +28,7 @@ class P {
28
28
  this.signalPictureLayer,
29
29
  this.signalClusterLayer,
30
30
  this.subDistrictControllerLayer
31
- ]);
31
+ ]), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
32
32
  }
33
33
  /**
34
34
  * 显示所有区控、子区、信号机
@@ -36,7 +36,7 @@ class P {
36
36
  * @returns
37
37
  */
38
38
  async showSignalControlArea(t) {
39
- await this.clearSignalControlArea(), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this)), this.districtControllerDashLayer.visible = !1, this.districtControllerSolidLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.signalMarkerLayer.visible = !1, this.signalPictureLayer.visible = !1, this.signalClusterLayer.visible = !0;
39
+ await this.clearSignalControlArea(), this.districtControllerDashLayer.visible = !1, this.districtControllerSolidLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.signalMarkerLayer.visible = !1, this.signalPictureLayer.visible = !1, this.signalClusterLayer.visible = !0;
40
40
  for (const i of t.areaList) {
41
41
  const s = new b(
42
42
  i,
@@ -63,7 +63,7 @@ class P {
63
63
  * @returns
64
64
  */
65
65
  async clearSignalControlArea() {
66
- this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0, this.view.removeHandles([this.clickHandler]), this.clickHandler = void 0;
66
+ this.districtGraphics = [], this.subDistrictGraphics = [], this.signalGraphics = [], this.districtControllerOid = 0, this.subDistrictControllerOid = 0, this.signalOid = 0;
67
67
  let t = await this.districtControllerDashLayer.queryFeatures();
68
68
  return await this.districtControllerDashLayer.applyEdits({
69
69
  deleteFeatures: t.features
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),g=require("@arcgis/core/layers/GraphicsLayer"),m=require("vue"),u=require("../../stores/index.js");class y{constructor(i){this.hasGpu=!1,this.appDataStore=u.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=m.toRaw(this.appDataStore.mapConfig),this.vehicleLayer=new g({id:"vehicleLayer"}),this.view.map.add(this.vehicleLayer);const t=localStorage.getItem("gpu");this.hasGpu=t!=="Unknown",this.hasGpu&&(this.rafSignal=requestAnimationFrame(()=>this.render()))}getLog(){return this.logTable}async init(){}addVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=i.map(s=>{const{vehicleId:o,heading:r,localTimestamp:h}=s,l=Number(s.x),n=Number(s.y),a=new p({geometry:{type:"point",x:l,y:n},attributes:{...s,type:"trackVehicle"},symbol:this.hasGpu?this.createCIMSymbol(s):this.createMarkerSymbol()});return this.hasGpu&&(a.visible=!1,this.historyPositionMap.set(o,[{pos:[l,n,0],heading:r,time:h}]),this.vehicleObjectMap.set(o,{graphic:a,data:s,waitForDelete:!1,isMoving:!1})),a});this.vehicleLayer.addMany(e),t()})}updateVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=[];i.forEach(s=>{const{vehicleId:o,heading:r,localTimestamp:h}=s,l=Number(s.x),n=Number(s.y);if(this.hasGpu){const a=this.vehicleObjectMap.get(o);a?(a.data=s,a.graphic.attributes={...s,type:"trackVehicle"},this.historyPositionMap.get(o).push({pos:[l,n,0],heading:r,time:h})):e.push(s)}else{const a=this.vehicleLayer.graphics.find(c=>c.getAttribute("vehicleId")==s.vehicleId);a?a.geometry={type:"point",x:l,y:n}:e.push(s)}}),this.addVehicles(e),t()})}deleteVehicles(i){this.isPaused||(this.hasGpu?i.forEach(t=>{const e=this.vehicleObjectMap.get(t);e&&(e.waitForDelete=!0)}):i.forEach(t=>{const e=this.vehicleLayer.graphics.find(s=>s.getAttribute("vehicleId")==t);e&&this.vehicleLayer.remove(e)}))}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&&this.rafSignal?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,t)=>{this.updatePosition(t)}),this.rafSignal=requestAnimationFrame(()=>this.render())}updatePosition(i){const t=this.historyPositionMap.get(i),e=this.vehicleObjectMap.get(i);if(!t||!e||!e.isMoving&&t.length<=2)return;e.isMoving=!0,(e.graphic.getAttribute("roadLayer")||"1")==="1"?e.graphic.visible=this.showGroundVehicle:e.graphic.visible=this.showElevatedVehicle,e.segmentStartTime||(e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time);const o=Date.now()-e.segmentStartTime,r=Math.min(1,o/e.segmentTotalTime);if(r===1)if(t.shift(),t.length===1){e.waitForDelete?(this.vehicleLayer.remove(e.graphic),this.vehicleObjectMap.delete(i),this.historyPositionMap.delete(i)):(e.segmentStartTime=void 0,e.segmentTotalTime=void 0,e.graphic.visible=!1,e.isMoving=!1);return}else e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time,Math.abs(t[1].heading-t[0].heading)>180&&(t[1].heading>t[0].heading?t[0].heading+=360:t[1].heading+=360),e.graphic.geometry={type:"point",x:t[0].pos[0],y:t[0].pos[1]};else{const h=t[0].pos[0]+(t[1].pos[0]-t[0].pos[0])*r,l=t[0].pos[1]+(t[1].pos[1]-t[0].pos[1])*r,n=t[0].heading+(t[1].heading-t[0].heading)*r;e.graphic.geometry={type:"point",x:h,y:l},e.data.heading=n,e.graphic.symbol=this.hasGpu?this.createCIMSymbol(e.data):this.createMarkerSymbol()}}createCIMSymbol(i){const t=this.getPlateFontColor(i.plateColor),e=this.getCarPic(i.vehicleColor,i.speed);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:t.backgroundColor}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.fillColor}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:e.size,rotation:i.heading,rotateClockwise:!0,textureFilter:"Picture",url:`${this.mapConfig.assetsRoot}Images/${e.pic}`}]}}}}createMarkerSymbol(){return{type:"simple-marker",color:"green",size:5,outline:{color:"white",width:1}}}getCarPic(i,t){if(this.view.scale>=1e3){let e="point_green.png";return t&&(t<=4.2?e="point_red.png":t<=8.4?e="point_yellow.png":e="point_green.png"),{pic:e,size:15}}else{let e="grey";switch(typeof i=="string"&&(i=i.toLowerCase()),i){case"a":case 1:e="white";break;case"b":case 2:e="grey";break;case"c":case 3:e="yellow";break;case"d":case 4:e="pink";break;case"e":case 5:e="red";break;case"f":case 10:e="purple";break;case"g":case 6:e="green";break;case"h":case 7:e="blue";break;case"i":case 8:e="brown";break;case"j":case 9:e="black";break}return{pic:"/car/"+e+".png",size:20}}}getPlateFontColor(i){let t=[255,255,255,255],e=[169,169,169,255];switch(i){case 0:t=[0,0,0,255],e=[255,255,255,255];break;case 1:t=[0,0,0,255],e=[244,164,96,255];break;case 2:t=[255,255,255,255],e=[65,105,225,255];break;case 3:t=[255,255,255,255],e=[0,0,0,255];break;case 15:t=[244,164,96,255],e=[0,250,154,255];break;case 16:t=[0,0,0,255],e=[0,250,154,255];break}return{fillColor:t,backgroundColor:e}}}exports.default=y;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/Graphic"),g=require("@arcgis/core/layers/GraphicsLayer"),m=require("vue"),u=require("../../stores/index.js");class y{constructor(i){this.hasGpu=!1,this.appDataStore=u.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=m.toRaw(this.appDataStore.mapConfig),this.vehicleLayer=new g({id:"vehicleLayer"}),this.view.map.add(this.vehicleLayer);const t=localStorage.getItem("gpu");this.hasGpu=t!=="Unknown",this.hasGpu&&(this.rafSignal=requestAnimationFrame(()=>this.render()))}getLog(){return this.logTable}async init(){}addVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=i.map(s=>{const{vehicleId:r,heading:o,localTimestamp:l}=s,n=Number(s.x),h=Number(s.y),a=new p({geometry:{type:"point",x:n,y:h},attributes:{...s,type:"trackVehicle"},symbol:this.hasGpu?this.createCIMSymbol(s):this.createMarkerSymbol()});return this.hasGpu&&(a.visible=!1,this.historyPositionMap.set(r,[{pos:[n,h,0],heading:o,time:l}]),this.vehicleObjectMap.set(r,{graphic:a,data:s,waitForDelete:!1,isMoving:!1})),a});this.vehicleLayer.addMany(e),t()})}updateVehicles(i){return new Promise(t=>{if(this.isPaused){t();return}const e=[];i.forEach(s=>{const{vehicleId:r,heading:o,localTimestamp:l}=s,n=Number(s.x),h=Number(s.y);if(this.hasGpu){const a=this.vehicleObjectMap.get(r);a?(a.data=s,a.graphic.attributes={...s,type:"trackVehicle"},this.historyPositionMap.get(r).push({pos:[n,h,0],heading:o,time:l})):e.push(s)}else{const a=this.vehicleLayer.graphics.find(c=>c.getAttribute("vehicleId")==s.vehicleId);a?a.geometry={type:"point",x:n,y:h}:e.push(s)}}),this.addVehicles(e),t()})}deleteVehicles(i){this.isPaused||(this.hasGpu?i.forEach(t=>{const e=this.vehicleObjectMap.get(t);e&&(e.waitForDelete=!0)}):i.forEach(t=>{const e=this.vehicleLayer.graphics.find(s=>s.getAttribute("vehicleId")==t);e&&this.vehicleLayer.remove(e)}))}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&&this.rafSignal?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,t)=>{this.updatePosition(t)}),this.rafSignal=requestAnimationFrame(()=>this.render())}updatePosition(i){const t=this.historyPositionMap.get(i),e=this.vehicleObjectMap.get(i);if(!t||!e||!e.isMoving&&t.length<=2)return;e.isMoving=!0,(e.graphic.getAttribute("roadLayer")||"1")==="1"?e.graphic.visible=this.showGroundVehicle:e.graphic.visible=this.showElevatedVehicle,e.segmentStartTime||(e.segmentStartTime=Date.now(),e.segmentTotalTime=t[1].time-t[0].time);const r=Date.now()-e.segmentStartTime,o=Math.min(1,r/e.segmentTotalTime);if(o===1)if(t.shift(),t.length===1){e.waitForDelete?(this.vehicleLayer.remove(e.graphic),this.vehicleObjectMap.delete(i),this.historyPositionMap.delete(i)):(e.segmentStartTime=void 0,e.segmentTotalTime=void 0,e.graphic.visible=!1,e.isMoving=!1);return}else{e.segmentStartTime=Date.now();const l=r-e.segmentTotalTime;e.segmentTotalTime=t[1].time-t[0].time-l,Math.abs(t[1].heading-t[0].heading)>180&&(t[1].heading>t[0].heading?t[0].heading+=360:t[1].heading+=360),e.graphic.geometry={type:"point",x:t[0].pos[0],y:t[0].pos[1]}}else{const l=t[0].pos[0]+(t[1].pos[0]-t[0].pos[0])*o,n=t[0].pos[1]+(t[1].pos[1]-t[0].pos[1])*o,h=t[0].heading+(t[1].heading-t[0].heading)*o;e.graphic.geometry={type:"point",x:l,y:n},e.data.heading=h,e.graphic.symbol=this.hasGpu?this.createCIMSymbol(e.data):this.createMarkerSymbol()}}createCIMSymbol(i){const t=this.getPlateFontColor(i.plateColor),e=this.getCarPic(i.vehicleColor,i.speed);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:t.backgroundColor}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t.fillColor}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:e.size,rotation:i.heading,rotateClockwise:!0,textureFilter:"Picture",url:`${this.mapConfig.assetsRoot}Images/${e.pic}`}]}}}}createMarkerSymbol(){return{type:"simple-marker",color:"green",size:5,outline:{color:"white",width:1}}}getCarPic(i,t){if(this.view.scale>=1e3){let e="point_green.png";return t&&(t<=4.2?e="point_red.png":t<=8.4?e="point_yellow.png":e="point_green.png"),{pic:e,size:15}}else{let e="grey";switch(typeof i=="string"&&(i=i.toLowerCase()),i){case"a":case 1:e="white";break;case"b":case 2:e="grey";break;case"c":case 3:e="yellow";break;case"d":case 4:e="pink";break;case"e":case 5:e="red";break;case"f":case 10:e="purple";break;case"g":case 6:e="green";break;case"h":case 7:e="blue";break;case"i":case 8:e="brown";break;case"j":case 9:e="black";break}return{pic:"/car/"+e+".png",size:20}}}getPlateFontColor(i){let t=[255,255,255,255],e=[169,169,169,255];switch(i){case 0:t=[0,0,0,255],e=[255,255,255,255];break;case 1:t=[0,0,0,255],e=[244,164,96,255];break;case 2:t=[255,255,255,255],e=[65,105,225,255];break;case 3:t=[255,255,255,255],e=[0,0,0,255];break;case 15:t=[244,164,96,255],e=[0,250,154,255];break;case 16:t=[0,0,0,255],e=[0,250,154,255];break}return{fillColor:t,backgroundColor:e}}}exports.default=y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/Graphic"),h=require("@arcgis/core/layers/FeatureLayer"),b=require("@turf/buffer"),C=require("@turf/convex"),w=require("@turf/helpers"),E=require("concaveman"),D=require("./district-controller.js"),y=require("./layer-symbol.js");function f(d){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const t in d)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(d,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>d[t]})}}return e.default=d,Object.freeze(e)}const k=f(L),p=f(w);class F{constructor(e){this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.popupEnabled=!0,this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown",this.districtControllerDashLayer=new h(y.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer=new h(y.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer.popupEnabled=this.popupEnabled,this.subDistrictControllerLayer=new h(y.subDistrictLayerOptions),this.subDistrictControllerLayer.spatialReference=e.spatialReference,this.subDistrictControllerLayer.popupEnabled=this.popupEnabled,this.signalMarkerLayer=new h(y.signalMarkerLayerOptions),this.signalMarkerLayer.spatialReference=e.spatialReference,this.signalMarkerLayer.popupEnabled=this.popupEnabled,this.signalPictureLayer=new h(y.signalPictureLayerOptions),this.signalPictureLayer.spatialReference=e.spatialReference,this.signalPictureLayer.popupEnabled=this.popupEnabled,this.signalClusterLayer=new h(y.signalClusterLayerOptions),this.signalClusterLayer.spatialReference=e.spatialReference,this.signalClusterLayer.popupEnabled=this.popupEnabled,this.view.map.addMany([this.districtControllerSolidLayer,this.districtControllerDashLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer,this.subDistrictControllerLayer])}async showSignalControlArea(e){await this.clearSignalControlArea(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this)),this.districtControllerDashLayer.visible=!1,this.districtControllerSolidLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.signalMarkerLayer.visible=!1,this.signalPictureLayer.visible=!1,this.signalClusterLayer.visible=!0;for(const t of e.areaList){const s=new D.default(t,e.style||"");this.generateGraphic(s,!0,e.style)}return await this.districtControllerDashLayer.applyEdits({addFeatures:this.districtGraphics}),await this.districtControllerSolidLayer.applyEdits({addFeatures:this.districtGraphics}),this.view.goTo(this.districtGraphics),this.districtGraphics=[],await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[],await this.signalMarkerLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalPictureLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalClusterLayer.applyEdits({addFeatures:this.signalGraphics}),this.signalGraphics=[],{status:0,message:"ok"}}async clearSignalControlArea(){this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.view.removeHandles([this.clickHandler]),this.clickHandler=void 0;let e=await this.districtControllerDashLayer.queryFeatures();return await this.districtControllerDashLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerDashLayer.definitionExpression="1=1",e=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerSolidLayer.definitionExpression="1=1",e=await this.subDistrictControllerLayer.queryFeatures(),await this.subDistrictControllerLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictControllerLayer.definitionExpression="1=1",e=await this.signalMarkerLayer.queryFeatures(),await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),this.signalMarkerLayer.definitionExpression="1=1",e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),this.signalPictureLayer.definitionExpression="1=1",e=await this.signalClusterLayer.queryFeatures(),await this.signalClusterLayer.applyEdits({deleteFeatures:e.features}),this.signalClusterLayer.definitionExpression="1=1",{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtControllerDashLayer.visible=e.visible,this.districtControllerSolidLayer.visible=e.visible;break;case"subDistrict":this.subDistrictControllerLayer.visible=e.visible;break;case"signal":this.signalMarkerLayer.visible=e.visible,this.signalPictureLayer.visible=e.visible;break;case"signalCluster":this.signalClusterLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":{const i=this.districtControllerDashLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.districtControllerDashLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const t=this.subDistrictControllerLayer.createQuery();t.where=`id = '${e.id}'`,t.returnGeometry=!0,t.outFields=["*"];const s=await this.subDistrictControllerLayer.queryFeatures(t);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"};case"signal":{const i=this.signalMarkerLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.signalMarkerLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo({target:r.features[0],scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){var t;switch((t=this.view.popup)!=null&&t.visible&&this.view.popup.close(),e.type){case"district":{const s=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`;const i=await this.districtControllerDashLayer.queryFeatures();return i.features.length>0?(this.districtControllerSolidLayer.definitionExpression=`id = '${e.id}'`,this.subDistrictControllerLayer.definitionExpression=`parentId = '${e.id}'`,this.signalMarkerLayer.definitionExpression=`districtId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`districtId = '${e.id}'`,this.signalClusterLayer.definitionExpression=`districtId = '${e.id}'`,await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):(this.districtControllerDashLayer.definitionExpression=s,{status:1,message:"未找到区控"})}case"subDistrict":{const s=this.subDistrictControllerLayer.definitionExpression;this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.subDistrictControllerLayer.queryFeatures();if(i.features.length>0){this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalClusterLayer.definitionExpression=`subDistrictId = '${e.id}'`;const l=i.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression=s,{status:1,message:"未找到子区"}}case"signal":{const s=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.signalMarkerLayer.queryFeatures();if(i.features.length>0){this.signalPictureLayer.definitionExpression=`id = '${e.id}'`,this.signalClusterLayer.definitionExpression=`id = '${e.id}'`;const r=i.features[0],{districtId:l,subDistrictId:o}=r.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${o}'`,await this.view.goTo({target:i.features,scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression=s,{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1",this.subDistrictControllerLayer.definitionExpression="1=1",this.signalMarkerLayer.definitionExpression="1=1",this.signalClusterLayer.definitionExpression="1=1",this.signalPictureLayer.definitionExpression="1=1";const e=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(e.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}generateGraphic(e,t,s){const i=e.getAllSignalCoordinates();let r=null;if(i.length>=2)if(i.length===2)r=p.lineString(i);else{if(t){const n=p.featureCollection(i.map(a=>p.point(a)));r=C(n)}else{const n=E(i,.5);n.length>=4&&(r=p.polygon([n]))}r||(r=p.lineString(i))}else if(i.length===1)r=p.point(i[0]);else return;const l=b(r.geometry,t?200:30,{units:"meters"}),o=new g({geometry:{type:"polyline",paths:l.geometry.coordinates},attributes:{ObjectID:t?this.districtControllerOid++:this.subDistrictControllerOid++,id:e.id,name:e.name,subDistrictCount:e.subDistrictCount,signalCount:e.signalCount,parentId:e.parentId,parentName:e.parentName,selected:s,type:t?"district":"subDistrict"}});t?this.districtGraphics.push(o):this.subDistrictGraphics.push(o);for(const n of e.subDistricts)this.generateGraphic(n,!1,s);e.signals.forEach(n=>{const a=new g({geometry:{type:"point",x:n.longitude,y:n.latitude},attributes:{ObjectID:this.signalOid++,id:n.id,name:n.name,signalId:n.signalId,nodeId:n.nodeId,isKey:n.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,type:"signal",selected:!0}});this.signalGraphics.push(a)})}async viewHitTest(e){var n;const s=(n=(await this.view.hitTest(e,{include:[this.districtControllerSolidLayer,this.subDistrictControllerLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer]})).results)==null?void 0:n.filter(a=>a.type==="graphic");if(s.length===0)return;const i=s[0].graphic;let r=null;i.geometry.type==="point"?r=i.geometry:i.geometry.type==="polyline"?r=i.geometry.extent.center:i.geometry.type==="polygon"&&(r=i.geometry.centroid),r!==null&&await this.view.goTo(r,{duration:1e3});const l=i.getAttribute("type"),o=i.getAttribute("id");switch(l){case"district":{let a=await this.districtControllerSolidLayer.queryFeatures();a.features.forEach(u=>{u.attributes.selected=u.attributes.id===o}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:a.features}),a=await this.districtControllerDashLayer.queryFeatures(),a.features.forEach(u=>{u.attributes.selected=u.attributes.id===o}),await this.districtControllerDashLayer.applyEdits({updateFeatures:a.features});break}case"subDistrict":{let a=await this.subDistrictControllerLayer.queryFeatures();a.features.forEach(c=>{c.attributes.selected=c.attributes.id===o}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:a.features}),a=await this.signalMarkerLayer.queryFeatures(),a.features.forEach(c=>{c.attributes.selected=c.attributes.subDistrictId===o});let u=await this.signalMarkerLayer.applyEdits({updateFeatures:a.features});console.log(u),a=await this.signalPictureLayer.queryFeatures(),a.features.forEach(c=>{c.attributes.selected=c.attributes.subDistrictId===o}),u=await this.signalPictureLayer.applyEdits({updateFeatures:a.features}),console.log(u);break}}k.when(()=>this.view.popup.visible===!1,async()=>{await this.resetSelectedSymbol(l)},{once:!0})}async resetSelectedSymbol(e){switch(e){case"district":{let t=await this.districtControllerSolidLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:t.features}),t=await this.districtControllerDashLayer.queryFeatures(),t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerDashLayer.applyEdits({updateFeatures:t.features});break}case"subDistrict":{let t=await this.subDistrictControllerLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalMarkerLayer.queryFeatures(),console.log("marker count",t.features.length),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalMarkerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalPictureLayer.queryFeatures(),console.log("picture count",t.features.length),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalPictureLayer.applyEdits({updateFeatures:t.features});break}}}}exports.default=F;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("@arcgis/core/core/reactiveUtils"),g=require("@arcgis/core/Graphic"),h=require("@arcgis/core/layers/FeatureLayer"),b=require("@turf/buffer"),C=require("@turf/convex"),w=require("@turf/helpers"),E=require("concaveman"),D=require("./district-controller.js"),y=require("./layer-symbol.js");function f(d){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const t in d)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(d,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>d[t]})}}return e.default=d,Object.freeze(e)}const F=f(L),p=f(w);class k{constructor(e){this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0,this.popupEnabled=!0,this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown",this.districtControllerDashLayer=new h(y.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer=new h(y.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=e.spatialReference,this.districtControllerSolidLayer.popupEnabled=this.popupEnabled,this.subDistrictControllerLayer=new h(y.subDistrictLayerOptions),this.subDistrictControllerLayer.spatialReference=e.spatialReference,this.subDistrictControllerLayer.popupEnabled=this.popupEnabled,this.signalMarkerLayer=new h(y.signalMarkerLayerOptions),this.signalMarkerLayer.spatialReference=e.spatialReference,this.signalMarkerLayer.popupEnabled=this.popupEnabled,this.signalPictureLayer=new h(y.signalPictureLayerOptions),this.signalPictureLayer.spatialReference=e.spatialReference,this.signalPictureLayer.popupEnabled=this.popupEnabled,this.signalClusterLayer=new h(y.signalClusterLayerOptions),this.signalClusterLayer.spatialReference=e.spatialReference,this.signalClusterLayer.popupEnabled=this.popupEnabled,this.view.map.addMany([this.districtControllerSolidLayer,this.districtControllerDashLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer,this.subDistrictControllerLayer]),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this))}async showSignalControlArea(e){await this.clearSignalControlArea(),this.districtControllerDashLayer.visible=!1,this.districtControllerSolidLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.signalMarkerLayer.visible=!1,this.signalPictureLayer.visible=!1,this.signalClusterLayer.visible=!0;for(const t of e.areaList){const s=new D.default(t,e.style||"");this.generateGraphic(s,!0,e.style)}return await this.districtControllerDashLayer.applyEdits({addFeatures:this.districtGraphics}),await this.districtControllerSolidLayer.applyEdits({addFeatures:this.districtGraphics}),this.view.goTo(this.districtGraphics),this.districtGraphics=[],await this.subDistrictControllerLayer.applyEdits({addFeatures:this.subDistrictGraphics}),this.subDistrictGraphics=[],await this.signalMarkerLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalPictureLayer.applyEdits({addFeatures:this.signalGraphics}),await this.signalClusterLayer.applyEdits({addFeatures:this.signalGraphics}),this.signalGraphics=[],{status:0,message:"ok"}}async clearSignalControlArea(){this.districtGraphics=[],this.subDistrictGraphics=[],this.signalGraphics=[],this.districtControllerOid=0,this.subDistrictControllerOid=0,this.signalOid=0;let e=await this.districtControllerDashLayer.queryFeatures();return await this.districtControllerDashLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerDashLayer.definitionExpression="1=1",e=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:e.features}),this.districtControllerSolidLayer.definitionExpression="1=1",e=await this.subDistrictControllerLayer.queryFeatures(),await this.subDistrictControllerLayer.applyEdits({deleteFeatures:e.features}),this.subDistrictControllerLayer.definitionExpression="1=1",e=await this.signalMarkerLayer.queryFeatures(),await this.signalMarkerLayer.applyEdits({deleteFeatures:e.features}),this.signalMarkerLayer.definitionExpression="1=1",e=await this.signalPictureLayer.queryFeatures(),await this.signalPictureLayer.applyEdits({deleteFeatures:e.features}),this.signalPictureLayer.definitionExpression="1=1",e=await this.signalClusterLayer.queryFeatures(),await this.signalClusterLayer.applyEdits({deleteFeatures:e.features}),this.signalClusterLayer.definitionExpression="1=1",{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtControllerDashLayer.visible=e.visible,this.districtControllerSolidLayer.visible=e.visible;break;case"subDistrict":this.subDistrictControllerLayer.visible=e.visible;break;case"signal":this.signalMarkerLayer.visible=e.visible,this.signalPictureLayer.visible=e.visible;break;case"signalCluster":this.signalClusterLayer.visible=e.visible;break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":{const i=this.districtControllerDashLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.districtControllerDashLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo(r.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}case"subDistrict":const t=this.subDistrictControllerLayer.createQuery();t.where=`id = '${e.id}'`,t.returnGeometry=!0,t.outFields=["*"];const s=await this.subDistrictControllerLayer.queryFeatures(t);return s.features.length>0?(await this.view.goTo(s.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到子区"};case"signal":{const i=this.signalMarkerLayer.createQuery();i.where=`id = '${e.id}'`,i.returnGeometry=!0,i.outFields=["*"];const r=await this.signalMarkerLayer.queryFeatures(i);return r.features.length>0?(await this.view.goTo({target:r.features[0],scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){var t;switch((t=this.view.popup)!=null&&t.visible&&this.view.popup.close(),e.type){case"district":{const s=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${e.id}'`;const i=await this.districtControllerDashLayer.queryFeatures();return i.features.length>0?(this.districtControllerSolidLayer.definitionExpression=`id = '${e.id}'`,this.subDistrictControllerLayer.definitionExpression=`parentId = '${e.id}'`,this.signalMarkerLayer.definitionExpression=`districtId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`districtId = '${e.id}'`,this.signalClusterLayer.definitionExpression=`districtId = '${e.id}'`,await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}):(this.districtControllerDashLayer.definitionExpression=s,{status:1,message:"未找到区控"})}case"subDistrict":{const s=this.subDistrictControllerLayer.definitionExpression;this.subDistrictControllerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.subDistrictControllerLayer.queryFeatures();if(i.features.length>0){this.signalMarkerLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalPictureLayer.definitionExpression=`subDistrictId = '${e.id}'`,this.signalClusterLayer.definitionExpression=`subDistrictId = '${e.id}'`;const l=i.features[0].attributes.parentId;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,await this.view.goTo(i.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.subDistrictControllerLayer.definitionExpression=s,{status:1,message:"未找到子区"}}case"signal":{const s=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`id = '${e.id}'`;const i=await this.signalMarkerLayer.queryFeatures();if(i.features.length>0){this.signalPictureLayer.definitionExpression=`id = '${e.id}'`,this.signalClusterLayer.definitionExpression=`id = '${e.id}'`;const r=i.features[0],{districtId:l,subDistrictId:o}=r.attributes;return this.districtControllerDashLayer.definitionExpression=`id = '${l}'`,this.districtControllerSolidLayer.definitionExpression=`id = '${l}'`,this.subDistrictControllerLayer.definitionExpression=`id = '${o}'`,await this.view.goTo({target:i.features,scale:e.scale||1e3},{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}else return this.signalMarkerLayer.definitionExpression=s,{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1",this.subDistrictControllerLayer.definitionExpression="1=1",this.signalMarkerLayer.definitionExpression="1=1",this.signalClusterLayer.definitionExpression="1=1",this.signalPictureLayer.definitionExpression="1=1";const e=await this.districtControllerDashLayer.queryFeatures();return this.view.goTo(e.features,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}generateGraphic(e,t,s){const i=e.getAllSignalCoordinates();let r=null;if(i.length>=2)if(i.length===2)r=p.lineString(i);else{if(t){const n=p.featureCollection(i.map(a=>p.point(a)));r=C(n)}else{const n=E(i,.5);n.length>=4&&(r=p.polygon([n]))}r||(r=p.lineString(i))}else if(i.length===1)r=p.point(i[0]);else return;const l=b(r.geometry,t?200:30,{units:"meters"}),o=new g({geometry:{type:"polyline",paths:l.geometry.coordinates},attributes:{ObjectID:t?this.districtControllerOid++:this.subDistrictControllerOid++,id:e.id,name:e.name,subDistrictCount:e.subDistrictCount,signalCount:e.signalCount,parentId:e.parentId,parentName:e.parentName,selected:s,type:t?"district":"subDistrict"}});t?this.districtGraphics.push(o):this.subDistrictGraphics.push(o);for(const n of e.subDistricts)this.generateGraphic(n,!1,s);e.signals.forEach(n=>{const a=new g({geometry:{type:"point",x:n.longitude,y:n.latitude},attributes:{ObjectID:this.signalOid++,id:n.id,name:n.name,signalId:n.signalId,nodeId:n.nodeId,isKey:n.isKey,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,type:"signal",selected:!0}});this.signalGraphics.push(a)})}async viewHitTest(e){var n;const s=(n=(await this.view.hitTest(e,{include:[this.districtControllerSolidLayer,this.subDistrictControllerLayer,this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer]})).results)==null?void 0:n.filter(a=>a.type==="graphic");if(s.length===0)return;const i=s[0].graphic;let r=null;i.geometry.type==="point"?r=i.geometry:i.geometry.type==="polyline"?r=i.geometry.extent.center:i.geometry.type==="polygon"&&(r=i.geometry.centroid),r!==null&&await this.view.goTo(r,{duration:1e3});const l=i.getAttribute("type"),o=i.getAttribute("id");switch(l){case"district":{let a=await this.districtControllerSolidLayer.queryFeatures();a.features.forEach(u=>{u.attributes.selected=u.attributes.id===o}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:a.features}),a=await this.districtControllerDashLayer.queryFeatures(),a.features.forEach(u=>{u.attributes.selected=u.attributes.id===o}),await this.districtControllerDashLayer.applyEdits({updateFeatures:a.features});break}case"subDistrict":{let a=await this.subDistrictControllerLayer.queryFeatures();a.features.forEach(c=>{c.attributes.selected=c.attributes.id===o}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:a.features}),a=await this.signalMarkerLayer.queryFeatures(),a.features.forEach(c=>{c.attributes.selected=c.attributes.subDistrictId===o});let u=await this.signalMarkerLayer.applyEdits({updateFeatures:a.features});console.log(u),a=await this.signalPictureLayer.queryFeatures(),a.features.forEach(c=>{c.attributes.selected=c.attributes.subDistrictId===o}),u=await this.signalPictureLayer.applyEdits({updateFeatures:a.features}),console.log(u);break}}F.when(()=>this.view.popup.visible===!1,async()=>{await this.resetSelectedSymbol(l)},{once:!0})}async resetSelectedSymbol(e){switch(e){case"district":{let t=await this.districtControllerSolidLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerSolidLayer.applyEdits({updateFeatures:t.features}),t=await this.districtControllerDashLayer.queryFeatures(),t.features.forEach(s=>{s.attributes.selected=!0}),await this.districtControllerDashLayer.applyEdits({updateFeatures:t.features});break}case"subDistrict":{let t=await this.subDistrictControllerLayer.queryFeatures();t.features.forEach(s=>{s.attributes.selected=!0}),await this.subDistrictControllerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalMarkerLayer.queryFeatures(),console.log("marker count",t.features.length),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalMarkerLayer.applyEdits({updateFeatures:t.features}),t=await this.signalPictureLayer.queryFeatures(),console.log("picture count",t.features.length),t.features.forEach(s=>{s.attributes.selected=!0}),await this.signalPictureLayer.applyEdits({updateFeatures:t.features});break}}}}exports.default=k;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.215",
3
+ "version": "1.0.217",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [