gisviewer-vue3-arcgis 1.0.284 → 1.0.286
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.mjs +6 -5
- package/es/src/gis-map/gis-map.vue.d.ts +126 -3
- package/es/src/gis-map/gis-map.vue.mjs +63 -63
- package/es/src/gis-map/index.d.ts +126 -3
- package/es/src/gis-map/utils/edpass-device-controller.mjs +278 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +362 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +101 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +153 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.mjs +4 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +336 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +240 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +106 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +578 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +386 -0
- package/es/src/gis-map/utils/index.mjs +2 -2
- package/es/src/gis-map/utils/overlay.d.ts +2 -2
- package/es/src/gis-map/utils/overlay.mjs +2 -2
- package/es/src/gis-map/utils/police-jurisdiction.mjs +202 -0
- package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
- package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
- package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
- package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +593 -0
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +84 -0
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +122 -0
- package/es/src/gis-map/utils/signal-control-area/edit-area.mjs +550 -0
- package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +984 -0
- package/es/src/gis-map/utils/signal-control-area/signal-area-controller.mjs +140 -0
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +423 -0
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +123 -0
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +367 -0
- package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +137 -0
- package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +79 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.mjs +93 -0
- package/es/src/gis-map-ol/gis-map-ol.vue2.mjs +4 -0
- package/es/src/gis-map-ol/gis-map-ol.vue3.mjs +5 -0
- package/es/src/gis-map-ol/index.d.ts +69 -1
- package/es/src/gis-map-ol/index.mjs +8 -0
- package/es/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
- package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
- package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.mjs +122 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +29 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +183 -0
- package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
- package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.mjs +102 -0
- package/es/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
- package/es/src/gis-map-ol/utils/overlay/overlay-controller.mjs +276 -0
- package/es/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
- package/es/src/gis-map-ol/utils/police-area-controller.mjs +155 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +33 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +221 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.mjs +127 -0
- package/es/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
- package/es/src/gis-map-ol/utils/style/line-style.mjs +151 -0
- package/es/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
- package/es/src/gis-map-ol/utils/style/point-style.mjs +206 -0
- package/es/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
- package/es/src/gis-map-ol/utils/style/polygon-style.mjs +166 -0
- package/es/src/index.mjs +4 -4
- package/es/src/types/index.d.ts +2 -1
- package/es/src/types/index.mjs +5 -0
- package/lib/index.js +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +126 -3
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +126 -3
- package/lib/src/gis-map/utils/edpass-device-controller.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -0
- package/lib/src/gis-map/utils/index.js +1 -1
- package/lib/src/gis-map/utils/overlay.d.ts +2 -2
- package/lib/src/gis-map/utils/overlay.js +1 -1
- package/lib/src/gis-map/utils/police-jurisdiction.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/edit-area.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-area-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -0
- package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +79 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue2.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue3.js +1 -0
- package/lib/src/gis-map-ol/index.d.ts +69 -1
- package/lib/src/gis-map-ol/index.js +1 -0
- package/lib/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
- package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
- package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.js +1 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +29 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -0
- package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
- package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
- package/lib/src/gis-map-ol/utils/overlay/overlay-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
- package/lib/src/gis-map-ol/utils/police-area-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +33 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
- package/lib/src/gis-map-ol/utils/style/line-style.js +1 -0
- package/lib/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
- package/lib/src/gis-map-ol/utils/style/point-style.js +1 -0
- package/lib/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
- package/lib/src/gis-map-ol/utils/style/polygon-style.js +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/types/index.d.ts +2 -1
- package/lib/src/types/index.js +1 -0
- package/package.json +1 -1
|
@@ -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:Number(a.x),latitude:Number(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,79 @@
|
|
|
1
|
+
import { default as OlMap } from 'ol/Map';
|
|
2
|
+
import type { EventsKey } from 'ol/events';
|
|
3
|
+
import { IClusterPointParams, ILayerVisibleParams, IOverlayParam, ISetMapCameraParams, ISetMapCenterParams, IShowJurisdictionParams, IShowSignalCrossParams, IShowSignalSystemParams, IShowSubSignalSystemParams } from '../types';
|
|
4
|
+
import OlMapInitializer from './utils/ol-map-initializer';
|
|
5
|
+
import ClusterPointController from './utils/overlay/cluster-point-controller';
|
|
6
|
+
import PoliceAreaController from './utils/police-area-controller';
|
|
7
|
+
import SignalCrossController from './utils/signal-control/signal-cross-controller';
|
|
8
|
+
import SignalSystemController from './utils/signal-control/signal-system-controller';
|
|
9
|
+
import OverlayController from './utils/overlay/overlay-controller';
|
|
10
|
+
declare const _sfc_main: import("vue").DefineComponent<{
|
|
11
|
+
config: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
assetsRoot: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
required: false;
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
mapContainer: import("vue").Ref<any>;
|
|
21
|
+
mapInitializer: OlMapInitializer;
|
|
22
|
+
map: OlMap;
|
|
23
|
+
viewEventKeys: EventsKey[];
|
|
24
|
+
lastEmittedZoomInt: number | null;
|
|
25
|
+
emitZoomIfChanged: (z: number) => void;
|
|
26
|
+
signalCrossController: SignalCrossController;
|
|
27
|
+
signalSystemController: SignalSystemController;
|
|
28
|
+
clusterPointController: ClusterPointController;
|
|
29
|
+
policeAreaController: PoliceAreaController;
|
|
30
|
+
overlayController: OverlayController;
|
|
31
|
+
setMapCenter: (params: ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
32
|
+
setMapCamera: (params: ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
33
|
+
setLayerVisibility: (params: ILayerVisibleParams) => Promise<import("../types").IResult>;
|
|
34
|
+
setMapZoom: (zoom: number) => import("../types").IResult;
|
|
35
|
+
showSignalCross: (params: IShowSignalCrossParams) => import("../types").IResult;
|
|
36
|
+
changeSignalCrossShowName: (showName: 'detail' | 'crossName' | 'signalId') => void | {
|
|
37
|
+
success: boolean;
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
clearSignalCross: () => void;
|
|
41
|
+
showSignalSystem: (params: IShowSignalSystemParams) => Promise<import("../types").IResult> | {
|
|
42
|
+
status: number;
|
|
43
|
+
message: string;
|
|
44
|
+
};
|
|
45
|
+
removeSignalSystem: (areaCode?: string | undefined) => void | {
|
|
46
|
+
success: boolean;
|
|
47
|
+
message: string;
|
|
48
|
+
};
|
|
49
|
+
showSubSignalSystem: (params: IShowSubSignalSystemParams) => Promise<import("../types").IResult>;
|
|
50
|
+
removeSubSignalSystem: (subCode?: string | undefined) => void | {
|
|
51
|
+
success: boolean;
|
|
52
|
+
message: string;
|
|
53
|
+
};
|
|
54
|
+
addClusterPoints: (params: IClusterPointParams) => void;
|
|
55
|
+
removeAllClusterPoints: () => void;
|
|
56
|
+
showPoliceArea: (params: IShowJurisdictionParams) => Promise<void>;
|
|
57
|
+
clearPoliceArea: () => void;
|
|
58
|
+
addOverlays: (params: IOverlayParam) => import("../types").IResult;
|
|
59
|
+
removeOverlaysById: (ids: string[] | string) => void;
|
|
60
|
+
removeOverlaysByType: (type: string[] | string) => void;
|
|
61
|
+
removeAllOverlays: () => void;
|
|
62
|
+
props: any;
|
|
63
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", ...args: any[]) => void;
|
|
64
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick" | "update:zoom")[], "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
65
|
+
config: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
required: true;
|
|
68
|
+
};
|
|
69
|
+
assetsRoot: {
|
|
70
|
+
type: StringConstructor;
|
|
71
|
+
required: false;
|
|
72
|
+
};
|
|
73
|
+
}>> & {
|
|
74
|
+
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
75
|
+
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
76
|
+
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
77
|
+
"onUpdate:zoom"?: ((...args: any[]) => any) | undefined;
|
|
78
|
+
}, {}, {}>;
|
|
79
|
+
export default _sfc_main;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue"),U=require("ol/Observable"),D=require("../stores/index.js"),G=require("./utils/ol-map-initializer.js"),H=require("./utils/overlay/cluster-point-controller.js"),S=require("./utils/police-area-controller.js"),Q=require("./utils/signal-control/signal-cross-controller.js"),v=require("./utils/signal-control/signal-system-controller.js"),W=require("./utils/overlay/overlay-controller.js"),X={class:"gis-viewer"},Y=s.defineComponent({__name:"gis-map-ol",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(w,{expose:h,emit:b}){const g=s.ref(null);let i,t,u=[],f=null;const y=e=>{if(!Number.isFinite(e))return;const l=Math.round(e);l!==f&&(f=l,m("update:zoom",l))};let n,o,c,a,r;s.onMounted(async()=>{D.registerStore();const e=s.getCurrentInstance(),{$gisviewerAssetsRoot:l}=e.appContext.config.globalProperties,C=await(await fetch(d.config)).json();C.assetsRoot=d.assetsRoot||l,i=new G.default,t=i.initialize({container:g.value,mapConfig:C,markerClickCallback:(j,J,K,F)=>{m("markerClick",j,J,K,F)}});const p=t.getView();u.push(p.on("change:resolution",()=>{y(p.getZoom())})),y(t.getView().getZoom()),m("mapLoaded"),a=new S.default(t),await a.initialize()});const M=async e=>await i.setMapCenter(e),k=async e=>await i.setMapCamera(e),_=async e=>await i.setLayerVisibility(e),O=e=>i.setMapZoom({zoom:e}),P=e=>(n||(n=new Q.default(t)),n.showSignalCross(e)),q=e=>n?n.changeShowName(e):{success:!1,message:"SignalCrossController未初始化"},A=()=>{n&&n.clearSignalCross()},B=e=>(o||(o=new v.default(t)),o.showSignalSystem(e)),I=e=>o?o.removeSignalSystem(e):{success:!1,message:"SignalSystemController未初始化"},z=e=>(o||(o=new v.default(t)),o.showSubSignalSystem(e)),Z=e=>o?o.removeSubSignalSystem(e):{success:!1,message:"SignalSystemController未初始化"},$=e=>(c||(c=new H.default(t)),c.addClusterPoints(e)),x=()=>{c&&c.removeAllClusterPoints()},E=async e=>(a||(a=new S.default(t)),await a.showJurisdiction(e)),V=()=>{a&&a.clearJurisdiction()},L=e=>(r||(r=new W.default(t)),r.addOverlays(e)),N=e=>{r&&r.removeOverlaysById(e)},R=e=>{r&&r.removeOverlaysByType(e)},T=()=>{r&&r.removeAllOverlays()};s.onBeforeUnmount(()=>{u.forEach(e=>U.unByKey(e)),u=[]});const d=w,m=b;return h({setMapCenter:M,setMapCamera:k,setMapZoom:O,setLayerVisibility:_,showSignalCross:P,showSignalSystem:B,removeSignalSystem:I,showSubSignalSystem:z,removeSubSignalSystem:Z,clearSignalCross:A,changeSignalCrossShowName:q,addClusterPoints:$,removeAllClusterPoints:x,showPoliceArea:E,clearPoliceArea:V,addOverlays:L,removeOverlaysById:N,removeOverlaysByType:R,removeAllOverlays:T}),(e,l)=>(s.openBlock(),s.createElementBlock("div",X,[s.createElementVNode("div",{id:"divCMap",class:"gis-viewer-main",ref_key:"mapContainer",ref:g},null,512)]))}});exports.default=Y;
|
|
@@ -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,70 @@
|
|
|
1
|
-
export declare const GisMapOl:
|
|
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
|
+
signalSystemController: import("./utils/signal-control/signal-system-controller").default;
|
|
19
|
+
clusterPointController: import("./utils/overlay/cluster-point-controller").default;
|
|
20
|
+
policeAreaController: import("./utils/police-area-controller").default;
|
|
21
|
+
overlayController: import("./utils/overlay/overlay-controller").default;
|
|
22
|
+
setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
23
|
+
setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
24
|
+
setLayerVisibility: (params: import("../types").ILayerVisibleParams) => Promise<import("../types").IResult>;
|
|
25
|
+
setMapZoom: (zoom: number) => import("../types").IResult;
|
|
26
|
+
showSignalCross: (params: import("../types").IShowSignalCrossParams) => import("../types").IResult;
|
|
27
|
+
changeSignalCrossShowName: (showName: "detail" | "crossName" | "signalId") => void | {
|
|
28
|
+
success: boolean;
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
clearSignalCross: () => void;
|
|
32
|
+
showSignalSystem: (params: import("../types").IShowSignalSystemParams) => Promise<import("../types").IResult> | {
|
|
33
|
+
status: number;
|
|
34
|
+
message: string;
|
|
35
|
+
};
|
|
36
|
+
removeSignalSystem: (areaCode?: string | undefined) => void | {
|
|
37
|
+
success: boolean;
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
showSubSignalSystem: (params: import("../types").IShowSubSignalSystemParams) => Promise<import("../types").IResult>;
|
|
41
|
+
removeSubSignalSystem: (subCode?: string | undefined) => void | {
|
|
42
|
+
success: boolean;
|
|
43
|
+
message: string;
|
|
44
|
+
};
|
|
45
|
+
addClusterPoints: (params: import("../types").IClusterPointParams) => void;
|
|
46
|
+
removeAllClusterPoints: () => void;
|
|
47
|
+
showPoliceArea: (params: import("../types").IShowJurisdictionParams) => Promise<void>;
|
|
48
|
+
clearPoliceArea: () => void;
|
|
49
|
+
addOverlays: (params: import("../types").IOverlayParam) => import("../types").IResult;
|
|
50
|
+
removeOverlaysById: (ids: string | string[]) => void;
|
|
51
|
+
removeOverlaysByType: (type: string | string[]) => void;
|
|
52
|
+
removeAllOverlays: () => void;
|
|
53
|
+
props: any;
|
|
54
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", ...args: any[]) => void;
|
|
55
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick" | "update:zoom")[], "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
56
|
+
config: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
required: true;
|
|
59
|
+
};
|
|
60
|
+
assetsRoot: {
|
|
61
|
+
type: StringConstructor;
|
|
62
|
+
required: false;
|
|
63
|
+
};
|
|
64
|
+
}>> & {
|
|
65
|
+
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
66
|
+
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
67
|
+
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
68
|
+
"onUpdate:zoom"?: ((...args: any[]) => any) | undefined;
|
|
69
|
+
}, {}, {}>>;
|
|
2
70
|
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,65 @@
|
|
|
1
|
+
import type { default as OlMap } from 'ol/Map';
|
|
2
|
+
import { ICluster, IClusterLocation } from '../../../types';
|
|
3
|
+
export interface IPixelClusterOptions {
|
|
4
|
+
/** 聚合半径(像素),默认 120 */
|
|
5
|
+
clusterRadius?: number;
|
|
6
|
+
/** 最小聚合点数,默认 2 */
|
|
7
|
+
minClusterPoints?: number;
|
|
8
|
+
/** 最大聚合符号大小,默认 40 */
|
|
9
|
+
maxClusterSymbolSize?: number;
|
|
10
|
+
/** 最小聚合符号大小,默认 20 */
|
|
11
|
+
minClusterSymbolSize?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 像素聚合计算器
|
|
15
|
+
* 基于屏幕像素距离进行点聚合
|
|
16
|
+
*/
|
|
17
|
+
export declare class PixelClusterCalculator {
|
|
18
|
+
private map;
|
|
19
|
+
private options;
|
|
20
|
+
private clusteredLocations;
|
|
21
|
+
constructor(map: OlMap, options?: IPixelClusterOptions);
|
|
22
|
+
/**
|
|
23
|
+
* 计算聚合结果
|
|
24
|
+
* @param locations 原始点位数组
|
|
25
|
+
* @returns 聚合结果
|
|
26
|
+
*/
|
|
27
|
+
calculate(locations: IClusterLocation[]): ICluster[];
|
|
28
|
+
/**
|
|
29
|
+
* 计算聚合符号大小
|
|
30
|
+
* @param clusters 聚合结果
|
|
31
|
+
* @returns 带有符号大小信息的聚合结果
|
|
32
|
+
*/
|
|
33
|
+
calculateSymbolSizes(clusters: ICluster[]): (ICluster & {
|
|
34
|
+
symbolSize?: number;
|
|
35
|
+
})[];
|
|
36
|
+
/**
|
|
37
|
+
* 更新配置
|
|
38
|
+
*/
|
|
39
|
+
updateOptions(options: Partial<IPixelClusterOptions>): void;
|
|
40
|
+
/**
|
|
41
|
+
* 获取当前配置
|
|
42
|
+
*/
|
|
43
|
+
getOptions(): Required<IPixelClusterOptions>;
|
|
44
|
+
/**
|
|
45
|
+
* 将地理坐标转换为屏幕坐标
|
|
46
|
+
*/
|
|
47
|
+
private locationToScreen;
|
|
48
|
+
/**
|
|
49
|
+
* 基于像素距离的聚合算法
|
|
50
|
+
*/
|
|
51
|
+
private doPixelCluster;
|
|
52
|
+
/**
|
|
53
|
+
* 获取指定点的邻近点
|
|
54
|
+
*/
|
|
55
|
+
private getNeighbors;
|
|
56
|
+
/**
|
|
57
|
+
* 计算两点之间的屏幕距离
|
|
58
|
+
*/
|
|
59
|
+
private getDistance;
|
|
60
|
+
/**
|
|
61
|
+
* 根据聚合结果创建聚合对象
|
|
62
|
+
*/
|
|
63
|
+
private createClusters;
|
|
64
|
+
}
|
|
65
|
+
export default PixelClusterCalculator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p={clusterRadius:120,minClusterPoints:2,maxClusterSymbolSize:40,minClusterSymbolSize:20};class c{constructor(s,t){this.clusteredLocations=[],this.map=s,this.options={...p,...t}}calculate(s){return this.locationToScreen(s),this.doPixelCluster(this.options.clusterRadius)}calculateSymbolSizes(s){let t=Number.MIN_VALUE,i=Number.MAX_VALUE;return s.forEach(e=>{e.count>1&&(i=Math.min(i,e.count),t=Math.max(t,e.count))}),s.map(e=>{if(e.id!==-1&&e.center){let r=i===t?(this.options.maxClusterSymbolSize+this.options.minClusterSymbolSize)/2:this.options.minClusterSymbolSize+(e.count-i)/(t-i)*(this.options.maxClusterSymbolSize-this.options.minClusterSymbolSize);return r*=.75,{...e,symbolSize:r}}return e})}updateOptions(s){this.options={...this.options,...s}}getOptions(){return{...this.options}}locationToScreen(s){this.clusteredLocations=[],s.forEach(t=>{const i=this.map.getPixelFromCoordinate([t.x,t.y]),[e,r]=i||[NaN,NaN];Number.isFinite(e)&&Number.isFinite(r)&&e>0&&r>0&&(t.properties=t.properties||{},t.properties.screenX=e,t.properties.screenY=r,t.visited=!1,t.clusterId=void 0,this.clusteredLocations.push(t))})}doPixelCluster(s){let t=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,s);r.length<this.options.minClusterPoints?e.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=t}),e.clusterId=t,t++)}return this.createClusters()}getNeighbors(s,t){return this.clusteredLocations.filter(i=>i.id===s.id||i.visited?!1:this.getDistance(s,i)<=t)}getDistance(s,t){var i,e,r,o;return Math.sqrt(Math.pow((((i=s.properties)==null?void 0:i.screenX)??0)-(((e=t.properties)==null?void 0:e.screenX)??0),2)+Math.pow((((r=s.properties)==null?void 0:r.screenY)??0)-(((o=t.properties)==null?void 0:o.screenY)??0),2))}createClusters(){const s={},t=[];for(const e of this.clusteredLocations)e.clusterId===void 0||e.clusterId===-1?t.push(e):(s[e.clusterId]||(s[e.clusterId]=[]),s[e.clusterId].push(e));const i=Object.keys(s).map(e=>{const r=s[Number(e)],o=r.length,l=r.reduce((n,u)=>n+u.x,0),a=r.reduce((n,u)=>n+u.y,0),d=l/o,h=a/o;return{id:Number(e),items:r,count:o,center:{x:d,y:h}}});return t.length>0&&i.push({id:-1,items:t,count:t.length,center:null}),i}}exports.PixelClusterCalculator=c;exports.default=c;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 pointerMoveRaf;
|
|
8
|
+
private markerClick;
|
|
9
|
+
initialize(params: IMapInitializerParams): OlMap;
|
|
10
|
+
private processUrl;
|
|
11
|
+
private loadLayers;
|
|
12
|
+
private createMap;
|
|
13
|
+
/**
|
|
14
|
+
* 设置地图中心点和缩放级别
|
|
15
|
+
* @param params
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
setMapCenter(params: ISetMapCenterParams): Promise<IResult>;
|
|
19
|
+
setMapZoom(params: {
|
|
20
|
+
zoom: number;
|
|
21
|
+
}): IResult;
|
|
22
|
+
/**
|
|
23
|
+
* 设置地图预存的相机视图
|
|
24
|
+
* @param params
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
setMapCamera(params: ISetMapCameraParams): Promise<IResult>;
|
|
28
|
+
setLayerVisibility(params: ILayerVisibleParams): Promise<IResult>;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("ol/layer/Image"),u=require("ol/layer/Tile"),l=require("ol/Map");require("ol/ol.css");const d=require("ol/proj"),n=require("ol/source"),g=require("ol/tilegrid"),w=require("ol/tilegrid/WMTS"),f=require("ol/View");class S{constructor(){this.mapConfig={},this.pointerMoveRaf=null}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):e)}loadLayers(e){if(!this.map)return;const i=1/0,s=16384;e.forEach(t=>{var o,a;(o=t.source)!=null&&o.url&&(t.source.url=this.processUrl(t.source.url));let r;switch(t.type.toLowerCase()){case"webtile":{console.log(t),r=new u({preload:i,cacheSize:s,source:new n.XYZ({url:t.source.url,projection:t.source.projection||"EPSG:4326",tileSize:t.source.tileSize||256})});break}case"gwc-wms":{r=new u({preload:i,cacheSize:s,source:new n.TileWMS({...t.source,tileGrid:new g.TileGrid({...t.source.tileGrid})}),...t.options});break}case"wmts":{const c=t.source.matrixSet||"",m=Array.from({length:22},(z,h)=>`${c}:${h}`);r=new u({preload:i,cacheSize:s,source:new n.WMTS({...t.source,format:"image/png",projection:new d.Projection({code:t.source.projection||"EPSG:4326"}),tileGrid:new w({resolutions:[1.4078260157100582,.703913007855028,.35195650392751515,.17597825196375638,.08798912598187819,.043994562990939096,.021997281495469548,.010998640747734774,.005499320373868577,.0027496601869330985,.001374830093467739,.0006874150467326798,.0003437075233663399,.00017185376168316996,8592688084158498e-20,4296344042198222e-20,2148172021099111e-20,10740860104305824e-21,53704300533426425e-22,2685215025481591e-21,13426075127407955e-22,6713037563703978e-22],matrixIds:m,tileSize:256,origin:[-400,400]})}),...t.options});break}case"image-wms":{r=new p({source:new n.ImageWMS({...t.source}),...t.options});break}}r&&(r.set("id",t.id),r.set("group",t.group),(a=this.map)==null||a.addLayer(r))})}createMap(e){const i=this.mapConfig.view;this.mapView=new f({...i}),this.mapConfig.camera?this.mapConfig.camera.home=i:this.mapConfig.camera={home:i};const s=new l({target:e,view:this.mapView});return s.on("pointermove",t=>{t.dragging||this.pointerMoveRaf===null&&(this.pointerMoveRaf=requestAnimationFrame(()=>{const r=s.hasFeatureAtPixel(t.pixel),o=s.getTargetElement();o&&(o.style.cursor=r?"pointer":""),this.pointerMoveRaf=null}))}),s.on("click",t=>{const r=s.forEachFeatureAtPixel(t.pixel,o=>o);if(r&&this.markerClick){const o=r.get("type")??"",a=r.get("id")??"",c=r.getProperties();this.markerClick(o,a,c,t)}}),s}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().filter(s=>s.get("id")===e.id||s.get("group")===e.id);return i.length>0?(i.forEach(s=>s.setVisible(e.visible)),{status:0,message:"成功"}):{status:-1,message:`未找到ID为 ${e.id} 的图层`}}}exports.default=S;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as OlMap } from 'ol/Map';
|
|
2
|
+
import { IClusterPointParams } from '../../../types';
|
|
3
|
+
export default class ClusterPointController {
|
|
4
|
+
private map;
|
|
5
|
+
private clusterLayer;
|
|
6
|
+
private source;
|
|
7
|
+
private view;
|
|
8
|
+
private clusterCalculator;
|
|
9
|
+
private countBackgroundColor;
|
|
10
|
+
private countFontColor;
|
|
11
|
+
private locations;
|
|
12
|
+
private clusterMarkUrl;
|
|
13
|
+
private viewChangeKey;
|
|
14
|
+
private mapMoveKey;
|
|
15
|
+
private resolutionChangeTimeout;
|
|
16
|
+
constructor(map: OlMap);
|
|
17
|
+
addClusterPoints(params: IClusterPointParams): void;
|
|
18
|
+
removeAllClusterPoints(): void;
|
|
19
|
+
private configureVectorLayerStyle;
|
|
20
|
+
private getClusterStyle;
|
|
21
|
+
private showClusterResult;
|
|
22
|
+
private calculateCluster;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("ol/Feature"),i=require("ol/geom/Point"),h=require("ol/layer/Vector"),l=require("ol/Observable"),y=require("ol/source/Vector"),n=require("ol/style/Fill"),g=require("ol/style/Icon"),C=require("ol/style/Stroke"),u=require("ol/style/Style"),m=require("ol/style/Text"),d=require("../cluster/pixel-cluster-calculator.js"),c=require("../style/point-style.js");class S{constructor(t){this.countBackgroundColor=[2,72,200,.8],this.countFontColor=[255,255,255,1],this.locations=[],this.clusterMarkUrl="",this.viewChangeKey=null,this.mapMoveKey=null,this.resolutionChangeTimeout=null,this.map=t,this.view=t.getView(),this.clusterCalculator=new d.PixelClusterCalculator(t),this.source=new y,this.clusterLayer=new h({source:this.source}),this.clusterLayer.set("id","cluster-points-layer"),this.map.addLayer(this.clusterLayer),this.configureVectorLayerStyle()}addClusterPoints(t){var e;this.clusterMarkUrl=((e=t.clusterSymbol)==null?void 0:e.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",this.countBackgroundColor=t.countBackgroundColor||this.countBackgroundColor,this.countFontColor=t.countFontColor||this.countFontColor,this.locations=t.points,this.locations.forEach(o=>{o.symbol=o.symbol||t.pointSymbol}),this.viewChangeKey||(this.viewChangeKey=this.view.on("change:resolution",()=>{this.resolutionChangeTimeout&&clearTimeout(this.resolutionChangeTimeout),this.resolutionChangeTimeout=setTimeout(()=>{this.calculateCluster()},150)})),this.mapMoveKey||(this.mapMoveKey=this.map.on("moveend",()=>{this.calculateCluster()})),this.calculateCluster()}removeAllClusterPoints(){this.source.clear(),this.viewChangeKey&&(l.unByKey(this.viewChangeKey),this.viewChangeKey=null),this.mapMoveKey&&(l.unByKey(this.mapMoveKey),this.mapMoveKey=null),this.resolutionChangeTimeout&&(clearTimeout(this.resolutionChangeTimeout),this.resolutionChangeTimeout=null)}configureVectorLayerStyle(){const t=this.view.getResolutionForZoom(18);this.clusterLayer.setStyle((e,o)=>{const s=e.get("type");if(o<=t)return c.getPointStyle(e.getProperties().symbol);if(s==="cluster-point")return c.getPointStyle(e.getProperties().symbol);if(s==="cluster-cluster")return this.getClusterStyle(e.getProperties())})}getClusterStyle(t){const e=t.clusterSymbolSize,o=new g({src:this.clusterMarkUrl,scale:e/32}),s=-(e+10),a=new m({text:String(t.count??0),font:"16px Arial Unicode MS",fill:new n({color:this.countFontColor}),backgroundFill:new n({color:this.countBackgroundColor}),backgroundStroke:new C({color:[this.countBackgroundColor[0],this.countBackgroundColor[1],this.countBackgroundColor[2],.5],width:4}),padding:[1,2,1,2],offsetY:s,textAlign:"center",justify:"center",textBaseline:"middle"});return[new u({image:o}),new u({text:a})]}showClusterResult(t){this.source.clear(),t.forEach(e=>{if(e.id!==-1&&e.center&&e.symbolSize){const o=new r({geometry:new i([e.center.x,e.center.y]),type:"cluster-cluster",count:e.count,clusterSymbolSize:e.symbolSize});this.source.addFeature(o)}else e.items.forEach(o=>{const s=new r({...o.properties,geometry:new i([o.x,o.y]),type:"cluster-point",symbol:o.symbol});this.source.addFeature(s)})}),this.clusterLayer.changed()}calculateCluster(){const t=this.clusterCalculator.calculate(this.locations),e=this.clusterCalculator.calculateSymbolSizes(t);this.showClusterResult(e)}}exports.default=S;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import Feature from 'ol/Feature';
|
|
2
|
+
import { Geometry } from 'ol/geom';
|
|
3
|
+
import VectorLayer from 'ol/layer/Vector';
|
|
4
|
+
import { default as OlMap } from 'ol/Map';
|
|
5
|
+
import VectorSource from 'ol/source/Vector';
|
|
6
|
+
import { ILineSymbol, IOverlayParam, IPointSymbol, IPolygonSymbol, IResult } from '../../../types';
|
|
7
|
+
interface IOverlayOptions {
|
|
8
|
+
id?: string;
|
|
9
|
+
}
|
|
10
|
+
export default class OverlayController {
|
|
11
|
+
private map;
|
|
12
|
+
overlayLayer: VectorLayer<VectorSource<Feature<Geometry>>>;
|
|
13
|
+
private vectorSource;
|
|
14
|
+
constructor(map: OlMap, options?: IOverlayOptions);
|
|
15
|
+
private defaultPointSymbol;
|
|
16
|
+
/**
|
|
17
|
+
* 添加覆盖物
|
|
18
|
+
* @param params
|
|
19
|
+
*/
|
|
20
|
+
addOverlays(params: IOverlayParam): IResult;
|
|
21
|
+
/**
|
|
22
|
+
* 添加或更新单个覆盖物
|
|
23
|
+
* @param overlay 覆盖物对象
|
|
24
|
+
* @param symbol 符号
|
|
25
|
+
* @param properties 属性
|
|
26
|
+
* @param visible 是否可见
|
|
27
|
+
*/
|
|
28
|
+
private addOverlay;
|
|
29
|
+
/**
|
|
30
|
+
* 创建几何对象
|
|
31
|
+
* @param geometryConfig 几何配置
|
|
32
|
+
*/
|
|
33
|
+
private createGeometry;
|
|
34
|
+
/**
|
|
35
|
+
* 获取样式
|
|
36
|
+
* @param geometryType 几何类型
|
|
37
|
+
* @param symbol 符号配置
|
|
38
|
+
* @param attributes 属性
|
|
39
|
+
*/
|
|
40
|
+
private getStyle;
|
|
41
|
+
/**
|
|
42
|
+
* 按type移除覆盖物
|
|
43
|
+
* @param types
|
|
44
|
+
*/
|
|
45
|
+
removeOverlaysByType(types: string[] | string): IResult;
|
|
46
|
+
/**
|
|
47
|
+
* 按id移除覆盖物
|
|
48
|
+
* @param ids
|
|
49
|
+
*/
|
|
50
|
+
removeOverlaysById(ids: string[] | string): IResult;
|
|
51
|
+
/**
|
|
52
|
+
* 按id显示或隐藏覆盖物
|
|
53
|
+
* @param ids
|
|
54
|
+
* @param isShow
|
|
55
|
+
*/
|
|
56
|
+
isShowOverlaysByIds(ids: string[], isShow: boolean): void;
|
|
57
|
+
/**
|
|
58
|
+
* 显示全部覆盖物
|
|
59
|
+
*/
|
|
60
|
+
showAllOverlays(): void;
|
|
61
|
+
/**
|
|
62
|
+
* 删除全部覆盖物
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
removeAllOverlays(): IResult;
|
|
66
|
+
/**
|
|
67
|
+
* 更新覆盖物符号
|
|
68
|
+
* @param ids 覆盖物id数组
|
|
69
|
+
* @param symbol 新的符号配置
|
|
70
|
+
*/
|
|
71
|
+
updateOverlaysSymbol(ids: string[], symbol: IPointSymbol | ILineSymbol | IPolygonSymbol): IResult;
|
|
72
|
+
/**
|
|
73
|
+
* 按type更新覆盖物符号
|
|
74
|
+
* @param types 类型数组
|
|
75
|
+
* @param symbol 新的符号配置
|
|
76
|
+
*/
|
|
77
|
+
updateOverlaysSymbolByType(types: string[], symbol: IPointSymbol | ILineSymbol | IPolygonSymbol): IResult;
|
|
78
|
+
/**
|
|
79
|
+
* 获取几何类型字符串
|
|
80
|
+
* @param geometry
|
|
81
|
+
*/
|
|
82
|
+
private getGeometryType;
|
|
83
|
+
/**
|
|
84
|
+
* 按id获取覆盖物Feature
|
|
85
|
+
* @param id
|
|
86
|
+
*/
|
|
87
|
+
getOverlayById(id: string): Feature<Geometry> | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* 按type获取覆盖物Feature数组
|
|
90
|
+
* @param type
|
|
91
|
+
*/
|
|
92
|
+
getOverlaysByType(type: string): Feature<Geometry>[];
|
|
93
|
+
/**
|
|
94
|
+
* 隐藏图层
|
|
95
|
+
*/
|
|
96
|
+
hideLayer(): void;
|
|
97
|
+
/**
|
|
98
|
+
* 显示图层
|
|
99
|
+
*/
|
|
100
|
+
showLayer(): void;
|
|
101
|
+
/**
|
|
102
|
+
* 删除指定的Feature
|
|
103
|
+
* @param features
|
|
104
|
+
*/
|
|
105
|
+
removeFeatures(features: Feature<Geometry> | Feature<Geometry>[]): void;
|
|
106
|
+
/**
|
|
107
|
+
* 查找屏幕坐标处的覆盖物
|
|
108
|
+
* @param pixel 屏幕像素坐标 [x, y]
|
|
109
|
+
*/
|
|
110
|
+
findFeaturesAtPixel(pixel: number[]): Feature<Geometry>[];
|
|
111
|
+
/**
|
|
112
|
+
* 销毁
|
|
113
|
+
*/
|
|
114
|
+
destroy(): void;
|
|
115
|
+
}
|
|
116
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("ol/Feature"),a=require("ol/geom"),d=require("ol/layer/Vector"),h=require("ol/source/Vector"),c=require("ol/style/Style"),v=require("../style/line-style.js"),p=require("../style/point-style.js"),g=require("../style/polygon-style.js");class S{constructor(e,s){this.defaultPointSymbol={type:"simple-marker",style:"circle",color:"yellow",size:10},this.map=e,this.vectorSource=new h,this.overlayLayer=new d({source:this.vectorSource,properties:{id:(s==null?void 0:s.id)??"overlay-layer"}}),this.map.addLayer(this.overlayLayer)}addOverlays(e){let s=0,r=0;e.defaultVisible=e.defaultVisible??!0;for(const t of e.overlays){t.properties?(t.properties.type||(t.properties.type=e.type),t.properties.id||(t.properties.id=t.id)):t.properties={type:e.type,id:t.id};const i=t.symbol||e.defaultSymbol||this.defaultPointSymbol,l=t.visible==null?e.defaultVisible:t.visible;this.addOverlay(t,i,t.properties,l).message==="add"?s++:r++}return e.needZoom===!0&&this.map.getView().fit(this.vectorSource.getExtent(),{padding:[50,50,50,50]}),{status:0,message:`新增${s}, 更新${r}`}}addOverlay(e,s,r,t){let i,l=!0;e.id&&(i=this.vectorSource.getFeatures().find(o=>o.get("id")===e.id));const n=this.createGeometry(e.geometry);if(!n)return{status:-1,message:"不支持的几何类型"};i?(i.setGeometry(n),l=!1):(i=new u({geometry:n}),this.vectorSource.addFeature(i),l=!0);const y=this.getStyle(e.geometry.type,s,r);return y&&i.setStyle(y),i.setProperties(r),t||i.setStyle(new c({})),i.set("_visible",t),i.set("_originalStyle",y),{status:0,message:l?"add":"update"}}createGeometry(e){var r;switch((r=e.type)==null?void 0:r.toLowerCase()){case"point":return new a.Point([e.x,e.y]);case"line":case"polyline":if(e.paths&&e.paths.length>0){const t=e.paths[0];return Array.isArray(t)&&Array.isArray(t[0])?e.paths.length===1?new a.LineString(e.paths[0]):new a.MultiLineString(e.paths):new a.LineString(e.paths)}return null;case"polygon":return e.rings&&e.rings.length>0?new a.Polygon(e.rings):null;default:return null}}getStyle(e,s,r){switch(e==null?void 0:e.toLowerCase()){case"point":return p.getPointStyle(s,r);case"line":case"polyline":return v.getLineStyle(s,r);case"polygon":return g.getPolygonStyle(s,r);default:return null}}removeOverlaysByType(e){const r=this.vectorSource.getFeatures().filter(t=>{const i=t.get("type");return Array.isArray(e)?e.includes(i):i===e});return r.forEach(t=>{this.vectorSource.removeFeature(t)}),{status:0,message:`删除${r.length}`}}removeOverlaysById(e){const r=this.vectorSource.getFeatures().filter(t=>{const i=t.get("id");return Array.isArray(e)?e.includes(i):i===e});return r.forEach(t=>{this.vectorSource.removeFeature(t)}),{status:0,message:`删除${r.length}`}}isShowOverlaysByIds(e,s){this.vectorSource.getFeatures().forEach(r=>{const t=r.get("id");if(e.includes(t)){if(s){const i=r.get("_originalStyle");i&&r.setStyle(i)}else r.setStyle(new c({}));r.set("_visible",s)}else{if(s)r.setStyle(new c({}));else{const i=r.get("_originalStyle");i&&r.setStyle(i)}r.set("_visible",!s)}})}showAllOverlays(){this.vectorSource.getFeatures().forEach(e=>{const s=e.get("_originalStyle");s&&e.setStyle(s),e.set("_visible",!0)})}removeAllOverlays(){const e=this.vectorSource.getFeatures().length;return this.vectorSource.clear(),{status:0,message:`删除${e}`}}updateOverlaysSymbol(e,s){let r=0;return this.vectorSource.getFeatures().forEach(t=>{const i=t.get("id");if(e.includes(i)){const l=t.getGeometry();if(l){const n=this.getGeometryType(l),y=t.getProperties(),o=this.getStyle(n,s,y);o&&(t.setStyle(o),t.set("_originalStyle",o),r++)}}}),{status:0,message:`更新${r}个覆盖物符号`}}updateOverlaysSymbolByType(e,s){let r=0;return this.vectorSource.getFeatures().forEach(t=>{const i=t.get("type");if(e.includes(i)){const l=t.getGeometry();if(l){const n=this.getGeometryType(l),y=t.getProperties(),o=this.getStyle(n,s,y);o&&(t.setStyle(o),t.set("_originalStyle",o),r++)}}}),{status:0,message:`更新${r}个覆盖物符号`}}getGeometryType(e){return e instanceof a.Point?"point":e instanceof a.LineString?"polyline":e instanceof a.Polygon?"polygon":""}getOverlayById(e){return this.vectorSource.getFeatures().find(s=>s.get("id")===e)}getOverlaysByType(e){return this.vectorSource.getFeatures().filter(s=>s.get("type")===e)}hideLayer(){this.overlayLayer.setVisible(!1)}showLayer(){this.overlayLayer.setVisible(!0)}removeFeatures(e){Array.isArray(e)||(e=[e]),e.forEach(s=>{this.vectorSource.removeFeature(s)})}findFeaturesAtPixel(e){const s=[];return this.map.forEachFeatureAtPixel(e,(r,t)=>{t===this.overlayLayer&&r instanceof u&&s.push(r)},{layerFilter:r=>r===this.overlayLayer}),s}destroy(){this.vectorSource.clear(),this.map.removeLayer(this.overlayLayer),this.overlayLayer.dispose()}}exports.default=S;
|