//設備在地圖上進行標註 function GetGateInfo(vSID, vMap) { var icon = "../Content/easyui/themes/icons/gate.png"; var myIcon = new BMap.Icon(icon, new BMap.Size(3 ...
//設備在地圖上進行標註
function GetGateInfo(vSID, vMap) {
var icon = "../Content/easyui/themes/icons/gate.png";
var myIcon = new BMap.Icon(icon, new BMap.Size(32, 32), {
offset: new BMap.Size(32, 32)
});
$.ajax({
type: "post",
url: "/MonitorManage/GetStationGate?SID=" + vSID,
success: function (obj) {
for (var i = 0; i < obj.length; i++) {
//var vGateID = obj[i].GateID;
//var vGateName = obj[i].GateName;
//var vlongitude = obj[i].Longitude;
//var vlatitude = obj[i].Latitude;
//var point = new BMap.Point(obj[i].Longitude, obj[i].Latitude); //POI點坐標
//var marker = new BMap.Marker(point, { icon: myIcon });
//vMap.addOverlay(marker);
(function (x) {
var point = new BMap.Point(obj[x].Longitude, obj[x].Latitude); // 創建點坐標
alert(point);
var marker = new BMap.Marker(point,{icon:myIcon});
// 創建信息視窗對象,引號里可以書寫任意的html語句。
var infoWindow = new BMap.InfoWindow
("<table class='mytable' border='0' cellspacing='0' cellpadding='0'>"
+ "<tr><td>站點名稱:" + obj[x].GateName
+ "</td></tr><tr><td>經度:" + obj[x].Longitude
+ "</td></tr><tr><td>緯度:" + obj[x].Latitude
+ "</td></tr></table>");
// 滑鼠移上標註點要發生的事
marker.addEventListener("mouseover", function () {
this.openInfoWindow(infoWindow);
});
// 滑鼠移開標註點要發生的事
marker.addEventListener("mouseout", function () {
this.closeInfoWindow(infoWindow);
});
vMap.addOverlay(marker);
})(i);
//// 創建信息視窗對象,引號里可以書寫任意的html語句。
//var infoWindow = new BMap.InfoWindow
// ("<table class='mytable' border='0' cellspacing='0' cellpadding='0'>"
// + "<tr><td>站點名稱:" + vGateName
// + "</td></tr><tr><td>經度:" + vlongitude
// + "</td></tr><tr><td>緯度:" + vlatitude
// + "</td></tr></table>");
//// 滑鼠移上標註點要發生的事
//marker.addEventListener("mouseover", function () {
// this.openInfoWindow(infoWindow,point);
//});
//// 滑鼠移開標註點要發生的事
//marker.addEventListener("mouseout", function () {
// this.closeInfoWindow(infoWindow, point);
//});
}
}
})
}