在skylines上彈出html頁面用ShowPopup的接口:
在創(chuàng)建popup之前要創(chuàng)建CreatePopupMessage:
var url=abspath() + "/model_pop.html"+ "?obj_model="+id;
SGWorld.Creator.CreatePopupMessage("3D模型信息",url ,1707,0,450,420,-1);
SGWorld.Window.ShowPopup(pop);
abspath(),當(dāng)前界面的絕對路徑,利用key往扔,value的形式把參數(shù)傳到Popup中潮尝。
在Popup中var url = document.location.href;
var value = url.split("=");
var x = value[1];
來接受傳過來的參數(shù)
Pop接受多個參數(shù)
window.onload = function(){
b();
var buildingname = "";
var lh = "";
var floor = "";
var winurl = decodeURI(window.location.href);
var wlp = winurl.split("?")[1];
var wincs = wlp.split("&");
if(wincs != null && wincs.length > 0){
for (var i = 0; i < wincs.length; i++) {
var tur = wincs[i].split("=");
if (tur[0] == "floor") {
floor = tur[1];
}else if(tur[0] == "buildingname"){
buildingname = tur[1];
}else if(tur[0] == "lh"){
lh = tur[1];
}
}
}
}
這樣Popup就創(chuàng)建完成了祈纯,接下來是要刪除Popup:
刪除Popup有三種方法
1.自帶的方法
缺點:灰色條樣式不好看吉懊。
2.根據(jù)Popup對象來刪除
SGWorld.Window.RemovePopup(Popup);
跟自帶的方法一樣
3.根據(jù)Popup的名稱來刪除
SGWorld.Window.RemovePopupByCaption("3D模型信息");
pop.ShowCaption=false;
缺點:Popup頁面無法移動文兑。
解決Popup接受OpenLayers發(fā)布的sfs服務(wù)數(shù)據(jù)
var b = function a() {
var _class = OpenLayers.Format.XML;
var originalWriteFunction = _class.prototype.write;
var patchedWriteFunction = function() {
var child = originalWriteFunction.apply(this, arguments);
// NOTE: Remove the rogue namespaces as one block of text.
// The second fragment "NS1:" is too small on its own and could cause valid text (in, say, ogc:Literal elements) to be erroneously removed.
child = child.replace(new RegExp('xmlns:NS1="" NS1:', 'g'), '');
return child;
}
_class.prototype.write = patchedWriteFunction
};