Bläddra i källkod

3dDisplayEngine map.js 袁明明 commit at 2021-02-09

袁明明 4 år sedan
förälder
incheckning
97aa46f892
1 ändrade filer med 199 tillägg och 0 borttagningar
  1. 199 0
      3dDisplayEngine/buildingJs/map.js

+ 199 - 0
3dDisplayEngine/buildingJs/map.js

@@ -1431,3 +1431,202 @@ var showInfo = function(e) {
             //					time_label.id = 'alarm_tab_time_'+(i+1);
             //					time_label.setAttribute('class','alarm_tab_time');
             //					time_label.innerHTML=AlarmStore[i].time;
+            //					tab.appendChild(time_label);
+            //					var data = document.createElement('div');
+            //					data.id = "alarm_tab_data_"+(i+1);
+            //					data.setAttribute('class','alarm_tab_data');
+            //					data.innerHTML=AlarmStore[i].company_name+' '+AlarmStore[i].data;
+            //					tab.appendChild(data);
+            //					var icon = document.createElement('img');
+            //					icon.setAttribute('class','alarm_tab_icon');
+            //					icon.height = '66';
+            //					icon.width = '66';
+            //					icon.src = baseUrl+'res/img/icons/'+((AlarmStore[i].dwtype==1)?'alarm_tab_01.gif'
+            //							:(AlarmStore[i].dwtype==2)?'alarm_tab_03.gif'
+            //									:(AlarmStore[i].dwtype==5)?'alarm_tab_03.gif'
+            //											:(AlarmStore[i].dwtype==6)?'alarm_tab_04.gif'
+            //													:(AlarmStore[i].dwtype==7)?'alarm_tab_02.gif':'alarm_tab_04.gif')+'?t='+(new Date());
+            //					tab.appendChild(icon);
+            //				}
+            //			}
+            break;
+        }
+    }
+}
+
+var markerSortByRotation = function(a, b) {
+    if ((rotation <= 45) || (rotation >= 315))
+        return b.lat - a.lat;
+    else if ((rotation > 45) && (rotation <= 135))
+        return a.lng - b.lng;
+    else if ((rotation > 135) && (rotation <= 270))
+        return a.lat - b.lat;
+    else
+        return b.lng - a.lng;
+}
+
+var alarmSortByTime = function(a, b) {
+    var time_a = Date.parse(a.time);
+    var time_b = Date.parse(b.time);
+    return time_b - time_a;
+}
+
+var draw_pie = function(id, total, num) {
+    var mColor = '#34abf5';
+    var percent = 100;
+    if (total > 0)
+        percent = Number(((num * 100) / total).toString().match(/^\d+(?:\.\d{0,2})?/));
+    if (percent < 60)
+        mColor = '#f66167';
+    else if (percent < 80)
+        mColor = '#DDDF0D';
+    if (id == 'data_pie_1') {
+        $("#title-label-11").css({
+            color: mColor
+        }).html(percent + '%');
+        $("#title-label-12").html(total);
+    } else if (id == 'data_pie_2') {
+        $("#title-label-21").css({
+            color: mColor
+        }).html(percent + '%');
+        $("#title-label-22").html(total);
+    } else if (id == 'data_pie_3') {
+        $("#title-label-31").css({
+            color: mColor
+        }).html(percent + '%');
+        $("#title-label-32").html(total);
+    } else if (id == 'data_pie_4') {
+        $("#title-label-41").css({
+            color: mColor
+        }).html(percent + '%');
+        $("#title-label-42").html(total);
+    }
+    Highcharts.getOptions().colors = Highcharts.map(['#f66167', '#34abf5', '#DDDF0D'], function(color) {
+        return {
+            radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
+            stops: [
+                [0, color],
+                [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
+            ]
+        };
+    });
+    Highcharts.chart(id, {
+        chart: {
+            type: 'pie',
+            backgroundColor: 'rgba(0,0,0,0)',
+            height: '100%',
+            options3d: {
+                enabled: true,
+                alpha: 45,
+                beta: 0
+            }
+        },
+        title: {
+            text: '处置率:' + percent + '%',
+            floating: true,
+            y: 85,
+            style: { fontSize: '12px', color: '#ffffff' }
+        },
+        exporting: {
+            enabled: false
+        },
+        credits: {
+            enabled: false
+        },
+        tooltip: {
+            //	      enabled: false
+            pointFormat: '{point.percentage:.2f}%'
+        },
+        plotOptions: {
+            pie: {
+                allowPointSelect: true,
+
+                cursor: 'pointer',
+                depth: 15,
+                dataLabels: {
+                    enabled: false,
+                    format: '{point.name}'
+                }
+            }
+        },
+        series: [{
+            type: 'pie',
+            name: '处置率',
+            startAngle: 90,
+            data: [{
+                    name: '待处理',
+                    y: 100 - percent,
+                    sliced: true,
+                    selected: true
+                },
+                ['已处理', percent]
+            ]
+        }]
+    });
+}
+
+var draw_all = function() {
+    if (company_cur > 0)
+        return;
+    var d0 = 0,
+        d0o = 0,
+        d0oc = 0,
+        d0a = 0,
+        d0ac = 0;
+    var d1 = 0,
+        d1o = 0,
+        d1oc = 0,
+        d1a = 0,
+        d1ac = 0;
+    var d2 = 0,
+        d2o = 0,
+        d2oc = 0,
+        d2a = 0,
+        d2ac = 0;
+    var d6 = 0,
+        d6o = 0,
+        d6oc = 0,
+        d6a = 0,
+        d6ac = 0;
+    var d7 = 0,
+        d7o = 0,
+        d7oc = 0,
+        d7a = 0,
+        d7ac = 0;
+    var totalLat = 0,
+        totalLng = 0,
+        latngCount = 0;
+    //	map.clearMap();
+    clear_detail_info();
+    markers = [];
+    var zoom = map.getZoom();
+    var iconWidth = 28;
+    var iconHeight = 28;
+    if ((StatusStore != null) && (StatusStore.length > 0)) {
+        rotation = map.getRotation();
+        StatusStore.sort(markerSortByRotation);
+        for (var i = 0; i < StatusStore.length; i++) {
+            var obj = StatusStore[i];
+            var iconurl = baseUrl + 'res/img/icons/building.png';
+            if ((obj.d0a != obj.d0ac) ||
+                (obj.d0o != obj.d0oc) ||
+                (obj.d1a != obj.d1ac) ||
+                (obj.d1o != obj.d1oc) ||
+                (obj.d2a != obj.d2ac) ||
+                (obj.d2o != obj.d2oc) ||
+                (obj.d6a != obj.d6ac) ||
+                (obj.d6o != obj.d6oc) ||
+                (obj.d7a != obj.d7ac) ||
+                (obj.d7o != obj.d7oc))
+                iconurl = baseUrl + 'res/img/icons/building_alarm.png';
+            d1 += obj.d1;
+            d1o += obj.d1o;
+            d1a += obj.d1a;
+            d1oc += obj.d1oc;
+            d1ac += obj.d1ac;
+            d2 += obj.d2;
+            d2o += obj.d2o;
+            d2a += obj.d2a;
+            d2oc += obj.d2oc;
+            d2ac += obj.d2ac;
+            d6 += obj.d6;