Skyline培訓完,做的程式碼

來源:互聯網
上載者:User

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>lianxi</title>
</head>
<body OnLoad="Init();">
 <object id="TEInformationWindow" classid="CLSID:3a4f9193-65a8-11d5-85c1-0001023952c1" width="300" height="400">
   <embed width="300" height="400"></embed>
 </object>
 <object ID="TE3DWindow" classid="CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1" width=650 height="400"></object>
 <object ID="TE" CLASSId="CLSID:3a4f9191-65a8-11d5-85c1-0001023952c1"></object>
 <hr/>
 <br>
 <table width="100%" height="133" border="1" align="center" bordercolor="#00FF33">
   <tr>
     <td width="16%" height="29" align="center">
  <input type="button" name="createline" value="建立線" onClick="Createpolyline()">
  <input type="button" name="Container" value="彈新視窗" onClick="Container()">
     </td>
     <td width="16%" align="center">
  <input type="button" name="ITerraExplorer" value="pro屬性" onClick="ProInfo()">
     <input type="button" name="ITerraExplorer" value="pro方法" onClick="MethedInfo()">
  </td>
     <td width="16%" align="center">
  <input type="button" name="typeInfo" value="ITerrain屬性測試" onClick="ITerrainProInfo()">
  </td>
     <td colspan="3" align="center">&nbsp;
  <input type="button" name="typeInfo" value="IStartPosition的屬性" onClick="IIStartPositionInfo()">
  <input type="button" name="typeInfo" value="IRender的屬性" onClick="IRenderProInfo()">
  <input type="button" name="addprograme" value="添加工程檔案" onClick="AddG()">
  </td>
   </tr>
   <tr>
     <td height="25" colspan="2"><label>建立路徑操作:</label>
       <input type="button" name="createdynamic" value="建立" onClick="CreateDynamic()">
       <input type="button" name="dynamicPlay" value="播放" onClick="DynamicPlay()">
       <input type="button" name="dynamicstop" value="停止" onClick="DynamicStop()">
       <input type="button" name="dynamicP" value="暫停" onClick="DynamicP()">     </td>
     <td colspan="2" align="center">&nbsp;
       <input type="text" name="text" value="新群組" id="CG" width="120"> 
     <input type="button" name="createGroup" value="建使用者組" id="GN" onClick="CreateGroup1()" ></td>
     <td width="15%" align="center">
    <input type="button" name="kuaizhao" value="快照" onClick="Menu.Invoke(32783)">
    <input type="button" name="kzsaveas" value="滑鼠模式" onClick="GetMouseMode()">
  </td>
     <td width="20%">&nbsp;
    <input type="checkbox" name="showlaler" checked  id="chk1" onClick="LayerVis()"> <label>顯示和隱藏層</label>
  </td>
   </tr>
   <tr>
     <td height="21" colspan="4">
  名稱:<input name="Name" id="flyName" type="text" value="克拉瑪依" size="12" width="100">
  經度:<input name="flyJD" id="flyJD"  type="text" value="87" size="10" width="100">
  緯度:<input name="flyWD" id="flyWD" type="text" value="43" size="10" width="100">
  &nbsp;
        <input type="button" value="起 飛" name="FlyToSomeWhere" onClick="FlyToSomeWhere()">
  </td>
     <td><input type="button" name="deleteobj" value="刪除選定的對象" id="delobj" onClick="DelObj()"></td>
     <td align="center"><input type="button" name="infortree" id="iftv" value="資訊樹的遍曆" onClick="InformationTreeVist()"></td>
   </tr>
   <tr>
     <td height="19"><input type="button" name="createpolygon" value="建立稜錐"onClick="CreateP()"></td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td width="17%">&nbsp;</td>
     <td>&nbsp;</td>
     <td><input type="button" name="loadsave" value="載入我的操作" onClick="LoadFromSaved()"></td>
   </tr>
   <tr>
     <td height="25" colspan="3">經度:<span id="jd"></span>緯度:<span id="wd"></span></td>
     <td colspan="3">&nbsp;  <input type="button" value="儲存" name="save" onClick="SaveAs()">       &nbsp;
  <input type="file" value="E:\a.fly" name="saveas" id="adr" width="10">&nbsp;
     <input type="button" value="fly另存新檔" name="save" onClick="SaveAsOther()"> 
     <label></label>
  </td>
   </tr>
 </table>
