SkyLine二次開発:Webページの起動時にTerraExplorerを自動的に実行する問題を解決する

17042 ワード

ブラウザでSkyLineマップを開く(ブラウザ対応:IE 7以上、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>

この場合、ページに3 Dシーン表示のコントロール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>