在瀏覽器中打開SkyLine地圖(支持瀏覽器:IE7以上,360瀏覽器兼容模式)javascript
實例代碼:html
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的問題java
在SkyLine的Web開發中,在頁面添加TerraExplorer Object(SGWord)對象,在頁面加載時會自動運行TerraExplorer Projquery
<object id="SGWorld" classid="CLSID:3a4f9197-65a8-11d5-85c1-0001023952c1" style="visibility: hidden; height: 0"></object>
出現這種狀況時須要在頁面中添加三維場景顯示的控件TE,而且在SGWorld被初始化以前先初始化TEweb
<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>SkyLine</title> 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 <!--頁面中先初始化TE--> 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>