| | |
| | | import { Factor } from './Factor'; |
| | | import calculate from '@/utils/map/calculate'; |
| | | import { Legend } from './Legend'; |
| | | import moment from 'moment'; |
| | | |
| | | /** |
| | | * |
| | |
| | | }); |
| | | }, |
| | | |
| | | getByDate(s, e) { |
| | | const sTime = moment(s).format('YYYY-MM-DD HH:mm:ss'); |
| | | const eTime = moment(e).format('YYYY-MM-DD HH:mm:ss'); |
| | | const sIndex = this.times.findIndex((v) => { |
| | | return v == sTime; |
| | | }); |
| | | const eIndex = this.times.findIndex((v) => { |
| | | return v == eTime; |
| | | }); |
| | | if (sIndex != -1 && eIndex != -1) { |
| | | return this.getByIndex(sIndex, eIndex); |
| | | } |
| | | }, |
| | | |
| | | // 获取数据长度 |
| | | length: function () { |
| | | return this.lnglats_GD.length; |
| | |
| | | const fDatas = _factorDatas; |
| | | const factor = _factor; |
| | | drawMesh(fDatas, factor); |
| | | |
| | | if (_polFactorDatasList.length > 0) { |
| | | _polCylinderList.forEach((p) => { |
| | | object3Dlayer.remove(p); |
| | | }); |
| | | _polCylinderList = []; |
| | | _polFactorDatasList.forEach((e, i) => { |
| | | drawHighLight3DLayer(e, _polFactorList[i]); |
| | | }); |
| | | } |
| | | // console.log(map.getZoom()); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 绘制高亮的污染区域3D立面 |
| | | */ |
| | | var _polCylinder = undefined; |
| | | var _polFactorDatas = { |
| | | lnglats: [], |
| | | heights: [], |
| | | type: '' |
| | | }, |
| | | var _polCylinderList = []; |
| | | var _polFactorDatasList = [], |
| | | //当前选中的监测因子数据 |
| | | _polFactor = {}; |
| | | _polFactorList = []; |
| | | function drawHighLight3DLayer(fDatas, factor) { |
| | | const offsetH = 40; |
| | | const offsetH = 100; |
| | | |
| | | const lnglats_GD = fDatas.lnglats_GD; |
| | | const coors = fDatas.coors_GD; |
| | |
| | | } |
| | | } |
| | | |
| | | // const color = [1, 1, 1, 0.75] |
| | | const color = [1, 0, 0, 0.75]; |
| | | const color = [1, 1, 1, 1]; |
| | | // const color = [1, 0, 0, 0.75]; |
| | | geometry.vertexColors.push.apply(geometry.vertexColors, color); //底部顶点颜色 |
| | | geometry.vertexColors.push.apply(geometry.vertexColors, color); //顶部顶点颜色 |
| | | } |
| | | |
| | | // 7.根据合并选项重置或新增当前缓存数据 |
| | | _polFactorDatas = fDatas; |
| | | _polFactor = factor; |
| | | if (_polCylinder != undefined) { |
| | | object3Dlayer.remove(_polCylinder); |
| | | } |
| | | _polFactorDatasList.push(fDatas); |
| | | _polFactorList.push(factor); |
| | | // if (_polCylinderList.length > 0) { |
| | | // _polCylinderList.forEach((p) => { |
| | | // object3Dlayer.remove(p); |
| | | // }); |
| | | // } |
| | | object3Dlayer.add(cylinder); |
| | | |
| | | _polCylinder = cylinder; |
| | | _polCylinderList.push(cylinder); |
| | | } |
| | | |
| | | export default { |
| | |
| | | if (_cylinder != undefined) { |
| | | object3Dlayer.remove(_cylinder); |
| | | } |
| | | if (_polCylinderList.length > 0) { |
| | | _polCylinderList.forEach((p) => { |
| | | object3Dlayer.remove(p); |
| | | }); |
| | | _polCylinderList = []; |
| | | } |
| | | _polFactorDatasList = []; |
| | | _polFactorList = []; |
| | | }, |
| | | |
| | | drawMesh: drawMesh, |
| | |
| | | factorType: defaultOptions(TYPE0).value, |
| | | // 监测数据 |
| | | factorDatas: new FactorDatas(), |
| | | // 污染溯源结果 |
| | | pollutionData: undefined, |
| | | // 决定绘制3D图形时是否与原图像合并 |
| | | merge: false, |
| | | // 决定绘制完3D图形后地图视角是否自动回中 |
| | |
| | | watch: { |
| | | factorType(nValue, oValue) { |
| | | if (nValue != oValue && this.status == 0) { |
| | | Layer.clear(); |
| | | this.draw(); |
| | | this.drawHighlightPollution(); |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | ); |
| | | }, |
| | | drawHighlightPollution() { |
| | | this.pollutionData.forEach((e) => { |
| | | if (this.factorType == e.factorId + '') { |
| | | const fDatas = this.factorDatas.getByDate(e.startDate, e.endDate); |
| | | Layer.drawHighLight3DLayer(fDatas, fDatas.factor[this.factorType]); |
| | | } |
| | | }); |
| | | }, |
| | | onFetchData(deviceType, data) { |
| | | if (this.isUnmounted) return; |
| | | // todo 根据设备类型切换地图监测因子展示单选框、折线图复选框、数据表格复选框的因子类型 |
| | | this.deviceType = deviceType; |
| | | this.factorDatas.setData(data, this.drawMode, () => { |
| | | this.factorDatas.refreshHeight(this.factorType); |
| | | Layer.clear(); |
| | | this.draw(); |
| | | }); |
| | | }, |
| | |
| | | handleClick() { |
| | | const { missionCode } = this.mission; |
| | | dataAnalysisApi.pollutionTrace(missionCode).then((res) => { |
| | | res.data.forEach((e) => { |
| | | const fDatas = new FactorDatas(); |
| | | fDatas.setData(e.dataVoList, this.drawMode, () => { |
| | | fDatas.refreshHeight(this.factorType); |
| | | Layer.drawHighLight3DLayer(fDatas, fDatas.factor[this.factorType]); |
| | | console.log(e.dataVoList); |
| | | }); |
| | | }); |
| | | this.pollutionData = res.data; |
| | | this.drawHighlightPollution(); |
| | | }); |
| | | } |
| | | }, |