于紫祥_1901
2020-06-30 d903f312cf6a1d0fc4c5745832a9d6fa681e5141
update(无组织排放)
4 files added
2 files modified
482 ■■■■■ changed files
src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java 375 ●●●● patch | view | raw | blame | history
src/main/webapp/img/arrows01.png patch | view | raw | blame | history
src/main/webapp/img/arrows02.png patch | view | raw | blame | history
src/main/webapp/img/wind_dir01.png patch | view | raw | blame | history
src/main/webapp/img/wind_dir02.png patch | view | raw | blame | history
src/main/webapp/view/unorganizedMap.jsp 107 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/service/impl/MonitorPointServiceImpl.java
@@ -518,215 +518,228 @@
            List<Map> windList = new ArrayList<Map>();//存放每台设备的风向和经纬度
            Map<String, Object> jsonMap = new HashMap<String, Object>();//每台设备的数据
            Map<String, Object> deviceMap = null;
            for (Device device : deviceList) {
                deviceMap = new HashMap<String, Object>();
                smac = device.getMac();
                latitude = device.getLatitude();
                longitude = device.getLongitude();
            if (deviceList.size()>1){
                for (Device device : deviceList) {
                    deviceMap = new HashMap<String, Object>();
                    smac = device.getMac();
                    latitude = device.getLatitude();
                    longitude = device.getLongitude();
                jsonMap = historyHourlyService.getDataByMac(smac, Time);
                deviceMap.put("longitude", longitude);
                deviceMap.put("latitude", latitude);
                if (jsonMap != null) {
                    deviceMap.put("jsonMap", jsonMap);
                } else {
                    deviceMap.put("jsonMap", "该设备该时间点无数据");
                }
                list.add(deviceMap);
            }
            Map<String, Object> mapData = new HashMap<String, Object>();
            Map<String, Object> mapDevice;
            JSONArray windDir;
            for (Map<String, Object> objectMap : list) {
                mapDevice = new HashMap<String, Object>();
                Map<String, Object> map = null;
                if (!(objectMap.get("jsonMap") instanceof String)) {
                    mapData = (Map<String, Object>) objectMap.get("jsonMap");
                    map = (Map) JSON.parseObject((String) mapData.get("json"));
                    windDir = (JSONArray) JSONArray.toJSON(map.get("e23"));
                    JSONArray concentration = (JSONArray) JSONArray.toJSON(map.get(sensor));
                    BigDecimal bigDecimal1=new BigDecimal(0);
                    BigDecimal bigDecimal=new BigDecimal(0);
                    if (concentration!=null){
                        if (concentration.get(0) instanceof Integer){
                            bigDecimal1 =new BigDecimal(concentration.get(0).toString());
                        }else {
                            bigDecimal1= (BigDecimal) concentration.get(0);
                        }
                        if (windDir!=null){
                            if (windDir.get(0) instanceof Integer){
                                bigDecimal =new BigDecimal(windDir.get(0).toString());
                            }else {
                                bigDecimal=(BigDecimal) windDir.get(0);
                            }
                            mapDevice.put("e23", bigDecimal.doubleValue());
                            mapDevice.put("sensor", bigDecimal1.doubleValue());
                            mapDevice.put("longitude", objectMap.get("longitude"));
                            mapDevice.put("latitude", objectMap.get("latitude"));
                        }else {
                            mapDevice.put("noSensor", "无风向数据");
                            mapDevice.put("longitude", objectMap.get("longitude"));
                            mapDevice.put("latitude", objectMap.get("latitude"));
                        }
                    jsonMap = historyHourlyService.getDataByMac(smac, Time);
                    deviceMap.put("longitude", longitude);
                    deviceMap.put("latitude", latitude);
                    if (jsonMap != null) {
                        deviceMap.put("jsonMap", jsonMap);
                    } else {
                        deviceMap.put("jsonMap", "该设备该时间点无数据");
                    }
                } else {
                    mapDevice.put("info", objectMap.get("jsonMap"));
                    mapDevice.put("longitude", objectMap.get("longitude"));
                    mapDevice.put("latitude", objectMap.get("latitude"));
                }
                windList.add(mapDevice);
            }
            // if (windDir!=null){}
            Double differenceNum = 0.0;
            Map<String, Object> indexMap;
            List<Map> mapList = new ArrayList<>();
            for (int j = 0; j < windList.size(); j++) {
                for (int k = 0; k < windList.size(); k++) {
                    if (k != j) {
                        indexMap = new HashMap<String, Object>();
                        if (windList.get(k).containsKey("e23") && windList.get(j).containsKey("e23")) {
                            Double e23Numk = (Double) windList.get(k).get("e23");
                            Double e23Numj = (Double) windList.get(j).get("e23");
                            Double diff = e23Numk - e23Numj;
                            BigDecimal b = new BigDecimal(Math.abs(diff));
                            differenceNum = b.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
                            if (differenceNum > 180) {
                                differenceNum = 360 - differenceNum;
                    list.add(deviceMap);
                }
                Map<String, Object> mapData = new HashMap<String, Object>();
                Map<String, Object> mapDevice;
                JSONArray windDir;
                for (Map<String, Object> objectMap : list) {
                    mapDevice = new HashMap<String, Object>();
                    Map<String, Object> map = null;
                    if (!(objectMap.get("jsonMap") instanceof String)) {
                        mapData = (Map<String, Object>) objectMap.get("jsonMap");
                        map = (Map) JSON.parseObject((String) mapData.get("json"));
                        windDir = (JSONArray) JSONArray.toJSON(map.get("e23"));
                        JSONArray concentration = (JSONArray) JSONArray.toJSON(map.get(sensor));
                        BigDecimal bigDecimal1=new BigDecimal(0);
                        BigDecimal bigDecimal=new BigDecimal(0);
                        if (concentration!=null){
                            if (concentration.get(0) instanceof Integer){
                                bigDecimal1 =new BigDecimal(concentration.get(0).toString());
                            }else {
                                bigDecimal1= (BigDecimal) concentration.get(0);
                            }
                            indexMap.put("k", k);
                            indexMap.put("j", j);
                            indexMap.put("diff", differenceNum);
                        } else {
                            indexMap.put("k", k);
                            indexMap.put("j", j);
                            indexMap.put("info", "设备无数据");
                            if (windDir!=null){
                                if (windDir.get(0) instanceof Integer){
                                    bigDecimal =new BigDecimal(windDir.get(0).toString());
                                }else {
                                    bigDecimal=(BigDecimal) windDir.get(0);
                                }
                                mapDevice.put("e23", bigDecimal.doubleValue());
                                mapDevice.put("sensor", bigDecimal1.doubleValue());
                                mapDevice.put("longitude", objectMap.get("longitude"));
                                mapDevice.put("latitude", objectMap.get("latitude"));
                            }else {
                                mapDevice.put("noSensor", "无风向数据");
                                mapDevice.put("longitude", objectMap.get("longitude"));
                                mapDevice.put("latitude", objectMap.get("latitude"));
                            }
                        }
                    } else {
                        mapDevice.put("info", objectMap.get("jsonMap"));
                        mapDevice.put("longitude", objectMap.get("longitude"));
                        mapDevice.put("latitude", objectMap.get("latitude"));
                    }
                    windList.add(mapDevice);
                }
                // if (windDir!=null){}
                Double differenceNum = 0.0;
                Map<String, Object> indexMap;
                List<Map> mapList = new ArrayList<>();
                for (int j = 0; j < windList.size(); j++) {
                    for (int k = 0; k < windList.size(); k++) {
                        if (k != j) {
                            indexMap = new HashMap<String, Object>();
                            if (windList.get(k).containsKey("e23") && windList.get(j).containsKey("e23")) {
                                Double e23Numk = (Double) windList.get(k).get("e23");
                                Double e23Numj = (Double) windList.get(j).get("e23");
                                Double diff = e23Numk - e23Numj;
                                BigDecimal b = new BigDecimal(Math.abs(diff));
                                differenceNum = b.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
                                if (differenceNum > 180) {
                                    differenceNum = 360 - differenceNum;
                                }
                                indexMap.put("k", k);
                                indexMap.put("j", j);
                                indexMap.put("diff", differenceNum);
                            } else {
                                indexMap.put("k", k);
                                indexMap.put("j", j);
                                indexMap.put("info", "设备无数据");
                            }
//                     indexMap.put("longitude",windList.get(k).get("longitude"));
//                     indexMap.put("latitude",windList.get(k).get("latitude"));
                        mapList.add(indexMap);
                    } else {
                        continue;
                    }
                            mapList.add(indexMap);
                        } else {
                            continue;
                        }
                    }
                }
            }
            Double min = 0.0;
            int indexMin = 0;
            if (mapList.size()>0){
                if (mapList.get(0).containsKey("diff")) {
                    min = (Double) mapList.get(0).get("diff");
                    for (int q = 1; q < mapList.size(); q++) {
                        if (mapList.get(q).containsKey("diff")) {
                            if (min > (Double) mapList.get(q).get("diff")) {
                                min = (Double) mapList.get(q).get("diff");
                Double min = 0.0;
                int indexMin = 0;
                if (mapList.size()>0){
                    if (mapList.get(0).containsKey("diff")) {
                        min = (Double) mapList.get(0).get("diff");
                        for (int q = 1; q < mapList.size(); q++) {
                            if (mapList.get(q).containsKey("diff")) {
                                if (min > (Double) mapList.get(q).get("diff")) {
                                    min = (Double) mapList.get(q).get("diff");
                                    indexMin = q;
                                }
                            } else {
                                indexMin = q;
                            }
                        } else {
                            indexMin = q;
                        }
                    }
                }
            }
            Map twoDeviceMap = mapList.get(indexMin);
            List<Map> list1 = new ArrayList<Map>();           //存放风向夹角最小的两台设备的经纬度
            list1.add(windList.get((Integer) twoDeviceMap.get("k")));
            list1.add(windList.get((Integer) twoDeviceMap.get("j")));
            Double wind = 0.0;
            Double sum = 0.0;
            if (list1.get(0).containsKey("e23")) {
                if (Math.abs((Double) list1.get(0).get("e23") - (Double) list1.get(1).get("e23")) > 180) {
                    sum = (Double) list1.get(0).get("e23") + (Double) list1.get(1).get("e23");
                    wind = sum / 2 + 180;
                    if (wind > 360) {
                        wind = wind - 360;
                Map twoDeviceMap = mapList.get(indexMin);
                List<Map> list1 = new ArrayList<Map>();           //存放风向夹角最小的两台设备的经纬度
                list1.add(windList.get((Integer) twoDeviceMap.get("k")));
                list1.add(windList.get((Integer) twoDeviceMap.get("j")));
                Double wind = 0.0;
                Double sum = 0.0;
                if (list1.get(0).containsKey("e23")) {
                    if (Math.abs((Double) list1.get(0).get("e23") - (Double) list1.get(1).get("e23")) > 180) {
                        sum = (Double) list1.get(0).get("e23") + (Double) list1.get(1).get("e23");
                        wind = sum / 2 + 180;
                        if (wind > 360) {
                            wind = wind - 360;
                        }
                    } else {
                        for (Map map : list1) {
                            sum += (Double) map.get("e23");
                        }
                        wind = sum / 2;
                    }
                } else {
                    for (Map map : list1) {
                        sum += (Double) map.get("e23");
                    }
                    wind = sum / 2;
                    wind = 0.0;
                }
            } else {
                wind = 0.0;
            }
            Map<String, Object> longAndLatiMap;
            List<Map> longAndLatiList = new ArrayList<>();//经纬度夹角集合,存放的是windList中两台设备的下标和两台设备夹角与风向角的差值
            List<Map> preAngleDeviceList = new ArrayList<Map>(); //角度减去风向最小的两台设备
            if (wind != 0.0) {
                for (int f = 0; f < windList.size(); f++) {
                    for (int h = 0; h < windList.size(); h++) {
                        if (f != h) {
                            longAndLatiMap = new HashMap<String, Object>();
                            longAndLatiMap.put("h", h);
                            longAndLatiMap.put("f", f);
                            Double angle = mapUtils.getAngle(
                                    new MyLatLng((Double) windList.get(h).get("longitude"),
                                            (Double) windList.get(h).get("latitude")),
                                    new MyLatLng((Double) windList.get(f).get("longitude"),
                                            (Double) windList.get(f).get("latitude")));
                            Double angleDiff = Math.abs(angle - wind);
                            longAndLatiMap.put("angle", angleDiff);
                            longAndLatiList.add(longAndLatiMap);
                Map<String, Object> longAndLatiMap;
                List<Map> longAndLatiList = new ArrayList<>();//经纬度夹角集合,存放的是windList中两台设备的下标和两台设备夹角与风向角的差值
                List<Map> preAngleDeviceList = new ArrayList<Map>(); //角度减去风向最小的两台设备
                if (wind != 0.0) {
                    for (int f = 0; f < windList.size(); f++) {
                        for (int h = 0; h < windList.size(); h++) {
                            if (f != h) {
                                longAndLatiMap = new HashMap<String, Object>();
                                longAndLatiMap.put("h", h);
                                longAndLatiMap.put("f", f);
                                Double angle = mapUtils.getAngle(
                                        new MyLatLng((Double) windList.get(h).get("longitude"),
                                                (Double) windList.get(h).get("latitude")),
                                        new MyLatLng((Double) windList.get(f).get("longitude"),
                                                (Double) windList.get(f).get("latitude")));
                                Double angleDiff = Math.abs(angle - wind);
                                longAndLatiMap.put("angle", angleDiff);
                                longAndLatiList.add(longAndLatiMap);
                            }
                        }
                    }
                }
                Double minAngle = (Double) longAndLatiList.get(0).get("angle");
                int indexAngle = 0;
                for (int j = 0; j < longAndLatiList.size(); j++) {
                    if (minAngle > (Double) longAndLatiList.get(j).get("angle")) {
                        minAngle = (Double) longAndLatiList.get(j).get("angle");
                        indexAngle = j;
                    Double minAngle = (Double) longAndLatiList.get(0).get("angle");
                    int indexAngle = 0;
                    for (int j = 0; j < longAndLatiList.size(); j++) {
                        if (minAngle > (Double) longAndLatiList.get(j).get("angle")) {
                            minAngle = (Double) longAndLatiList.get(j).get("angle");
                            indexAngle = j;
                        }
                    }
                    //windList.get((Integer) longAndLatiList.get(indexAngle).get("f"))获得风向和经纬度
                    preAngleDeviceList.add(windList.get((Integer) longAndLatiList.get(indexAngle).get("h")));
                    preAngleDeviceList.add(windList.get((Integer) longAndLatiList.get(indexAngle).get("f")));
                    Double length = mapUtils.getDistance((Double) preAngleDeviceList.get(0).get("longitude"), (Double) preAngleDeviceList.get(0).get("latitude"),
                            (Double) preAngleDeviceList.get(1).get("longitude"), (Double) preAngleDeviceList.get(1).get("latitude"));
                    Double subLength = length/5;
                    Double subLength1 = length/6.1;
                    Double angle = mapUtils.getAngle(
                            new MyLatLng((Double) preAngleDeviceList.get(0).get("longitude"),
                                    (Double) preAngleDeviceList.get(0).get("latitude")),
                            new MyLatLng((Double) preAngleDeviceList.get(1).get("longitude"),
                                    (Double) preAngleDeviceList.get(1).get("latitude")));
                    params.put("preAngleDeviceList", preAngleDeviceList);
                    params.put("angle", angle);
                    List locationList = new ArrayList();
                    String[] firstLocation = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, (Double) preAngleDeviceList.get(0).get("longitude"),
                            (Double) preAngleDeviceList.get(0).get("latitude"), subLength);
                    String[] secondLoction = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(firstLocation[0]),
                            Double.parseDouble(firstLocation[1]), subLength);
                    String[] thirdLocation = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(secondLoction[0]),
                            Double.parseDouble(secondLoction[1]), subLength);
                    String[] fourthLoction = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(thirdLocation[0]),
                            Double.parseDouble(thirdLocation[1]), subLength);
                    String[] fivethLoction = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(fourthLoction[0]),
                            Double.parseDouble(fourthLoction[1]), subLength1);
                    locationList.add(firstLocation);
                    locationList.add(secondLoction);
                    locationList.add(thirdLocation);
                    locationList.add(fourthLoction);
                    locationList.add(fivethLoction);
                    params.put("locationList", locationList);
                    String preAngleDeviceString = JSON.toJSON(preAngleDeviceList).toString();
                    params.put("preAngleDeviceString", preAngleDeviceString);//两台添加箭头的设备
                } else {
                    params.put("preAngleDeviceString", 0);
                }
                //windList.get((Integer) longAndLatiList.get(indexAngle).get("f"))获得风向和经纬度
                preAngleDeviceList.add(windList.get((Integer) longAndLatiList.get(indexAngle).get("h")));
                preAngleDeviceList.add(windList.get((Integer) longAndLatiList.get(indexAngle).get("f")));
                Double length = mapUtils.getDistance((Double) preAngleDeviceList.get(0).get("longitude"), (Double) preAngleDeviceList.get(0).get("latitude"),
                        (Double) preAngleDeviceList.get(1).get("longitude"), (Double) preAngleDeviceList.get(1).get("latitude"));
                Double subLength = length / 5;
                Double angle = mapUtils.getAngle(
                        new MyLatLng((Double) preAngleDeviceList.get(0).get("longitude"),
                                (Double) preAngleDeviceList.get(0).get("latitude")),
                        new MyLatLng((Double) preAngleDeviceList.get(1).get("longitude"),
                                (Double) preAngleDeviceList.get(1).get("latitude")));
                params.put("preAngleDeviceList", preAngleDeviceList);
                params.put("angle", angle);
                List locationList = new ArrayList();
                String[] firstLocation = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, (Double) preAngleDeviceList.get(0).get("longitude"),
                        (Double) preAngleDeviceList.get(0).get("latitude"), subLength);
                String[] secondLoction = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(firstLocation[0]),
                        Double.parseDouble(firstLocation[1]), subLength);
                String[] thirdLocation = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(secondLoction[0]),
                        Double.parseDouble(secondLoction[1]), subLength);
                String[] fourthLoction = mapUtils.calLocationByDistanceAndLocationAndDirection(angle, Double.parseDouble(thirdLocation[0]),
                        Double.parseDouble(thirdLocation[1]), subLength);
                locationList.add(firstLocation);
                locationList.add(secondLoction);
                locationList.add(thirdLocation);
                locationList.add(fourthLoction);
                params.put("locationList", locationList);
                String preAngleDeviceString = JSON.toJSON(preAngleDeviceList).toString();
                params.put("preAngleDeviceString", preAngleDeviceString);//两台添加箭头的设备
            } else {
                params.put("preAngleDeviceString", "");
                params.put("wind", wind);
                //String preAngleDeviceString=preAngleDeviceList.
                params.put("deviceList", deviceList);
            }else {
                if (deviceList.size()!=0){
                    params.put("deviceList", deviceList.get(0));
                }else {
                    params.put("deviceList","");
                }
                params.put("preAngleDeviceString", 1);
                params.put("locationList", "");
            }
            //String preAngleDeviceString=preAngleDeviceList.
            params.put("wind", wind);
            params.put("list1", list1);
            params.put("deviceList", deviceList);
            params.put("latitudeCompany", latitudeCompany);
            params.put("longitudeCompany", longitudeCompany);
        }
        return params;
    }
src/main/webapp/img/arrows01.png
src/main/webapp/img/arrows02.png
src/main/webapp/img/wind_dir01.png
src/main/webapp/img/wind_dir02.png
src/main/webapp/view/unorganizedMap.jsp
@@ -17,16 +17,16 @@
        }
        #box {
            width:300px;
            height:100px;
            height:500px;
            top:80px;
            left:30px;
            right:30px;
            position:absolute;
            z-index:1;
            border:0px solid red;
            background-color:#f5f3f0;
            border:2px solid red;
            background-color:gainsboro;
            opacity: 0.8;
        }
        #cpm {
        #cpm,#cpm1{
            width: 300px;
            height: 100px;
            position: absolute;
@@ -57,11 +57,22 @@
    <title>地图展示</title>
</head>
<body>
<div id="cpm">该时间存在设备掉线,数据不能作为参考</div>
<div id="cpm">该时间存在设备无风向数据,数据不能作为参考</div>
<div id="cpm1">该时间在线设备小于两台,数据不能作为参考</div>
<div id="allmap" style="z-index: 0" ;>
</div>
<div id="box">
    <p style="text-indent: 2em;line-height: 25px;color: red">注:方向箭头代表风向,箭头上的颜色变化代表该厂区内该时间点的因子浓度变化</p>
    <p>
            <img src="/img/wind_dir02.png" style="width: 30px;height: 45px;margin-left: 20px;"/> <span style="position: relative;top: -9px;">&nbsp;&nbsp;:风向(尖头向上代表正北方向)</span>
    </p>
    <p>
        <img src="/img/arrows01.png" style="margin-left: 20px;transform:rotate(90deg);width: 30px;height: 60px;"/> <span style="position: relative;top: -25px;">&nbsp;&nbsp;:浓度由高到低</span>
    </p>
    <p>
        <img src="/img/arrows02.png" style="width: 30px;height: 60px;margin-left: 20px;transform:rotate(90deg);"/> <span style="position: relative;top: -25px;">&nbsp;&nbsp;:浓度由低到高</span>
    </p>
    <p style="text-indent: 1em;line-height: 25px;color: red" id="alarm">浓度变化:<span id="diff" ></span></br></br>&nbsp;&nbsp;&nbsp; 注:浓度变化为下风向因子浓度减去上风向因子浓度</p>
</div>
<div id="mapParams" style="display: none;">
    ${requestScope.params}
@@ -80,15 +91,45 @@
    map.centerAndZoom(point, 18.5);  // 初始化地图,设置中心点坐标和地图级别
    var device1 = params["deviceList"];
    var preAngleDeviceString = params["preAngleDeviceString"];
    var wind = params["wind"];
    var devices=[];
    var locationList=params["locationList"];
    var wind=params["wind"];
    var color;
    if (preAngleDeviceString!=""){
        var preAngleDeviceList=JSON.parse(preAngleDeviceString);
    //添加地图类型控件
    map.addControl(new BMap.MapTypeControl({
        mapTypes: [
            BMAP_HYBRID_MAP,
            BMAP_NORMAL_MAP
        ]
    }));
    map.setMapType(BMAP_HYBRID_MAP);
    if (device1 != null) {
        if(device1.length>1){
            for (var i = 0; i < device1.length; i++) {
                var icon1 = new BMap.Icon("/img/ico00.png", new BMap.Size(48, 48));
                var mark1 = new BMap.Marker(new BMap.Point(device1[i].longitude, device1[i].latitude), {icon: icon1});
                devices.push( new BMap.Point(device1[i].longitude, device1[i].latitude));
                map.addOverlay(mark1);
            }
        }else {
            var icon1 = new BMap.Icon("/img/ico00.png", new BMap.Size(48, 48));
            var mark1 = new BMap.Marker(new BMap.Point(device1.longitude, device1.latitude), {icon: icon1});
            devices.push( new BMap.Point(device1.longitude, device1.latitude));
            map.addOverlay(mark1);
            $("#alarm").css("visibility","hidden");
        }
    }
    var preAngleDeviceList="";
    if (preAngleDeviceString!=0 &&preAngleDeviceString!=1){
        preAngleDeviceList=JSON.parse(preAngleDeviceString);
        var diff=preAngleDeviceList[0].sensor-preAngleDeviceList[1].sensor;
        var diffSensor=preAngleDeviceList[1].sensor-preAngleDeviceList[0].sensor;
        diffSensor=String(diffSensor).replace(/^(.*\..{4}).*$/,"$1");
       var info="";
        if (diff>0){
            info="厂区内无排放";
            var polyline = new BMap.Polyline([
                new BMap.Point(preAngleDeviceList[0].longitude, preAngleDeviceList[0].latitude),
                new BMap.Point(locationList[0][0],locationList[0][1])
@@ -111,13 +152,14 @@
            map.addOverlay(polyline3);   //增加折线
            var polyline4 = new BMap.Polyline([
                new BMap.Point(locationList[3][0],locationList[3][1]),
                new BMap.Point(preAngleDeviceList[1].longitude, preAngleDeviceList[1].latitude)
                new BMap.Point(locationList[4][0],locationList[4][1])
            ], {strokeColor:"Gold", strokeWeight:8, strokeOpacity:0.5});   //创建折线
            map.addOverlay(polyline4);   //增加折线
            var arrowLineList = new Array();//记录绘制的箭头线
            color="Gold";
            arrowLineList[arrowLineList.length] = addArrow(polyline4,30,Math.PI/7,color);//记录绘制的箭头线
        } else {
            info="厂区内有排放";
            var polyline = new BMap.Polyline([
                new BMap.Point(preAngleDeviceList[0].longitude, preAngleDeviceList[0].latitude),
                new BMap.Point(locationList[0][0],locationList[0][1])
@@ -140,34 +182,37 @@
            map.addOverlay(polyline3);   //增加折线
            var polyline4 = new BMap.Polyline([
                new BMap.Point(locationList[3][0],locationList[3][1]),
                new BMap.Point(preAngleDeviceList[1].longitude, preAngleDeviceList[1].latitude)
                new BMap.Point(locationList[4][0],locationList[4][1])
            ], {strokeColor:"red", strokeWeight:8, strokeOpacity:0.5});   //创建折线
            map.addOverlay(polyline4);   //增加折线
            var arrowLineList = new Array();//记录绘制的箭头线
            color="red";
            arrowLineList[arrowLineList.length] = addArrow(polyline4,28,Math.PI/7,color);//记录绘制的箭头线
        }
    }else {
        document.getElementById("cpm").style.display = 'block';
    }
    if (device1 != null) {
        for (var i = 0; i < device1.length; i++) {
            var icon1 = new BMap.Icon("/img/ico_co00.png", new BMap.Size(48, 48));
            var mark1 = new BMap.Marker(new BMap.Point(device1[i].longitude, device1[i].latitude), {icon: icon1});
            devices.push( new BMap.Point(device1[i].longitude, device1[i].latitude));
            map.addOverlay(mark1);
        $("#diff").html(diffSensor+" ("+info+")");
        var winds=[];
        if (wind>=180){
            wind=wind-180;
        }else{
            wind=wind+180;
        }
        for (var i = 0; i <preAngleDeviceList.length; i++) {
            var icon11=new BMap.Icon("/img/wind_dir02.png", new BMap.Size(25, 25), {anchor:new BMap.Size(11, 21.5)});
            var mark11 = new BMap.Marker(new BMap.Point(preAngleDeviceList[i].longitude, preAngleDeviceList[i].latitude), {icon: icon11});
            winds.push( new BMap.Point(preAngleDeviceList[i].longitude, preAngleDeviceList[i].latitude));
            mark11.setRotation(wind);
            map.addOverlay(mark11);
        }
    }
    //添加地图类型控件
    map.addControl(new BMap.MapTypeControl({
        mapTypes: [
            BMAP_NORMAL_MAP,
            BMAP_HYBRID_MAP
        ]
    }));
    if(preAngleDeviceString==0){
        $("#box").css("visibility","hidden");
        document.getElementById("cpm").style.display = 'block';
    }
    if(preAngleDeviceString==1){
        $("#box").css("visibility","hidden");
        document.getElementById("cpm1").style.display = 'block';
    }
    function addArrow(polyline,length,angleValue,color){ //绘制箭头的函数