From 5e059c9c17a6d63b6c017d2d2beb25ae227071d1 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 11 四月 2025 17:33:59 +0800 Subject: [PATCH] 走航融合优化中 --- src/model/SatelliteGrid.js | 140 +++++++++------------------------------------- 1 files changed, 27 insertions(+), 113 deletions(-) diff --git a/src/model/SatelliteGrid.js b/src/model/SatelliteGrid.js index 2ca4d43..e2ef06d 100644 --- a/src/model/SatelliteGrid.js +++ b/src/model/SatelliteGrid.js @@ -15,16 +15,16 @@ } gridGroupId; - + // 榛樿鍦板浘缃戞牸鐩稿叧瀵硅薄 mapViews; gridDataDetail; - infoMap = new Map(); - // 鍦板浘缃戞牸瀵硅薄Map缁撴瀯锛屽瓨鍌ㄥ搴攌ey涓嬬殑缃戞牸瀵硅薄銆佺綉鏍煎潗鏍囦俊鎭� mapViewsMap = new Map(); + + gridStateMap = new Map(); // 缃戞牸鏁版嵁Map缁撴瀯锛屽瓨鍌ㄥ搴攌ey涓嬬殑缃戞牸鐩戞祴鏁版嵁淇℃伅 gridDataDetailMap = new Map(); @@ -349,7 +349,8 @@ drawTagGrid({ tag, data, grid, dataTxt, rankTxt, extData }) { if (!this.mapViewsMap.has(tag)) { const newMapViews = this._createNewMapViews({ extData }); - this.infoMap.set(tag, extData); + const newGridState = this._createNewGridState({ extData }); + this.gridStateMap.set(tag, newGridState); this.mapViewsMap.set(tag, newMapViews); this.gridDataDetailMap.set(tag, data); } @@ -373,6 +374,7 @@ tags.forEach((t) => { this.mapViewsMap.delete(t); this.gridDataDetailMap.delete(t); + this.gridStateMap.delete(t); }); } @@ -405,7 +407,7 @@ _mapViewsList.forEach((v) => { if (v.dataTxt) { map.add(v.dataTxt); - v.show = true; + v.showData = true; } }); } else { @@ -413,7 +415,7 @@ _mapViewsList.forEach((v) => { if (v.dataTxt) { map.remove(v.dataTxt); - v.show = false; + v.showData = false; } }); } @@ -424,7 +426,7 @@ _mapViewsList.forEach((v) => { if (v.rankTxt) { map.add(v.rankTxt); - v.show = true; + v.showRank = true; } }); } else { @@ -432,7 +434,7 @@ _mapViewsList.forEach((v) => { if (v.rankTxt) { map.remove(v.rankTxt); - v.show = false; + v.showRank = false; } }); } @@ -470,9 +472,9 @@ if (_mapViewsList.length == _gridDataDetailList.length) { _mapViewsList.forEach((v, i) => { if (v.lastGridViews) { - if (useCustomColor != undefined) v.useCustomColor = useCustomColor; + if (useCustomColor != undefined) v.showCustomColor = useCustomColor; const lastGridDataDetail = _gridDataDetailList[i]; - if (v.useCustomColor) { + if (v.showCustomColor) { gridMapUtil.drawGridColorCustom( v.lastGridViews, lastGridDataDetail, @@ -588,7 +590,6 @@ }); this.changeGridColor({ tags: [mixTag], isMixGridHighlight }); } else { - // const mixMapViews = this._createNewMapViews(); // 鏍规嵁鏍囩tag锛岃幏鍙栧搴斿缁勭綉鏍兼暟鎹� let { _gridDataDetailList } = this._getMapViews(...tags); const _dataMap = new Map(); @@ -691,108 +692,6 @@ } return mixTag; - } - - /** - * 缁樺埗鐑姏鍥剧綉鏍� - * @param {string} tag - */ - drawHeatGrid(tag) { - if (!this.mapViewsMap.has(tag) || !this.gridDataDetailMap.has(tag)) { - return; - } - - const heatTag = `heat-${tag}`; - if (this.mapViewsMap.has(heatTag)) { - this.changeVisibility({ - tags: [heatTag], - showGridViews: true - }); - } else { - const _mapViews = this.mapViewsMap.get(tag); - const _gridDataDetail = this.gridDataDetailMap.get(tag); - // const groupId = _gridDataDetail[0].groupId; - // const cellId = _gridDataDetail.cellId; - - const originCellIdList = _gridDataDetail.map((v) => v.cellId); - let headGridDataDetailList = []; - - const width = 120; - const height = 90; - const eachwidth = 10; - const eachheight = 10; - - const searchLength = 3; - - const _dataMap = new Map(); - - _gridDataDetail.forEach((gdd) => { - const searchRes = this.search( - gdd, - width, - height, - eachwidth, - eachheight, - searchLength - ); - if (searchRes.find((v) => v.cellId == 1670)) { - console.log(); - } - searchRes.forEach((e) => { - if (originCellIdList.indexOf(e.cellId) == -1) { - if (!_dataMap.has(e.cellId)) { - _dataMap.set(e.cellId, { - source: [], - res: {} - }); - } - _dataMap.get(e.cellId).source.push(e); - } - }); - }); - - _dataMap.forEach((v, k) => { - let total = 0, - count = v.source.length; - v.source.forEach((s) => { - total += s.pm25; - }); - v.res = { - isHeatData: true, - groupId: v.source[0].groupId, - cellId: v.source[0].cellId, - pm25: count == 0 ? null : Math.round((total / count) * 10) / 10, - originData: v.source - }; - headGridDataDetailList.push(v.res); - }); - headGridDataDetailList = headGridDataDetailList.concat(_gridDataDetail); - - // 閲嶆柊鎸夌収鐩戞祴鏁版嵁鎺掑簭骞舵爣璁版帓鍚� - headGridDataDetailList.sort((a, b) => { - return b.pm25 - a.pm25; - }); - headGridDataDetailList.forEach((gdd, i) => { - gdd.rank = i + 1; - }); - - this.drawTagGrid({ - tag: heatTag, - data: headGridDataDetailList, - // grid: { - // style: { - // isMixGridHighlight: - // isMixGridHighlight == undefined ? true : isMixGridHighlight - // } - // }, - extData: { - name: `璧拌埅鐑姏鍥� - ${heatTag}`, - type: 2 - } - }); - } - - return heatTag; } drawHeatGrid2(tag, headGridDataDetailList) { @@ -971,4 +870,19 @@ show: true }; } + + _createNewGridState({ extData }) { + return { + type: undefined, + name: '', + showGrid: true, + showRank: false, + showData: false, + showCustomColor: false, + showHeatMap: false, + highlightFusionGrid: false, + showUnderway: false, + opacityValue: 1 + }; + } } -- Gitblit v1.9.3