ZhuDongming
2019-08-05 cd7eb0bcb27a51d0ee94bbe2960fa5d5252bde7b
src/main/webapp/view/uavTrajectory.jsp
@@ -85,7 +85,7 @@
    var coincidentPoints = new Array();
    if (sensorInfo.length > 0) {
        $.each(sensorInfo, function (item, value) {
            trackPoints.push(new BMap.Point(value.e76, value.e77));
            trackPoints.push(new BMap.Point(value.经度, value.纬度));
        })
        for (var i = 0; i < trackPoints.length; i++) {
            var startPoint = trackPoints[i];
@@ -136,7 +136,9 @@
            );
            if (i < trackPoints.length - 1) {
                map.addOverlay(polyline);// 画两点间线
                addArrow(polyline, arrowLength, Math.PI / 7);
                if (i != 0) {
                    addArrow(polyline, arrowLength, Math.PI / 7);
                }
            }
            if (coincidentPoints.indexOf(i) > -1) {
                //判断是否已经已经显示过该点的信息,避免重复。
@@ -156,7 +158,8 @@
                marker = new BMap.Marker(startPoint);
            }
            var count = 0;
            var winfowText = "";
            var winfowText =
                '<div style="min-height:20px;overflow-y:auto;max-height:400px;" >';
            for (var j = i + 1; j < trackPoints.length; j++) {
                distance = map.getDistance(trackPoints[i], trackPoints[j]).toFixed(5);
                if (distance <= 1.9) {
@@ -165,7 +168,7 @@
                    }
                    coincidentPoints.push(j);
                    count++;
                    winfowTextAdd = '<p id="' + j + '" onclick="openInfo(this)">' + "时间:" + sensorInfo[j].uavDate + "</p>";
                    winfowTextAdd = '<p id="' + j + '" onclick="openInfo(this)" onmousemove="red(this.id)" onmouseout="black(this.id)">' + "时间:" + sensorInfo[j].时间 + "</p>";
                    winfowText += winfowTextAdd;
                    if (j == trackPoints.length - 1) {
                        marker = new BMap.Marker(trackPoints[j], {icon: endIcon, offset: new BMap.Size(0, -20)});
@@ -174,30 +177,15 @@
            }
            if (coincidentPoints.indexOf(i) > -1) {
                winfowText = '<p id="' + i + '" onclick="openInfo(this)">' + "时间:" + sensorInfo[i].uavDate + "</p>" + winfowText;
                winfowText = '<p id="' + i + '" onclick="openInfo(this)" onmousemove="red(this.id)" onmouseout="black(this.id)">' + "时间:" + sensorInfo[i].时间 + "</p>" + winfowText + "</div>";
            } else {
                winfowText = "时间:" + sensorInfo[i].uavDate
                    + "</br> PM 2.5:" + sensorInfo[i].e1
                    + "</br> PM 10:" + sensorInfo[i].e2
                    + "</br> 颗粒物(0.1升中0.3um量):" + sensorInfo[i].e3
                    + "</br> 颗粒物(0.1升中2.5um量):" + sensorInfo[i].e4
                    + "</br> 湿度:" + sensorInfo[i].e6
                    + "</br> 温度:" + sensorInfo[i].e7
                    + "</br> 氯气(CL₂):" + sensorInfo[i].e9
                    + "</br> 一氧化碳(CO):" + sensorInfo[i].e10
                    + "</br> 二氧化硫(SO₂):" + sensorInfo[i].e11
                    + "</br> 臭氧(O₃):" + sensorInfo[i].e15
                    + "</br> 挥发性有机气体(TVOC):" + sensorInfo[i].e17
                    + "</br> 非甲烷总烃:" + sensorInfo[i].e27
                    + "</br> 气压:" + sensorInfo[i].e28
                    + "</br> 经度:" + sensorInfo[i].e76
                    + "</br> 纬度:" + sensorInfo[i].e77
                    + "</br> 高度:" + sensorInfo[i].e78
                    + "</br> 速度x:" + sensorInfo[i].e79
                    + "</br> 速度y:" + sensorInfo[i].e80
                    + "</br> 速度z:" + sensorInfo[i].e81;
                for (var prop in sensorInfo[i]) {
                    if (sensorInfo[i].hasOwnProperty(prop)) {
                        winfowText += (prop + ":" + sensorInfo[i][prop] + "</br>");
                    }
                }
                winfowText += "</div>";
            }
            (function (x) {
                var infoWindow = new BMap.InfoWindow(winfowText, {enableMessage: false});
                marker.addEventListener("click", function () {
@@ -206,32 +194,27 @@
            })(i);
            function openInfo(e) {
                var point = new BMap.Point(sensorInfo[e.id].e76, sensorInfo[e.id].e77);
                // 创建信息窗口对象
                var infoWindow1 = new BMap.InfoWindow("时间:" + sensorInfo[e.id].uavDate
                    + "</br> PM 2.5:" + sensorInfo[e.id].e1
                    + "</br> PM 10:" + sensorInfo[e.id].e2
                    + "</br> 颗粒物(0.1升中0.3um量):" + sensorInfo[e.id].e3
                    + "</br> 颗粒物(0.1升中2.5um量):" + sensorInfo[e.id].e4
                    + "</br> 湿度:" + sensorInfo[e.id].e6
                    + "</br> 温度:" + sensorInfo[e.id].e7
                    + "</br> 氯气(CL₂):" + sensorInfo[e.id].e9
                    + "</br> 一氧化碳(CO):" + sensorInfo[e.id].e10
                    + "</br> 二氧化硫(SO₂):" + sensorInfo[e.id].e11
                    + "</br> 臭氧(O₃):" + sensorInfo[e.id].e15
                    + "</br> 挥发性有机气体(TVOC):" + sensorInfo[e.id].e17
                    + "</br> 非甲烷总烃:" + sensorInfo[e.id].e27
                    + "</br> 气压:" + sensorInfo[e.id].e28
                    + "</br> 经度:" + sensorInfo[e.id].e76
                    + "</br> 纬度:" + sensorInfo[e.id].e77
                    + "</br> 高度:" + sensorInfo[e.id].e78
                    + "</br> 速度x:" + new Number(sensorInfo[e.id].e79).toLocaleString()
                    + "</br> 速度y:" + new Number(sensorInfo[e.id].e80).toLocaleString()
                    + "</br> 速度z:" + new Number(sensorInfo[e.id].e81).toLocaleString(), {enableMessage: false});
                var point = new BMap.Point(sensorInfo[e.id].经度, sensorInfo[e.id].纬度);
                var winfowText1 = "";
                for (var prop in sensorInfo[e.id]) {
                    if (sensorInfo[e.id].hasOwnProperty(prop)) {
                        winfowText1 += (prop + ":" + sensorInfo[e.id][prop] + "</br>");
                    }
                }
                var infoWindow1 = new BMap.InfoWindow(winfowText1, {enableMessage: false});
                //开启信息窗口
                map.openInfoWindow(infoWindow1, point);
            }
            function red(x) {
                document.getElementById(x).style.color = "#FF1111";
                document.getElementById(x).style.cursor = "pointer";
            }
            function black(x) {
                document.getElementById(x).style.color = "#000000";
            }
            if (count > 0) {
                var lab = new BMap.Label(count + 1, {position: startPoint, offset: new BMap.Size(-7, -23)});
                lab.setStyle({