From 3d77e7584fe49f629a6b1c231999e5bc182c419a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=BB=B6=E7=A6=8F?= <> Date: Tue, 16 May 2023 16:10:28 +0800 Subject: [PATCH] =?UTF-8?q?style:=E6=B8=85=E7=A9=BA=E6=97=A0=E6=95=88?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mock/layer.ts | 312 +------------ src/views/base.component.ts | 474 +------------------- src/views/overview.component.html | 4 - src/views/overview.component.scss | 125 ------ src/views/overview.component.ts | 697 +----------------------------- 5 files changed, 7 insertions(+), 1605 deletions(-) diff --git a/src/mock/layer.ts b/src/mock/layer.ts index e07e5b8..382b7c1 100644 --- a/src/mock/layer.ts +++ b/src/mock/layer.ts @@ -18,28 +18,7 @@ enum COLOR{ // 四色图-红 RED="#FF5959" } -export default [{ - name:"在管企业", - ids:[] as string[], - type:"areaMarker", - value:"company", - colors:["#0a5fff","#5e93fd"], - selected:false, - pages:["parkFile","companyFile","closePark","smartSafetySupervision","smartEnvironment","smartEnergy","gasConsumption","electricityConsumption","waterConsumption","steamConsumption"] -},{ - name:"视频监控", - ids:[] as string[], - type:"marker", - urls:[ - "@path:camera_0.png", - "@path:camera_1.png", - "@path:camera_2.png", - "@path:camera_3.png", - ], - value:"video" , - selected:false, - pages:["parkFile","smartEmergency","closePark","peopleCar","dangrousCar","boundsManager","smartSafetySupervision"] -},{ +export default [ { name:"电子围栏", ids:[] as string[], type:"area", @@ -47,14 +26,7 @@ export default [{ color:COLOR.BOUNDS, selected:false, pages:["closePark","peopleCar"] -},{ - name:"人员热力图", - ids:[] as string[], - type:"heatmap", - value:"heatmap", - selected:false, - pages:[] -},{ +}{ name:"人员定位", ids:[] as string[], type:"moveMarker", @@ -65,15 +37,7 @@ export default [{ coordinateType:1, selected:false, pages:["closePark","peopleCar","smartSafetySupervision","smartEmergency"] -},{ - name:"人员热力图", - ids:[] as string[], - type:"heatmap", - value:"heatmap", - coordinateType:1, - selected:false, - pages:["smartEmergency"] -},{ +}{ name:"车辆定位", ids:[] as string[], type:"moveMarker", @@ -88,274 +52,4 @@ export default [{ coordinateType:1, selected:false, pages:["closePark","peopleCar","smartSafetySupervision","smartEmergency"] -},{ - name:"重载车辆", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/VehicleLibrary/Exhibition/重型货车_01", - value:"heavy-car", - scale:[3,3,3], - selected:false, - pages:["closePark","dangrousCar"] -},{ - name:"空载车辆", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/ObjectLibrary/Exhibition/交通工具/车辆/工程车_2", - value:"empty-car", - scale:[3,3,3], - selected:false, - pages:["closePark","dangrousCar"] -},{ - name:"疏散路线", - ids:[] as string[], - type:"line", - color:COLOR.GREEN, - value:"safe-route", - selected:false, - pages:["dangrousCar"] -}, -// { -// name:"气体监测", -// ids:[] as string[], -// type:"", -// value:"gas-monitor", -// selected:false, -// pages:["dangrousCar"] -// }, -{ - name:"重大危险源", - ids:[] as string[], - type:"areaMarker", - value:"dangrous", - color:"#FFF", - colors:[], - selected:false, - pages:["parkFile","smartSafetySupervision","smartEmergency"] -},{ - name:"风险四色图", - ids:[] as string[], - type:"areaMarker", - value:"four-color", - colors:[COLOR.RED,COLOR.YELLOW,COLOR.BLUE,COLOR.GREEN], - selected:false, - pages:["parkFile","smartSafetySupervision","risk"] -},{ - name:"风险四色图", - ids:[] as string[], - type:"areaMarker", - value:"four-color2", - colors:[COLOR.RED,COLOR.YELLOW,COLOR.BLUE,COLOR.GREEN], - selected:false, - pages:["dangrousCar"] -},{ - name:"应急设施", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/EffectLibrary/Exhibition/3DUI/3D_UI_D_2", - value:"safe-building", - scale:[3,3,3], - selected:false, - pages:["parkFile","smartEmergency","goods"] -},{ - name:"物资仓库", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/EffectLibrary/Exhibition/3DUI/3D_UI_C_5", - value:"safe-goods", - scale:[3,3,3], - selected:false, - pages:["parkFile","smartEmergency","goods"] -},{ - name:"实控线", - ids:[] as string[], - type:"area", - value:"real-line", - color:COLOR.REALLINE, - selected:false, - pages:["parkFile","boundsManager"] -},{ - name:"安全线", - ids:[] as string[], - type:"area", - value:"safe-line", - color:COLOR.SAFELINE, - selected:false, - pages:["parkFile","boundsManager"] -},{ - name:"规划线", - ids:[] as string[], - type:"area", - value:"plan-line", - color:COLOR.PLANLINE, - selected:false, - pages:["parkFile","boundsManager"] -},{ - name:"卡口设施", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/EffectLibrary/Exhibition/3DUI/3D_UI_D_2", - value:"check-point", - scale:[3,3,3], - selected:false, - pages:["boundsManager"] -},{ - name:"动火", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/EffectLibrary/Exhibition/3DUI/3D_UI_A_1", - value:"use-fire", - scale:[3,3,3], - selected:false, - pages:["dangerousWork"] -},{ - name:"断路", - ids:[] as string[], - type:"areaMarker", - value:"break-road", - selected:false, - color:"#000", - pages:["dangerousWork"] -},{ - name:"高空", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/EffectLibrary/Exhibition/3DUI/3D_UI_A_1", - value:"high-sky", - scale:[3,3,3], - selected:false, - pages:["dangerousWork"] -},{ - name:"吊装", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/EffectLibrary/Exhibition/3DUI/3D_UI_A_1", - value:"hoisting", - scale:[3,3,3], - selected:false, - pages:["dangerousWork"] -},{ - name:"动土", - ids:[] as string[], - type:"areaMarker", - value:"make-ground", - selected:false, - color:"#efaf00", - pages:["dangerousWork"] -},{ - name:"临时用电", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/EffectLibrary/Exhibition/3DUI/3D_UI_A_1", - value:"use-e", - scale:[3,3,3], - selected:false, - pages:["dangerousWork"] -},{ - name:"受限空间", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/EffectLibrary/Exhibition/3DUI/3D_UI_A_1", - value:"forbid-space", - scale:[3,3,3], - selected:false, - pages:["dangerousWork"] -},{ - name:"盲板抽堵", - ids:[] as string[], - type:"model", - pakFilePath: "@path:DTS_Library_V5.4.pak", - assetPath:"/JC_CustomAssets/EffectLibrary/Exhibition/3DUI/3D_UI_A_1", - value:"blind-plate", - scale:[3,3,3], - selected:false, - pages:["dangerousWork"] -},{ - name:"大气环境", - ids:[] as string[], - type:"marker", - value:"gas-env", - hasText:true, - coordinateType:1, - url:"@path:mp_atmosphere.png", - selected:false, - pages:["smartEnvironment","airQuality","dangrousCar"] -},{ - name:"土壤环境", - ids:[] as string[], - type:"marker", - value:"ground-env", - coordinateType:1, - hasText:true, - url:"@path:mp_soil.png", - selected:false, - pages:["smartEnvironment","soilQuality"] -},{ - name:"废气污染源", - ids:[] as string[], - type:"marker", - url:"@path:mp_fluegas.png", - value:"fq-wrw", - coordinateType:1, - hasText:true, - selected:false, - pages:["smartEnvironment","gas"] -},{ - name:"清下水监控", - ids:[] as string[], - type:"marker", - coordinateType:1, - hasText:true, - url:"@path:mp_purewater.png", - value:"qxs-jk", - selected:false, - pages:["smartEnvironment","clean"] -},{ - name:"水环境", - ids:[] as string[], - type:"marker", - coordinateType:1, - url:"@path:mp_water.png", - value:"water-env", - hasText:true, - selected:false, - pages:["smartEnvironment","waterQuality"] -},{ - name:"特征污染物", - ids:[] as string[], - type:"marker", - coordinateType:1, - hasText:true, - url:"@path:mp_contaminant.png", - value:"tz-wrw", - selected:false, - pages:["smartEnvironment","characteristicContaminants"] -},{ - name:"废水污染源", - ids:[] as string[], - type:"marker", - coordinateType:1, - hasText:true, - url:"@path:mp_fluewater.png", - value:"fs-wrw", - selected:false, - pages:["smartEnvironment","waste"] -},{ - name:"隐患治理", - ids:[] as string[], - type:"marker", - url:"@path:dt_yinhuan.png", - value:"hidden-dangrous", - selected:false, - pages:["pitfall"] }] \ No newline at end of file diff --git a/src/views/base.component.ts b/src/views/base.component.ts index 24c7d28..62600f0 100644 --- a/src/views/base.component.ts +++ b/src/views/base.component.ts @@ -27,12 +27,6 @@ export default class BaseComponent extends Vue { public lock = true; public timerList = {} as any; - - public eventAssets = { - fire:"/JC_CustomAssets/ParticleLibrary/Exhibition/火/火焰_10", - normal:"/JC_CustomAssets/EffectLibrary/Exhibition/Point/Point_R_2" - } ; - public warnAssets = "/JC_CustomAssets/EffectLibrary/Exhibition/Point/Point_Y_2"; public pakFilePath = "@path:DTS_Library_V5.4.pak"; public currentWanning:any = null; public currentEvent:any = null; @@ -67,61 +61,6 @@ export default class BaseComponent extends Vue { } - - public addEvent(data){ - if(this.currentEvent){ - this.player.api.customObject.delete(this.currentEvent.id); - this.player.api.marker.delete(this.currentEvent.id); - this.currentEvent = null; - } - if(!data.position[2]){ - data.position[2]=0.5 - } - this.currentEvent = { - id: data.id, - pakFilePath: this.pakFilePath, - assetPath:this.eventAssets[data.type] , - location: data.position, - scale: data.type==="fire"?[15, 15, 15]:[10,10,10], - popupSize:[355,212], - coordinate:data.position, - lineSize:[2,40], - autoHeight:true, - popupOffset:[-176,-106], - useTextAnimation: false, - autoHidePopupWindow:false, - displayMode:2, - popupURL:"http://192.168.1.20:8080/#/popup?"+new URLSearchParams(data), - } - - this.player.api.marker.add(this.currentEvent, (data) => { - this.player.api.marker.showPopupWindow(this.currentEvent.id); - this.player.api.marker.focus(this.currentEvent.id,150,2) - }) - - this.player.api.customObject.add(this.currentEvent, (data) => { - }) - } - - public addWarnning(item){ - if(this.currentWanning){ - this.player.api.customObject.delete(this.currentWanning.id) - } - this.currentWanning = { - id:item.id+"", - groupId:"warning", - pakFilePath:this.pakFilePath, - assetPath:this.warnAssets, - // coordinateType:1, - location:[...item.position,10], - rotation:[0,90,0] - - } - this.player.api.customObject.add(this.currentWanning,()=>{ - this.player.api.customObject.focus(this.currentWanning.id,15,2) - }) - } - // 添加电子围栏 // 安全线 // 实控线 // 规划线 public async toggleArea(layer){ if(!layer.ids.length){ @@ -151,407 +90,6 @@ export default class BaseComponent extends Vue { } } - // 添加marker - public toggleMarker(layer){ - if(!layer.ids.length){ - let text = {}; - const datas = this.dataList[layer.value].map(item=>{ - if(layer.hasText){ - text = { - useTextAnimation: false, - textBackgroundColor:[0,0,0,0.7], - textOffset:[0,0], - fontSize:12, - fontColor:"#FFF", - text:item.name || layer.name - } - } - return Object.assign({ - id:item.id, - groupId:layer.value, - coordinate:item.position, - coordinateType:layer.coordinateType?layer.coordinateType:0, - displayMode:2, - imagePath:layer.url || layer.urls[item.type], - imageSize:[48,48], - // popupURL:"http://192.168.1.20:8080/#/popup?"+new URLSearchParams(item), - lineSize:[2,40], - useTextAnimation: false, - lineOffset:[24,0], - // textBackgroundColor:[0,0,0,0.7], - autoHeight:true, - - },text) - }); - this.player.api.marker.add(datas,(data)=>{ - layer.ids = datas.map(item=>item.id) - }) - }else{ - if(layer.selected){ - // this.player.api.marker.showAllPopupWindow(); - this.player.api.marker.show(layer.ids) - }else{ - // this.player.api.marker.hideAllPopupWindow(); - this.player.api.marker.hide(layer.ids) - } - } - - - } - - // 添加企业面 tag - public toggleAreaMarker(layer){ - if(!layer.ids.length){ - const result = this.dataList[layer.value]; - if (!result) return - const datas = result.map(item=>{ - return { - id:item.id, - groupId:layer.value, - coordinate:item.position, - displayMode:2, - text:item.name, - // popupURL:"http://192.168.1.20:8080/#/popup?"+new URLSearchParams(item), - // popupSize:[348,156], - lineSize:[2,40], - useTextAnimation: false, - textBackgroundColor:[0,0,0,0.7], - textOffset:[0,0], - fontSize:12, - fontColor:"#FFF", - autoHeight:true, - - } - }); - const datas2 = result.map((item,index)=>{ - return { - id:item.id, - groupId:layer.value, - coordinates:item.area, - height:layer.value==="company"?5:40, - color:layer.color || layer.colors[index], - style:1, - generateTop:true, - generateBottom:true - - } - }); - - this.player.api.polygon3d.add(datas2,(data)=>{ - // - console.log(layer.value,data) - }) - this.player.api.marker.add(datas,(data)=>{ - layer.ids = result.map(item=>item.id) - }) - // this.player.api.marker.showAllPopupWindow(); - }else{ - if(layer.selected){ - // this.player.api.marker.showAllPopupWindow(); - this.player.api.marker.show(layer.ids) - this.player.api.polygon3d.show(layer.ids) - }else{ - // this.player.api.marker.hideAllPopupWindow(); - this.player.api.marker.hide(layer.ids) - this.player.api.polygon3d.hide(layer.ids) - } - } - } - - public async toggleMoveMarker(layer){ - const result = this.dataList[layer.value]; - - if(!layer.ids.length){ - const datas = result.map(item=>{ - return { - id:item.id, - groupId:layer.value, - pakFilePath:layer.pakFilePath, - assetPath:layer.assetPath, - coordinateType:layer.coordinateType?layer.coordinateType:0, - location:item.position, - smoothMotion:1, - scale:[0,0,0], - rotation:[0,90,0] - - } - }); - const markerDatas = result.map(item=>{ - return { - id:item.id, - groupId:layer.value, - coordinate:item.position, - coordinateType:layer.coordinateType?layer.coordinateType:0, - displayMode:2, - imagePath:layer.url || layer.urls[item.type], - imageSize:[48,48], - // popupURL:"http://192.168.1.20:8080/#/popup?"+new URLSearchParams(item), - lineSize:[2,40], - useTextAnimation: false, - lineOffset:[24,0], - // textBackgroundColor:[0,0,0,0.7], - autoHeight:true, - - } - }) - this.player.api.marker.add(markerDatas) - this.player.api.customObject.add(datas,(data)=>{ - console.log(data) - if(data.resultMessage==="OK"){ - this.player.api.marker.setAttachCustomObject(result.map(item=>{ - layer.ids.push(item.id); - - - return{ - markerId: item.id, //标注id - objectId: item.id, //自定义对象id - offset: [0, 0, 0] //偏移量 - } - })); - this.player.api.customObject.moveTo(result.map(item=>{ - return { - id:item.id, - location:turf.destination(turf.point(item.position),layer.value==="car"?50:1,Math.random()*360,{units:"meters"}).geometry.coordinates, - "smoothTime": 5 - } - })) - - this.timerList[layer.value] = setInterval(()=>{ - this.player.api.customObject.moveTo(result.map(item=>{ - return { - id:item.id, - location:turf.destination(turf.point(item.position),layer.value==="car"?50:1,Math.random()*360,{units:"meters"}).geometry.coordinates, - "smoothTime": 5 - } - })) - },5000) - } - }) - }else{ - if(layer.selected){ - this.player.api.customObject.show(layer.ids) - this.player.api.marker.show(layer.ids) - this.player.api.customObject.moveTo(result.map(item=>{ - return { - id:item.id, - location:turf.destination(turf.point(item.position),layer.value==="car"?50:1,Math.random()*360,{units:"meters"}).geometry.coordinates, - "smoothTime": 5 - } - })) - - this.timerList[layer.value] = setInterval(()=>{ - this.player.api.customObject.moveTo(result.map(item=>{ - return { - id:item.id, - location:turf.destination(turf.point(item.position),layer.value==="car"?50:1,Math.random()*360,{units:"meters"}).geometry.coordinates, - "smoothTime": 5 - } - })) - },5000) - }else{ - clearInterval(this.timerList[layer.value]); - this.timerList[layer.value] = null; - this.player.api.customObject.hide(layer.ids) - this.player.api.marker.hide(layer.ids) - } - } - - } - - // 添加3dMarker - public async toggleCustom(layer){ - if(!layer.type){ - return - } - - if(!layer.ids.length){ - const result = this.dataList[layer.value] || []; - const datas = result.map(item=>{ - if(!item.position[2]){ - item.position[2] = item.name==="高空"? 20:3 - } - return { - id:item.id, - groupId:layer.value, - pakFilePath:layer.pakFilePath, - assetPath:layer.assetPath, - coordinateType:layer.coordinateType?layer.coordinateType:0, - location:item.position, - scale:layer.scale, - rotation:[0,90,0] - - } - }); - this.player.api.customObject.add(datas,(data)=>{ - if(data.resultMessage==="OK"){ - if(layer.value.indexOf("car")<0){ - result.forEach(async (item)=>{ - let res = await this.player.api.misc.getBPFunction(layer.assetPath); - console.log(res,item) - if(layer.value==="safe-goods"){ - this.player.api.customObject.callBatchBPFunction([{ - id: item.id, - functionName: '数据', - parameters: [ - { "paramType": 5, "paramValue": item.remark}, - { "paramType": 6, "paramValue": [1,1,1,1] }, - ] - },{ - id: item.id, - functionName: '文字', - parameters: [ - { "paramType": 5, "paramValue": item.name}, - { "paramType": 5, "paramValue": ""}, - { "paramType": 6, "paramValue": [1,1,1,1] }, - { "paramType": 6, "paramValue": [0, 0.3, 1, 1] }, - ] - }],(data)=>{ - console.error("物资盘点的marker点位供应商方面有问题 无法修改 预计五月底修复 产品经理说先放着不改文字") - }); - }else if (layer.value==="safe-building" || layer.value==="check-point"){ - this.player.api.customObject.callBatchBPFunction([{ - id: item.id, - functionName: '文字', - parameters: [ - { "paramType": 5, "paramValue": item.name}, - { "paramType": 2, "paramValue": 48 }, - { "paramType": 6, "paramValue": [0,1,0.000774,1] }, - { "paramType": 3, "paramValue": 1 } - ] - },{ - id: item.id, - functionName: '数据', - parameters: [ - { "paramType": 5, "paramValue": item.remark}, - { "paramType": 2, "paramValue": 150 }, - ] - }]); - }else{ - this.player.api.customObject.callBatchBPFunction([{ - id: item.id, - functionName: '文字', - parameters: [ - { "paramType": 5, "paramValue": layer.name+"作业"}, - { "paramType": 2, "paramValue": 48}, - { "paramType": 6, "paramValue": [1,1,1,1] }, - ] - }],(data)=>{ - console.log(data) - }); - } - }) - } - layer.ids = result.map(item=>item.id) - } - }) - }else{ - if(layer.selected){ - this.player.api.customObject.show(layer.ids) - }else{ - this.player.api.customObject.hide(layer.ids) - } - } - } - - - // 热力图 - public async addHeatMap(layer) { - if(!layer.ids.length){ - const range = [0, 100]; - const data = [] as any; - const bbox = [ - 13312554.24, - 4098064.96, - 0, - 13313446.4, - 4098892.48, - 0 - ] - for (let i = 0; i < 100; i++) { - const x = getRandNumBetween(bbox[0], bbox[3]); //minX ~ maxX - const y = getRandNumBetween(bbox[1], bbox[4]); //minY ~ maxY - data.push({ - id: i.toString(), - coordinate: [x, y, 0], //热力点的坐标 - radius: Math.random() * 30, //热力点影像半径范围 - heatValue: Math.random() * 100 //热力值 - }); - } - this.player.api.heatmap.add('heatmap', bbox, range, data); - layer.ids.push("heatmap") - }else{ - if(layer.selected){ - this.player.api.heatmap.show(layer.ids) - }else{ - this.player.api.heatmap.hide(layer.ids) - } - } - - - } - - // 添加逃生路线 - - public async addRoute(layer){ - - if(!layer.ids.length){ - const result = this.dataList[layer.value].map(item=>{ - return { - id:item.id, - groupId:layer.value, - coordinates:item.positions, - thickness:5, - shape:0, - flowRate:0.1, - color:layer.color, - style:0, - } - }); - this.player.api.polyline.add(result,(data)=>{ - if(data.resultMessage==="OK"){ - layer.ids = result.map(item=>item.id) - } - }) - }else{ - if(layer.selected){ - this.player.api.polyline.show(layer.ids) - }else{ - this.player.api.polyline.hide(layer.ids) - } - } - } - - - public toggleLayerAssets(layer){ - if(layer.type === "area"){ - this.toggleArea(layer) - return - } - if(layer.type === "line"){ - this.addRoute(layer) - return - } - if(layer.type === "heatmap"){ - this.addHeatMap(layer) - return - } - if(layer.type==="areaMarker"){ - this.toggleAreaMarker(layer) - return - } - if(layer.type==="moveMarker"){ - this.toggleMoveMarker(layer) - return - } - if(layer.type==="model"){ - this.toggleCustom(layer) - return - } - if(layer.type==="marker"){ - this.toggleMarker(layer) - } - } - public onFocus(data){ this.player.api[data.type].focus(data.id) @@ -564,18 +102,10 @@ export default class BaseComponent extends Vue { console.log(1) } beforeDestory(){ + // } destroyed(){ - this.layerData.forEach(item=>{ - if(item.type){ - this.player.api[item.type].clear() - } - if(this.timerList[item.value]){ - clearInterval(this.timerList[item.value]); - this.timerList[item.value] = null; - } - - }) + // } diff --git a/src/views/overview.component.html b/src/views/overview.component.html index b744d61..fe01f9b 100644 --- a/src/views/overview.component.html +++ b/src/views/overview.component.html @@ -1,8 +1,4 @@