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)) }; position_top = function (h) { //图片内目标Y坐标=取绝对值(目标纬度-图片上边对应纬度)/取绝对值(图片下边纬度-图片上边对应纬度)* (图片的高度)-边距 return (F.height * (h - F.latitude_max) / (F.latitude_min - F.latitude_max)) }; //绑定站点 $.getJSON("/VIS/StationsList.js?t=" + Math.random(), function (json) { InitStationsList(json, object); }) var InitStationsList=function(obj) { var stationsList = $(object.stationsList_id);//站点容器 stationsList.empty(); //var rids = ""; $.each(obj, function (index, content) { var rid = content.id; if (rid == "VI7019") return true;//隐藏高明气象局 // rids += "," + rid; var li = $("
  • "); $("").attr({ value: rid, title: content.name, href: '/VISLine.aspx?t=1&n=' + escape(content.name) + '&rid=' + rid }).addClass('zoom').text(content.name).appendTo(li) li.appendTo(stationsList); //请求生成折线图数据 }); $(".njd").height($("#stationsList").height()+1) //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}" }); } //绑定示意图 $.getJSON("/VIS/mapdata.js?t=" + Math.random(), function (json) { showMap(json); }); var showMap = function (obj) { var nMap = $(object.nMap_id);//地图容器 //按time 排序 obj.sort(function (a, b) { return a.time - b.time; }); $.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); switch (content.rid) { case "VB59628"://南海狮山官窑汀圃水闸 left = 417; top = 298; break; case "VB59653"://顺德良仁冲水闸 left = 493; top = 515; break; case "VB59652"://顺德均安水利会 left = 490; top = 620; break; case "VB59651"://顺德港 left = 579; top = 576; break; } //if (left > 550 || left < 0 || top > 700 || top < 0) // return true; $("").attr({ rid: content.rid, title: content.name,// + " " + content.time, href: '/VISLine.aspx?t=1&n=' + escape(content.name) + '&rid=' + content.rid }).addClass('mIcon_2 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 (index==0) //{ $(".newVIS").replaceWith(content.time); // } }) $(".zoomMap").colorbox({ rel: "group2", iframe: true, innerWidth: 610, innerHeight: 340, current: "{current} / {total}" }); } }