|  |  |  | 
|---|
|  |  |  | line-height: 100px; | 
|---|
|  |  |  | text-align: center; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #show { | 
|---|
|  |  |  | position: absolute; | 
|---|
|  |  |  | z-index: 1; | 
|---|
|  |  |  | top: 30px; | 
|---|
|  |  |  | right: 50px; | 
|---|
|  |  |  | display: inline-block; | 
|---|
|  |  |  | width: 100px; | 
|---|
|  |  |  | height: 40px; | 
|---|
|  |  |  | border-width: 0px; | 
|---|
|  |  |  | border-radius: 3px; | 
|---|
|  |  |  | background: #6495ED; | 
|---|
|  |  |  | cursor: pointer; | 
|---|
|  |  |  | outline: none; | 
|---|
|  |  |  | color: white; | 
|---|
|  |  |  | font-size: 20px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #show:hover { | 
|---|
|  |  |  | background: #5CACEE; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <body> | 
|---|
|  |  |  | <div class="main_body"> | 
|---|
|  |  |  | <div id="cpm">查无数据</div> | 
|---|
|  |  |  | <input type="button" id="show" value="溯源运算"/> | 
|---|
|  |  |  | <div id="cpm"></div> | 
|---|
|  |  |  | <div id="mapCanvas"></div> <!-- 百度地图 --> | 
|---|
|  |  |  | <!-- 传sensorInfo,regionCode,regionName,monitorPoint,device--> | 
|---|
|  |  |  | <div id="pollutionSourceParams" style="display: none;"> | 
|---|
|  |  |  | 
|---|
|  |  |  | var device = params["device"]; | 
|---|
|  |  |  | var dirPoint = new BMap.Point(params["dirPoint"].lng, params["dirPoint"].lat); | 
|---|
|  |  |  | var getPollutionSourceData = params["getPollutionSourceData"]; | 
|---|
|  |  |  | var windSpeed = parseFloat(getPollutionSourceData["e18"]); | 
|---|
|  |  |  | var map = new BMap.Map("mapCanvas", {enableMapClick: false}); | 
|---|
|  |  |  | map.setMapStyle(mapStyle); | 
|---|
|  |  |  | map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放 | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addControl(navigation); | 
|---|
|  |  |  | map.addControl(new BMap.ScaleControl()); | 
|---|
|  |  |  | if ($.isEmptyObject(dirPoint) || $.isEmptyObject(getPollutionSourceData) || getPollutionSourceData["e6"] == 0 || getPollutionSourceData["e18"] == 0 || getPollutionSourceData["e23"] == 0 || windSpeed <= 0.03) { | 
|---|
|  |  |  | showNoData(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | var humidity = parseFloat(getPollutionSourceData["e6"]); | 
|---|
|  |  |  | var longitude = params["device"]["longitude"]; | 
|---|
|  |  |  | var latitude = params["device"]["latitude"]; | 
|---|
|  |  |  | var point = new BMap.Point(longitude, latitude); | 
|---|
|  |  |  | var icon = new BMap.Icon("/img/ico00.png", new BMap.Size(50, 50)); | 
|---|
|  |  |  | var icon1 = new BMap.Icon("/img/ico01.png", new BMap.Size(50, 50)); | 
|---|
|  |  |  | var icon2 = new BMap.Icon("/img/ico02.png", new BMap.Size(50, 50)); | 
|---|
|  |  |  | var marker = new BMap.Marker(point, {icon: icon, offset: new BMap.Size(0, -20)}); | 
|---|
|  |  |  | map.addOverlay(marker); | 
|---|
|  |  |  | map.centerAndZoom(point, 16); | 
|---|
|  |  |  | var humidity = 0; | 
|---|
|  |  |  | var temperature = 0; | 
|---|
|  |  |  | if (!$.isEmptyObject(dirPoint) && !$.isEmptyObject(getPollutionSourceData) && typeof (getPollutionSourceData["e18"]) != "undefined" && typeof (getPollutionSourceData["e23"]) != "undefined" && getPollutionSourceData["e18"] != 0) { | 
|---|
|  |  |  | var windSpeed = parseFloat(getPollutionSourceData["e18"]); | 
|---|
|  |  |  | var windDir = parseFloat(getPollutionSourceData["e23"]); | 
|---|
|  |  |  | var longitude = params["device"]["longitude"]; | 
|---|
|  |  |  | var latitude = params["device"]["latitude"]; | 
|---|
|  |  |  | var point = new BMap.Point(longitude, latitude); | 
|---|
|  |  |  | var icon = new BMap.Icon("/img/ico00.png", new BMap.Size(50, 50)); | 
|---|
|  |  |  | var marker = new BMap.Marker(point, {icon: icon, offset: new BMap.Size(0, -20)}); | 
|---|
|  |  |  | map.addOverlay(marker); | 
|---|
|  |  |  | map.centerAndZoom(point, 16); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //centre:椭圆中心点,X:横向经度,Y:纵向纬度 | 
|---|
|  |  |  | function add_oval(centre, x, y) { | 
|---|
|  |  |  | var assemble = new Array(); | 
|---|
|  |  |  | var angle; | 
|---|
|  |  |  | var dot; | 
|---|
|  |  |  | var tangent = x / y; | 
|---|
|  |  |  | for (i = 0; i < 36; i++) { | 
|---|
|  |  |  | angle = (2 * Math.PI / 36) * i; | 
|---|
|  |  |  | dot = new BMap.Point(centre.lng + Math.sin(angle) * y * tangent, centre.lat + Math.cos(angle) * y); | 
|---|
|  |  |  | assemble.push(dot); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return assemble; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //以画多边形区域的方法画扇形区域 画出以point点为圆心,半径为radius,夹角从sDegree到eDegree的扇形 | 
|---|
|  |  |  | function Sector(point, radius, sDegree, eDegree) { | 
|---|
|  |  |  | var points = []; //创建构成多边形的点数组 | 
|---|
|  |  |  | var step = ((eDegree - sDegree) / 10) || 10; //根据扇形的总夹角确定每步夹角度数,最大为10 | 
|---|
|  |  |  | points.push(point); | 
|---|
|  |  |  | for (var i = sDegree; i < eDegree + 0.001; i += step) { //循环获取每步的圆弧上点的坐标,存入点数组 | 
|---|
|  |  |  | points.push(EOffsetBearing(point, radius, i)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | points.push(point); | 
|---|
|  |  |  | return points; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //使用数学的方法计算需要画扇形的圆弧上的点坐标 | 
|---|
|  |  |  | function EOffsetBearing(point, dist, bearing) { | 
|---|
|  |  |  | var lngConv = map.getDistance(point, new BMap.Point(point.lng + 0.1, point.lat)) * 10; //计算经度与原点的距离 | 
|---|
|  |  |  | var latConv = map.getDistance(point, new BMap.Point(point.lng, point.lat + 0.1)) * 10; //计算纬度与原点的距离 | 
|---|
|  |  |  | var lat = dist * Math.sin(bearing * Math.PI / 180) / latConv; //正弦计算待获取的点的纬度与原点纬度差 | 
|---|
|  |  |  | var lng = dist * Math.cos(bearing * Math.PI / 180) / lngConv; //余弦计算待获取的点的经度与原点经度差 | 
|---|
|  |  |  | return new BMap.Point(point.lng + lng, point.lat + lat); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var distance = windSpeed * 3600; | 
|---|
|  |  |  | var winDirStart = 240 - windDir; | 
|---|
|  |  |  | var winDirEnd = 300 - windDir; | 
|---|
|  |  |  | var oval = new BMap.Polygon(Sector(dirPoint, distance, winDirStart, winDirEnd), { | 
|---|
|  |  |  | strokeColor: "grey", | 
|---|
|  |  |  | strokeWeight: 1, | 
|---|
|  |  |  | strokeOpacity: 0.8, | 
|---|
|  |  |  | fillColor: "grey" | 
|---|
|  |  |  | var winDirStart = 255 - windDir; | 
|---|
|  |  |  | var winDirEnd = 285 - windDir; | 
|---|
|  |  |  | var marker1 = new BMap.Marker(EOffsetBearing(dirPoint, distance * 0.15, winDirStart), { | 
|---|
|  |  |  | icon: icon2, | 
|---|
|  |  |  | offset: new BMap.Size(0, -20) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(oval); | 
|---|
|  |  |  | var oval = new BMap.Polygon(Sector(dirPoint, distance * 0.66, winDirStart, winDirEnd), { | 
|---|
|  |  |  | strokeColor: "grey", | 
|---|
|  |  |  | strokeWeight: 1, | 
|---|
|  |  |  | strokeOpacity: 0.6, | 
|---|
|  |  |  | fillColor: "grey" | 
|---|
|  |  |  | var marker2 = new BMap.Marker(EOffsetBearing(dirPoint, distance * 0.31, winDirEnd), { | 
|---|
|  |  |  | icon: icon2, | 
|---|
|  |  |  | offset: new BMap.Size(0, -20) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(oval); | 
|---|
|  |  |  | var oval = new BMap.Polygon(Sector(dirPoint, distance * 0.33, winDirStart, winDirEnd), { | 
|---|
|  |  |  | strokeColor: "grey", | 
|---|
|  |  |  | strokeWeight: 1, | 
|---|
|  |  |  | strokeOpacity: 0.4, | 
|---|
|  |  |  | fillColor: "grey" | 
|---|
|  |  |  | var marker3 = new BMap.Marker(EOffsetBearing(dirPoint, distance * 0.61, winDirStart), { | 
|---|
|  |  |  | icon: icon1, | 
|---|
|  |  |  | offset: new BMap.Size(0, -20) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(oval); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var polyline = new BMap.Polyline([ | 
|---|
|  |  |  | dirPoint, | 
|---|
|  |  |  | point | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | {strokeColor: "#5298FF", strokeWeight: 4, strokeOpacity: 1} | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | addArrow(polyline, 0, Math.PI / 7, windSpeed, humidity); | 
|---|
|  |  |  | var winfowTextCause = "<p style='height: 44px;line-height: 22px'>汽车尾气,工厂废气,以及周边地区农田秸秆焚烧,污染传播途径是根据风向来做出调整</p>"; | 
|---|
|  |  |  | var winfowTextSource; | 
|---|
|  |  |  | var supplement; | 
|---|
|  |  |  | if (month == 12 || month == 1 || month == 2) { | 
|---|
|  |  |  | if (windSpeed >= 3.4) { | 
|---|
|  |  |  | supplement = ",但风速较大,大气扩散条件较有利,空气质量相对提升"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (humidity >= 90.0) { | 
|---|
|  |  |  | supplement = ",但降雨有利于对颗粒物的沉降、冲刷,改善污染状况"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | supplement = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | winfowTextSource = "<p style='height: 22px;line-height: 22px'>压强升高气温降低,会因冷空气带来的颗粒物,导致污染上升" + supplement + "</p>"; | 
|---|
|  |  |  | } else if (month == 3 || month == 4 || month == 5) { | 
|---|
|  |  |  | if (windSpeed >= 3.4) { | 
|---|
|  |  |  | supplement = ",但风速较大,大气扩散条件较有利,空气质量相对提升"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (humidity >= 90.0) { | 
|---|
|  |  |  | supplement = ",但降雨有利于对颗粒物的沉降、冲刷,改善污染状况"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | supplement = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | winfowTextSource = "<p style='height: 22px;line-height: 22px'>地面逆温频率的增加使污染物在近地层不断积累" + supplement + "</p>"; | 
|---|
|  |  |  | } else if (month == 6 || month == 7) { | 
|---|
|  |  |  | if (windSpeed >= 3.4) { | 
|---|
|  |  |  | supplement = ",同时风速较大,加速扩散"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (humidity >= 90.0) { | 
|---|
|  |  |  | supplement = ",同时降雨有利于对颗粒物的沉降、冲刷,改善污染状况"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | supplement = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | winfowTextSource = "<p style='height: 22px;line-height: 22px'>夏季的气温条件不易发生逆温,利于污染物扩散" + supplement + "</p>"; | 
|---|
|  |  |  | } else if (month == 8 || month == 9 || month == 10 || month == 11) { | 
|---|
|  |  |  | if (windSpeed >= 3.4) { | 
|---|
|  |  |  | supplement = ",但风速较大,利于污染物扩散"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (humidity >= 90.0) { | 
|---|
|  |  |  | supplement = ",但降雨有利于对颗粒物的沉降、冲刷,改善污染状况"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | supplement = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | winfowTextSource = "<p style='height: 22px;line-height: 22px'>大气扩散条件不好使污染物聚集,增大了气态污染物向二次颗粒物转化的机会" + supplement + "</p>"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var winfowText = '<div style="height:150px;" >'; | 
|---|
|  |  |  | var opts = { | 
|---|
|  |  |  | width: 380, | 
|---|
|  |  |  | title: '<h3>污染分析</h3>', | 
|---|
|  |  |  | enableMessage: false //设置允许信息窗发送短息 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | this.openInfoWindow(infoWindow); | 
|---|
|  |  |  | var marker4 = new BMap.Marker(EOffsetBearing(dirPoint, distance * 0.78, winDirEnd), { | 
|---|
|  |  |  | icon: icon1, | 
|---|
|  |  |  | offset: new BMap.Size(0, -20) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(marker1); | 
|---|
|  |  |  | map.addOverlay(marker2); | 
|---|
|  |  |  | map.addOverlay(marker3); | 
|---|
|  |  |  | map.addOverlay(marker4); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function addArrow(polyline, length, angleValue, windSpeed, humidity) { | 
|---|
|  |  |  | $("#show").one('click', function () { | 
|---|
|  |  |  | setTimeout(function () { | 
|---|
|  |  |  | if ($.isEmptyObject(dirPoint) || $.isEmptyObject(getPollutionSourceData) || typeof (getPollutionSourceData["e18"]) == "undefined" || typeof (getPollutionSourceData["e23"]) == "undefined" || getPollutionSourceData["e18"] === 0) { | 
|---|
|  |  |  | showNoData(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (typeof (getPollutionSourceData["e6"]) != "undefined") { | 
|---|
|  |  |  | humidity = parseFloat(getPollutionSourceData["e6"]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (typeof (getPollutionSourceData["e7"]) != "undefined") { | 
|---|
|  |  |  | temperature = parseFloat(getPollutionSourceData["e7"]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var windSpeed = parseFloat(getPollutionSourceData["e18"]); | 
|---|
|  |  |  | var windDir = parseFloat(getPollutionSourceData["e23"]); | 
|---|
|  |  |  | var selectSensorKey = getPollutionSourceData["selectSensorKey"]; | 
|---|
|  |  |  | var markerDir = new BMap.Marker(dirPoint); | 
|---|
|  |  |  | lab = new BMap.Label("经过溯源运算,确认该点为污染源</br>" + selectSensorKey + "超标", { | 
|---|
|  |  |  | position: dirPoint, | 
|---|
|  |  |  | offset: new BMap.Size(20, -40) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | lab.setStyle({ | 
|---|
|  |  |  | color: "#EE3B3B", | 
|---|
|  |  |  | fontSize: "16px", | 
|---|
|  |  |  | backgroundColor: "1", | 
|---|
|  |  |  | fontWeight: "bold" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(lab); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var distance = windSpeed * 3600; | 
|---|
|  |  |  | var winDirStartLeft = 240 - windDir; | 
|---|
|  |  |  | var winDirEndLeft = 250 - windDir; | 
|---|
|  |  |  | var winDirStartMiddle = 250 - windDir; | 
|---|
|  |  |  | var winDirEndMiddle = 290 - windDir; | 
|---|
|  |  |  | var winDirStartRight = 290 - windDir; | 
|---|
|  |  |  | var winDirEndRight = 300 - windDir; | 
|---|
|  |  |  | var winDirStart = 255 - windDir; | 
|---|
|  |  |  | var winDirEnd = 285 - windDir; | 
|---|
|  |  |  | var polyline1 = new BMap.Polyline([ | 
|---|
|  |  |  | dirPoint, | 
|---|
|  |  |  | EOffsetBearing(dirPoint, distance, winDirStart) | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | {strokeColor: "red", strokeWeight: 4, strokeOpacity: 1} | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | var polyline2 = new BMap.Polyline([ | 
|---|
|  |  |  | dirPoint, | 
|---|
|  |  |  | EOffsetBearing(dirPoint, distance, winDirEnd) | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | {strokeColor: "red", strokeWeight: 4, strokeOpacity: 1} | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | map.addOverlay(polyline1);// 画两点间线 | 
|---|
|  |  |  | map.addOverlay(polyline2);// 画两点间线 | 
|---|
|  |  |  | map.addOverlay(markerDir); | 
|---|
|  |  |  | setTimeout(function () { | 
|---|
|  |  |  | var ovalLeft = new BMap.Polygon(Sector(dirPoint, distance, winDirStartLeft, winDirEndLeft), { | 
|---|
|  |  |  | strokeColor: "#ADADAD", | 
|---|
|  |  |  | strokeWeight: 0.1, | 
|---|
|  |  |  | strokeOpacity: 0.7, | 
|---|
|  |  |  | fillColor: "#ADADAD" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(ovalLeft); | 
|---|
|  |  |  | var oval = new BMap.Polygon(Sector(dirPoint, distance, winDirStartMiddle, winDirEndMiddle), { | 
|---|
|  |  |  | strokeColor: "#A6A6A6", | 
|---|
|  |  |  | strokeWeight: 0.1, | 
|---|
|  |  |  | strokeOpacity: 0.95, | 
|---|
|  |  |  | fillColor: "#A6A6A6" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(oval); | 
|---|
|  |  |  | var ovalRight = new BMap.Polygon(Sector(dirPoint, distance, winDirStartRight, winDirEndRight), { | 
|---|
|  |  |  | strokeColor: "#ADADAD", | 
|---|
|  |  |  | strokeWeight: 0.1, | 
|---|
|  |  |  | strokeOpacity: 0.7, | 
|---|
|  |  |  | fillColor: "#ADADAD" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(ovalRight); | 
|---|
|  |  |  | }, 1500); | 
|---|
|  |  |  | setTimeout(function () { | 
|---|
|  |  |  | var ovalLeft = new BMap.Polygon(Sector(dirPoint, distance * 0.66, winDirStartLeft, winDirEndLeft), { | 
|---|
|  |  |  | strokeColor: "#ADADAD", | 
|---|
|  |  |  | strokeWeight: 0.1, | 
|---|
|  |  |  | strokeOpacity: 0.5, | 
|---|
|  |  |  | fillColor: "#ADADAD" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(ovalLeft); | 
|---|
|  |  |  | var oval = new BMap.Polygon(Sector(dirPoint, distance * 0.66, winDirStartMiddle, winDirEndMiddle), { | 
|---|
|  |  |  | strokeColor: "#A6A6A6", | 
|---|
|  |  |  | strokeWeight: 0.1, | 
|---|
|  |  |  | strokeOpacity: 0.75, | 
|---|
|  |  |  | fillColor: "#A6A6A6" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(oval); | 
|---|
|  |  |  | var ovalRight = new BMap.Polygon(Sector(dirPoint, distance * 0.66, winDirStartRight, winDirEndRight), { | 
|---|
|  |  |  | strokeColor: "#ADADAD", | 
|---|
|  |  |  | strokeWeight: 0.1, | 
|---|
|  |  |  | strokeOpacity: 0.7, | 
|---|
|  |  |  | fillColor: "#ADADAD" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(ovalRight); | 
|---|
|  |  |  | var polyline = new BMap.Polyline([ | 
|---|
|  |  |  | dirPoint, | 
|---|
|  |  |  | point | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | {strokeColor: "#5298FF", strokeWeight: 4, strokeOpacity: 1} | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | addArrow(polyline, 0, Math.PI / 7, temperature, humidity, windSpeed, windDir); | 
|---|
|  |  |  | }, 1000); | 
|---|
|  |  |  | setTimeout(function () { | 
|---|
|  |  |  | var ovalLeft = new BMap.Polygon(Sector(dirPoint, distance * 0.33, winDirStartLeft, winDirEndLeft), { | 
|---|
|  |  |  | strokeColor: "#ADADAD", | 
|---|
|  |  |  | strokeWeight: 0.1, | 
|---|
|  |  |  | strokeOpacity: 0.3, | 
|---|
|  |  |  | fillColor: "#ADADAD" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(ovalLeft); | 
|---|
|  |  |  | var oval = new BMap.Polygon(Sector(dirPoint, distance * 0.33, winDirStartMiddle, winDirEndMiddle), { | 
|---|
|  |  |  | strokeColor: "#A6A6A6", | 
|---|
|  |  |  | strokeWeight: 0.1, | 
|---|
|  |  |  | strokeOpacity: 0.55, | 
|---|
|  |  |  | fillColor: "#A6A6A6" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | var ovalRight = new BMap.Polygon(Sector(dirPoint, distance * 0.33, winDirStartRight, winDirEndRight), { | 
|---|
|  |  |  | strokeColor: "#ADADAD", | 
|---|
|  |  |  | strokeWeight: 0.1, | 
|---|
|  |  |  | strokeOpacity: 0.7, | 
|---|
|  |  |  | fillColor: "#ADADAD" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | map.addOverlay(ovalRight); | 
|---|
|  |  |  | map.addOverlay(oval); | 
|---|
|  |  |  | }, 500); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var winfowTextCause = "<p style='height: 22px;line-height: 22px'>汽车尾气,工厂废气,以及周边地区农田秸秆焚烧</p>"; | 
|---|
|  |  |  | var winfowTextSource; | 
|---|
|  |  |  | var supplement; | 
|---|
|  |  |  | if (selectSensorKey == "臭氧") { | 
|---|
|  |  |  | winfowTextCause = "<p style='height: 44px;line-height: 22px'>主要来源机动车尾气、燃煤排放氮氧化物,油漆油气挥发有机物在高温,阳光充足的照射下发生光化学烟雾</p>"; | 
|---|
|  |  |  | winfowTextSource = "<p style='height: 22px;line-height: 22px'>NOx以及VOCs总量超标</p>"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (month == 12 || month == 1 || month == 2) { | 
|---|
|  |  |  | if (windSpeed >= 3.4) { | 
|---|
|  |  |  | supplement = ",但风速较大,大气扩散条件较有利,空气质量相对提升"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (humidity >= 90.0) { | 
|---|
|  |  |  | supplement = ",但降雨有利于对颗粒物的沉降、冲刷,改善污染状况"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | supplement = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | winfowTextSource = "<p style='height: 22px;line-height: 22px'>压强升高气温降低,会因冷空气带来的颗粒物,导致污染上升" + supplement + "</p>"; | 
|---|
|  |  |  | } else if (month == 3 || month == 4 || month == 5) { | 
|---|
|  |  |  | if (windSpeed >= 3.4) { | 
|---|
|  |  |  | supplement = ",但风速较大,大气扩散条件较有利,空气质量相对提升"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (humidity >= 90.0) { | 
|---|
|  |  |  | supplement = ",但降雨有利于对颗粒物的沉降、冲刷,改善污染状况"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | supplement = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | winfowTextSource = "<p style='height: 22px;line-height: 22px'>地面逆温频率的增加使污染物在近地层不断积累" + supplement + "</p>"; | 
|---|
|  |  |  | } else if (month == 6 || month == 7) { | 
|---|
|  |  |  | if (windSpeed >= 3.4) { | 
|---|
|  |  |  | supplement = ",同时风速较大,加速扩散"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (humidity >= 90.0) { | 
|---|
|  |  |  | supplement = ",同时降雨有利于对颗粒物的沉降、冲刷,改善污染状况"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | supplement = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | winfowTextSource = "<p style='height: 22px;line-height: 22px'>夏季的气温条件不易发生逆温,利于污染物扩散" + supplement + "</p>"; | 
|---|
|  |  |  | } else if (month == 8 || month == 9 || month == 10 || month == 11) { | 
|---|
|  |  |  | if (windSpeed >= 3.4) { | 
|---|
|  |  |  | supplement = ",但风速较大,利于污染物扩散"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (humidity >= 90.0) { | 
|---|
|  |  |  | supplement = ",但降雨有利于对颗粒物的沉降、冲刷,改善污染状况"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | supplement = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | winfowTextSource = "<p style='height: 22px;line-height: 22px'>大气扩散条件不好使污染物聚集,增大了气态污染物向二次颗粒物转化的机会" + supplement + "</p>"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var winfowText = '<div style="height:150px;" >'; | 
|---|
|  |  |  | var opts = { | 
|---|
|  |  |  | width: 380, | 
|---|
|  |  |  | title: '<h3>污染分析</h3>', | 
|---|
|  |  |  | enableMessage: false //设置允许信息窗发送短息 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | this.openInfoWindow(infoWindow); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, 1500); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //centre:椭圆中心点,X:横向经度,Y:纵向纬度 | 
|---|
|  |  |  | function add_oval(centre, x, y) { | 
|---|
|  |  |  | var assemble = new Array(); | 
|---|
|  |  |  | var angle; | 
|---|
|  |  |  | var dot; | 
|---|
|  |  |  | var tangent = x / y; | 
|---|
|  |  |  | for (i = 0; i < 36; i++) { | 
|---|
|  |  |  | angle = (2 * Math.PI / 36) * i; | 
|---|
|  |  |  | dot = new BMap.Point(centre.lng + Math.sin(angle) * y * tangent, centre.lat + Math.cos(angle) * y); | 
|---|
|  |  |  | assemble.push(dot); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return assemble; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //以画多边形区域的方法画扇形区域 画出以point点为圆心,半径为radius,夹角从sDegree到eDegree的扇形 | 
|---|
|  |  |  | function Sector(point, radius, sDegree, eDegree) { | 
|---|
|  |  |  | var points = []; //创建构成多边形的点数组 | 
|---|
|  |  |  | var step = ((eDegree - sDegree) / 100) || 1; //根据扇形的总夹角确定每步夹角度数,最大为10 | 
|---|
|  |  |  | points.push(point); | 
|---|
|  |  |  | for (var i = sDegree; i < eDegree + 0.001; i += step) { //循环获取每步的圆弧上点的坐标,存入点数组 | 
|---|
|  |  |  | points.push(EOffsetBearing(point, radius, i)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | points.push(point); | 
|---|
|  |  |  | return points; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //使用数学的方法计算需要画扇形的圆弧上的点坐标 | 
|---|
|  |  |  | function EOffsetBearing(point, dist, bearing) { | 
|---|
|  |  |  | var lngConv = map.getDistance(point, new BMap.Point(point.lng + 0.1, point.lat)) * 10; //计算经度与原点的距离 | 
|---|
|  |  |  | var latConv = map.getDistance(point, new BMap.Point(point.lng, point.lat + 0.1)) * 10; //计算纬度与原点的距离 | 
|---|
|  |  |  | var lat = dist * Math.sin(bearing * Math.PI / 180) / latConv; //正弦计算待获取的点的纬度与原点纬度差 | 
|---|
|  |  |  | var lng = dist * Math.cos(bearing * Math.PI / 180) / lngConv; //余弦计算待获取的点的经度与原点经度差 | 
|---|
|  |  |  | return new BMap.Point(point.lng + lng, point.lat + lat); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function addArrow(polyline, length, angleValue, temperature, humidity, windSpeed, windDir) { | 
|---|
|  |  |  | var linePoint = polyline.getPath();// 线的坐标串 | 
|---|
|  |  |  | var arrowCount = linePoint.length; | 
|---|
|  |  |  | for (var i = 1; i < arrowCount; i++) { // 在拐点处绘制箭头 | 
|---|
|  |  |  | 
|---|
|  |  |  | pixelY = pixelTemY - Math.tan(angle) * r / param; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var pointMiddle = map.pixelToPoint(new BMap.Pixel(poMiddleX, poMiddleY)); | 
|---|
|  |  |  | lab = new BMap.Label("<P>风速:" + windSpeed + "m/s</p><P>湿度:" + humidity + "°</p>", { | 
|---|
|  |  |  | position: pointMiddle, | 
|---|
|  |  |  | offset: new BMap.Size(-50, -20) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | var windDirection; | 
|---|
|  |  |  | if (windDir == 0) { | 
|---|
|  |  |  | windDirection = "北风"; | 
|---|
|  |  |  | } else if (windDir == 90) { | 
|---|
|  |  |  | windDirection = "东风"; | 
|---|
|  |  |  | } else if (windDir == 180) { | 
|---|
|  |  |  | windDirection = "南风"; | 
|---|
|  |  |  | } else if (windDir == 270) { | 
|---|
|  |  |  | windDirection = "西风"; | 
|---|
|  |  |  | } else if (windDir > 0 && windDir < 90) { | 
|---|
|  |  |  | windDirection = "东北风"; | 
|---|
|  |  |  | } else if (windDir > 90 && windDir < 180) { | 
|---|
|  |  |  | windDirection = "东南风"; | 
|---|
|  |  |  | } else if (windDir > 180 && windDir < 270) { | 
|---|
|  |  |  | windDirection = "西南风"; | 
|---|
|  |  |  | } else if (windDir > 270 && windDir < 360) { | 
|---|
|  |  |  | windDirection = "西北风"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (temperature != 0 && humidity != 0) { | 
|---|
|  |  |  | lab = new BMap.Label("<P>温度:" + temperature + "℃</p><P>湿度:" + humidity + "%</p><P>风速:" + windSpeed + "m/s</p><P>风向:" + windDirection + "</p>", { | 
|---|
|  |  |  | position: pointMiddle, | 
|---|
|  |  |  | offset: new BMap.Size(-50, -40) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else if (temperature == 0 && humidity != 0) { | 
|---|
|  |  |  | lab = new BMap.Label("<P>湿度:" + humidity + "%</p><P>风速:" + windSpeed + "m/s</p><P>风向:" + windDirection + "</p>", { | 
|---|
|  |  |  | position: pointMiddle, | 
|---|
|  |  |  | offset: new BMap.Size(-50, -40) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else if (temperature != 0 && humidity == 0) { | 
|---|
|  |  |  | lab = new BMap.Label("<P>温度:" + temperature + "℃</p><P>风速:" + windSpeed + "m/s</p><P>风向:" + windDirection + "</p>", { | 
|---|
|  |  |  | position: pointMiddle, | 
|---|
|  |  |  | offset: new BMap.Size(-50, -40) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | lab = new BMap.Label("<P>风速:" + windSpeed + "m/s</p><P>风向:" + windDirection + "</p>", { | 
|---|
|  |  |  | position: pointMiddle, | 
|---|
|  |  |  | offset: new BMap.Size(-50, -40) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | lab.setStyle({ | 
|---|
|  |  |  | color: "#FFFFFF", | 
|---|
|  |  |  | color: "#EE3B3B", | 
|---|
|  |  |  | fontSize: "16px", | 
|---|
|  |  |  | backgroundColor: "1", | 
|---|
|  |  |  | border: "0", | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function showNoData() { | 
|---|
|  |  |  | var longitude = 120.987287; | 
|---|
|  |  |  | var latitude = 31.391562; | 
|---|
|  |  |  | var point = new BMap.Point(longitude, latitude); | 
|---|
|  |  |  | map.centerAndZoom(point, 17); | 
|---|
|  |  |  | setTimeout(function () { | 
|---|
|  |  |  | if (JSON.stringify(getPollutionSourceData) == JSON.stringify({})) { | 
|---|
|  |  |  | document.getElementById("cpm").innerText = "该时间点查询无数据"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (getPollutionSourceData["e18"] === 0) { | 
|---|
|  |  |  | document.getElementById("cpm").style.width = '380px'; | 
|---|
|  |  |  | document.getElementById("cpm").innerText = "风速为0,无法溯源运算"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (typeof (getPollutionSourceData["e18"]) == "undefined") { | 
|---|
|  |  |  | document.getElementById("cpm").style.width = '400px'; | 
|---|
|  |  |  | document.getElementById("cpm").innerText = "设备无风速,无法溯源运算"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (typeof (getPollutionSourceData["e23"]) == "undefined") { | 
|---|
|  |  |  | document.getElementById("cpm").style.width = '400px'; | 
|---|
|  |  |  | document.getElementById("cpm").innerText = "设备无风向,无法溯源运算"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (typeof (getPollutionSourceData["e18"]) == "undefined" && typeof (getPollutionSourceData["e23"]) == "undefined") { | 
|---|
|  |  |  | document.getElementById("cpm").style.width = '500px'; | 
|---|
|  |  |  | document.getElementById("cpm").innerText = "设备无风速,无风向,无法溯源运算"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | document.getElementById("cpm").style.display = 'block'; | 
|---|
|  |  |  | }, 250); | 
|---|
|  |  |  | }; | 
|---|