开发过程中采用IE10或11版本,都会不同程度的出现浏览器崩溃无反应的状态,可能是数据量过大等,原因不明,比较显著的状态是CPU占用率达到80%就会出现这样的问题,这里改用控件的方式去加载数据后,不会出现问题,但是通过加载控件的方式是无法加载目录树的,需要自己自定义构建一个目录树。
JSP文件源码
在同一个页面中显示双球,是第一种和第二种方式。
第一种方式
该Jsp文件包含两种数据加载方式,第一个球体采用控件的方式加载,第二个球体采用直接加载的方式。
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=10">
<script type = "text/javascript" >
var SGWorld66;
function init()
{
setTimeout(function () {
//方法1:采用控件方法加载
SGWorld66 = TerraExplorer.CreateInstance("TerraExplorerX.SGWorld66");
SGWorld66.Open("http://192.168.1.224:8090/xi.FLY");
var firstItem = SGWorld66.ProjectTree.GetNextItem(SGWorld66.ProjectTree.RootID,18);
SGWorld66.Navigate.FlyTo(firstItem);
//var secondeItem = SGWorld66.ProjectTree.GetNextItem(firstItem,13);
//SGWorld66.Navigate.FlyTo(secondeItem);
//var rootItemsName = SGWorld66.ProjectTree.GetItemName(firstItem); // 获取图层名称
//SGWorld66.ProjectTree.EditItem(firstItem); // 编辑图层
//方法2:直接加载
var flyPath = "http://192.168.1.224:8090/xier.FLY";
SGWorld.Project.Open(flyPath);
SGWorld.Navigate.FlyTo(firstItem);
}, 500);
}
</script>
</head>
<body onload="init()">
<!--定义插件对象-->
<object id="TerraExplorer" classid="CLSID:3a4f9196-65a8-11d5-85c1-0001023952c1" width="80%" height="1000px" style="float: left;"></object>
<!--定义3D窗口对象-->
<object id="TE" classid="clsid:3a4f9192-65a8-11d5-85c1-0001023952c1" style="width: 19%;height: 10%;" ></object>
<!--定义TerraExplorer对象SGWorld-->
<object id="SGWorld" classid="CLSID:3A4F9199-65A8-11D5-85C1-0001023952C1" style="visibility:hidden;height:0 "></object>
</body>
</html>
第二种方式
两个球体通过拓展控件的方式加载。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>并列对比</title>
<script type = "text/javascript" language = "javascript">
var globe1;
var globe2;
var TerrainDatabaseToOpen = "http://www.skylineglobe.com/SkylineGlobeLayers/SG_ExternalFlys/skylineglobe.fly";
function Init() {
Resize();
globe1 = TEX1.CreateInstance("TerraExplorerX.SGWorld66");
globe1.AttachEvent("OnLoadFinished", g1OnLoadFinished);
globe1.Open(TerrainDatabaseToOpen);
globe2 = TEX2.CreateInstance("TerraExplorerX.SGWorld66");
globe2.Open(TerrainDatabaseToOpen);
}
function Resize() {
TEX1.width = window.document.documentElement.clientWidth / 2;
TEX1.height = window.document.documentElement.clientHeight;
TEX2.style.left = window.document.documentElement.clientWidth / 2+"px" ;
TEX2.width = window.document.documentElement.clientWidth / 2;
TEX2.height = window.document.documentElement.clientHeight;
}
function g1OnLoadFinished()
{
globe1.Application.Multiple3DWindows.SetAsLeader();
globe2.Application.Multiple3DWindows.LinkPosition(globe1);
}
</script>
</head>
<body onload="Init();" onresize="Resize() " >
<object id="TEX1" classid="CLSID:3a4f9196-65a8-11d5-85c1-0001023952c1" style="position:absolute;">
</object>
<object id="TEX2" classid="CLSID:3a4f9196-65a8-11d5-85c1-0001023952c1" style="position:absolute;">
</object>
</body>
</html>
注册表源码
采用控件的方式加载还需要添加一个注册表文件SkylineEX.reg,创建完成后,双击注册。
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SkyLine\TerraExplorer Globals]
"CreateControlOverride"=dword:00000001
效果图