| | |
| | | function drawPolyline(gridInfo) { |
| | | // 绘制网格 |
| | | const points = gridInfo.map((v) => { |
| | | return calculate.wgs84_To_Gcj02(v.longitude, v.latitude); |
| | | // return calculate.wgs84_To_Gcj02(v.longitude, v.latitude); |
| | | return [v.longitude, v.latitude]; |
| | | }); |
| | | const gridPoints = gridMapUtil.parseGridPoint(points); |
| | | // const gridPoints = gridMapUtil.parseGridPoint(points); |
| | | // console.log('gridPoints:', gridPoints); |
| | | |
| | | const gridPoints = gridInfo.map((v) => { |
| | | return [ |
| | | calculate.wgs84_To_Gcj02(v.point1Lon, v.point1Lat), |
| | | calculate.wgs84_To_Gcj02(v.point2Lon, v.point2Lat), |
| | | calculate.wgs84_To_Gcj02(v.point3Lon, v.point3Lat), |
| | | calculate.wgs84_To_Gcj02(v.point4Lon, v.point4Lat) |
| | | // [v.point1Lon, v.point1Lat], |
| | | // [v.point2Lon, v.point2Lat], |
| | | // [v.point3Lon, v.point3Lat], |
| | | // [v.point4Lon, v.point4Lat] |
| | | ]; |
| | | }); |
| | | const gridViews = gridMapUtil.drawPolylines(gridPoints); |
| | | return { gridViews, gridPoints, points }; |
| | | } |
| | |
| | | const data = gridData.map((v, i) => { |
| | | return { |
| | | lnglat_GD: points[i], |
| | | data: v.pm25 |
| | | // data: v.pm25 ? (v.pm25 + 'μg/m³') : '' |
| | | data: v.pm25 ? v.pm25 : '' |
| | | }; |
| | | }); |
| | | return gridMapUtil.drawGridTextLabel(data, textViews, labelsLayer, 'bottom'); |
| | | // return gridMapUtil.drawGridTextLabel(data, textViews, labelsLayer, 'bottom'); |
| | | return gridMapUtil.drawGridText(data, textViews, 'top-center', 'data'); |
| | | } |
| | | |
| | | // 绘制监测数据排名文本 |
| | |
| | | const data = gridData.map((v, i) => { |
| | | return { |
| | | lnglat_GD: points[i], |
| | | data: v.rank |
| | | // data: v.pm25 ? ('排名: ' + v.rank) : '' |
| | | data: v.pm25 ? v.rank : '' |
| | | }; |
| | | }); |
| | | return gridMapUtil.drawGridTextLabel(data, textViews, labelsLayer, 'top'); |
| | | // return gridMapUtil.drawGridTextLabel(data, textViews, labelsLayer, 'top'); |
| | | return gridMapUtil.drawGridText(data, textViews, 'bottom-center', 'rank'); |
| | | } |
| | | |
| | | // 绘制监测数据值对应网格颜色 |
| | | function drawColor(gridViews, gridData) { |
| | | function drawColor(gridViews, gridData, customColor) { |
| | | const pm25Data = gridData.map((v) => { |
| | | return v.pm25; |
| | | }); |
| | | gridMapUtil.drawGridColor(gridViews, pm25Data, 'PM25'); |
| | | if (customColor) { |
| | | gridMapUtil.drawGridColorCustom(gridViews, pm25Data); |
| | | } else { |
| | | gridMapUtil.drawGridColor(gridViews, pm25Data, 'PM25'); |
| | | } |
| | | } |
| | | |
| | | export default { |