</body>
<script language="javascript">
var ITerraExplorer = null;
var IInformationTree = null;
var Polylineflag = false;
var Dynamicflag = false;
var IRender = null;
var IPolyline = "";
var isLine = false;
var isRoute = false;
var IObiectManager = null;
var IStartPosition = null;
var Route = "";
var IContainer = null;
var IPlane = null;
var ITerrain = null;
var IStartPosition = null;
var ITerrain = null;
var Menu = null;
var ISnapShot = null;
var ItemID = "";
var curItemID = "";
var groupID = "";
var createpolygoyflag = false;
var isPolygon = false;
var IPolygon = "";

function Init()
{
    ITerraExplorer = TE.interface("ITerraExplorer5");
 IInformationTree = TE.interface("IInformationTree5");
 IRender = TE.interface("IRender5");
 IObjectManager = TE.interface("IObjectManager5");
 IStartPosition = TE.interface("IStartPosition");
 IContainer = TE.interface("IContainer2");
 IPlane = TE.interface("IPlane5");
 ITerrain = TE.interface("ITerrain4");
 IStartPosition = TE.interface("IStartPosition");
 IRender = TE.interface("IRender5");
 Menu = TE.interface("IMenu");
 ISnapShot = TE.interface("ISnapShot2");
 ITerraExplorer.load("c:\\a.fly");
 window.setTimeout("test()",800);
}
function test()

    IInformationTree.LoadFlyLayerEx("[TE Application Data]\\本人上次的操作記錄.fly",0);
 IInformationTree.LoadFlyLayerEx("[TE Application Data]\\本人上次建立的動態路徑.fly",0);
}
function SaveAs()
{
    ITerraExplorer.Save();
 alert("儲存成功");
}

function SaveAsOther()
{
    var txt = document.getElementById("adr").value;
    if(txt!="")
    {
    ITerraExplorer.SaveAs(txt);
    alert("儲存成功");
    }
 else
 alert("請輸入要儲存的位置!");
}
function Createpolyline()
{
    Polylineflag = true;
 IRender.SetMouseInputMode(1);
}

function CreateDynamic()
{
    Dynamicflag = true;
 IRender.SetMouseInputMode(1);
}

function TE::OnLButtonDown(flag,X,Y,Handled)
{
    if(Polylineflag)
    CreatePolylineVB(X,Y);
 if(Dynamicflag)
    CreateDynamicVB(X,Y);
 if(createpolygoyflag)
    CreatePolygonVB(X,Y)
}

function TE::OnRButtonDown(flag,X,Y,Handled)
{
    Polylineflag = false;
 Dynamicflag = false;
 isLine = false;
 isRoute = false;
    IRender.SetMouseInputMode(0);
 curItemID = "";
 createpolygoyflag = false;
}

function Container()
{
    //歡迎使用本產品!!的地方也可使用 URL定位
    IContainer.HTMLPopup (0, 50,50,350,350,"容器視窗", "歡迎使用本產品!!" ,2, -1 );
}

function ProInfo()
{
    alert(ITerraExplorer.TYPE);
 alert(ITerraExplorer.FlyName);
 alert(ITerraExplorer.DisplayErrorMessages = 1);
}

function MethedInfo()
{
 alert(ITerraExplorer.GetUserUnits(0,3,5,7));
 alert(ITerraExplorer.GetTEVersion("5","00","38"));
}

function ITerrainProInfo()
{
    alert("mpt的檔案名稱:"+ITerrain.MPTName);
 alert("SystemKey的檔案名稱:"+ITerrain.SystemKey);
 alert("GroupKey的檔案名稱:"+ITerrain.GroupKey);
 alert("DatumKey的檔案名稱:"+ITerrain.DatumKey);
 alert("UnitKey的檔案名稱:"+ ITerrain.UnitKey);
 alert("EPSG的檔案名稱:"+ ITerrain.EPSG);
 alert("Description的檔案名稱:"+ ITerrain.Description);
}

function IIStartPositionInfo()
{
 alert("開始座標X"+IStartPosition.StartX);
 alert("開始座標Z"+IStartPosition.StartZ);
}

function IRenderProInfo()
{
    alert(IRender.HudMode = 6);
}

function CreateGroup1()
{
    var groupID = null;
 var GroupName = document.getElementById("CG").value;
 if(GroupName!="")
     groupID = IInformationTree.CreateGroup(GroupName,0);
 else
     alert("請輸入要建立組的名字!");
}

function TE::OnInfoTreeAction(ItemID,Action,ActionParam)
{
 curItemID = ItemID;
}

function AddG()
{
    IInformationTree.LoadFlyLayer("E:\\skyline\\Terra pro練習\\lianxi\\124.fly");
 alert("工程添加成功!");
}

function LayerVis()
{
 if (document.getElementById("chk1").checked)
  IInformationTree.SetGroupVisibility(IInformationTree.FindItem("0"),true);
 else
  IInformationTree.SetGroupVisibility(IInformationTree.FindItem("0"),false);
}

