//$.getScript("/js/sorttableImg.js"); function VisApp(object) { var postUrl = "/VIS/visData.aspx"; var F = { longitude_min: 112.3319, latitude_min: 22.57414, longitude_max: 113.45495, latitude_max: 23.6471, width: 700, height: 740 }; position_left = function (w) { //图片内目标X坐标=取绝对值(目标经度-图片左边对应经度)/取绝对值(图片右边经度-图片左边对应经度)* (图片的宽度)-边距 return (F.width * (w - F.longitude_min) / (F.longitude_max - F.longitude_min)) - 50 }; position_top = function (h) { //图片内目标Y坐标=取绝对值(目标纬度-图片上边对应纬度)/取绝对值(图片下边纬度-图片上边对应纬度)* (图片的高度)-边距 return (F.height * (h - F.latitude_max) / (F.latitude_min - F.latitude_max)) - 25 }; //绑定站点 $.getJSON("/VIS/mapdata.js?t=" + Math.random(), function (json) {///VIS/StationsList.js InitStationsList(json, object); }) var InitStationsList = function (obj) { var stationsList = $(object.stationsList_id);//站点容器 stationsList.empty(); $("监测站点能见度(公里)时间").appendTo(stationsList); ////找到最大和最小能见度数 //var arry = new Array(); //arry = obj; //arry.sort(function (a, b) { // return b.value - a.value; //}); //alert(arry[0].value) //alert(obj[0].value) $.each(obj, function (index, content) { var rid = content.rid; if (rid == "VI7019") return true;//隐藏高明气象局 // rids += "," + rid; var tr = $(""); $("").attr({ value: rid, title: content.name, href: '/VISLine.aspx?t=1&n=' + escape(content.name) + '&rid=' + rid }).addClass('zoom').text(content.name).appendTo(tr); $("").attr({ title: content.value, Class: "NJD" }).html(content.value).appendTo(tr); var time = new Date(content.time.replace(/-/g, "/")); //转换成Data(); $("").attr({ title: content.time }).text(time.Format("hh:mm")).appendTo(tr); tr.appendTo(stationsList); //请求生成折线图数据 }); //rids = rids.length > 0 ? rids.substring(1) : rids; //$.post("VIS/InitLineData.aspx", { rids: rids }); stationsList.children('li:first').children('a').removeClass('zoom cboxElement').attr("href", "javascript:;"); //stationsList.fadeIn("slow"); //点击站点后出现的曲线图 //$(".zoom").colorbox({ rel: 'group1', iframe: true, innerWidth: 610, innerHeight: 340, current: "{current} / {total}" }); $(".sortTable").tablesorter(); TableMaxMinColor(".qimain td.NJD", "red", "blue"); } //绑定示意图 // $.getJSON("/VIS/mapdata.js", function (json) { // showMap(json); // }); var showMap = function (obj) { var nMap = $(object.nMap_id);//地图容器 $.each(obj, function (index, content) { if (content.rid == "VI7019") return true;//隐藏高明气象局 var visValue = content.value; var visTime; if (visValue == 0) visValue = "--"; var left = position_left(content.lo); var top = position_top(content.la); //if (left > 550 || left<0 || top > 700 || top < 0) // return true; switch (content.rid) { case "VB59651"://顺德港 left = 579; top = 576; break; case "VB59652"://顺德均安水利会 left = 463; top = 636; break; case "VB59653"://顺德良仁冲水闸 left = 493; top = 515; break; case "V6831"://南海里水文教金鸦水闸 left = 473; top = 261; break; case "V6853"://广三高速松岗收费站 left = 420; top = 332; break; } $("").attr({ rid: content.rid, title: content.name + " " + content.time, href: '/VISLine.aspx?t=1&n=' + escape(content.name) + '&rid=' + content.rid }).addClass('mIcon_' + content.classN + " zoomMap").css({ left: left, top: top, position: "absolute" }).text(visValue).hover( function () { var _span_curr = $(this) visTime = setTimeout(function () { _span_curr.click() }, 1000) }, function () { clearTimeout(visTime) } ).appendTo(nMap); if (content.rid == "59828") { $(".newVIS").replaceWith(content.time + " " + visValue); } }) $(".zoomMap").colorbox({ rel: "group2", iframe: true, innerWidth: 610, innerHeight: 340, current: "{current} / {total}" }); } } //标识最高最低值颜色 function TableMaxMinColor(tdCtrl, maxColor, minColor) { var max = 0; var min = 1000; $(tdCtrl).each(function () { var t = parseFloat($(this).text()); if (t > max) { $(tdCtrl + ":[style='color: " + maxColor + ";']").css("color", "black") max = t; $(this).css("color", maxColor); } if (t < min) { $(tdCtrl + ":[style='color: " + minColor + ";']").css("color", "black") min = t; $(this).css("color", minColor); } }) }