src/api/dataAnalysisApi.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/api/index.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/utils/map/3dLayer.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/utils/map/pollution_trace.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/historymode/HistoryMode.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/dataAnalysisApi.js
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,14 @@ import { $http } from './index'; export default { /** * æ±¡ææº¯æºåæ * @param {String} missionCode * @returns */ pollutionTrace(missionCode) { return $http .get(`air/analysis/pollution/trace`, { params: { missionCode } }) .then((res) => res.data); } }; src/api/index.js
@@ -1,7 +1,7 @@ import axios from 'axios'; import { ElMessage } from 'element-plus'; const debug = false; const debug = true; let ip1 = 'http://47.100.191.150:9029/'; // console.log(import.meta.env); src/utils/map/3dLayer.js
@@ -166,6 +166,78 @@ _cylinder = cylinder; } /** * ç»å¶é«äº®ç污æåºå3Dç«é¢ */ var _polCylinder = undefined; var _polFactorDatas = { lnglats: [], heights: [], type: '' }, //å½åéä¸ççæµå åæ°æ® _polFactor = {}; function drawHighLight3DLayer(fDatas, factor) { const offsetH = 40; const lnglats_GD = fDatas.lnglats_GD; const coors = fDatas.coors_GD; const heights = factor.heights; const colors = factor.colors; const bColors = factor.bottomColors; // eslint-disable-next-line no-undef var cylinder = new AMap.Object3D.Mesh(); cylinder.backOrFront = 'both'; cylinder.transparent = true; var geometry = cylinder.geometry; const scale = _getScale(_minH, _maxH); for (let i = 0; i < coors.length; i++) { var r = lnglats_GD[i]; var lastP = lnglats_GD[i - 1]; var p = coors[i]; var h = (heights[i] - _minH) * scale + _minHeight; if (heights[i] == -1) { h = -1; } geometry.vertices.push(p.x, p.y, 0 - h); //åºé¨é¡¶ç¹ geometry.vertices.push(p.x, p.y, 0 - h - offsetH); //é¡¶é¨é¡¶ç¹ if (i > 0) { // eslint-disable-next-line no-undef var distance = AMap.GeometryUtil.distance(r, lastP); //ä¸¤ä¸ªæ°æ®ç¹æå°é´éæ¶é´ä¸º4sï¼å设车éæç §120km/h计ç®ï¼4sè¡é©¶æå¤§è·ç¦»ä½ä¸º132ç±³ï¼ //设å®è¶ è¿1åéçæ°æ®ç»å¶ç¹æ®çè¿çº¿ if (distance <= 500 && h != -1) { var bottomIndex = i * 2; var topIndex = bottomIndex + 1; var lastBottomIndex = bottomIndex - 2; var lastTopIndex = bottomIndex - 1; geometry.faces.push(bottomIndex, topIndex, lastTopIndex); geometry.faces.push(bottomIndex, lastBottomIndex, lastTopIndex); } } // const color = [1, 1, 1, 0.75] 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); } object3Dlayer.add(cylinder); _polCylinder = cylinder; } export default { clear() { map.off('zoomend', onMapZoom); @@ -211,5 +283,7 @@ if (lnglats_GD.length > 0) { map.on('zoomend', onMapZoom); } } }, drawHighLight3DLayer }; src/utils/map/pollution_trace.js
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,24 @@ /** * æ±¡ææº¯æº */ /** * ç»å¶é«äº®ç污æåºå3Dç«é¢ */ function drawHighLight3DLayer() {} /** * ç»å¶æ¶åçæ±¡æåºæ¯ */ function drawPollutionScene() {} /** * ç»å¶ååæº¯æºæå½¢ */ function drawSectors() {} export default { drawHighLight3DLayer, drawPollutionScene, drawSectors }; src/views/historymode/HistoryMode.vue
@@ -8,6 +8,13 @@ @search="onSearch" ></SearchBar> <TrajectoryState v-show="status != 0" :status="status"></TrajectoryState> <el-button type="primary" class="p-events-auto el-button-custom" @click="handleClick" > åæ </el-button> </el-row> <el-row class="m-t-2"> <FactorRadio @@ -64,6 +71,7 @@ import DataSheet from './component/DataSheet.vue'; import { ElMessage } from 'element-plus'; import { fetchHistoryData } from '@/utils/factor/data'; import dataAnalysisApi from '@/api/dataAnalysisApi'; import { mapStores } from 'pinia'; import { useSceneStore } from '@/stores/scene'; @@ -196,9 +204,10 @@ }); }, onSearch(option) { const { deviceType, deviceCode, timeArray } = option; const { deviceType, deviceCode, timeArray, mission } = option; this.deviceType = deviceType; this.deviceCode = deviceCode; this.mission = mission; let startTime, endTime; if (timeArray && timeArray.length == 2) { startTime = moment(timeArray[0]).format('YYYY-MM-DD HH:mm:ss'); @@ -214,6 +223,19 @@ perPage: pageSize }).then((res) => this.onFetchData(deviceType, res.data)); }); }, 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); }); }); }); } }, mounted() {