function FlyToSomeWhere()
{
    var tName,tX0,tZ0
 tName = document.getElementById("flyName").value;
 tX0 = document.getElementById("flyJD").value;
 tZ0 = document.getElementById("flyWD").value;
 CreateLabelFlyTo(tName,tX0,tZ0);
}

function CreateLabelFlyTo(txt,x1,z1)
{
    var LabelInfo = new Object();
 LabelInfo.Text = txt;
 LabelInfo.Scale = 1;
 LabelInfo.bgColor = 0xff00;
 IObjectManager.CreateLabel(LabelInfo,x1,z1,2000.0);
 IPlane.FlyTo(x1,z1,2000.0,117.98,0,-35,"Oval");
}

function DelObj()
{
    if(curItemID =="")
 {
     alert("請選定你要刪除的對象!");
 }
 else
    {
     IInformationTree.DeleteItem(curItemID);
     alert("刪除成功!");
     curItemID ="";
    }
}

function InformationTreeVist()
{
    var groupID = IInformationTree.GetNextItem(0, 11);
 if (groupID == 0)
 {
  alert("資訊樹中無對象!");
  return 0;
 }
 else
     InformationTreeAll(groupID);
}
function InformationTreeAll(groupID)
{
 var a,b,c;
 if (groupID == 0)
  return 0;
 else
 {
  b = confirm(IInformationTree.GetItemName(groupID)+"__ID:"+groupID);
  if(b == false)
  {
       return 0;
  }
  a = groupID;
  groupID = IInformationTree.GetNextItem(groupID,11);
  if(groupID == 0)
  {  
      groupID = IInformationTree.GetNextItem(a,13);
   if(groupID == 0)
   {
       groupID = IInformationTree.GetNextItem(a,15);
    c = groupID; 
    groupID = IInformationTree.GetNextItem(c,13);groupID
    while(groupID == 0 )
       {   
        groupID = IInformationTree.GetNextItem(c,15);
     groupID = IInformationTree.GetNextItem(groupID,13);
     if (groupID == 0)
                  return 0;
    }
   }
  }
  InformationTreeAll(groupID);
 }
}

function LoadFromSaved()
{
    alert(IInformationTree.LoadFlyLayerEx("[TE Application Data]\\e.fly",0));
}

/*function CreateP()
{
    createpflag = true;
 IObjectManage.CreatePyramid(x,y,);
 
}*/
</script>
<script language="vbscript">
 function  CreatePolylineVB(x,y)
    dim outX,outY,outH,ObjectID
 IRender.ScreenToWorld x,y,63,outX,outH,outY,ObjectID
    if curItemID<>"" then
    if IInformationTree.IsGroup(curItemID) then
        if isLine = false then
            isLine = true
         Set IPolyline = IObjectManager.CreatePolyline(0,16744555,2,curItemID,"建立線")
        else
            IPolyline.AddVertex outX,outH,outY,0
        end if
           IInformationTree.SaveFlyLayer "本人上次的操作記錄.fly",curItemID
  else
     msgbox "你選擇的是對象不能容納對象,請選擇組!"
  end if
 else
     msgbox "請選擇容納對象的組!"
 end if
 
 end function
 
 function CreateDynamicVB(x,y)
    IRender.ScreenToWorld X,Y,63,outX,outH,outY,ObjectID
 if curItemID<>"" then
    if IInformationTree.IsGroup(curItemID) then
       if isRoute = false then
       set Route = IObjectManager.CreateRoute (empty,0,curItemID,"動態路徑")
       isRoute = true
       else
       Route.AddWaypoint outX,outH,outY,0,-45,0,-45,0,100,""
       end if
    IInformationTree.SaveFlyLayer "本人上次建立的動態路徑.fly",curItemID
  else
  msgbox "你選擇的是對象不能容納對象,請選擇組!"
  end if
 else
    msgbox "請選擇容納對象的組!"
 end if
end function

 

function DynamicPlay()
    Route.Play
 msgbox "播放動態路徑"
end function

function DynamicP()
    Route.Pause
 msgbox "暫停播放動態路徑"
end function

function GetMouseMode()
    msgbox IRender.GetMouseInputMode
end function

function TE_OnFrame()
    dim x1,y1
 IRender.GetMouseInfo 1,x1,y1
 ObjType = 0
 IRender.ScreenToWorld x1,y1,ObjType,WorldX,WorldHeigth,WorldY,ObjectID
 document.getElementById("jd").innerHTML = WorldX
 document.getElementById("wd").innerHTML = WorldY
end function
</script>
</html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.