gisviewer-vue3-arcgis 1.0.284 → 1.0.285

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.
Files changed (95) hide show
  1. package/es/index.mjs +6 -5
  2. package/es/src/gis-map/gis-map.vue.d.ts +124 -1
  3. package/es/src/gis-map/gis-map.vue.mjs +63 -63
  4. package/es/src/gis-map/index.d.ts +124 -1
  5. package/es/src/gis-map/utils/edpass-device-controller.mjs +278 -0
  6. package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +362 -0
  7. package/es/src/gis-map/utils/holo-flow/index.mjs +101 -0
  8. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
  9. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +153 -0
  10. package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.mjs +4 -0
  11. package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +336 -0
  12. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +236 -0
  13. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +106 -0
  14. package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +576 -0
  15. package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +386 -0
  16. package/es/src/gis-map/utils/index.mjs +2 -2
  17. package/es/src/gis-map/utils/police-jurisdiction.mjs +202 -0
  18. package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
  19. package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
  20. package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
  21. package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
  22. package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
  23. package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
  24. package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
  25. package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +593 -0
  26. package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +84 -0
  27. package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +122 -0
  28. package/es/src/gis-map/utils/signal-control-area/edit-area.mjs +550 -0
  29. package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +984 -0
  30. package/es/src/gis-map/utils/signal-control-area/signal-area-controller.mjs +140 -0
  31. package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +423 -0
  32. package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +123 -0
  33. package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +367 -0
  34. package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +137 -0
  35. package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
  36. package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +50 -0
  37. package/es/src/gis-map-ol/gis-map-ol.vue.mjs +67 -0
  38. package/es/src/gis-map-ol/gis-map-ol.vue2.mjs +4 -0
  39. package/es/src/gis-map-ol/gis-map-ol.vue3.mjs +5 -0
  40. package/es/src/gis-map-ol/index.d.ts +44 -1
  41. package/es/src/gis-map-ol/index.mjs +8 -0
  42. package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +28 -0
  43. package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +129 -0
  44. package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +42 -0
  45. package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +263 -0
  46. package/es/src/index.mjs +4 -4
  47. package/es/src/types/index.mjs +5 -0
  48. package/lib/index.js +1 -1
  49. package/lib/src/gis-map/gis-map.vue.d.ts +124 -1
  50. package/lib/src/gis-map/gis-map.vue.js +1 -1
  51. package/lib/src/gis-map/index.d.ts +124 -1
  52. package/lib/src/gis-map/utils/edpass-device-controller.js +1 -0
  53. package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -0
  54. package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
  55. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
  56. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -0
  57. package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.js +1 -0
  58. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -0
  59. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
  60. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -0
  61. package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -0
  62. package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -0
  63. package/lib/src/gis-map/utils/index.js +1 -1
  64. package/lib/src/gis-map/utils/police-jurisdiction.js +1 -0
  65. package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
  66. package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
  67. package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
  68. package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
  69. package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
  70. package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
  71. package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
  72. package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
  73. package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -0
  74. package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -0
  75. package/lib/src/gis-map/utils/signal-control-area/edit-area.js +1 -0
  76. package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -0
  77. package/lib/src/gis-map/utils/signal-control-area/signal-area-controller.js +1 -0
  78. package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -0
  79. package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -0
  80. package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -0
  81. package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -0
  82. package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
  83. package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +50 -0
  84. package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -0
  85. package/lib/src/gis-map-ol/gis-map-ol.vue2.js +1 -0
  86. package/lib/src/gis-map-ol/gis-map-ol.vue3.js +1 -0
  87. package/lib/src/gis-map-ol/index.d.ts +44 -1
  88. package/lib/src/gis-map-ol/index.js +1 -0
  89. package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +28 -0
  90. package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -0
  91. package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +42 -0
  92. package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -0
  93. package/lib/src/index.js +1 -1
  94. package/lib/src/types/index.js +1 -0
  95. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("pako"),h=require("../common-utils.js");class d{constructor(o,s){if(this.parentName="",this.signals=[],this.subDistricts=[],this.areaColor=this.getDarkNonGrayColor(),this.signalCount=0,this.subDistrictCount=0,this.roadConnections=[],this.id=o.name,this.name=o.areaDesc,this.parentId=o.parentId,s==="alarm"&&(this.areaColor=[255,0,0]),o.mapConnectList)try{const t=o.mapConnectList,i=new Uint8Array(window.atob(t).split("").map(r=>r.charCodeAt(0))),a=c.inflate(i,{to:"string"}),n=JSON.parse(a);this.roadConnections.push(...n.map(r=>({id:r.roadsectId,coordinates:JSON.parse(r.geomData).coordinates,districtId:this.parentId,subDistrictId:this.id})))}catch(t){console.error("解压子区路段连接信息失败:",t)}for(const t of o.children)if(t.children){const i=new d(t,s);if(i.id=t.id,i.name=`SS ${t.name}`,i.parentId=this.id,i.parentName=this.name,i.areaColor=this.getDarkNonGrayColor(t.id),this.subDistricts.push(i),this.subDistrictCount++,this.signalCount+=i.signalCount,t.mapConnectList)try{const a=t.mapConnectList,n=new Uint8Array(window.atob(a).split("").map(e=>e.charCodeAt(0))),r=c.inflate(n,{to:"string"}),l=JSON.parse(r);i.roadConnections.push(...l.map(e=>({id:e.roadsectId,coordinates:JSON.parse(e.geomData).coordinates,districtId:i.parentId,subDistrictId:i.id})))}catch(a){console.error("解压子区路段连接信息失败:",a)}}else if(h.default.isCoordinateValid(t)){const i={id:t.id,name:t.name,parentId:t.parentId,latitude:Number(t.latitude),longitude:Number(t.longitude),signalId:t.signalId,nodeId:t.nodeId,isKey:t.isKey===1};this.signals.push(i),this.signalCount++}}getAllSignalCoordinates(){const o=[];for(const s of this.signals)o.push([s.longitude,s.latitude]);for(const s of this.subDistricts)o.push(...s.getAllSignalCoordinates());return o}getDarkNonGrayColor(o){let s,t,i;if(o){const a=this.cyrb53(o);s=((a&16711680)>>16)%200,t=((a&65280)>>8)%200,i=(a&255)%200}else s=Math.floor(Math.random()*256),t=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return[s,t,i]}cyrb53(o,s=0){let t=3735928559^s,i=1103547991^s;for(let a=0,n;a<o.length;a++)n=o.charCodeAt(a),t=Math.imul(t^n,2654435761),i=Math.imul(i^n,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&i)+(t>>>0)}}exports.default=d;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("@arcgis/core/Graphic"),c=require("@arcgis/core/layers/FeatureLayer"),L=require("@turf/helpers"),d=require("@turf/turf"),l=require("../common-utils.js"),u=require("./layer-symbol.js");function g(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const n=g(L);class D{constructor(t){this.style="",this.view=t,this.districtControllerDashLayer=new c(u.districtDashLineLayerOptions),this.districtControllerDashLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer=new c(u.districtSolidLineLayerOptions),this.districtControllerSolidLayer.spatialReference=t.spatialReference,this.districtControllerSolidLayer.popupEnabled=!0,this.view.map.addMany([this.districtControllerDashLayer,this.districtControllerSolidLayer])}async showDistricts(t){await this.clearDistricts();const e=[];for(let i=0;i<t.length;i++){const r=t[i],s=r.getAllSignalCoordinates();let a=null;if(s.length>=2)if(s.length===2)a=n.lineString(s);else{const f=n.featureCollection(s.map(p=>n.point(p)));a=d.convex(f),a||(a=n.lineString(s))}else if(s.length===1)a=n.point(s[0]);else continue;const h=d.buffer(a.geometry,200,{units:"meters"}),y=new C({geometry:{type:"polyline",paths:h.geometry.coordinates},attributes:{ObjectID:i,id:r.id,name:r.name,subDistrictCount:r.subDistrictCount,signalCount:r.signalCount,parentId:r.parentId,parentName:r.parentName,selected:this.style,type:"district"}});e.push(y)}await this.districtControllerDashLayer.applyEdits({addFeatures:e}),await this.districtControllerSolidLayer.applyEdits({addFeatures:e}),await l.default.viewGoto(this.view,e)}async clearDistricts(){let t=await this.districtControllerDashLayer.queryFeatures();await this.districtControllerDashLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerDashLayer.definitionExpression="1=1",t=await this.districtControllerSolidLayer.queryFeatures(),await this.districtControllerSolidLayer.applyEdits({deleteFeatures:t.features}),this.districtControllerSolidLayer.definitionExpression="1=1"}setVisible(t){this.districtControllerDashLayer.visible=t,this.districtControllerSolidLayer.visible=t}async locateDistrict(t){const e=this.districtControllerDashLayer.createQuery();e.where=`id = '${t}'`,e.returnGeometry=!0,e.outFields=["*"];const i=await this.districtControllerDashLayer.queryFeatures(e);return i.features.length>0?(await l.default.viewGoto(this.view,i.features),{status:0,message:"ok"}):{status:1,message:"未找到区控"}}async highlightDistrict(t){const e=this.districtControllerDashLayer.definitionExpression;this.districtControllerDashLayer.definitionExpression=`id = '${t.id}'`;const i=await this.districtControllerDashLayer.queryFeatures(),r=i.features.length;return r>0?(this.districtControllerSolidLayer.definitionExpression=`id = '${t.id}'`,await l.default.viewGoto(this.view,i.features,t.needZoom!==!1)):this.districtControllerDashLayer.definitionExpression=e,r}filter(t){const e=`id = '${t}'`;this.districtControllerDashLayer.definitionExpression=e,this.districtControllerSolidLayer.definitionExpression=e}resetFilter(){this.districtControllerDashLayer.definitionExpression="1=1",this.districtControllerSolidLayer.definitionExpression="1=1"}}exports.default=D;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/GraphicsLayer"),h=require("@turf/buffer"),p=require("@turf/convex"),b=require("@turf/helpers"),f=require("axios"),C=require("concaveman"),I=require("../../../stores/index.js");function S(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const o=S(b);class v{constructor(e){var i;this.crossScale=5e3,this.hasGpu=!1,this.crossIdsInDistrict=[],this.view=e,this.hasGpu=localStorage.getItem("gpu")!=="Unknown";const r=I.default.useAppDataStore.mapConfig;this.openDriveServer=(i=r.openDriveServer)==null?void 0:i.url,this.districtControllerLayer=new d({id:"districtControllerLayer"}),this.subDistrictControllerLayer=new d({id:"subDistrictControllerLayer"}),this.crossLayer=new d({id:"crossLayer"}),this.view.map.addMany([this.districtControllerLayer,this.subDistrictControllerLayer,this.crossLayer])}showSubSignalControlArea(e){this.crossLayer.removeAll(),this.crossLayer.visible=!0;const r=e.children.map(i=>{const s={...i,selected:!0};return new c({geometry:{type:"point",x:i.longitude,y:i.latitude},symbol:this.getCrossSymbolInSubDistrict(s),attributes:s})});return this.crossLayer.addMany(r),this.view.goTo(r,{duration:this.hasGpu?1e3:0}),{status:0,message:"ok"}}async handleViewClick(e){var s;const r=(s=(await this.view.hitTest(e,{include:[this.crossLayer]})).results)==null?void 0:s.filter(a=>a.type==="graphic");if(r.length===0)return;const i=r[0].graphic;i.getAttribute("selected")?i.getAttribute("signalId")&&(this.removeCrossCallback&&this.removeCrossCallback({id:i.getAttribute("id")}),i.setAttribute("selected",!1),i.symbol=this.getCrossSymbolInSubDistrict(i.attributes)):(i.getAttribute("signalId")&&(this.addCrossCallback&&this.addCrossCallback(i.attributes),i.setAttribute("selected",!0),i.symbol=this.getCrossSymbolInSubDistrict(i.attributes)),await this.showNearbyCrosses(i.getAttribute("id")))}async showNearbyCrosses(e){const t=await f.get(`http://${this.openDriveServer}/api/computable/getRelatedNodesForNode`,{params:{nodeIds:e}});if(t.status===200)if(t.data.status===0){const r=t.data.result,i=[];for(const s of r){const a=s.nodeId;if(a.startsWith("-"))continue;if(s.signalId&&!this.crossIdsInDistrict.includes(a)){console.log("不是此区控内的路口",a);continue}if(this.crossLayer.graphics.some(u=>u.getAttribute("id")===a))continue;const m=new c({geometry:{type:"point",x:s.lon,y:s.lat},symbol:this.getCrossSymbolInSubDistrict(s),attributes:{id:a,name:s.name,signalId:s.signalId,selected:!1}});i.push(m)}return this.crossLayer.addMany(i),{status:0,message:"ok"}}else return{status:-1,message:t.data.message};else return{status:-1,message:"请求失败"}}async editSubSignalControlArea(e){if(e.odrServer){this.openDriveServer=e.odrServer,this.crossIdsInDistrict=e.crossesInArea.map(s=>s.id);const t=o.featureCollection(e.crossesInArea.map(s=>o.point([s.longitude,s.latitude]))),r=p(t);r&&(this.districtControllerLayer.removeAll(),this.districtControllerLayer.add(new c({geometry:{type:"polygon",rings:r.geometry.coordinates},symbol:{type:"simple-fill",style:"none",outline:{color:[61,139,249],width:3,style:"long-dash"}}}))),this.addCrossCallback=e.addCrossCallback,this.removeCrossCallback=e.removeCrossCallback,this.viewClickWatcher||(this.viewClickWatcher=this.view.on("click",async s=>{await this.handleViewClick(s)}));const i=this.crossLayer.graphics.toArray().map(s=>s.getAttribute("id")).join(",");return await this.showNearbyCrosses(i)}else return{status:1,message:"未配置OpenDriveServer"}}stopEditSubSignalControlArea(){var t;(t=this.viewClickWatcher)==null||t.remove(),this.viewClickWatcher=void 0;const e=this.crossLayer.graphics.filter(r=>r.getAttribute("signalId")===""||!r.getAttribute("signalId")||!r.getAttribute("selected"));this.crossLayer.removeMany(e.toArray()),this.districtControllerLayer.removeAll()}selectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&!t.getAttribute("selected"))return t.setAttribute("selected",!0),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}unselectSubSignalControlAreaCross(e){return this.crossLayer.graphics.forEach(t=>{if(t.getAttribute("id")===e&&t.getAttribute("selected"))return t.setAttribute("selected",!1),t.symbol=this.getCrossSymbolInSubDistrict(t.attributes),{status:0,message:"ok"}}),{status:0,message:"未找到"}}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.getAllSignalCoordinates();if(r.length>=2){let s=null;if(r.length===2)s=o.lineString(r);else{if(t){const y=o.featureCollection(r.map(g=>o.point(g)));s=p(y)}else{const y=C(r,.5);y.length>=4&&(s=o.polygon([y]))}s||(s=o.lineString(r))}const a=h(s.geometry,t?200:30,{units:"meters"});let l;t?l=[{fieldName:"id",label:"区控编号"},{fieldName:"crossCount",label:"路口数量"},{fieldName:"subDistrictCount",label:"子区数量"}]:l=[{fieldName:"parentName",label:"所属区控"},{fieldName:"crossCount",label:"路口数量"}];const m={type:"signalControlArea",id:e.id,name:e.name,parentId:e.parentId,parentName:e.parentName,crossCount:e.signalCount,subDistrictCount:e.subDistrictCount},u=new c({geometry:{type:"polygon",rings:a.geometry.coordinates},symbol:{type:"simple-fill",style:"none",outline:{color:t?[111,100,255]:[5,196,104],width:3,style:t?"long-dash":"solid"}},attributes:m,popupTemplate:{title:`${e.name}`,content:[{type:"fields",fieldInfos:l}]}});t?this.districtControllerLayer.add(u):this.subDistrictControllerLayer.add(u)}for(const s of e.subDistricts)this.drawArea(s,!1);const i=[];e.signals.forEach(s=>{const a={type:"cross",id:s.id,name:s.name,signalId:s.signalId,nodeId:s.nodeId,districtId:t?e.id:e.parentId,districtName:t?e.name:e.parentName,subDistrictId:t?"":e.id,subDistrictName:t?"":e.name,isKey:s.isKey},l=new c({geometry:{type:"point",x:s.longitude,y:s.latitude},symbol:this.getCrossGraphicSymbol(a,"marker"),attributes:a,popupTemplate:{title:s.name,content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]}});i.push(l)}),this.crossLayer.addMany(i)}getCrossSymbolInSubDistrict(e){return e.signalId&&e.signalId!==""?{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:20,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:30,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${e.selected?"gis_xhj_blue":"gis_xhj_gray"}.png`}]}}}:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_lkcz.png",width:"20px",height:"20px"}}getCrossGraphicSymbol(e,t){const r=e.isKey;if(t==="marker")return{type:"simple-marker",style:"circle",color:r?[254,172,22]:[5,116,255],size:r?12: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:15,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?40:20,rotateClockwise:!0,textureFilter:"Picture",url:`/GisViewerAssets/Images/cross/${r?"gis_gjxklk_orange":"gis_xhj_blue"}.png`}]}}}}}exports.default=v;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={id:"districtController",source:[],objectIdField:"ObjectID",geometryType:"polyline",outFields:["*"],fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"subDistrictCount",type:"integer"},{name:"signalCount",type:"integer"},{name:"selected",type:"string"}],renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"long-dash",color:[111,100,255],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"long-dash",color:[180,180,180],width:1}}]}},t={id:"districtController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"polyline",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"subDistrictCount",type:"integer"},{name:"signalCount",type:"integer"},{name:"type",type:"string"},{name:"selected",type:"string"}],renderer:{type:"unique-value",field:"selected",defaultSymbol:{type:"simple-line",style:"solid",color:[111,100,255,.4],width:2},uniqueValueInfos:[{value:"false",symbol:{type:"simple-line",style:"solid",color:[180,180,180,.4],width:1}}]}},i={id:"subDistrictPointController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"signalCount",type:"integer"},{name:"selected",type:"string"},{name:"type",type:"string"},{name:"color",type:"string"}],popupTemplate:{title:"{subDistrictName} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"districtName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]}},r={id:"subDistrictLineController",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"polyline",fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"signalCount",type:"integer"},{name:"fromNode",type:"string"},{name:"toNode",type:"string"},{name:"color",type:"string"}],popupTemplate:{title:"{subDistrictName} 子区",content:[{type:"fields",fieldInfos:[{fieldName:"subDistrictId",label:"子区编号"},{fieldName:"districtName",label:"所属区控"},{fieldName:"signalCount",label:"信号机数量"}]}]}},s={id:"signalLayer",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",maxScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"unique-value",field:"isKey",field2:"selected",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:0}},uniqueValueInfos:[{value:"true,true",symbol:{type:"picture-marker",url:"/GisViewerAssets/Images/icon_star.png",width:"20px",height:"20px"}},{value:"false,true",symbol:{type:"simple-marker",style:"circle",color:[5,116,255,.8],size:8,outline:{color:"white",width:0}}},{value:"true,false",symbol:{type:"simple-marker",style:"circle",color:[180,180,180,.8],size:8,outline:{color:"white",width:0}}},{value:"false,false",symbol:{type:"simple-marker",style:"circle",color:[180,180,180,.8],size:8,outline:{color:"white",width:0}}}]}},l={id:"signalLayer",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",minScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"unique-value",field:"isKey",field2:"selected",defaultSymbol:{type:"simple-marker",style:"circle",color:"gray",size:4,outline:{color:"white",width:1}},uniqueValueInfos:[{value:"true,true",symbol:{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:30,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:20,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_gjxklk_orange.png"}]}}}},{value:"false,true",symbol:{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:15,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:20,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}},{value:"true,false",symbol:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_gjxk_gray.png",width:20,height:20}},{value:"false,false",symbol:{type:"picture-marker",url:"/GisViewerAssets/Images/cross/gis_xhj_gray.png",width:20,height:20}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:28,value:2250},{size:24,value:4500}]}]}},n={id:"signalLayer",source:[],objectIdField:"ObjectID",outFields:["*"],geometryType:"point",maxScale:5e3,fields:[{name:"ObjectID",type:"oid"},{name:"id",type:"string"},{name:"name",type:"string"},{name:"signalId",type:"string"},{name:"nodeId",type:"string"},{name:"isKey",type:"string"},{name:"districtId",type:"string"},{name:"districtName",type:"string"},{name:"subDistrictId",type:"string"},{name:"subDistrictName",type:"string"},{name:"type",type:"string"},{name:"type",type:"string"},{name:"selected",type:"string"}],featureReduction:{type:"cluster",clusterRadius:"120px",clusterMaxSize:"50px",clusterMinSize:"30px",symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.cluster_count",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:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""},{type:"CIMMarkerGraphic",geometry:{rings:[[[-15,40],[15,40],[15,20],[-15,20],[-15,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:40,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}},popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"districtName",label:"区控名称"},{fieldName:"subDistrictName",label:"子区名称"},{fieldName:"signalId",label:"信号机编号"},{fieldName:"nodeId",label:"路口编号"}]}]},renderer:{type:"simple",symbol:{type:"simple-marker",style:"circle",color:[5,116,255],size:8,outline:{color:"white",width:1}}}};exports.districtDashLineLayerOptions=e;exports.districtSolidLineLayerOptions=t;exports.signalClusterLayerOptions=n;exports.signalMarkerLayerOptions=s;exports.signalPictureLayerOptions=l;exports.subDistrictLineLayerOptions=r;exports.subDistrictPointLayerOptions=i;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("../../../stores/index.js"),a=require("./cross-renderer.js"),r=require("./district-controller.js"),l=require("./district-renderer.js"),o=require("./signal-renderer.js"),d=require("./sub-district-renderer.js");class u{constructor(e){this.view=e;const t=c.default.useAppDataStore;this.mapConfig=JSON.parse(JSON.stringify(t.mapConfig)),this.districtRenderer=new l.default(e),this.subDistrictRenderer=new d.default(e),this.signalRenderer=new o.default(e),this.crossRenderer=new a.default(e)}async showSignalControlArea(e){await this.clearSignalControlArea(),this.districtRenderer.setVisible(!1),this.subDistrictRenderer.setVisible(!1),this.signalRenderer.setClusterVisible(!1),this.signalRenderer.setPointVisible(!1);const t=[],s=[];for(const i of e.areaList){const n=new r.default(i,e.style||"");t.push(n),s.push(...n.subDistricts)}return this.districtRenderer.style=e.style||"",await this.districtRenderer.showDistricts(t),await this.subDistrictRenderer.showSubDistricts(s),this.crossRenderer.addCrosses(t),{status:0,message:"ok"}}async showDistrict(e){this.setLayerVisibility({id:"district",visible:!0}),this.setLayerVisibility({id:"subDistrict",visible:!0});const t=new r.default(e.areaList,e.style||"");await this.districtRenderer.showDistricts([t]),await this.subDistrictRenderer.showSubDistricts(t.subDistricts),await this.subDistrictRenderer.showRoads({id:t.id,type:"district"})}async showSubDistrict(e){this.setLayerVisibility({id:"subDistrict",visible:!0});const t=new r.default(e.areaList,e.style||"");await this.subDistrictRenderer.showSubDistricts([t]),await this.subDistrictRenderer.showRoads({id:t.id,type:"subDistrict"})}async clearSignalControlArea(){return this.crossRenderer.clearCrosses(),await this.districtRenderer.clearDistricts(),await this.subDistrictRenderer.clearSubDistricts(),this.crossRenderer.clearCrosses(),{status:0,message:"ok"}}setLayerVisibility(e){switch(e.visible===!1&&this.view.closePopup(),e.id){case"district":this.districtRenderer.setVisible(e.visible);break;case"subDistrict":this.subDistrictRenderer.setVisible(e.visible);break;case"signal":e.visible===!1?this.crossRenderer.hideCrosses():this.crossRenderer.showScatter();break;case"signalCluster":e.visible===!1?this.crossRenderer.hideCrosses():this.crossRenderer.showCluster();break}return{status:0,message:"ok"}}async locateSignalControlArea(e){switch(e.type){case"district":return await this.districtRenderer.locateDistrict(e.id);case"subDistrict":return await this.subDistrictRenderer.locateSubDistrict(e.id);case"signal":return await this.signalRenderer.locateSignal(e.id);default:return{status:1,message:"未知类型"}}}async highlightSignalControlArea(e){switch(this.view.closePopup(),e.type){case"district":return await this.districtRenderer.highlightDistrict(e)?(this.subDistrictRenderer.filter(e),this.crossRenderer.filter(e),await this.subDistrictRenderer.showRoads(e),{status:0,message:"ok"}):{status:1,message:"未找到区控"};case"subDistrict":{const{count:t,parentId:s}=await this.subDistrictRenderer.highlightSubDistrict(e);return t>0?(this.districtRenderer.filter(s),this.crossRenderer.filter(e),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}case"signal":{const{districtId:t,subDistrictId:s,count:i}=await this.signalRenderer.highlightSignal(e.id);return i>0?(this.districtRenderer.filter(t),this.subDistrictRenderer.filter(e),{status:0,message:"ok"}):{status:1,message:"未找到信号机"}}default:return{status:1,message:"未知类型"}}}async resetHighlight(){return this.districtRenderer.resetFilter(),this.subDistrictRenderer.resetFilter(),this.crossRenderer.resetFilter(),{status:0,message:"ok"}}}exports.default=u;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class S{constructor(t){this.iconSymbolScale=1e4,this.largeMarkerScale=4e4,this.oldScale=0,this.showName="detail",this.showStyle="scatter",this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusteredLocations=[],this.locations=[],this.view=t,this.crossLayer=new p({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}didCrossScaleThreshold(t,s,i){return t<i&&s>=i||t>=i&&s<i}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(t=>{const s=this.view.toScreen(new u.Point({x:t.x,y:t.y}));s.x>0&&s.y>0&&(t.properties.screenX=s.x,t.properties.screenY=s.y,t.visited=!1,t.clusterId=void 0,this.clusteredLocations.push(t))})}showSignalCross(t){if(this.crossLayer.removeAll(),this.showName=t.showName||"detail",this.showStyle=t.style||"scatter",this.oldScale=this.view.scale,this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("stationary",()=>{if(this.showStyle==="scatter"){const s=this.view.scale,i=this.didCrossScaleThreshold(this.oldScale,s,this.iconSymbolScale),e=this.didCrossScaleThreshold(this.oldScale,s,this.largeMarkerScale);(i||e)&&this.updateScatterSymbol(),this.oldScale=s}else{this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}})),this.showStyle==="scatter"){const s=[],i=[];t.points.forEach(e=>{const r=this.getCrossSymbol(e),o=this.getBrandLabel(e.brand),n=this.getOnlineLabel(e.isOnline),l=this.getMalfunctionLabel(e.isMalfunction),a=new y({geometry:{type:"point",longitude:e.x,latitude:e.y},symbol:r,attributes:{type:"signal-cross",id:e.crossId,brandLabel:o,isOnlineLabel:n,isMalfunctionLabel:l,...e}});e.isMalfunction===!0||e.isOnline===!1?i.push(a):s.push(a)}),this.crossLayer.addMany(s),this.crossLayer.addMany(i)}else{this.locations=t.points.map(i=>({id:i.crossId,x:i.x,y:i.y,visited:!1,clusterId:void 0,properties:i})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}return{status:0,message:"ok"}}clearSignalCross(){var t;this.crossLayer.removeAll(),(t=this.scaleWatchHandle)==null||t.remove(),this.scaleWatchHandle=null}changeShowName(t){this.showName=t,this.showStyle==="scatter"&&this.updateScatterSymbol()}updateScatterSymbol(){this.crossLayer.graphics.forEach(t=>{t.symbol=this.getCrossSymbol(t.attributes)})}doPixelCluster(t){let s=0;for(let i=0;i<this.clusteredLocations.length;i++){const e=this.clusteredLocations[i];if(e.visited)continue;e.visited=!0;const r=this.getNeighbors(e,t);r.length<this.minClusterPoints?e.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=s}),e.clusterId=s,s++)}return this.createClusters()}getNeighbors(t,s){return this.clusteredLocations.filter(i=>i.id===t.id||i.visited?!1:this.getDistance(t,i)<=s)}getDistance(t,s){return Math.sqrt(Math.pow(t.properties.screenX-s.properties.screenX,2)+Math.pow(t.properties.screenY-s.properties.screenY,2))}createClusters(){const t={},s=[];for(const e of this.clusteredLocations)e.clusterId===void 0||e.clusterId===-1?s.push(e):(t[e.clusterId]||(t[e.clusterId]=[]),t[e.clusterId].push(e));const i=Object.keys(t).map((e,r)=>{const o=t[Number(e)],n=o.length,l=o.reduce((c,h)=>c+h.x,0),a=o.reduce((c,h)=>c+h.y,0),m=l/n,d=a/n;return{id:Number(e),items:o,count:n,center:{x:m,y:d}}});return s.length>0&&i.push({id:-1,items:s,count:s.length,center:null}),i}showClusterResult(t){this.crossLayer.removeAll();let s=Number.MIN_VALUE,i=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(i=Math.min(i,e.count),s=Math.max(s,e.count))}),t.forEach(e=>{if(e.id!==-1){let r=i===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-i)/(s-i)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(e.count.toString().length*8+6)/2,a=new y({geometry:new u.Point({x:e.center.x,y:e.center.y}),attributes:{count:e.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:r,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(a)}else e.items.forEach(r=>{const o=new y({geometry:new u.Point({x:r.x,y:r.y}),attributes:{...r,...r.properties,type:"signal-cross",id:r.id},symbol:this.getCrossSymbol(r.properties)});this.crossLayer.add(o)})})}getBrandLabel(t){const s=(t??"").toLowerCase();return s==="scats"?"SCATS":s==="gc"?"国产":t??""}getOnlineLabel(t){return t?"在线":"离线"}getMalfunctionLabel(t){return t?"故障":"正常"}getCrossSymbol(t){var s,i;if(this.view.scale<=this.iconSymbolScale){let e="/GisViewerAssets/Images/cross/ic_";return e+=((s=t.brand)==null?void 0:s.toLowerCase())==="scats"?"scats_":"gc_",e+=t.isOnline?"online_":"offline_",e+=t.isMalfunction?"malfunction.png":"normal.png",{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:this.showName==="crossName"?'Replace($feature.name, "与", "/")':this.showName==="signalId"?"$feature.signalId":'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:25,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:20,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:20,rotateClockwise:!0,textureFilter:"Picture",url:e}]}}}}else{const e={type:"simple-marker",style:"circle",size:this.view.scale>this.largeMarkerScale?3:6,outline:{width:1}};return((i=t.brand)==null?void 0:i.toLowerCase())==="scats"?t.isOnline?(e.color=[68,203,188],e.outline.color=[59,176,163]):(e.color=[100,100,100],e.outline.color=[150,150,150]):t.isOnline?(e.color=[129,226,73],e.outline.color=[108,189,61]):(e.color=[100,100,100],e.outline.color=[150,150,150]),e}}}exports.default=S;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@arcgis/core/Graphic"),u=require("@arcgis/core/layers/FeatureLayer"),y=require("../common-utils.js"),l=require("./layer-symbol.js");class o{constructor(e){this.view=e,this.signalMarkerLayer=new u(l.signalMarkerLayerOptions),this.signalMarkerLayer.spatialReference=e.spatialReference,this.signalMarkerLayer.popupEnabled=!0,this.signalPictureLayer=new u(l.signalPictureLayerOptions),this.signalPictureLayer.spatialReference=e.spatialReference,this.signalPictureLayer.popupEnabled=!0,this.signalClusterLayer=new u(l.signalClusterLayerOptions),this.signalClusterLayer.spatialReference=e.spatialReference,this.signalClusterLayer.popupEnabled=!0,this.view.map.addMany([this.signalMarkerLayer,this.signalPictureLayer,this.signalClusterLayer])}async showSignals(e){await this.clearSignals();let r=0;const a=[];e.forEach(s=>{s.signals.forEach(i=>{const t=new d({geometry:{type:"point",longitude:i.longitude,latitude:i.latitude},attributes:{ObjectID:r++,id:i.id,name:i.name,signalId:i.signalId,nodeId:i.nodeId||i.id,districtId:s.id,districtName:s.name,subDistrictId:"",subDistrictName:"",isKey:i.isKey,type:"signal",selected:!0}});a.push(t)}),s.subDistricts.forEach(i=>{i.signals.forEach(t=>{const n=new d({geometry:{type:"point",longitude:t.longitude,latitude:t.latitude},attributes:{ObjectID:r++,id:t.id,name:t.name,signalId:t.signalId,nodeId:t.nodeId||t.id,districtId:s.id,districtName:s.name,subDistrictId:i.id,subDistrictName:i.name,isKey:t.isKey,type:"signal",selected:!0}});a.push(n)})})}),await this.signalMarkerLayer.applyEdits({addFeatures:a}),await this.signalPictureLayer.applyEdits({addFeatures:a}),await this.signalClusterLayer.applyEdits({addFeatures:a})}async clearSignals(){let 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"}async setPointVisible(e){this.signalMarkerLayer.visible=e,this.signalPictureLayer.visible=e}setClusterVisible(e){this.signalClusterLayer.visible=e}async locateSignal(e){return{status:0,message:"ok"}}async highlightSignal(e){let r="",a="";const s=this.signalMarkerLayer.definitionExpression;this.signalMarkerLayer.definitionExpression=`signalId = '${e}'`;const i=await this.signalMarkerLayer.queryFeatures(),t=i.features.length;if(t>0){const n=i.features[0].attributes.districtId||"",c=i.features[0].attributes.subDistrictId||"";return await y.default.viewGoto(this.view,i.features),{districtId:n,subDistrictId:c,count:t}}else this.signalMarkerLayer.definitionExpression=s;return{districtId:r,subDistrictId:a,count:t}}filter(e){const{id:r,type:a}=e,s=`${a==="district"?"districtId":"subDistrictId"} = '${r}'`;this.signalClusterLayer.definitionExpression=s,this.signalMarkerLayer.definitionExpression=s,this.signalPictureLayer.definitionExpression=s}resetFilter(){const e="1=1";this.signalClusterLayer.definitionExpression=e,this.signalMarkerLayer.definitionExpression=e,this.signalPictureLayer.definitionExpression=e}}exports.default=o;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@arcgis/core/Graphic"),w=require("@arcgis/core/layers/FeatureLayer"),D=require("../common-utils.js"),I=require("./layer-symbol.js");class P{constructor(t){this.roadConnections=[],this.view=t,this.subDistrictPointLayer=new w(I.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=t.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new w(I.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=t.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(t){var n;await this.clearSubDistricts(),(n=this.clickHandler)==null||n.remove(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const i=[],r=[];t.forEach(e=>{e.roadConnections.length>0&&this.roadConnections.push(...e.roadConnections),r.push({value:e.id,label:e.name,symbol:{type:"simple-marker",style:"circle",color:[...e.areaColor,.8],size:"8px",outline:{color:[...e.areaColor],width:4}}}),e.signals.forEach(a=>{const d=new m({geometry:{type:"point",longitude:a.longitude,latitude:a.latitude},attributes:{ObjectID:s++,id:a.nodeId,name:a.name,subDistrictId:e.id,subDistrictName:e.name,districtId:e.parentId,districtName:e.parentName,signalCount:e.signalCount,color:e.areaColor.join(","),type:"subDistrict"}});i.push(d)})}),this.subDistrictPointLayer.renderer={type:"simple",symbol:{type:"simple-marker",color:[23,151,255,.8],size:"8px",outline:{color:"white",width:1}}},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:i}),await D.default.viewGoto(this.view,i)}async showRoads(t){const{type:s,id:i}=t,r=this.subDistrictPointLayer.createQuery(),n=s==="district"?"districtId":"subDistrictId";i!==""?r.where=`${n} = '${i}'`:r.where="1=1";const e=await this.subDistrictPointLayer.queryFeatures(r),a=new Map;e.features.forEach(o=>{var p;const{subDistrictId:u,color:c,id:h,districtName:y,subDistrictName:f,signalCount:b}=o.attributes;a.has(u)||a.set(u,{color:c,signalIds:[],districtName:y,subDistrictName:f,signalCount:b}),(p=a.get(u))==null||p.signalIds.push(h)});const d=[],L=[];for(const o of a){let u=0;const c=o[0];d.push({value:c,symbol:{type:"simple-line",color:o[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:h,subDistrictName:y,signalIds:f,signalCount:b}=o[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const g=new m({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:u++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:y,districtName:h,signalCount:b,color:o[1].color}});L.push(g)})}this.subDistrictLineLayer.renderer={type:"simple",symbol:{type:"simple-line",color:[23,151,255],width:2}},this.currentLineRenderer=this.subDistrictLineLayer.renderer.clone(),await this.subDistrictLineLayer.applyEdits({addFeatures:L})}async clearSubDistricts(){var i;const t=await this.subDistrictPointLayer.queryFeatures();t.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:t.features}),this.subDistrictPointLayer.definitionExpression="1=1";const s=await this.subDistrictLineLayer.queryFeatures();s.features.length>0&&await this.subDistrictLineLayer.applyEdits({deleteFeatures:s.features}),this.subDistrictLineLayer.definitionExpression="1=1",this.roadConnections=[],(i=this.clickHandler)==null||i.remove()}setVisible(t){this.showRoads({type:"district",id:""}),this.subDistrictPointLayer.visible=t,this.subDistrictLineLayer.visible=t}async locateSubDistrict(t){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${t}'`,s.returnGeometry=!0;const i=await this.subDistrictPointLayer.queryFeatures(s);return i.features.length>0?(await D.default.viewGoto(this.view,i.features,!1),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(t){let s="";const i=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${t.id}'`;const r=await this.subDistrictPointLayer.queryFeatures(),n=r.features.length;return n>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${t.id}'`,s=r.features[0].attributes.districtId,await D.default.viewGoto(this.view,r.features,t.needZoom!==!1)):this.subDistrictPointLayer.definitionExpression=i,{count:n,parentId:s}}filter(t){const{type:s,id:i}=t,r=`${s==="district"?"districtId":"subDistrictId"} = '${i}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(t){var r;const i=(r=(await this.view.hitTest(t,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(n=>n.type==="graphic");if(i.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const n=i[0].graphic,e=n.attributes.color.split(",").map(Number);this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",style:"circle",color:[0,0,0,0],size:"8px",outline:{color:[180,180,180,.5],width:4}},defaultLabel:"其他子区",uniqueValueInfos:[{value:n.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...e,.8],size:"8px",outline:{color:e,width:4}}}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:n.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:n.attributes.color.split(",").map(Number),width:"8px"}}]}}}}exports.default=P;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer"),o=require("../common-utils.js");class h{constructor(e){this.view=e,this.signalSystemLayer=new n({title:"信控系统图层"}),this.view.map.add(this.signalSystemLayer)}async showSignalSystems(e){return e.areaList.forEach(s=>{this.showSystem(s)}),await o.default.viewGoto(this.view,this.signalSystemLayer.graphics.toArray()),{status:0,message:"success"}}async showSubSignalSystems(e){return e.areaList.forEach(s=>{this.showSubSystem(s)}),await o.default.viewGoto(this.view,this.signalSystemLayer.graphics.toArray()),{status:0,message:"success"}}removeSubSignalSystems(e){return e?this.signalSystemLayer.graphics.filter(s=>s.getAttribute("subCode")===e).forEach(s=>{this.signalSystemLayer.remove(s)}):this.signalSystemLayer.removeAll(),{status:0,message:"success"}}removeSignalSystems(e){return e?this.signalSystemLayer.graphics.filter(s=>s.getAttribute("areaCode")===e).forEach(s=>{this.signalSystemLayer.remove(s)}):this.signalSystemLayer.removeAll(),{status:0,message:"success"}}showSystem(e){if(e.shape){let s;if(typeof e.shape=="string"?s=JSON.parse(e.shape):s=e.shape,s){const t=new i({geometry:{type:"polyline",paths:[s]},symbol:e.lineSymbol||{type:"simple-line",style:"dash",color:[17,113,191],width:2},attributes:{areaCode:e.areaCode,type:"signal-system-border"}});this.signalSystemLayer.add(t)}}e.children.forEach(s=>{this.showSubSystem(s,e.areaCode)})}showSubSystem(e,s){if(e.subShape){let t;typeof e.subShape=="string"?t=JSON.parse(e.subShape):t=e.subShape;const a=t.map((r,l)=>new i({geometry:{type:"polyline",paths:[r]},symbol:e.roadSymbol||{type:"simple-line",color:[23,151,255],width:3},attributes:{type:"signal-sub-system",id:e.subAreaCode+"_"+l,subCode:e.subAreaCode,areaCode:s||""}}));this.signalSystemLayer.addMany(a)}if(e.children){const t=e.children.map(a=>new i({geometry:{type:"point",longitude:a.x,latitude:a.y},symbol:a.symbol||e.nodeSymbol||{type:"simple-marker",color:[23,151,255,.8],size:10,outline:{color:[23,151,255],width:2}},attributes:{...a,type:"signal-sub-system-node",subCode:e.subAreaCode,areaCode:s||""}}));this.signalSystemLayer.addMany(t)}}}exports.default=h;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/geometry/geometryEngine.js"),u=require("@arcgis/core/geometry/Polyline.js"),M=require("@arcgis/core/geometry/support/webMercatorUtils.js"),m=require("@arcgis/core/Graphic.js"),f=require("@arcgis/core/layers/GraphicsLayer"),b=require("@arcgis/core/widgets/Sketch"),L=require("@arcgis/core/widgets/Sketch/SketchViewModel"),D=require("@turf/turf");function g(d){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>d[e]})}}return t.default=d,Object.freeze(t)}const w=g(P),p=g(M),h=g(D),k={maxAllowedGraphics:0,GraphicsLayer:{},sketchVisibleElements:{},sketchPosition:"top-left",defaultSketchVisible:!0,sketchViewModelItemSymbol:{}},G={type:"simple-line",color:"#556DEA",width:2},S={type:"simple-fill",color:[227,139,79,.4],outline:{color:[255,255,255],width:1}};class T{constructor(t,e){this.isDraw=!1,this.drawStartGraphicId=null,this.drawPointGraphic=new Map,this.dimensionType=null,this.viewer=t,this.options={...k,...e},this.graphicsLayer=new f({...this.options.GraphicsLayer}),this.textGraphicsLayer=new f,this.viewer.map.layers.add(this.graphicsLayer),this.viewer.map.layers.add(this.textGraphicsLayer),this.init()}init(){this.sketchViewModel=new L({layer:this.graphicsLayer,view:this.viewer,updateOnGraphicClick:!0,polylineSymbol:G,polygonSymbol:S,...this.options.sketchViewModelItemSymbol});const t=this.findLayerById("TrafficToolMarkings"),e=[];t&&e.push({layer:t,enabled:!0}),this.sketch=new b({view:this.viewer,viewModel:this.sketchViewModel,layer:this.graphicsLayer,visible:this.options.defaultSketchVisible,snappingOptions:{enabled:!0,featureSources:e}}),this.sketch.visibleElements={...this.options.sketchVisibleElements},this.viewer.ui.add(this.sketch,this.options.sketchPosition);const i=this;this.viewer.on("pointer-move",function(s){const r={x:s.x,y:s.y};if(i.isDraw&&i.dimensionType=="distance"){i.tipsDom||(i.tipsDom=i.createDom());const o=i.getDrawGraphicLength();i.tipsDom.innerText=`${o}米`,i.tipsDom.style.left=`${r.x}px`,i.tipsDom.style.top=`${r.y+3}px`,i.tipsDom.style.pointerEvents="none"}})}on(t){const e=this;this.sketch.on("create",function(i){e.onCreate(i,t)}),this.sketch.on("update",function(i){e.onUpdate(i,t)}),this.sketch.on("delete",function(i){e.onDelete(i,t)}),this.sketch.on("redo",function(i){console.log("redo",i),t&&t("redo","complete",i)}),this.sketch.on("undo",function(i){console.log("undo",i),t&&t("undo","complete",i)})}onCreate(t,e){if(console.log("create",t),this.drawStartGraphicId||(this.drawStartGraphicId=new Date().getTime().toString()),t.graphic.getAttribute("id")||(t.graphic.setAttribute("type","draw"),t.graphic.setAttribute("id",this.drawStartGraphicId)),t.state==="start"&&t.graphic.geometry.type==="polyline"&&(this.isDraw=!0,this.drawStartGraphic=p.webMercatorToGeographic(t.graphic.geometry),this.dimensionType=="distance")){const i=this.getGeometryXY(this.drawStartGraphic,0),s=`${this.drawStartGraphicId}-start`;this.addOrUpdateMarkPoint("起点",i,s)}if(t.state==="active"&&t.graphic.geometry.type==="polyline"){const i=p.webMercatorToGeographic(t.graphic.geometry),s=this.drawStartGraphicId;this.dimensionType=="distance"&&(this.drawPolylinePoint(i,s),this.drawStartGraphic=i)}if(t.state==="complete"&&t.graphic.geometry.type==="polyline"&&this.dimensionType=="distance"){const i=this.getDrawGraphicLength(),s=`${this.drawStartGraphicId}-end`,r=p.webMercatorToGeographic(t.graphic.geometry),o=r.paths[0],n=this.getGeometryXY(r,o.length-1);this.addOrUpdateMarkPoint(`总长度:${i}米`,n,s),this.drawStartGraphic=null,this.removeDom(),this.isDraw=!1,this.drawStartGraphicId=null}t.state==="cancel"&&t.graphic.geometry.type==="polyline"&&this.onCreateToCancel(),e&&e("create",t.state,t.graphic)}onCreateToCancel(){this.removeDom(),this.isDraw=!1,this.drawStartGraphic=null;const t=this.drawStartGraphicId;this.drawPointGraphic.forEach((e,i)=>{new RegExp(`^${t}-`).test(i)&&(this.textGraphicsLayer.remove(e),this.drawPointGraphic.delete(i))}),this.drawStartGraphicId=null}onUpdate(t,e){console.log("update",t),this.updatePolylinePoint(t.graphics.filter(i=>i.geometry.type==="polyline")),e&&e("update",t.state,t.graphics)}onDelete(t,e){console.log("delete",t),this.deletePolylinePoint(t.graphics.filter(i=>i.geometry.type==="polyline")),e&&e("delete","complete",t.graphics)}addPolyline(t){const e=[],i={type:"draw",id:new Date().getTime().toString()};t.map(s=>{e.push(this.createPolylineGraphic(s,G,{...i}))}),this.graphicsLayer.addMany(e)}createPolylineGraphic(t,e,i){const s=new u({paths:[t]}),r=p.geographicToWebMercator(s);return new m({geometry:r,symbol:e,attributes:i})}createDom(){const t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.width="100px",t.style.height="80px",t.style.zIndex="999",t.style.display="flex",t.style.justifyContent="center",t.style.alignItems="center",t.style.color="#fff",t.style.fontSize="20px",t.style.fontWeight="bold",t.innerText="";const e=document.getElementsByClassName("esri-view-root");if(e.length>0)return e[0].appendChild(t),t}removeDom(){this.tipsDom&&(this.tipsDom.remove(),this.tipsDom=null)}sketchCreate(t,e){this.sketchViewModel.create(t,e)}sketchCancel(){this.sketchViewModel.cancel()}getCalculateDistance(t="meters"){const e=[];return this.graphicsLayer.graphics.map(i=>{i.geometry.type==="polyline"&&e.push(this.calculateDistance(i.geometry,t))}),e}getCalculateHeading(t="north"){const e=[];return this.graphicsLayer.graphics.map(i=>{i.geometry.type==="polyline"&&e.push(this.calculateHeading(i.geometry,t))}),e}getAllPolylineGraphicPath(t="meters"){const e=[];return this.graphicsLayer.graphics.map(i=>{i.geometry.type==="polyline"&&e.push({paths:p.webMercatorToGeographic(i.geometry).paths[0],distance:this.calculateDistance(i.geometry,t)})}),e}close(){this.sketch.visible=!1}show(){this.sketch.visible=!0}removeAll(){this.graphicsLayer.removeAll(),this.textGraphicsLayer.removeAll(),this.drawPointGraphic.clear()}calculateDistance(t,e="meters"){return w.geodesicLength(t,e)}calculateHeading(t,e="north"){const s=p.webMercatorToGeographic(t).paths[0];return this.calculatePointHeading(s,e)}calculatePointHeading(t,e="north"){const i={longitude:t[0][0],latitude:t[0][1]},s={longitude:t[t.length-1][0],latitude:t[t.length-1][1]},r=i.longitude,o=i.latitude,n=s.longitude,a=s.latitude,c=n-r,y=Math.sin(c)*Math.cos(a),x=Math.cos(o)*Math.sin(a)-Math.sin(o)*Math.cos(a)*Math.cos(c);let l=(Math.atan2(y,x)*(180/Math.PI)+360)%360;return e==="east"?l=(l+90)%360:e==="south"?l=(l+180)%360:e==="west"&&(l=(l+270)%360),l}drawPolylinePoint(t,e,i="add"){const s=t==null?void 0:t.paths[0],r=[];for(let o=0;o<s.length-1;o++){const n=s[o];r.push([...n]);const a={x:n[0],y:n[1]};if(o==0){i=="update"&&this.addOrUpdateMarkPoint("起点",a,`${e}-start`);continue}const c=`${e}-${o+1}`,y=this.getPointLength(r,"meters");this.addOrUpdateMarkPoint(`${y.toFixed(2)}米`,a,c)}if(i=="update"&&s.length>1){const o=this.getGeometryXY(t,s.length-1);r.push([o.x,o.y]);const n=this.getPointLength(r,"meters");this.addOrUpdateMarkPoint(`总长度:${n.toFixed(2)}米`,o,`${e}-end`)}}updatePolylinePoint(t){for(let e=0;e<t.length;e++){console.log(t[e]);const i=t[e].getAttribute("id"),s=p.webMercatorToGeographic(t[e].geometry);this.drawPolylinePoint(s,i,"update")}}deletePolylinePoint(t){var e;for(let i=0;i<t.length;i++){const s=t[i].getAttribute("id"),r=`${s}-start`,o=`${s}-end`,n=[r,o];(e=t[i].geometry)==null||e.paths[0].map((a,c)=>{n.push(`${s}-${c+1}`)}),n.map(a=>{const c=this.drawPointGraphic.get(a);c&&(this.textGraphicsLayer.remove(c),this.drawPointGraphic.delete(a))})}}addOrUpdateMarkPoint(t,e,i,s={}){if(this.drawPointGraphic.has(i)){const o=this.drawPointGraphic.get(i);this.textGraphicsLayer.remove(o);const n=this.createTextGraphic(t,e,{...s,id:i});this.drawPointGraphic.set(i,n),this.textGraphicsLayer.add(n);return}const r=this.createTextGraphic(t,e,{...s,id:i});this.drawPointGraphic.set(i,r),this.textGraphicsLayer.add(r)}getGeometryXY(t,e=0){const i=t==null?void 0:t.paths[0];return{x:i[e][0],y:i[e][1]}}createTextGraphic(t,e,i={}){return new m({geometry:{type:"point",x:e.x,y:e.y},symbol:{type:"text",text:t,color:"white",haloColor:"black",haloSize:"1px",xoffset:3,yoffset:3},attributes:{...i}})}getDrawGraphicLength(){return this.drawStartGraphic?this.calculateDistance(this.drawStartGraphic,"meters").toFixed(2):0}getAngle(t,e){const i=e.x-t.x,s=e.y-t.y;return Math.atan2(s,i)*180/Math.PI}getBearing(t,e){return h.bearing(h.point([t.x,t.y]),h.point([e.x,e.y]))}getPointLength(t,e="meters"){const i=new u({paths:[t]});return w.geodesicLength(i,e)}featureCollection(t){const e=h.featureCollection(t.map(s=>h.point([s.x,s.y])));return h.center(e)}midpoint(t,e){return h.midpoint(h.point([t.x,t.y]),h.point([e.x,e.y]))}getDirection(t,e){const i=e.x-t.x,s=e.y-t.y,o=Math.atan2(s,i)*180/Math.PI;return o>=-45&&o<=45?0:o>45&&o<=135?1:o>135||o<=-135?2:3}findLayerById(t){return this.viewer.map.findLayerById(t)}turnOnLayerSnap(){this.sketchViewModel.snappingOptions.enabled=!0}turnOffLayerSnap(){this.sketchViewModel.snappingOptions.enabled=!1}setDimensionType(t){this.dimensionType=t}remove(t){this.graphicsLayer.remove(t)}destroy(){var t,e;this.viewer.map.remove(this.graphicsLayer),this.viewer.map.remove(this.textGraphicsLayer),(t=this.sketch)==null||t.destroy(),(e=this.sketchViewModel)==null||e.destroy()}}exports.default=T;
@@ -0,0 +1,50 @@
1
+ import { default as OlMap } from 'ol/Map';
2
+ import type { EventsKey } from 'ol/events';
3
+ import { ILayerVisibleParams, ISetMapCameraParams, ISetMapCenterParams, IShowSignalCrossParams } from '../types';
4
+ import OlMapInitializer from './utils/ol-map-initializer';
5
+ import SignalCrossController from './utils/signal-control/signal-cross-controller';
6
+ declare const _sfc_main: import("vue").DefineComponent<{
7
+ config: {
8
+ type: StringConstructor;
9
+ required: true;
10
+ };
11
+ assetsRoot: {
12
+ type: StringConstructor;
13
+ required: false;
14
+ };
15
+ }, {
16
+ mapContainer: import("vue").Ref<any>;
17
+ mapInitializer: OlMapInitializer;
18
+ map: OlMap;
19
+ viewEventKeys: EventsKey[];
20
+ lastEmittedZoomInt: number | null;
21
+ emitZoomIfChanged: (z: number) => void;
22
+ signalCrossController: SignalCrossController;
23
+ setMapCenter: (params: ISetMapCenterParams) => Promise<import("../types").IResult>;
24
+ setMapCamera: (params: ISetMapCameraParams) => Promise<import("../types").IResult>;
25
+ setLayerVisibility: (params: ILayerVisibleParams) => Promise<import("../types").IResult>;
26
+ setMapZoom: (zoom: number) => import("../types").IResult;
27
+ showSignalCross: (params: IShowSignalCrossParams) => import("../types").IResult;
28
+ changeSignalCrossShowName: (showName: 'detail' | 'crossName' | 'signalId') => void | {
29
+ success: boolean;
30
+ message: string;
31
+ };
32
+ clearSignalCross: () => void;
33
+ props: any;
34
+ emit: (event: "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", ...args: any[]) => void;
35
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick" | "update:zoom")[], "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
36
+ config: {
37
+ type: StringConstructor;
38
+ required: true;
39
+ };
40
+ assetsRoot: {
41
+ type: StringConstructor;
42
+ required: false;
43
+ };
44
+ }>> & {
45
+ onMapLoaded?: ((...args: any[]) => any) | undefined;
46
+ onMarkerClick?: ((...args: any[]) => any) | undefined;
47
+ onMapClick?: ((...args: any[]) => any) | undefined;
48
+ "onUpdate:zoom"?: ((...args: any[]) => any) | undefined;
49
+ }, {}, {}>;
50
+ export default _sfc_main;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),x=require("ol/Observable"),z=require("../stores/index.js"),E=require("./utils/ol-map-initializer.js"),I=require("./utils/signal-control/signal-cross-controller.js"),V={class:"gis-viewer"},B=t.defineComponent({__name:"gis-map-ol",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(C,{expose:d,emit:f}){const l=t.ref(null);let s,a,r=[],c=null;const u=e=>{if(!Number.isFinite(e))return;const n=Math.round(e);n!==c&&(c=n,i("update:zoom",n))};let o;t.onMounted(async()=>{z.registerStore();const e=t.getCurrentInstance(),{$gisviewerAssetsRoot:n}=e.appContext.config.globalProperties,p=await(await fetch(m.config)).json();p.assetsRoot=m.assetsRoot||n,s=new E.default,a=s.initialize({container:l.value,mapConfig:p,markerClickCallback:(_,b,Z,q)=>{i("markerClick",_,b,Z,q)}});const g=a.getView();r.push(g.on("change:resolution",()=>{u(g.getZoom())})),u(a.getView().getZoom()),i("mapLoaded")});const w=async e=>await s.setMapCenter(e),h=async e=>await s.setMapCamera(e),v=async e=>await s.setLayerVisibility(e),y=e=>s.setMapZoom({zoom:e}),M=e=>(o||(o=new I.default(a)),o.showSignalCross(e)),k=e=>o?o.changeShowName(e):{success:!1,message:"SignalCrossController未初始化"},S=()=>{o&&o.clearSignalCross()};t.onBeforeUnmount(()=>{r.forEach(e=>x.unByKey(e)),r=[]});const m=C,i=f;return d({setMapCenter:w,setMapCamera:h,setMapZoom:y,setLayerVisibility:v,showSignalCross:M,clearSignalCross:S,changeSignalCrossShowName:k}),(e,n)=>(t.openBlock(),t.createElementBlock("div",V,[t.createElementVNode("div",{id:"divCMap",class:"gis-viewer-main",ref_key:"mapContainer",ref:l},null,512)]))}});exports.default=B;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="";exports.default=e;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./gis-map-ol.vue.js");require("./gis-map-ol.vue2.js");exports.default=e.default;
@@ -1,2 +1,45 @@
1
- export declare const GisMapOl: any;
1
+ export declare const GisMapOl: import("@easyest/utils/dist/lib/withinstall").SFCWithInstall<import("vue").DefineComponent<{
2
+ config: {
3
+ type: StringConstructor;
4
+ required: true;
5
+ };
6
+ assetsRoot: {
7
+ type: StringConstructor;
8
+ required: false;
9
+ };
10
+ }, {
11
+ mapContainer: import("vue").Ref<any>;
12
+ mapInitializer: import("./utils/ol-map-initializer").default;
13
+ map: import("ol/Map").default;
14
+ viewEventKeys: import("ol/events").EventsKey[];
15
+ lastEmittedZoomInt: number | null;
16
+ emitZoomIfChanged: (z: number) => void;
17
+ signalCrossController: import("./utils/signal-control/signal-cross-controller").default;
18
+ setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
19
+ setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
20
+ setLayerVisibility: (params: import("../types").ILayerVisibleParams) => Promise<import("../types").IResult>;
21
+ setMapZoom: (zoom: number) => import("../types").IResult;
22
+ showSignalCross: (params: import("../types").IShowSignalCrossParams) => import("../types").IResult;
23
+ changeSignalCrossShowName: (showName: "detail" | "crossName" | "signalId") => void | {
24
+ success: boolean;
25
+ message: string;
26
+ };
27
+ clearSignalCross: () => void;
28
+ props: any;
29
+ emit: (event: "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", ...args: any[]) => void;
30
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick" | "update:zoom")[], "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
31
+ config: {
32
+ type: StringConstructor;
33
+ required: true;
34
+ };
35
+ assetsRoot: {
36
+ type: StringConstructor;
37
+ required: false;
38
+ };
39
+ }>> & {
40
+ onMapLoaded?: ((...args: any[]) => any) | undefined;
41
+ onMarkerClick?: ((...args: any[]) => any) | undefined;
42
+ onMapClick?: ((...args: any[]) => any) | undefined;
43
+ "onUpdate:zoom"?: ((...args: any[]) => any) | undefined;
44
+ }, {}, {}>>;
2
45
  export default GisMapOl;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("@easyest/utils"),u=require("./gis-map-ol.vue.js");require("./gis-map-ol.vue2.js");const e=t.withInstall(u.default);exports.GisMapOl=e;exports.default=e;
@@ -0,0 +1,28 @@
1
+ import { default as OlMap } from 'ol/Map';
2
+ import { ILayerVisibleParams, IMapInitializerParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
3
+ export default class OlMapInitializer {
4
+ private mapConfig;
5
+ private map;
6
+ private mapView;
7
+ private markerClick;
8
+ initialize(params: IMapInitializerParams): OlMap;
9
+ private processUrl;
10
+ private loadLayers;
11
+ private createMap;
12
+ /**
13
+ * 设置地图中心点和缩放级别
14
+ * @param params
15
+ * @returns
16
+ */
17
+ setMapCenter(params: ISetMapCenterParams): Promise<IResult>;
18
+ setMapZoom(params: {
19
+ zoom: number;
20
+ }): IResult;
21
+ /**
22
+ * 设置地图预存的相机视图
23
+ * @param params
24
+ * @returns
25
+ */
26
+ setMapCamera(params: ISetMapCameraParams): Promise<IResult>;
27
+ setLayerVisibility(params: ILayerVisibleParams): Promise<IResult>;
28
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("ol/layer/Tile"),m=require("ol/Map");require("ol/ol.css");const h=require("ol/proj"),c=require("ol/source"),p=require("ol/tilegrid"),l=require("ol/tilegrid/WMTS"),d=require("ol/View");class g{constructor(){this.mapConfig={}}initialize(e){return this.mapConfig=e.mapConfig||{},this.markerClick=e.markerClickCallback,this.map=this.createMap(e.container),this.mapConfig.baseLayers&&this.loadLayers(this.mapConfig.baseLayers),this.map}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}loadLayers(e){if(!this.map)return;const i=1/0,r=16384;e.forEach(t=>{var o,a;(o=t.source)!=null&&o.url&&(t.source.url=this.processUrl(t.source.url));let s;switch(t.type){case"gwc-wms":{s=new n({preload:i,cacheSize:r,source:new c.TileWMS({...t.source,tileGrid:new p.TileGrid({...t.source.tileGrid})}),...t.options});break}case"wmts":{s=new n({preload:i,cacheSize:r,source:new c.WMTS({...t.source,tileGrid:new l({...t.source.tileGrid}),projection:new h.Projection({code:t.source.projection||"EPSG:4326"})}),...t.options});break}}s&&(s.set("id",t.id),(a=this.map)==null||a.addLayer(s))})}createMap(e){const i=this.mapConfig.view;this.mapView=new d({...i}),this.mapConfig.camera?this.mapConfig.camera.home=i:this.mapConfig.camera={home:i};const r=new m({target:e,view:this.mapView});return r.on("pointermove",t=>{if(t.dragging)return;const s=r.hasFeatureAtPixel(t.pixel),o=r.getTargetElement();o&&(o.style.cursor=s?"pointer":"")}),r.on("click",t=>{const s=r.forEachFeatureAtPixel(t.pixel,o=>o);if(s&&this.markerClick){const o=s.get("type")??"",a=s.get("id")??"",u=s.getProperties();this.markerClick(o,a,u,t)}}),r}async setMapCenter(e){return this.map?new Promise(i=>{e.duration&&e.duration>0?this.mapView.animate({center:e.center||this.mapView.getCenter(),zoom:e.zoom||this.mapView.getZoom(),duration:e.duration*1e3},()=>{i({status:0,message:"成功"})}):(e.zoom&&this.mapView.setZoom(e.zoom),e.center&&this.mapView.setCenter(e.center),i({status:0,message:"成功"}))}):{status:-1,message:"地图未初始化"}}setMapZoom(e){return this.map?(this.mapView.setZoom(e.zoom),{status:0,message:"成功"}):{status:-1,message:"地图未初始化"}}async setMapCamera(e){if(!this.map)return{status:-1,message:"地图未初始化"};const i=this.mapConfig.camera[e.name];return i?await this.setMapCenter({center:i.center,zoom:e.zoom||i.zoom,duration:e.duration||0}):{status:-1,message:`未找到名称为 ${e.name} 的相机视图`}}async setLayerVisibility(e){const i=this.map.getLayers().getArray().find(r=>r.get("id")===e.id);return i?(i.setVisible(e.visible),{status:0,message:"成功"}):{status:-1,message:`未找到ID为 ${e.id} 的图层`}}}exports.default=g;
@@ -0,0 +1,42 @@
1
+ import { default as OlMap } from 'ol/Map';
2
+ import { IResult, IShowSignalCrossParams } from '../../../types';
3
+ export default class SignalCrossController {
4
+ private map;
5
+ private crossLayer;
6
+ private source;
7
+ private view;
8
+ private showName;
9
+ private showStyle;
10
+ private viewChangeKey;
11
+ private mapMoveKey;
12
+ private resolutionChangeTimeout;
13
+ private readonly clusterRadius;
14
+ private readonly minClusterPoints;
15
+ private readonly maxClusterSymbolSize;
16
+ private readonly minClusterSymbolSize;
17
+ private clusteredLocations;
18
+ private locations;
19
+ constructor(map: OlMap);
20
+ showSignalCross(params: IShowSignalCrossParams): IResult;
21
+ private calculateCluster;
22
+ clearSignalCross(): void;
23
+ changeShowName(showName: string): void;
24
+ private updateScatterSymbol;
25
+ /**
26
+ * 配置矢量图层样式:复用 Icon,并为不同 feature 渲染不同 Text。
27
+ * - 使用 resolution 判断是否显示文字(在指定缩放级别后才显示)
28
+ * - 使用缓存避免每次渲染都创建新的 Style/Icon/数组对象
29
+ */
30
+ private configureVectorLayerStyle;
31
+ private createCrossFeature;
32
+ private getClusterStyle;
33
+ private getBrandLabel;
34
+ private getOnlineLabel;
35
+ private getMalfunctionLabel;
36
+ private locationToScreen;
37
+ private doPixelCluster;
38
+ private getNeighbors;
39
+ private getDistance;
40
+ private createClusters;
41
+ private showClusterResult;
42
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("ol/Feature"),v=require("ol/geom/Point"),X=require("ol/layer/Vector"),E=require("ol/Observable"),Y=require("ol/source/Vector"),V=require("ol/style/Circle"),f=require("ol/style/Fill"),F=require("ol/style/Icon"),b=require("ol/style/Stroke"),g=require("ol/style/Style"),K=require("ol/style/Text");class k{constructor(e){this.showName="detail",this.showStyle="scatter",this.viewChangeKey=null,this.mapMoveKey=null,this.resolutionChangeTimeout=null,this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusteredLocations=[],this.locations=[],this.map=e,this.view=e.getView(),this.source=new Y,this.crossLayer=new X({source:this.source}),this.crossLayer.set("id","signal-control-cross-layer"),this.map.addLayer(this.crossLayer),this.configureVectorLayerStyle()}showSignalCross(e){if(this.source.clear(),this.showName=e.showName||"detail",this.showStyle=e.style||"scatter",this.viewChangeKey||(this.viewChangeKey=this.view.on("change:resolution",()=>{this.showStyle==="cluster"&&(this.resolutionChangeTimeout&&clearTimeout(this.resolutionChangeTimeout),this.resolutionChangeTimeout=setTimeout(()=>{this.calculateCluster(),this.resolutionChangeTimeout=null},150))})),this.mapMoveKey||(this.mapMoveKey=this.map.on("moveend",()=>{this.showStyle==="cluster"&&this.calculateCluster()})),this.showStyle==="scatter"){const s=[],n=[];e.points.forEach(t=>{const o=this.createCrossFeature(t);t.isMalfunction===!0||t.isOnline===!1?n.push(o):s.push(o)}),this.source.addFeatures(s),this.source.addFeatures(n),this.crossLayer.changed()}else this.locations=e.points.map(s=>({id:s.crossId,x:s.x,y:s.y,visited:!1,clusterId:void 0,properties:s})),this.calculateCluster();return{status:0,message:"success"}}calculateCluster(){console.time("cluster"),this.locationToScreen();const e=this.doPixelCluster(this.clusterRadius);this.showClusterResult(e),console.timeEnd("cluster")}clearSignalCross(){this.source.clear(),this.viewChangeKey&&(E.unByKey(this.viewChangeKey),this.viewChangeKey=null),this.mapMoveKey&&(E.unByKey(this.mapMoveKey),this.mapMoveKey=null),this.resolutionChangeTimeout&&(clearTimeout(this.resolutionChangeTimeout),this.resolutionChangeTimeout=null)}changeShowName(e){this.showName=e,this.showStyle==="scatter"&&this.updateScatterSymbol()}updateScatterSymbol(){this.crossLayer.changed()}configureVectorLayerStyle(){const r=this.map.getView(),w=r.getResolutionForZoom(13),S=r.getResolutionForZoom(15),C=r.getResolutionForZoom(17),p=(i,c,l)=>`/GisViewerAssets/Images/cross/ic_${(i??"gc").toLowerCase()==="scats"?"scats":"gc"}_${c===!1?"offline":"online"}_${l?"malfunction":"normal"}.png`,u=new Map,h=new Map,O=new WeakMap,I=new Map,M={gc:"#86efac",scats:"#16a34a"},z=new b({color:"#ffffff",width:1.5}),R=(i,c)=>{const l=M[i]?i:"gc",a=I.get(l);if(a)return a;const d=[new g({image:new V({radius:c>w?3:8,fill:new f({color:M[l]}),stroke:z}),zIndex:1})];return I.set(l,d),d},q=new f({color:"#1f2937"}),P=new b({color:"#ffffff",width:3}),L=i=>{const c=u.get(i);if(c)return c;const l=new g({image:new F({src:i,scale:.5,anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction"}),zIndex:1});return u.set(i,l),l},Z=i=>{const c=h.get(i);if(c)return c;const l=[L(i)];return h.set(i,l),l};this.crossLayer.setStyle((i,c)=>{if((i.get("type")??"")==="signal-cluster")return this.getClusterStyle(i.getProperties());const a=this.showName==="crossName"?i.get("name"):this.showName==="signalId"?i.get("signalId"):`${i.get("name")}(${i.get("signalId")})`,d=i.get("brand")??"gc",x=i.get("isOnline"),T=i.get("isMalfunction"),y=p(d,x,T);if(c>S)return R(d,c);if(c>C)return Z(y);const m=O.get(i);if(m&&m.label===a&&m.iconKey===y)return m.styles;const A=L(y),B=new g({text:new K({text:a,font:'12px "Microsoft YaHei"',textAlign:"center",textBaseline:"bottom",offsetY:-28,fill:q,stroke:P}),zIndex:2}),_=[A,B];return O.set(i,{label:a,iconKey:y,styles:_}),_})}createCrossFeature(e){return e.brand=e.brand.toLowerCase(),new N({geometry:new v([e.x,e.y]),type:"signal-cross",id:e.crossId,brandLabel:this.getBrandLabel(e.brand),isOnlineLabel:this.getOnlineLabel(e.isOnline),isMalfunctionLabel:this.getMalfunctionLabel(e.isMalfunction),...e})}getClusterStyle(e){const s=e.clusterSymbolSize,n=new F({src:"/GisViewerAssets/Images/cross/gis_xhj_blue.png",scale:s/32}),t=-(s+10),o=new K({text:String(e.count??0),font:"16px sans-serif",fill:new f({color:[255,255,255,255]}),backgroundFill:new f({color:[2,72,200,255]}),backgroundStroke:new b({color:[2,72,200,128],width:2}),padding:[3,6,3,6],offsetY:t,textAlign:"center"});return[new g({image:n}),new g({text:o})]}getBrandLabel(e){const s=(e??"").toLowerCase();return s==="scats"?"SCATS":s==="gc"?"国产":e??""}getOnlineLabel(e){return e?"在线":"离线"}getMalfunctionLabel(e){return e?"故障":"正常"}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(e=>{const s=this.map.getPixelFromCoordinate([e.x,e.y]),[n,t]=s||[NaN,NaN];Number.isFinite(n)&&Number.isFinite(t)&&n>0&&t>0&&(e.properties=e.properties||{},e.properties.screenX=n,e.properties.screenY=t,e.visited=!1,e.clusterId=void 0,this.clusteredLocations.push(e))})}doPixelCluster(e){let s=0;for(let n=0;n<this.clusteredLocations.length;n++){const t=this.clusteredLocations[n];if(t.visited)continue;t.visited=!0;const o=this.getNeighbors(t,e);o.length<this.minClusterPoints?t.clusterId=-1:(o.forEach(r=>{r.visited=!0,r.clusterId=s}),t.clusterId=s,s++)}return this.createClusters()}getNeighbors(e,s){return this.clusteredLocations.filter(n=>n.id===e.id||n.visited?!1:this.getDistance(e,n)<=s)}getDistance(e,s){var n,t,o,r;return Math.sqrt(Math.pow((((n=e.properties)==null?void 0:n.screenX)??0)-(((t=s.properties)==null?void 0:t.screenX)??0),2)+Math.pow((((o=e.properties)==null?void 0:o.screenY)??0)-(((r=s.properties)==null?void 0:r.screenY)??0),2))}createClusters(){const e={},s=[];for(const t of this.clusteredLocations)t.clusterId===void 0||t.clusterId===-1?s.push(t):(e[t.clusterId]||(e[t.clusterId]=[]),e[t.clusterId].push(t));const n=Object.keys(e).map(t=>{const o=e[Number(t)],r=o.length,w=o.reduce((u,h)=>u+h.x,0),S=o.reduce((u,h)=>u+h.y,0),C=w/r,p=S/r;return{id:Number(t),items:o,count:r,center:{x:C,y:p}}});return s.length>0&&n.push({id:-1,items:s,count:s.length,center:null}),n}showClusterResult(e){this.source.clear();let s=Number.MIN_VALUE,n=Number.MAX_VALUE;e.forEach(t=>{t.count>1&&(n=Math.min(n,t.count),s=Math.max(s,t.count))}),e.forEach(t=>{if(t.id!==-1&&t.center){let o=n===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(t.count-n)/(s-n)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);o*=.75;const r=new N({geometry:new v([t.center.x,t.center.y]),type:"signal-cluster",count:t.count,clusterSymbolSize:o});this.source.addFeature(r)}else t.items.forEach(o=>{const r=this.createCrossFeature({...o.properties,x:o.x,y:o.y});this.source.addFeature(r)})}),this.crossLayer.changed()}}exports.default=k;
package/lib/src/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./gis-map/index.js"),t=require("./gis-map-ol");exports.GisMap=r.GisMap;Object.keys(t).forEach(e=>{e!=="default"&&!exports.hasOwnProperty(e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./gis-map/index.js"),i=require("./gis-map-ol/index.js");exports.GisMap=e.GisMap;exports.GisMapOl=i.GisMapOl;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var o=(r=>(r.West="1",r.North="2",r.East="3",r.South="4",r))(o||{}),u=(r=>(r[r.None=0]="None",r[r.PlateNumber=1]="PlateNumber",r[r.Id=2]="Id",r[r.Mix=3]="Mix",r))(u||{});exports.EVehiclePlateState=u;exports.QuadrantCode=o;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.284",
3
+ "version": "1.0.285",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [