<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<%@ include file="/sc/sys/common.jsp"%>
<script type="text/javascript" src="sc/sys/res/SuperMap.Include.js">
<title>地图管理</title>
</script>
<script type="text/javascript">
var scene = null;
var sceneAddress = null;
var sceneName = null;
var sceneControl = null;
// var htmlUrl = document.location.host;
$(function() {
getUrlAndName();
});
//判断网页的打开方式是本地打开还是通过网络打开
//不同的打开方式url赋值不同
/* if (htmlUrl == "") {
htmlUrl = "http://localhost:8090";
} else {
htmlUrl = "http://" + htmlUrl;
} */
function getUrlAndName() {
sc.ajax("3DMap/getUrlAndName", null, function (result) {
if(result){
sceneAddress = result.tdmapUrl;
sceneName = result.tdmapName;
}
},false);
}
function onPageLoad() {
//初始化三维场景控件
try {
//初始化三维场景控件实例,参数为包含控件的HTML元素
if(sceneControl == null){
sceneControl = new SuperMap.Web.UI.Controls.SceneControl(
$get("sceneControlDiv"), initCallback, failedCallback);
}
} catch (e) {
//若没有安装插件,则抛出该异常
if (e.name == SuperMap.Web.Realspace.ExceptionName.PlugInNotInstalled) {
var ie =window.navigator.platform;
if(ie =="Win32") {
var url = sc.getRootPath() + "/sc/res/Setup_32.exe";
document.write("您使用的是32位浏览器,请点击下载32位 <a href='" + url +"'>SuperMap iClient3D For Plugin</a> 插件进行安装");
return;
}
else if(ie =="Win64") {
var url = sc.getRootPath() + "/sc/res/Setup.exe";
document.write("您使用的是64位浏览器,请点击下载64位 <a href='" + url +"'>SuperMap iClient3D For Plugin</a> 插件进行安装");
return;
}
}
//若使用非IE浏览器,则抛出该异常
else if (e.name == SuperMap.Web.Realspace.ExceptionName.BrowserNotSupport) {
document.write("<p>SuperMap iClient 7C for Realspace目前只支持IE浏览器</p>");
return;
}
//抛出其他异常
else {
alert(e.message);
}
}
}
//控件初始化完成后的回调函数,初始化完成之后才能进行数据加载
function initCallback() {
//获取地球控件场景,控件和场景是一对一的捆绑关系
scene = sceneControl.get_scene();
//打开场景
scene.open("http://47.104.151.51:8090/iserver/services/3D-GongSiSanQi/rest/realspace", "公司三期");
//获取场景中的图层
debugger
var layer3D = scene.get_layer3Ds().get_item("Ground@OlympicGreen");
if (layer3D != null)
{
//获取图层的地理范围,并飞行到该范围
var geobound = layer3D.get_bounds();
scene.get_flyingOperator().flyToBounds(geobound);
}
}
//控件初始化失败后的回调函数
function failedCallback() {
alert("Realspace initialized failed!");
}
</script>
</head>
<body onLoad="onPageLoad()">
<div id="sceneControlDiv"
style="position:absolute;left:0px;top:0px;bottom:0px;right:0px">
</div>
</body>
</html>