| | |
| | | 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()); |
| | | } |
| | | |
| | |
| | | |
| | | var geometry = cylinder.geometry; |
| | | |
| | | const scale = _getScale(_minH, _maxH); |
| | | var minH = heights[0]; |
| | | var maxH = heights[0]; |
| | | for (let i = 0; i < heights.length; i++) { |
| | | const h = heights[i]; |
| | | minH = Math.min(minH, h); |
| | | maxH = Math.max(maxH, h); |
| | | } |
| | | |
| | | 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; |
| | | var h = (heights[i] - minH) * scale + _minHeight; |
| | | if (heights[i] == -1) { |
| | | h = -1; |
| | | } |
| | |
| | | /** |
| | | * 绘制高亮的污染区域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, |
| | |
| | | map.off('zoomend', onMapZoom); |
| | | |
| | | // 2.计算绘图高度的边界值 |
| | | if (merge != true) { |
| | | var minH = _minH < 0 ? heights[0] : _minH; |
| | | var maxH = _maxH < 0 ? heights[0] : _maxH; |
| | | for (let i = 0; i < heights.length; i++) { |
| | | const h = heights[i]; |
| | | minH = Math.min(minH, h); |
| | | maxH = Math.max(maxH, h); |
| | | } |
| | | _minH = minH; |
| | | _maxH = maxH; |
| | | } |
| | | // if (merge != true) { |
| | | // var minH = _minH < 0 ? heights[0] : _minH; |
| | | // var maxH = _maxH < 0 ? heights[0] : _maxH; |
| | | // for (let i = 0; i < heights.length; i++) { |
| | | // const h = heights[i]; |
| | | // minH = Math.min(minH, h); |
| | | // maxH = Math.max(maxH, h); |
| | | // } |
| | | // _minH = minH; |
| | | // _maxH = maxH; |
| | | // } |
| | | |
| | | // 5.绘制3D图形 |
| | | this.drawMesh(fDatas, factor, merge); |