var scene = null;
var sceneControl = null;
var htmlUrl = document.location.host;
//判断网页的打开方式是本地打开还是通过网络打开
//不同的打开方式url赋值不同
if(htmlUrl == "")
{
htmlUrl = "http://localhost:8090";
}
else
{
htmlUrl = "http://" + htmlUrl;
}
function onPageLoad()
{
try
{
//获取 html 页面中名为 sceneControlDiv 的 div 对象作为场景控件
sceneControl = new SuperMap.Web.UI.Controls.SceneControl($get("sceneControlDiv"), initCallback, failedCallback);
}
catch(e)
{
//若没有安装插件,则抛出该异常。
if (e.name == SuperMap.Web.Realspace.ExceptionName.PlugInNotInstalled)
{
var url = htmlUrl + "/SuperMapRealspace/SuperMap iClient 6R for Realspace.exe";
document.write("<a href='"+url+"'>请点击下载SuperMap iClient3D for Plugin插件进行安装</a>");
return;
}
//若使用暂不支持的浏览器,则抛出该异常
else if (e.name == SuperMap.Web.Realspace.ExceptionName.BrowserNotSupport)
{
document.write("<p>SuperMap iClient3D for Plugin目前不支持此浏览器。</p>");
return;
}
//抛出其他异常
else
{
alert(e.message);
}
}
}
//控件初始化完成后的回调函数,初始化完成之后才能进行数据加载
function initCallback()
{
//获取 Realspace 控件的场景,控件和场景是一对一关系
scene = sceneControl.get_scene();
}
//控件初始化失败后的回调函数
function failedCallback()
{
alert("Realspace initialized failed!");
}
|