gisviewer-vue3-arcgis 1.0.141 → 1.0.142

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.
@@ -1,10 +1,10 @@
1
- import * as p from "@arcgis/core/core/reactiveUtils.js";
1
+ import * as g from "@arcgis/core/core/reactiveUtils.js";
2
2
  import y from "@arcgis/core/Graphic";
3
3
  import o from "@arcgis/core/layers/GraphicsLayer";
4
- import g from "@turf/buffer";
5
- import d from "@turf/concave";
6
- import f from "@turf/convex";
7
- import * as n from "@turf/helpers";
4
+ import d from "@turf/buffer";
5
+ import f from "@turf/concave";
6
+ import m from "@turf/convex";
7
+ import * as h from "@turf/helpers";
8
8
  import b from "./district-controller.mjs";
9
9
  class x {
10
10
  constructor(e) {
@@ -36,13 +36,13 @@ class x {
36
36
  showSignalControlArea(e) {
37
37
  this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !0, this.subDistrictControllerLayer.visible = !0;
38
38
  for (const t of e) {
39
- const i = new b(t);
40
- this.drawArea(i, !0);
39
+ const r = new b(t);
40
+ this.drawArea(r, !0);
41
41
  }
42
- return this.watchHandle = p.watch(
42
+ return this.watchHandle = g.watch(
43
43
  () => this.view.scale,
44
- (t, i) => {
45
- t > this.crossScale && i <= this.crossScale ? (this.crossLayer.graphics.forEach((s) => {
44
+ (t, r) => {
45
+ t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((s) => {
46
46
  s.symbol = this.getCrossGraphicSymbol(
47
47
  s.attributes,
48
48
  "marker"
@@ -52,7 +52,7 @@ class x {
52
52
  s.attributes,
53
53
  "marker"
54
54
  ));
55
- })) : t <= this.crossScale && i > this.crossScale && (this.crossLayer.graphics.forEach((s) => {
55
+ })) : t <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((s) => {
56
56
  s.symbol = this.getCrossGraphicSymbol(
57
57
  s.attributes,
58
58
  "picture"
@@ -86,12 +86,12 @@ class x {
86
86
  }
87
87
  async highlightSignalControlArea(e) {
88
88
  this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1, this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1;
89
- const t = this.districtControllerLayer.graphics.filter((r) => r.getAttribute("id") === e.id).toArray().map((r) => r.clone()), i = this.subDistrictControllerLayer.graphics.filter(
90
- (r) => r.getAttribute("id") === e.id || r.getAttribute("parentId") === e.id
91
- ).toArray().map((r) => r.clone()), s = this.crossLayer.graphics.filter(
92
- (r) => r.getAttribute("id") === e.id || r.getAttribute("districtId") === e.id || r.getAttribute("subDistrictId") === e.id
93
- ).toArray().map((r) => r.clone());
94
- return t.length > 0 && this.highlightLayer.addMany(t), i.length > 0 && (this.highlightLayer.addMany(i), this.showPopup(i[0])), s.length > 0 && this.highlightLayer.addMany(s), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (t.length > 0 ? (await this.view.goTo(t), this.showPopup(t[0])) : i.length > 0 ? (await this.view.goTo(i), this.showPopup(i[0])) : (s.length > 1 ? await this.view.goTo(s) : await this.view.goTo({
89
+ const t = this.districtControllerLayer.graphics.filter((i) => i.getAttribute("id") === e.id).toArray().map((i) => i.clone()), r = this.subDistrictControllerLayer.graphics.filter(
90
+ (i) => i.getAttribute("id") === e.id || i.getAttribute("parentId") === e.id
91
+ ).toArray().map((i) => i.clone()), s = this.crossLayer.graphics.filter(
92
+ (i) => i.getAttribute("id") === e.id || i.getAttribute("districtId") === e.id || i.getAttribute("subDistrictId") === e.id
93
+ ).toArray().map((i) => i.clone());
94
+ return t.length > 0 && this.highlightLayer.addMany(t), r.length > 0 && (this.highlightLayer.addMany(r), this.showPopup(r[0])), s.length > 0 && this.highlightLayer.addMany(s), this.highlightLayer.graphics.length === 0 ? { status: 1, message: "未找到" } : (t.length > 0 ? (await this.view.goTo(t), this.showPopup(t[0])) : r.length > 0 ? (await this.view.goTo(r), this.showPopup(r[0])) : (s.length > 1 ? await this.view.goTo(s) : await this.view.goTo({
95
95
  target: s[0].geometry,
96
96
  scale: 1500
97
97
  }), this.showPopup(s[0])), { status: 0, message: "ok" });
@@ -106,11 +106,11 @@ class x {
106
106
  */
107
107
  findAreaGraphic(e) {
108
108
  let t = this.districtControllerLayer.graphics.find(
109
- (i) => i.attributes.id === e
109
+ (r) => r.attributes.id === e
110
110
  );
111
111
  return t || (t = this.subDistrictControllerLayer.graphics.find(
112
- (i) => i.attributes.id === e
113
- )), t || (t = this.crossLayer.graphics.find((i) => i.attributes.id === e)), t;
112
+ (r) => r.attributes.id === e
113
+ )), t || (t = this.crossLayer.graphics.find((r) => r.attributes.id === e)), t;
114
114
  }
115
115
  /**
116
116
  * 绘制区控与子区
@@ -119,23 +119,23 @@ class x {
119
119
  * @returns
120
120
  */
121
121
  drawArea(e, t) {
122
- const i = e.getAllCrossCoordinates();
123
- if (i.length >= 2) {
124
- let r = null;
125
- if (i.length === 2)
126
- r = n.lineString(i);
127
- else if (i.length > 2) {
128
- const c = n.featureCollection(
129
- i.map((u) => n.point(u))
122
+ const r = e.getAllCrossCoordinates();
123
+ if (r.length >= 2) {
124
+ let i = null;
125
+ if (r.length === 2)
126
+ i = h.lineString(r);
127
+ else if (r.length > 2) {
128
+ const n = h.featureCollection(
129
+ r.map((p) => h.point(p))
130
130
  );
131
- r = d(c, { maxEdge: 400, units: "meters" }), r || (r = f(c));
131
+ t ? i = m(n) : (i = f(n, { maxEdge: 400, units: "meters" }), i || (i = m(n)));
132
132
  }
133
- if (!r) {
133
+ if (!i) {
134
134
  console.log("生成区控面失败", e);
135
135
  return;
136
136
  }
137
- const a = g(
138
- r.geometry,
137
+ const a = d(
138
+ i.geometry,
139
139
  // 区控面积更大,需要更大的缓冲半径
140
140
  t ? 200 : 30,
141
141
  {
@@ -166,7 +166,7 @@ class x {
166
166
  label: "路口数量"
167
167
  }
168
168
  ];
169
- const m = {
169
+ const u = {
170
170
  type: "signalControlArea",
171
171
  id: e.id,
172
172
  name: e.name,
@@ -174,7 +174,7 @@ class x {
174
174
  parentName: e.parentName,
175
175
  crossCount: e.crossCount,
176
176
  subDistrictCount: e.subDistrictCount
177
- }, h = new y({
177
+ }, c = new y({
178
178
  geometry: {
179
179
  type: "polygon",
180
180
  rings: a.geometry.coordinates
@@ -188,7 +188,7 @@ class x {
188
188
  style: t ? "solid" : "long-dash"
189
189
  }
190
190
  },
191
- attributes: m,
191
+ attributes: u,
192
192
  popupTemplate: {
193
193
  title: `${t ? "区控" : "子区"} ${e.name}`,
194
194
  content: [
@@ -199,33 +199,33 @@ class x {
199
199
  ]
200
200
  }
201
201
  });
202
- t ? this.districtControllerLayer.add(h) : this.subDistrictControllerLayer.add(h);
202
+ t ? this.districtControllerLayer.add(c) : this.subDistrictControllerLayer.add(c);
203
203
  }
204
- for (const r of e.subDistricts)
205
- this.drawArea(r, !1);
206
- const s = e.crosses.map((r) => {
204
+ for (const i of e.subDistricts)
205
+ this.drawArea(i, !1);
206
+ const s = e.crosses.map((i) => {
207
207
  const a = {
208
208
  type: "cross",
209
- id: r.id,
210
- name: r.name,
209
+ id: i.id,
210
+ name: i.name,
211
211
  color: e.areaColor,
212
- signalId: r.signalId,
212
+ signalId: i.signalId,
213
213
  districtId: t ? e.id : e.parentId,
214
214
  districtName: t ? e.name : e.parentName,
215
215
  subDistrictId: t ? "" : e.id,
216
216
  subDistrictName: t ? "" : e.name,
217
- isKey: r.isKey
217
+ isKey: i.isKey
218
218
  };
219
219
  return new y({
220
220
  geometry: {
221
221
  type: "point",
222
- x: r.longitude,
223
- y: r.latitude
222
+ x: i.longitude,
223
+ y: i.latitude
224
224
  },
225
225
  symbol: this.getCrossGraphicSymbol(a, "marker"),
226
226
  attributes: a,
227
227
  popupTemplate: {
228
- title: r.name,
228
+ title: i.name,
229
229
  content: [
230
230
  {
231
231
  type: "fields",
@@ -261,16 +261,16 @@ class x {
261
261
  * @returns
262
262
  */
263
263
  getCrossGraphicSymbol(e, t) {
264
- const { isKey: i, color: s } = e;
264
+ const { isKey: r, color: s } = e;
265
265
  if (t === "marker")
266
266
  return {
267
267
  type: "simple-marker",
268
- style: i ? "diamond" : "circle",
268
+ style: r ? "diamond" : "circle",
269
269
  color: s,
270
- size: i ? 16 : 8,
270
+ size: r ? 16 : 8,
271
271
  outline: {
272
- color: i ? "red" : "white",
273
- width: i ? 2 : 1
272
+ color: r ? "red" : "white",
273
+ width: r ? 2 : 1
274
274
  }
275
275
  };
276
276
  if (t === "picture")
@@ -317,7 +317,7 @@ class x {
317
317
  height: 12,
318
318
  horizontalAlignment: "Center",
319
319
  offsetX: 0,
320
- offsetY: i ? 30 : 22,
320
+ offsetY: r ? 30 : 22,
321
321
  haloSize: 1,
322
322
  haloSymbol: {
323
323
  type: "CIMPolygonSymbol",
@@ -356,10 +356,10 @@ class x {
356
356
  y: 0
357
357
  },
358
358
  anchorPointUnits: "Relative",
359
- size: i ? 45 : 30,
359
+ size: r ? 45 : 30,
360
360
  rotateClockwise: !0,
361
361
  textureFilter: "Picture",
362
- url: `/GisViewerAssets/Images/xhj_${i ? 4 : 1}.png`
362
+ url: `/GisViewerAssets/Images/xhj_${r ? 4 : 1}.png`
363
363
  }
364
364
  ]
365
365
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/core/reactiveUtils.js"),y=require("@arcgis/core/Graphic"),l=require("@arcgis/core/layers/GraphicsLayer"),b=require("@turf/buffer"),f=require("@turf/concave"),L=require("@turf/convex"),v=require("@turf/helpers"),C=require("./district-controller.js");function m(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=m(d),h=m(v);class S{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 i=new C.default(t);this.drawArea(i,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,i)=>{t>this.crossScale&&i<=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&&i>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),this.showPopup(t),{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(r=>r.getAttribute("id")===e.id).toArray().map(r=>r.clone()),i=this.subDistrictControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("parentId")===e.id).toArray().map(r=>r.clone()),s=this.crossLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("districtId")===e.id||r.getAttribute("subDistrictId")===e.id).toArray().map(r=>r.clone());return t.length>0&&this.highlightLayer.addMany(t),i.length>0&&(this.highlightLayer.addMany(i),this.showPopup(i[0])),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(t.length>0?(await this.view.goTo(t),this.showPopup(t[0])):i.length>0?(await this.view.goTo(i),this.showPopup(i[0])):(s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500}),this.showPopup(s[0])),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(i=>i.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(i=>i.attributes.id===e)),t||(t=this.crossLayer.graphics.find(i=>i.attributes.id===e)),t}drawArea(e,t){const i=e.getAllCrossCoordinates();if(i.length>=2){let r=null;if(i.length===2)r=h.lineString(i);else if(i.length>2){const u=h.featureCollection(i.map(p=>h.point(p)));r=f(u,{maxEdge:400,units:"meters"}),r||(r=L(u))}if(!r){console.log("生成区控面失败",e);return}const o=b(r.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 g={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},c=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:g,popupTemplate:{title:`${t?"区控":"子区"} ${e.name}`,content:[{type:"fields",fieldInfos:n}]}});t?this.districtControllerLayer.add(c):this.subDistrictControllerLayer.add(c)}for(const r of e.subDistricts)this.drawArea(r,!1);const s=e.crosses.map(r=>{const o={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:r.isKey};return new y({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(o,"marker"),attributes:o,popupTemplate:{title:r.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:i,color:s}=e;if(t==="marker")return{type:"simple-marker",style:i?"diamond":"circle",color:s,size:i?16:8,outline:{color:i?"red":"white",width:i?2: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:i?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:i?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${i?4:1}.png`}]}}}}}exports.default=S;
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 i=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const w=g(b),c=g(v);class S{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 i=new C.default(t);this.drawArea(i,!0)}return this.watchHandle=w.watch(()=>this.view.scale,(t,i)=>{t>this.crossScale&&i<=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&&i>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),this.showPopup(t),{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(r=>r.getAttribute("id")===e.id).toArray().map(r=>r.clone()),i=this.subDistrictControllerLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("parentId")===e.id).toArray().map(r=>r.clone()),s=this.crossLayer.graphics.filter(r=>r.getAttribute("id")===e.id||r.getAttribute("districtId")===e.id||r.getAttribute("subDistrictId")===e.id).toArray().map(r=>r.clone());return t.length>0&&this.highlightLayer.addMany(t),i.length>0&&(this.highlightLayer.addMany(i),this.showPopup(i[0])),s.length>0&&this.highlightLayer.addMany(s),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(t.length>0?(await this.view.goTo(t),this.showPopup(t[0])):i.length>0?(await this.view.goTo(i),this.showPopup(i[0])):(s.length>1?await this.view.goTo(s):await this.view.goTo({target:s[0].geometry,scale:1500}),this.showPopup(s[0])),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let t=this.districtControllerLayer.graphics.find(i=>i.attributes.id===e);return t||(t=this.subDistrictControllerLayer.graphics.find(i=>i.attributes.id===e)),t||(t=this.crossLayer.graphics.find(i=>i.attributes.id===e)),t}drawArea(e,t){const i=e.getAllCrossCoordinates();if(i.length>=2){let r=null;if(i.length===2)r=c.lineString(i);else if(i.length>2){const h=c.featureCollection(i.map(d=>c.point(d)));t?r=m(h):(r=L(h,{maxEdge:400,units:"meters"}),r||(r=m(h)))}if(!r){console.log("生成区控面失败",e);return}const o=f(r.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 r of e.subDistricts)this.drawArea(r,!1);const s=e.crosses.map(r=>{const o={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:r.isKey};return new y({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(o,"marker"),attributes:o,popupTemplate:{title:r.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:i,color:s}=e;if(t==="marker")return{type:"simple-marker",style:i?"diamond":"circle",color:s,size:i?16:8,outline:{color:i?"red":"white",width:i?2: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:i?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:i?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${i?4:1}.png`}]}}}}}exports.default=S;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.141",
3
+ "version": "1.0.142",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [