ZhuDongming
2019-08-29 1a5dddf9f8ca09da14f6abdeb0f125baffd9fc87
src/main/webapp/view/pollutionsource.jsp
@@ -34,6 +34,51 @@
        padding: 0;
        list-style: none;
    }
    .BMap_top {
        display: none;
    }
    .BMap_center {
        display: none;
    }
    .BMap_bubble_title {
        color: white;
        padding: 0 5px 0 5px;
        background-color: #2DA0EB;
    }
    .BMap_bubble_content {
        background-color: white;
        padding: 5px;
    }
    .BMap_pop > img {
        top: 42px !important;
        margin-left: -10px;
    }
    .BMap_pop div:nth-child(1) div {
        display: none;
    }
    .BMap_pop div:nth-child(3) {
        display: none;
    }
    .BMap_pop div:nth-child(5) {
        display: none;
    }
    .BMap_pop div:nth-child(7) {
        display: none;
    }
    .BMap_pop div:nth-child(9) {
        top: 35px !important;
        border-radius: 5px;
    }
</style>
<body>
@@ -57,9 +102,7 @@
    var weatherInfoToday = params["weatherInfoToday"];
    var weatherInfoForecast = params["weatherInfoForecast"];
    var isToday = params["isToday"];
    console.log(weatherInfoToday);
    console.log(weatherInfoForecast);
    console.log(isToday);
    var month = params["month"];
    var device = params["device"];
    var cityName = params["weatherInfoToday"]["cityName"];
    var map = new BMap.Map("mapCanvas", {enableMapClick: false});
@@ -90,16 +133,24 @@
    var w = new BMap.Point(sw.lng, latitude);
    var e = new BMap.Point(ne.lng, latitude);
    var dirPoint;
    var windLevel;
    var condition;
    if (Object.keys(weatherInfoForecast).length === 0) {
        var windDir = weatherInfoToday["windDir"];
        dirPoint = getWindDir(windDir, dirPoint);
        windLevel = weatherInfoToday["windLevel"];
        condition = weatherInfoToday["condition"];
    } else {
        if (isToday) {
            var windDir = weatherInfoToday["windDir"];
            dirPoint = getWindDir(windDir, dirPoint);
            windLevel = weatherInfoToday["windLevel"];
            condition = weatherInfoToday["condition"];
        } else {
            var windDir = weatherInfoForecast["windDirDay"];
            dirPoint = getWindDir(windDir, dirPoint);
            windLevel = weatherInfoForecast["windLevelDay"];
            condition = weatherInfoForecast["conditionDay"];
        }
    }
    var polyline = new BMap.Polyline([
@@ -110,16 +161,53 @@
    );
    map.addOverlay(polyline);// 画两点间线
    addArrow(polyline, 50, Math.PI / 7);
    var winfowTextCause = "<p style='height: 44px;line-height: 22px'>汽车尾气,工厂废气,以及周边地区农田秸秆焚烧,污染传播途径是根据风向来做出调整</p>";
    var winfowTextSource;
    var supplement;
    if (month == 12 || month == 1 || month == 2) {
        if (windLevel >= 3) {
            supplement = ",但风速较大,大气扩散条件较有利,空气质量相对提升";
        }
        if (condition.indexOf("雨") != -1) {
            supplement = ",但降雨有利于对颗粒物的沉降、冲刷,改善污染状况";
        }
        winfowTextSource = "<p style='height: 22px;line-height: 22px'>压强升高气温降低,会因冷空气带来的颗粒物,导致污染上升" + supplement + "</p>";
    } else if (month == 3 || month == 4 || month == 5) {
        if (windLevel >= 3) {
            supplement = ",但风速较大,大气扩散条件较有利,空气质量相对提升";
        }
        if (condition.indexOf("雨") != -1) {
            supplement = ",但降雨有利于对颗粒物的沉降、冲刷,改善污染状况";
        }
        winfowTextSource = "<p style='height: 22px;line-height: 22px'>地面逆温频率的增加使污染物在近地层不断积累" + supplement + "</p>";
    } else if (month == 6 || month == 7) {
        if (windLevel >= 3) {
            supplement = ",同时风速较大,加速扩散";
        }
        if (condition.indexOf("雨") != -1) {
            supplement = ",同时降雨有利于对颗粒物的沉降、冲刷,改善污染状况";
        }
        winfowTextSource = "<p style='height: 22px;line-height: 22px'>夏季的气温条件不易发生逆温,利于污染物扩散" + supplement + "</p>";
    } else if (month == 8 || month == 9 || month == 10 || month == 11) {
        if (windLevel >= 3) {
            supplement = ",但风速较大,利于污染物扩散";
        }
        if (condition.indexOf("雨") != -1) {
            supplement = ",但降雨有利于对颗粒物的沉降、冲刷,改善污染状况";
        }
        winfowTextSource = "<p style='height: 22px;line-height: 22px'>大气扩散条件不好使污染物聚集,增大了气态污染物向二次颗粒物转化的机会" + supplement + "</p>";
    }
    var winfowText =
        '<div style="min-height:20px;overflow:auto;max-height:330px;" >';
    var winfowText = '<div style="height:150px;" >';
    var opts = {
        width: 220,
        height: 220,
        width: 380,
        title: '<h3>污染分析</h3>',
        enableMessage: false //设置允许信息窗发送短息
    }
    winfowText += ("<p style='height: 22px;line-height: 22px'></p>");
    winfowText += '<h3 style="background-color: #CD5C5C;color:white;margin-bottom: 1px">污染来源</h3>';
    winfowText += winfowTextCause;
    winfowText += '<h3 style="background-color: #66CD00;color:white;margin-bottom: 1px">污染成因</h3>';
    winfowText += winfowTextSource;
    winfowText += "</div>";
    marker.addEventListener("click", function () {
        var infoWindow = new BMap.InfoWindow(winfowText, opts);