gisviewer-vue3-arcgis 1.0.269 → 1.0.272
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/src/gis-map/gis-map.vue.d.ts +4 -0
- package/es/src/gis-map/gis-map.vue.mjs +54 -53
- package/es/src/gis-map/index.d.ts +4 -0
- package/es/src/gis-map/utils/common-utils.mjs +31 -31
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.d.ts +12 -1
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +98 -72
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +105 -99
- package/lib/src/gis-map/gis-map.vue.d.ts +4 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +4 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.d.ts +12 -1
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),q=require("./stores/index.js");require("./style/index.css");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),q=require("./stores/index.js");require("./style/index.css");const ft=require("./utils/dbscan-cluster/index.js"),wt=require("./utils/detect-gpu.js"),St=require("./utils/edpass-device-controller.js"),P=require("./utils/green-wave-band-controller/index.js"),yt=require("./utils/holo-flow/index.js"),ht=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Ct=require("./utils/map-initializer.js"),N=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),vt=require("./utils/police-jurisdiction.js"),bt=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),Ot=require("./utils/signal-control-area/edit-area.js"),B=require("./utils/signal-control-area/signal-area-controller.js"),kt=require("./utils/signal-control-area/signal-cross-controller.js"),At=require("./utils/traffic-flow.js"),Dt={class:"gis-viewer"},Lt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Tt=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(H,{expose:G,emit:Z}){const b=r.ref(null);let n,g,l,i,s,o,w,t,u,a,f,p,y,O,S;const k=r.ref(!1);q.registerStore();const V=q.default.useAppDataStore,_=r.reactive([]),I=e=>Math.log2(591657527591555e-6/e);let h=null,M=null;const A=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==M&&(M=d,C("update:zoom",d))};wt.default(),r.onMounted(async()=>{if(!b.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(k.value=!k.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(x.config)).json();c.assetsRoot=x.assetsRoot||d,V.mapConfig=c,g=new Ct.default,V.mapInitializer=g,n=await g.initialize({container:b.value,mapConfig:c,markerClickCallback:(m,L,T,pt)=>{C("markerClick",m,L,T,pt)},mapClickCallback:(m,L,T)=>{C("mapClick",m,L,T)}});const v=n.zoom??(n.scale?I(n.scale):void 0);typeof v=="number"&&A(v);const gt=n.zoom!==void 0?n.watch("zoom",m=>{A(m)}):n.watch("scale",m=>{typeof m=="number"&&m>0&&A(I(m))});h=()=>gt.remove(),s=new yt.default(n,_),await s.init(),C("mapLoaded")}),r.onUnmounted(()=>{a==null||a.clearSignalControlArea(),t==null||t.clearOpenDrive(),s.clearHoloTrace(),s.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),h==null||h(),h=null});const W=r.computed(()=>n),j=()=>{const e=q.default.useAppDataStore;e.saveTrackLog=!0},J=()=>{s.downloadTrackLog()},Q=()=>{D("vehicleId")},U=()=>{D("plateNumber")},K=async e=>await g.setMapCenter(e),F=async e=>await g.setMapCamera(e),X=e=>g.setMapZoom(e),Y=async e=>await g.lookAt(e),R=e=>g.setLayerVisibility(e),$=(e,d)=>g.requestCoordinateTransform(e,d),ee=e=>{g.cancelCoordinateTransform(e)},te=e=>{g.setMapZoomRange(e)},ne=e=>(l||(l=new E.default(n)),l.showLaneNumber(e)),ae=()=>{l==null||l.clearLaneNumber()},se=async e=>(l||(l=new E.default(n)),await l.initializeSearch(e)),re=async()=>l==null?void 0:l.calCrossIndicatorArea(),oe=async()=>{},ie=async(e,d)=>{i||(i=new At.default(n)),i.connectTrafficFlow(e,d)},ce=()=>{i==null||i.disconnectTrafficFlow()},le=async e=>{s.handleVehicleTraceData(e)},ue=()=>{s.clearHoloTrace()},de=e=>{s.setInterpolate(e)},me=async e=>{await s.handleSignalData(e)},ge=async e=>{await s.initializeLampGroup(e)},pe=e=>{s.handleUniSignalData(e)},fe=()=>{s.clearHoloSignal()},we=e=>{i==null||i.toggleTrafficInfo(e),s==null||s.toggleTrafficInfo(e)},Se=e=>{s==null||s.togglePause(e)},ye=e=>{i==null||i.toggleTrafficObject(e),s==null||s.toggleTrafficObject(e)},D=e=>{s==null||s.updatePanelContent(e)},he=async e=>(o||(o=new z.default(n)),o.addOverlays(e)),Ce=async e=>(S||(S=new ft.default(n)),S.addClusterPoints(e)),ve=()=>{S==null||S.removeAllClusterPoints()},be=e=>(o||(o=new z.default(n)),o.addMask(e)),Oe=()=>{o==null||o.removeMask()},ke=e=>o==null?void 0:o.removeOverlaysByType(e),Ae=e=>o==null?void 0:o.removeOverlaysById(e),De=()=>o==null?void 0:o.removeAllOverlays(),Le=()=>{o==null||o.showAllOverlays()},Te=e=>{w||(w=new bt.default(n)),w.updateQueueLength(e)},qe=()=>{w==null||w.removeQueueLength()},Be=async(e,d)=>(t||(t=new N.default(n)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new N.default(n)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Ie=async()=>await(t==null?void 0:t.clearOpenDrive()),Me=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Ne=async e=>t?t.selectComputable(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},He=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ge=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ze=async e=>t?t==null?void 0:t.blockLane(e):{status:-1,message:"未加载OpenDrive地图"},We=e=>t?t==null?void 0:t.clearBlockLane(e):{status:-1,message:"未加载OpenDrive地图"},je=async e=>(a||(a=new B.default(n)),await a.showSignalControlArea(e)),Je=async e=>(a||(a=new B.default(n)),await a.showDistrict(e)),Qe=async e=>(a||(a=new B.default(n)),await a.showSubDistrict(e)),Ue=async()=>await(a==null?void 0:a.clearSignalControlArea()),Ke=e=>a==null?void 0:a.setLayerVisibility(e),Fe=async e=>a?await(a==null?void 0:a.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Xe=async e=>a?await a.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ye=()=>a?a.resetHighlight():{status:-1,message:"未加载信号控制区"},Re=e=>(u||(u=new Ot.default(n)),u.showSubSignalControlArea(e)),$e=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},et=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},tt=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},nt=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},at=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},st=e=>(f||(f=new kt.default(n)),f.showSignalCross(e)),rt=()=>f?f.clearSignalCross():{status:-1,message:"未加载信号路口"},ot=e=>f?f.changeShowName(e):{status:-1,message:"未加载信号路口"},it=e=>(p||(p=new P.default(n)),p.addGreenWaveBand(e)),ct=()=>{if(!p)return{status:-1,message:"未加载绿波带"};p.stopAddGreenWaveBand()},lt=async e=>(p||(p=new P.default(n)),await p.showGreenWaveBand(e)),ut=async e=>(y||(y=new vt.default(n)),await y.showJurisdiction(e)),dt=()=>{if(!y)return{status:-1,message:"未加载警务管辖区"};y.clearJurisdiction()},mt=async e=>(O||(O=new St.default(n)),await O.setEdpassLayerVisibility(e)),x=H,C=Z;return G({mapViewer:W,setLayerVisibility:R,setMapCenter:K,lookAt:Y,setMapCamera:F,setMapZoom:X,setMapZoomRange:te,requestCoordinateTransform:$,cancelCoordinateTransform:ee,addOverlays:he,addClusterPoints:Ce,removeAllClusterPoints:ve,addMask:be,removeMask:Oe,showAllOverlays:Le,removeOverlaysByType:ke,removeOverlaysById:Ae,removeAllOverlays:De,showLaneNumber:ne,clearLaneNumber:ae,initializeAreaTool:se,calCrossIndicatorArea:re,calRoadIndicatorArea:oe,connectCarFlow:ie,disconnectCarFlow:ce,handleHoloVehicleTraceData:le,clearHoloTrace:ue,initializeLampGroup:ge,handleUniSignalData:pe,handleHoloSignalData:me,clearHoloSignal:fe,setInterpolate:de,toggleTrafficInfo:we,toggleTrafficObject:ye,toggleVehicleInfo:D,togglePause:Se,updateQueueLength:Te,removeQueueLength:qe,showOpenDriveFromServer:Be,showOpenDriveFromFile:Ve,clearOpenDrive:Ie,setOpendriveVisibility:_e,geometrySearchInOpenDrive:ze,findSumoInOpenDrive:Me,selectSumoInOpenDrive:xe,unselectSumoInOpenDrive:Pe,selectComputableInOpenDrive:Ne,getSumoInfo:Ee,splitOpenDriveLane:He,clearSplitOpenDriveLane:Ge,blockOpenDriveLane:Ze,clearBlockOpenDriveLane:We,showSignalControlArea:je,showDistrictArea:Je,showSubDistrictArea:Qe,clearSignalControlArea:Ue,setSignalControlAreaVisibility:Ke,locateSignalControlArea:Fe,highlightSignalControlArea:Xe,resetHighlightSignalControlArea:Ye,showSubSignalControlArea:Re,editSubSignalControlArea:$e,stopEditSubSignalControlArea:et,selectSubSignalControlAreaCross:tt,unselectSubSignalControlAreaCross:nt,changeSubSignalControlAreaBorderVisibility:at,showSignalCross:st,clearSignalCross:rt,changeSignalCrossShowName:ot,addGreenWaveBand:it,stopAddGreenWaveBand:ct,showGreenWaveBand:lt,showPoliceArea:ut,clearPoliceArea:dt,setEdpassLayerVisibility:mt}),(e,d)=>(r.openBlock(),r.createElementBlock("div",Dt,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:b},[r.withDirectives(r.createElementVNode("div",Lt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:Q}," 显示车辆id "),r.createElementVNode("button",{onClick:U},"显示车辆号牌")],512),[[r.vShow,k.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_,(c,v)=>(r.openBlock(),r.createBlock(ht.default,{key:v,"display-mode":c.displayMode,flash:c.flash,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=Tt;
|
|
@@ -176,6 +176,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
176
176
|
status: number;
|
|
177
177
|
message: string;
|
|
178
178
|
};
|
|
179
|
+
changeSignalCrossShowName: (nameType: string) => void | {
|
|
180
|
+
status: number;
|
|
181
|
+
message: string;
|
|
182
|
+
};
|
|
179
183
|
addGreenWaveBand: (params: import("../types").IEditSignalControlAreaParams) => void;
|
|
180
184
|
stopAddGreenWaveBand: () => {
|
|
181
185
|
status: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),h=require("@turf/bearing"),y=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),x=require("@turf/line-slice-along"),A=require("pako"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@arcgis/core/geometry"),L=require("@arcgis/core/geometry/geometryEngineAsync"),w=require("@arcgis/core/geometry/support/webMercatorUtils"),h=require("@turf/bearing"),y=require("@turf/destination"),b=require("@turf/helpers"),S=require("@turf/length"),x=require("@turf/line-slice-along"),A=require("pako"),P=require("proj4");function d(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const g=d(L),O=d(w),f=d(b);class o{static destinationWithPoint(e,t,n){const r=f.point([e.x,e.y]),i=y(r,n,t,{units:"meters"});return new p.Point({x:i.geometry.coordinates[0],y:i.geometry.coordinates[1]})}static angleOfLine(e){const t=e.paths[0],n=f.point(t[0]),r=f.point(t[t.length-1]);return h(n,r)}static extendLineInTowDir(e,t){const n=e.paths[0],r=f.point(n[0]),i=f.point(n[1]),a=h(i,r),c=y(r,t,a,{units:"meters"}),u=a>0?a-180:a+180,s=y(i,t,u,{units:"meters"});return new p.Polyline({paths:[[c.geometry.coordinates,s.geometry.coordinates]]})}static async getIntersectPointOfTwoLines(e,t){const n=await g.intersectLinesToPoints(e,t);if(n.length)return n[0]}static async getIntersectPointsOfStopLineAndLane(e,t,n){let r=await o.getIntersectPointOfLineAndPolygon(e,t);if(await o.pointDistance(r)<3&&n){for(const i of n)if(r=await o.getIntersectPointOfLineAndPolygon(e,t,i),await o.pointDistance(r)>2.5){const a=new p.Polyline({paths:[r]});return(await o.getOffsetLine(a,-i)).paths[0]}}else return r;return[]}static async pointDistance(e){if(e.length<2)return 0;const t=new p.Polyline({paths:[e]});return await g.geodesicLength(t,"meters")}static async getIntersectPointOfLineAndPolygon(e,t,n=0){n!==0&&(e=await o.getOffsetLine(e,n));const r=await g.intersect(e,t);if(r instanceof p.Polyline){const i=r.paths[0],a=i[0],c=i[i.length-1];return[a,c]}return[]}static async getOffsetLine(e,t){const n=O.geographicToWebMercator(e),r=await g.offset(n,t,"meters");return O.webMercatorToGeographic(r,!1)}static unzip(e){try{const t=[],n=e.split("");for(let i=0;i<n.length;i++){const a=n[i];t.push(a.charCodeAt(0))}const r=new Uint8Array(t);return A.inflate(r,{to:"string"})}catch{console.log(`非压缩内容: ${e}`)}}static getStdVecEntries(e,t=!1){const n=new Array(e.size());for(let r=0;r<e.size();r++)n[r]=e.get(r);return t&&e.delete(),n}static getStdMapEntries(e){const t=[];for(const n of o.getStdMapKeys(e))t.push([n,e.get(n)]);return t}static getStdMapKeys(e,t=!1){const n=[],r=e.keys();for(let i=0;i<r.size();i++)n.push(r.get(i));return r.delete(),t&&e.delete(),n}static setGeoData(e,t,n){o.geoReference=e,o.xOffset=t,o.yOffset=n}static transformLineProjection(e){try{return e.map(t=>P(o.geoReference).inverse([t[0]-o.xOffset,t[1]-o.yOffset]))}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",o.geoReference),e}}static transformPointProjection(e){try{return P(o.geoReference).inverse([e[0]-o.xOffset,e[1]-o.yOffset])}catch{return console.error("OpenDrive坐标转换为WGS84坐标失败",o.geoReference),e}}static pointsEqual(e,t){return Math.abs(e[0]-t[0])<Number.EPSILON&&Math.abs(e[1]-t[1])<Number.EPSILON}static getExtensionLine(e,t,n){const r=f.point(e),i=f.point(t),a=h(r,i);return y(i,n,a,{units:"meters"}).geometry.coordinates}static isCoordinateValid(e){return typeof e.latitude=="string"&&(e.latitude=Number(e.latitude)),typeof e.longitude=="string"&&(e.longitude=Number(e.longitude)),e.latitude!==null&&e.longitude!==null&&!isNaN(e.latitude)&&!isNaN(e.longitude)&&e.latitude!==0&&e.longitude!==0}static getCenterPointInLine(e){const t=f.lineString(e),n=S(t,{units:"meters"})/2,r=x(t,0,n,{units:"meters"});return r.geometry.coordinates[r.geometry.coordinates.length-1]}static async viewGoto(e,t,n=!0){var a,c;const i=localStorage.getItem("gpu")!=="Unknown";if(!n){if(t.length>0){const u=t.map(s=>s.geometry).filter(s=>s);if(u.length>0){let s=(a=await g.union(u))==null?void 0:a.extent;s&&(s=s.expand(1.3),i?await e.goTo(s.center,{duration:1e3}):e.center=s.center)}}return}if(i)await e.goTo(t,{duration:1e3});else if(t.length>0){const u=t.map(s=>s.geometry).filter(s=>s);if(u.length>0){let s=(c=await g.union(u))==null?void 0:c.extent;s&&(s=s.expand(1.3),e.extent=s)}}}}exports.default=o;
|
|
@@ -5,11 +5,13 @@ import { IResult, IShowSignalCrossParams } from 'packages/components/src/types';
|
|
|
5
5
|
export default class SignalCrossController {
|
|
6
6
|
private view;
|
|
7
7
|
private crossLayer;
|
|
8
|
-
private readonly
|
|
8
|
+
private readonly iconSymbolScale;
|
|
9
|
+
private readonly largeMarkerScale;
|
|
9
10
|
private oldScale;
|
|
10
11
|
private scaleWatchHandle;
|
|
11
12
|
private showName;
|
|
12
13
|
private showStyle;
|
|
14
|
+
private didCrossScaleThreshold;
|
|
13
15
|
private readonly clusterRadius;
|
|
14
16
|
private readonly minClusterPoints;
|
|
15
17
|
private readonly maxClusterSymbolSize;
|
|
@@ -27,6 +29,15 @@ export default class SignalCrossController {
|
|
|
27
29
|
*/
|
|
28
30
|
showSignalCross(params: IShowSignalCrossParams): IResult;
|
|
29
31
|
clearSignalCross(): void;
|
|
32
|
+
/**
|
|
33
|
+
* 更改路口显示名称内容
|
|
34
|
+
* @param showName
|
|
35
|
+
*/
|
|
36
|
+
changeShowName(showName: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* 更新散点符号
|
|
39
|
+
*/
|
|
40
|
+
private updateScatterSymbol;
|
|
30
41
|
/**
|
|
31
42
|
* 按照像素距离聚类
|
|
32
43
|
* @param locations
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
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(e){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=e,this.crossLayer=new p({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}didCrossScaleThreshold(e,s,t){return e<t&&s>=t||e>=t&&s<t}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(e=>{const s=this.view.toScreen(new u.Point({x:e.x,y:e.y}));s.x>0&&s.y>0&&(e.properties.screenX=s.x,e.properties.screenY=s.y,e.visited=!1,e.clusterId=void 0,this.clusteredLocations.push(e))})}showSignalCross(e){if(this.crossLayer.removeAll(),this.showName=e.showName||"detail",this.showStyle=e.style||"scatter",this.oldScale=this.view.scale,this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("stationary",()=>{if(this.showStyle==="scatter"){const s=this.view.scale,t=this.didCrossScaleThreshold(this.oldScale,s,this.iconSymbolScale),i=this.didCrossScaleThreshold(this.oldScale,s,this.largeMarkerScale);(t||i)&&this.updateScatterSymbol(),this.oldScale=s}else{this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}})),this.showStyle==="scatter"){const s=e.points.map(t=>{const i=this.getCrossSymbol(t),r=this.getBrandLabel(t.brand),o=this.getOnlineLabel(t.isOnline),n=this.getMalfunctionLabel(t.isMalfunction);return new y({geometry:{type:"point",longitude:t.x,latitude:t.y},symbol:i,attributes:{type:"signal-cross",id:t.crossId,brandLabel:r,isOnlineLabel:o,isMalfunctionLabel:n,...t}})});this.crossLayer.addMany(s)}else{this.locations=e.points.map(t=>({id:t.crossId,x:t.x,y:t.y,visited:!1,clusterId:void 0,properties:t})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}return{status:0,message:"ok"}}clearSignalCross(){var e;this.crossLayer.removeAll(),(e=this.scaleWatchHandle)==null||e.remove(),this.scaleWatchHandle=null}changeShowName(e){this.showName=e,this.showStyle==="scatter"&&this.updateScatterSymbol()}updateScatterSymbol(){this.crossLayer.graphics.forEach(e=>{e.symbol=this.getCrossSymbol(e.attributes)})}doPixelCluster(e){let s=0;for(let t=0;t<this.clusteredLocations.length;t++){const i=this.clusteredLocations[t];if(i.visited)continue;i.visited=!0;const r=this.getNeighbors(i,e);r.length<this.minClusterPoints?i.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=s}),i.clusterId=s,s++)}return this.createClusters()}getNeighbors(e,s){return this.clusteredLocations.filter(t=>t.id===e.id||t.visited?!1:this.getDistance(e,t)<=s)}getDistance(e,s){return Math.sqrt(Math.pow(e.properties.screenX-s.properties.screenX,2)+Math.pow(e.properties.screenY-s.properties.screenY,2))}createClusters(){const e={},s=[];for(const i of this.clusteredLocations)i.clusterId===void 0||i.clusterId===-1?s.push(i):(e[i.clusterId]||(e[i.clusterId]=[]),e[i.clusterId].push(i));const t=Object.keys(e).map((i,r)=>{const o=e[Number(i)],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(i),items:o,count:n,center:{x:m,y:d}}});return s.length>0&&t.push({id:-1,items:s,count:s.length,center:null}),t}showClusterResult(e){this.crossLayer.removeAll();let s=Number.MIN_VALUE,t=Number.MAX_VALUE;e.forEach(i=>{i.count>1&&(t=Math.min(t,i.count),s=Math.max(s,i.count))}),e.forEach(i=>{if(i.id!==-1){let r=t===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(i.count-t)/(s-t)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(i.count.toString().length*8+6)/2,a=new y({geometry:new u.Point({x:i.center.x,y:i.center.y}),attributes:{count:i.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 i.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(e){const s=(e??"").toLowerCase();return s==="scats"?"SCATS":s==="gc"?"国产":e??""}getOnlineLabel(e){return e?"在线":"离线"}getMalfunctionLabel(e){return e?"故障":"正常"}getCrossSymbol(e){var s;if(this.view.scale<=this.iconSymbolScale){let t="/GisViewerAssets/Images/cross/ic_";return t+=e.brand==="scats"?"scats_":"gc_",t+=e.isOnline?"online_":"offline_",t+=e.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:t}]}}}}else{const t={type:"simple-marker",style:"circle",size:this.view.scale>this.largeMarkerScale?3:6,outline:{width:1}};return((s=e.brand)==null?void 0:s.toLowerCase())==="scats"?(e.isOnline?t.color=[68,203,188]:t.color=[200,200,200],t.outline.color=[32,97,90]):(e.isOnline?t.color=[129,226,73]:t.color=[200,200,200],t.outline.color=[65,115,37]),t}}}exports.default=S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
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"),v=require("./layer-symbol.js");class g{constructor(i){this.roadConnections=[],this.view=i,this.subDistrictPointLayer=new w(v.subDistrictPointLayerOptions),this.subDistrictPointLayer.spatialReference=i.spatialReference,this.subDistrictPointLayer.popupEnabled=!0,this.subDistrictLineLayer=new w(v.subDistrictLineLayerOptions),this.subDistrictLineLayer.spatialReference=i.spatialReference,this.subDistrictLineLayer.popupEnabled=!0,this.view.map.addMany([this.subDistrictLineLayer,this.subDistrictPointLayer])}async showSubDistricts(i){var a;await this.clearSubDistricts(),(a=this.clickHandler)==null||a.remove(),this.clickHandler=this.view.on("click",this.viewHitTest.bind(this));let s=0;const e=[],r=[];i.forEach(t=>{t.roadConnections.length>0&&this.roadConnections.push(...t.roadConnections),r.push({value:t.id,label:t.name,symbol:{type:"simple-marker",style:"circle",color:[...t.areaColor,.8],size:"8px",outline:{color:[...t.areaColor],width:4}}}),t.signals.forEach(n=>{const d=new m({geometry:{type:"point",longitude:n.longitude,latitude:n.latitude},attributes:{ObjectID:s++,id:n.nodeId,name:n.name,subDistrictId:t.id,subDistrictName:t.name,districtId:t.parentId,districtName:t.parentName,signalCount:t.signalCount,color:t.areaColor.join(","),type:"subDistrict"}});e.push(d)})}),this.subDistrictPointLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-marker",color:[180,180,180,.5],size:"8px",outline:{color:"white",width:1}},defaultLabel:"其他子区",uniqueValueInfos:r,visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.currentPointRenderer=this.subDistrictPointLayer.renderer.clone(),await this.subDistrictPointLayer.applyEdits({addFeatures:e}),await D.default.viewGoto(this.view,e)}async showRoads(i){const{type:s,id:e}=i,r=this.subDistrictPointLayer.createQuery(),a=s==="district"?"districtId":"subDistrictId";e!==""?r.where=`${a} = '${e}'`:r.where="1=1";const t=await this.subDistrictPointLayer.queryFeatures(r),n=new Map;t.features.forEach(u=>{var p;const{subDistrictId:o,color:c,id:h,districtName:y,subDistrictName:f,signalCount:b}=u.attributes;n.has(o)||n.set(o,{color:c,signalIds:[],districtName:y,subDistrictName:f,signalCount:b}),(p=n.get(o))==null||p.signalIds.push(h)});const d=[],L=[];for(const u of n){let o=0;const c=u[0];d.push({value:c,symbol:{type:"simple-line",color:u[1].color.split(",").map(Number),width:2,style:"solid"}});const{districtName:h,subDistrictName:y,signalIds:f,signalCount:b}=u[1];this.roadConnections.filter(l=>l.subDistrictId===c).forEach(l=>{const I=new m({geometry:{type:"polyline",paths:l.coordinates},attributes:{ObjectID:o++,id:l.id,districtId:l.districtId,subDistrictId:c,subDistrictName:y,districtName:h,signalCount:b,color:u[1].color}});L.push(I)})}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 e;const i=await this.subDistrictPointLayer.queryFeatures();i.features.length>0&&await this.subDistrictPointLayer.applyEdits({deleteFeatures:i.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=[],(e=this.clickHandler)==null||e.remove()}setVisible(i){this.showRoads({type:"district",id:""}),this.subDistrictPointLayer.visible=i,this.subDistrictLineLayer.visible=i}async locateSubDistrict(i){const s=this.subDistrictPointLayer.createQuery();s.where=`subDistrictId = '${i}'`,s.returnGeometry=!0;const e=await this.subDistrictPointLayer.queryFeatures(s);return e.features.length>0?(await D.default.viewGoto(this.view,e.features,!1),{status:0,message:"ok"}):{status:1,message:"未找到子区"}}async highlightSubDistrict(i){let s="";const e=this.subDistrictPointLayer.definitionExpression;this.subDistrictPointLayer.definitionExpression=`subDistrictId = '${i.id}'`;const r=await this.subDistrictPointLayer.queryFeatures(),a=r.features.length;return a>0?(this.subDistrictLineLayer.definitionExpression=`subDistrictId = '${i.id}'`,s=r.features[0].attributes.districtId,await D.default.viewGoto(this.view,r.features,i.needZoom!==!1)):this.subDistrictPointLayer.definitionExpression=e,{count:a,parentId:s}}filter(i){const{type:s,id:e}=i,r=`${s==="district"?"districtId":"subDistrictId"} = '${e}'`;this.subDistrictPointLayer.definitionExpression=r,this.subDistrictLineLayer.definitionExpression=r}resetFilter(){this.subDistrictPointLayer.definitionExpression="1=1",this.subDistrictLineLayer.definitionExpression="1=1"}async viewHitTest(i){var r;const e=(r=(await this.view.hitTest(i,{include:[this.subDistrictPointLayer,this.subDistrictLineLayer]})).results)==null?void 0:r.filter(a=>a.type==="graphic");if(e.length===0)console.time("resetRenderer"),this.subDistrictPointLayer.renderer=this.currentPointRenderer,this.subDistrictLineLayer.renderer=this.currentLineRenderer;else{const a=e[0].graphic,t=a.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:a.attributes.subDistrictId,symbol:{type:"simple-marker",style:"circle",color:[...t,.8],size:"8px",outline:{color:t,width:4}}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:24,value:2500},{size:20,value:5e3},{size:8,value:18055.954822000003},{size:4,value:144447.638572},{size:2,value:1155581108577e-6}]}]},this.subDistrictLineLayer.renderer={type:"unique-value",field:"subDistrictId",defaultSymbol:{type:"simple-line",style:"solid",color:[180,180,180,.5],width:"8px"},defaultLabel:"其他子区",uniqueValueInfos:[{value:a.attributes.subDistrictId,symbol:{type:"simple-line",style:"solid",color:a.attributes.color.split(",").map(Number),width:"8px"}}],visualVariables:[{type:"size",valueExpression:"$view.scale",stops:[{size:6,value:2500},{size:5,value:5e3},{size:4,value:18055.954822000003},{size:3,value:144447.638572},{size:2,value:1155581108577e-6}]}]}}}}exports.default=g;
|