SkyLine二次开发——解决在web页面启动时自动运行TerraExplorer的问题

  在浏览器中打开SkyLine地图(支持浏览器:IE7以上,360浏览器兼容模式)

  实例代码:

 1 <html xmlns="http://www.w3.org/1999/xhtml">
 2 <head>
 3     <title>title>
 4     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
 5     <script type="text/javascript" src="javascript/jquery-1.8.2.js">script>
 6     <script type="text/javascript">
 7         $(function () {
 8             //fly文件目录
 9             var t_flyPath = "E:\\SkyLine\\Skyline\\basekit\\Default.fly";
10             //打开fly文件
11             SGWorld.Project.Open(t_flyPath);
12         });
13     script>
14 head>
15 <body>
16     <div id="map">
17         <object id="TE" classid="clsid:3a4f9192-65a8-11d5-85c1-0001023952c1" style="width: 100%;
18             height: 100%;">
19         object>
20         <object id="SGWorld" classid="CLSID:3a4f9197-65a8-11d5-85c1-0001023952c1" style="visibility: hidden;
21             height: 0">
22         object>
23     div>
24 body>
25 html>

   

  解决在web页面启动时自动运行TerraExplorer的问题

  在SkyLine的Web开发中,在页面添加TerraExplorer Object(SGWord)对象,在页面加载时会自动运行TerraExplorer Pro

<object id="SGWorld" classid="CLSID:3a4f9197-65a8-11d5-85c1-0001023952c1" style="visibility: hidden; height: 0">object>

  出现这种情况时需要在页面中添加三维场景显示的控件TE,并且在SGWorld被初始化之前先初始化TE

<object id="TE" classid="clsid:3a4f9192-65a8-11d5-85c1-0001023952c1" style="width: 100%; height: 100%;">object>

  实例代码:  

 1 DOCTYPE HTML>
 2 <html>
 3 <head>
 4     <title>SkyLinetitle>
 5     <script src="../JavaScript/lib/jquery-1.8.2.js" type="text/javascript">script>
 6     <script type="text/javascript">
 7         $(function () {
 8             //页面加载完成后创建SGWorld
 9             var SGWorld = CreateSGWorld();
10             //打开fly文件
11             SGWorld.Project.Open(g_flyPath);
12             var CreateSGWorld = function () {
13                 var obj = document.getElementById("SGWorld");
14                 if (obj == null) {
15                     obj = document.createElement('object'); //创建元素
16                     document.body.appendChild(obj);
17                     obj.id = "SGWorld";
18                     obj.name = "SGWorld";
19                     obj.classid = "CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1";
20                 }
21                 return obj;
22             }
23         }); 
24     script>
25 head>
26 <body>
27     <div id="map">
28         
29         <object id="TE" classid="clsid:3a4f9192-65a8-11d5-85c1-0001023952c1" style="width: 100%;
30             height: 100%;">
31         object>
32     div>
33 body>
34 html>

 

你可能感兴趣的:(SkyLine二次开发——解决在web页面启动时自动运行TerraExplorer的问题)