gisviewer-vue3-arcgis 1.0.156 → 1.0.157
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.
|
@@ -160,7 +160,7 @@ class k {
|
|
|
160
160
|
fieldName: "subDistrictCount",
|
|
161
161
|
label: "子区数量"
|
|
162
162
|
}
|
|
163
|
-
],
|
|
163
|
+
], c = {
|
|
164
164
|
type: "signalControlArea",
|
|
165
165
|
id: e.id,
|
|
166
166
|
name: e.name,
|
|
@@ -168,7 +168,7 @@ class k {
|
|
|
168
168
|
parentName: e.parentName,
|
|
169
169
|
crossCount: e.crossCount,
|
|
170
170
|
subDistrictCount: e.subDistrictCount
|
|
171
|
-
},
|
|
171
|
+
}, h = new a({
|
|
172
172
|
geometry: {
|
|
173
173
|
type: "polygon",
|
|
174
174
|
rings: s.geometry.coordinates
|
|
@@ -181,7 +181,7 @@ class k {
|
|
|
181
181
|
width: 2
|
|
182
182
|
}
|
|
183
183
|
},
|
|
184
|
-
attributes:
|
|
184
|
+
attributes: c,
|
|
185
185
|
popupTemplate: {
|
|
186
186
|
title: `区控 ${e.name}`,
|
|
187
187
|
content: [
|
|
@@ -192,7 +192,7 @@ class k {
|
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
|
-
this.districtControllerLayer.add(
|
|
195
|
+
this.districtControllerLayer.add(h);
|
|
196
196
|
}
|
|
197
197
|
for (let t = 0; t < e.subDistricts.length; t++) {
|
|
198
198
|
const s = e.subDistricts[t];
|
|
@@ -273,7 +273,7 @@ class k {
|
|
|
273
273
|
symbol: this.getCrossGraphicSymbol(t, "marker"),
|
|
274
274
|
attributes: t,
|
|
275
275
|
popupTemplate: {
|
|
276
|
-
title: i.name
|
|
276
|
+
title: `${i.name}`,
|
|
277
277
|
content: [
|
|
278
278
|
{
|
|
279
279
|
type: "fields",
|
|
@@ -316,13 +316,13 @@ class k {
|
|
|
316
316
|
if (r.status === 200) {
|
|
317
317
|
const i = r.data.result;
|
|
318
318
|
if (i.length > 0) {
|
|
319
|
-
const t = i.map((
|
|
319
|
+
const t = i.map((h) => new g({ paths: [h] })), s = y.geodesicBuffer(
|
|
320
320
|
t,
|
|
321
321
|
5,
|
|
322
322
|
"meters"
|
|
323
323
|
), o = y.union(
|
|
324
324
|
s
|
|
325
|
-
),
|
|
325
|
+
), c = new a({
|
|
326
326
|
geometry: o,
|
|
327
327
|
symbol: {
|
|
328
328
|
type: "simple-fill",
|
|
@@ -333,13 +333,37 @@ class k {
|
|
|
333
333
|
}
|
|
334
334
|
},
|
|
335
335
|
attributes: {
|
|
336
|
+
type: "subDistrict",
|
|
336
337
|
districtId: e.parentId,
|
|
337
338
|
districtName: e.parentName,
|
|
338
339
|
subDistrictId: e.id,
|
|
339
|
-
subDistrictName: e.name
|
|
340
|
+
subDistrictName: e.name,
|
|
341
|
+
crossCount: e.crosses.length
|
|
342
|
+
},
|
|
343
|
+
popupTemplate: {
|
|
344
|
+
title: `子区 ${e.name}`,
|
|
345
|
+
content: [
|
|
346
|
+
{
|
|
347
|
+
type: "fields",
|
|
348
|
+
fieldInfos: [
|
|
349
|
+
{
|
|
350
|
+
fieldName: "districtName",
|
|
351
|
+
label: "区控名称"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
fieldName: "subDistrictName",
|
|
355
|
+
label: "子区名称"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
fieldName: "crossCount",
|
|
359
|
+
label: "路口数量"
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
}
|
|
363
|
+
]
|
|
340
364
|
}
|
|
341
365
|
});
|
|
342
|
-
this.subDistrictControllerLayer.add(
|
|
366
|
+
this.subDistrictControllerLayer.add(c);
|
|
343
367
|
}
|
|
344
368
|
}
|
|
345
369
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/core/reactiveUtils.js"),b=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/geometryEngine.js"),l=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer"),v=require("@turf/buffer"),S=require("@turf/concave"),L=require("@turf/helpers"),w=require("axios"),I=require("../../stores/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@arcgis/core/core/reactiveUtils.js"),b=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/geometryEngine.js"),l=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer"),v=require("@turf/buffer"),S=require("@turf/concave"),L=require("@turf/helpers"),w=require("axios"),I=require("../../stores/index.js"),d=require("../common-utils.js"),A=require("./district-controller.js");function y(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const i in a)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(a,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:()=>a[i]})}}return e.default=a,Object.freeze(e)}const D=y(f),m=y(C),c=y(L);class N{constructor(e){this.districtControllers=[],this.crossScale=5e3,this.loadedSubDistricts=[],this.view=e;const r=I.default.useAppDataStore.mapConfig;this.openDriveServerUrl=r.openDriveServer.url,this.districtControllerLayer=new n({id:"districtControllerLayer",maxScale:144447,minScale:1155582}),this.subDistrictControllerLayer=new n({id:"subDistrictControllerLayer",maxScale:0,minScale:144447}),this.crossLayer=new n({id:"crossLayer",maxScale:0,minScale:36112}),this.highlightLayer=new n({id:"highlightLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer,this.highlightLayer])}async showSignalControlArea(e){console.time("showSignalControlArea"),this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0;for(const i of e){const r=new A.default(i);this.showDistrict(r),this.districtControllers.push(r)}this.watchHandle=D.watch(()=>this.view.scale,(i,r)=>{i>this.crossScale&&r<=this.crossScale?(this.crossLayer.graphics.forEach(t=>{t.symbol=this.getCrossGraphicSymbol(t.attributes,"marker")}),this.highlightLayer.graphics.forEach(t=>{t.getAttribute("type")==="cross"&&(t.symbol=this.getCrossGraphicSymbol(t.attributes,"marker"))})):i<=this.crossScale&&r>this.crossScale&&(this.crossLayer.graphics.forEach(t=>{t.symbol=this.getCrossGraphicSymbol(t.attributes,"picture")}),this.highlightLayer.graphics.forEach(t=>{t.getAttribute("type")==="cross"&&(t.symbol=this.getCrossGraphicSymbol(t.attributes,"picture"))}))});for(const i of this.districtControllers)for(const r of i.subDistricts)await this.showSubDistrictRoad(r);return console.timeEnd("showSignalControlArea"),{status:0,message:"ok"}}clearSignalControlArea(){var e;return this.districtControllerLayer.removeAll(),this.subDistrictControllerLayer.removeAll(),this.crossLayer.removeAll(),this.highlightLayer.removeAll(),(e=this.watchHandle)==null||e.remove(),this.view.closePopup(),{status:0,message:"ok"}}async locateSignalControlArea(e){const i=this.findAreaGraphic(e.id);return i?(i[0].attributes.type==="cross"?await this.view.goTo({target:i,scale:1500}):await this.view.goTo(i),{status:0,message:"ok"}):{status:1,message:"未找到"}}showPopup(e){const i=e.geometry.type==="point"?e.geometry:e.geometry.centroid;this.view.openPopup({features:[e],location:i})}async highlightSignalControlArea(e){if(!e.id||e.id==="")return{status:1,message:"请输入id"};this.highlightLayer.removeAll(),this.districtControllerLayer.visible=!1,this.subDistrictControllerLayer.visible=!1,this.crossLayer.visible=!1;for(const s of this.districtControllers)for(const o of s.subDistricts)(o.id===e.id||o.parentId===e.id)&&await this.showSubDistrictRoad(o);const i=this.districtControllerLayer.graphics.filter(s=>s.getAttribute("id")===e.id).toArray().map(s=>s.clone()),r=this.subDistrictControllerLayer.graphics.filter(s=>s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone()),t=this.crossLayer.graphics.filter(s=>s.getAttribute("id")===e.id||s.getAttribute("districtId")===e.id||s.getAttribute("subDistrictId")===e.id).toArray().map(s=>s.clone());return i.length>0&&this.highlightLayer.addMany(i),r.length>0&&this.highlightLayer.addMany(r),t.length>0&&this.highlightLayer.addMany(t),this.highlightLayer.graphics.length===0?{status:1,message:"未找到"}:(i.length>0?await this.view.goTo(i):r.length>0?await this.view.goTo({target:r,scale:this.crossScale-500}):t.length>1?await this.view.goTo(t):await this.view.goTo({target:t[0].geometry,scale:1500}),{status:0,message:"ok"})}resetHighlight(){return this.highlightLayer.removeAll(),this.view.closePopup(),this.districtControllerLayer.visible=!0,this.subDistrictControllerLayer.visible=!0,this.crossLayer.visible=!0,{status:0,message:"ok"}}findAreaGraphic(e){let i=this.districtControllerLayer.graphics.filter(r=>r.attributes.id===e);if(i||(i=this.subDistrictControllerLayer.graphics.filter(r=>r.attributes.getAttribute("subDistrictId")===e)),i||(i=this.crossLayer.graphics.filter(r=>r.attributes.id===e)),i.length!==0)return i.toArray()}showDistrict(e){const i=e.getAllCrossCoordinates();if(i.length>=2){let t=null;if(i.length===2)t=c.lineString(i);else if(i.length>2){const p=c.featureCollection(i.map(g=>c.point(g)));t=S(p)}t||(t=c.lineString(i));const s=v(t.geometry,200,{units:"meters"}),o=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}],h={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.crossCount,subDistrictCount:e.subDistrictCount},u=new l({geometry:{type:"polygon",rings:s.geometry.coordinates},symbol:{type:"simple-fill",color:[...e.areaColor,.1],outline:{color:e.areaColor,width:2}},attributes:h,popupTemplate:{title:`区控 ${e.name}`,content:[{type:"fields",fieldInfos:o}]}});this.districtControllerLayer.add(u)}for(let t=0;t<e.subDistricts.length;t++){const s=e.subDistricts[t];this.showSubDistrictCross(s)}const r=[];e.crosses=e.crosses.filter(t=>d.default.isCoordinateValid(t)),e.crosses.forEach(t=>{if(d.default.isCoordinateValid(t)){const s={type:"cross",id:t.id,name:t.name,color:e.areaColor,signalId:t.signalId,districtId:e.id,districtName:e.name,isKey:t.isKey},o=new l({geometry:{type:"point",x:t.longitude,y:t.latitude},symbol:this.getCrossGraphicSymbol(s,"marker"),attributes:s,popupTemplate:{title:t.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});r.push(o)}else console.log("路口坐标无效",t)}),this.crossLayer.addMany(r)}showSubDistrictCross(e){const i=[];e.crosses=e.crosses.filter(r=>d.default.isCoordinateValid(r)),e.crosses.forEach(r=>{const t={type:"cross",id:r.id,name:r.name,color:e.areaColor,signalId:r.signalId,districtId:e.parentId,districtName:e.parentName,subDistrictId:e.id,subDistrictName:e.name,isKey:r.isKey},s=new l({geometry:{type:"point",x:r.longitude,y:r.latitude},symbol:this.getCrossGraphicSymbol(t,"marker"),attributes:t,popupTemplate:{title:`${r.name}`,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"id",label:"路口编号"},{fieldName:"signalId",label:"信号机编号"}]}]}});i.push(s)}),this.crossLayer.addMany(i)}async showSubDistrictRoad(e){if(e.crosses.length>1&&!this.loadedSubDistricts.includes(e.id)&&this.openDriveServerUrl&&this.openDriveServerUrl!==""){this.loadedSubDistricts.push(e.id);const i=await w.get(`http://${this.openDriveServerUrl}/api/computable/getRoadsectWithinJunctions`,{params:{junctionIds:e.crosses.map(r=>r.id).join(",")}});if(i.status===200){const r=i.data.result;if(r.length>0){const t=r.map(u=>new b.Polyline({paths:[u]})),s=m.geodesicBuffer(t,5,"meters"),o=m.union(s),h=new l({geometry:o,symbol:{type:"simple-fill",color:[...e.areaColor,.8],outline:{color:e.areaColor,width:1}},attributes:{type:"subDistrict",districtId:e.parentId,districtName:e.parentName,subDistrictId:e.id,subDistrictName:e.name,crossCount:e.crosses.length},popupTemplate:{title:`子区 ${e.name}`,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"crossCount",label:"路口数量"}]}]}});this.subDistrictControllerLayer.add(h)}}}}getCrossGraphicSymbol(e,i){const{isKey:r,color:t}=e;if(i==="marker")return r?{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"30px",height:"30px"}:{type:"simple-marker",style:"circle",color:t,size:8,outline:{color:"white",width:1}};if(i==="picture")return{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:r?60:40,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r?45:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/xhj_${r?4:1}.png`,offsetY:r?22:15}]}}}}}exports.default=N;
|