您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > skyline-API详细使用说明手册
1TerraExplorerAPI简介TerraExplorerAPI提供了一套强大的接口用来集成TerraExplorer、TerraExplorerPro和用户自定义应用。它提供了一些访问外部信息扩展的方法,比如:访问数据库或基础地理空间数据。所有这些以COM协议为基础的API接口都可以通过脚本语言操作(例如Javascript),也可以通过非脚本语言来控制操作(例如:C++、VB、delphi或者.net)。TerraExplorer也提供了一套ActiveX控件,可将3D窗口、信息树和导航图以控件对象的方式嵌入到用户自定义的可视化界面中,其中,Runtime模块使得用户自定义的应用程序更易分发。1.1ITerraExplorer5描述用户接口的相关细节,例如当前用户使用的软件版本信息、单位参数(长度单位、速度单位等)、工程文件加载和保存等。ITerraExplorer属性:Type,FlyName,DisplayErrorMessages方法:Load,SetCPUSavingMode,GetUserUnits,GetTEVersion,LoadEx,Save,SaveAs,SetParam,GetParam(1)Load方法:HRESULTLoad([in]BSTRURL)其中URL是fly或mpt文件的完整路径。C#:(第一次举例是完整代码,主要部分为粗体部分,以后的例子只写主要部分,下面接口例子的其他代码与此例类似,其中加载保存路径读者可以自行设定)usingSystem;usingSystem.Windows.Forms;usingTerraExplorerX;namespaceLoad_Test{publicpartialclassForm1:Form{privateTerraExplorerClassobjTerraExplorer;publicForm1(){InitializeComponent();}privatevoidLoadbutton_Click(objectsender,EventArgse){objTerraExplorer=newTerraExplorerClass();objTerraExplorer.Load(@E:\SkylineProInterface\数据\数据\Default.fly);}}}VBscript:(其中黑体部分是主要部分)htmlheadmetahttp-equiv=Content-Typecontent=text/html;charset=gb2312titleLoad/title/headscripttype=text/vbscriptSubLoad()setITerraExplorer5=TE.interface(ITerraExplorer5)ITerraExplorer5.loadE:\SkylineProInterface\数据\数据\Default.flyendSub/scriptbodyleftmargin=0topmargin=0inputtype=buttonvalue=LoadonClick=Load()tablewidth=100%height=100%border=1trtdOBJECTID=TerraExplorerInformationWindowCLASSID=CLSID:3a4f9193-65a8-11d5-85c1-0001023952c1width=200height=760/OBJECT/tdtdOBJECTID=TerraExplorer3DWindowCLASSID=CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1width=800height=760/OBJECT/td/tr/tableOBJECTID=TECLASSID=CLSID:3a4f9191-65a8-11d5-85c1-0001023952c1/OBJECT/body/html(2)Save方法:只能保存fly工程,mpt工程不能保存C#:objTerraExplorer=newTerraExplorerClass();objTerraExplorer.Save();VBScript:SubSave()SetITerraExplorer=TE.interface(ITerraExplorer5)ITerraExplorer.SaveEndSub(3)SaveAs方法:HRESULTSaveAs([in]BSTRFileName)工程另存为C#:objTerraExplorer=newTerraExplorerClass();objTerraExplorer.SaveAs(@E:\SkylineProInterface\数据\数据\Default88.fly);VBScript:SubSaveAs()SetITerraExplorer=TE.interface(ITerraExplorer5)ITerraExplorer.SaveAsE:\SkylineProInterface\数据\数据\Default88.flyEndSub1.2IPlane5控制飞机和摄像机的操作,对于对象的飞行方式、观看视角、视野高度进行控制,可按照需求控制摄像机的方向、倾角产生复杂的运动,例如飞机起飞模拟。IPlane5属性:Speed,FieldOfView方法:FlyTo,SetPosition,MovePosition,GetPosition,FlyToObject,SetSpeed,GetSpeed,Zoom,GetPositionEx(1)FlyTo方法:飞行到指定的位置[in]doubleX,水平方向坐标[in]doubleZ,垂直方向坐标[in]doubleHeight,高度[in]doubleDistance,飞行到后视点离位置的距离[in]doubleYaw,方位角[in]doublePitch,视角上下倾斜角度[in]BSTRPattern视角飞行到固定位置的模式C#:privateTerraExplorerClassobjTerraExplorer;IPlane5objIPlane5=objTerraExplorerasIPlane5;objIPlane5.FlyTo(100.71729,36.761361,40000,100,0,0,FlyToTerrain);VBScript:SubFlyTo()SetIPlane5=TE.Interface(IPlane5)IPlane5.FlyTo108,39,2000,50,0,0,FlyToLocationEndSub(2)SetPosition方法:设置跳转到视角的位置[in]doubleX[in]doubleY[in]doubleHeight[in]doubleYaw[in]doublePitch[in]doubleRoll[in]doubleCameraDeltaYaw,[in]doubleCameraDeltaPitch,[in,defaultvalue(0)]longFlagsC#:IPlane5objIPlane5=objTerraExplorerasIPlane5;objIPlane5.SetPosition(100.71729,36.761361,40000,100,0,0,0,0,1024);VBScript:SubSetPosition()SetIPlane5=TE.interface(IPlane5)IPlane5.SetPosition108,39,2000,0,0,0,0,0,1EndSub(3)GetPosition方法:[out]VARIANT*doubleX,输出视角所在的经度[out]VARIANT*doubleY,输出视角所在的经度[out]VARIANT*doubleHeight,输出视角所在的高度[out]VARIANT*doubleYaw,视角方位角[out]VARIANT*doublePitch,视角上下倾斜角度[out]VARIANT*doubleRoll,视角左右倾斜角度[out]VARIANT*doubleCameraDeltaYaw,[out]VARIANT*doubleCameraDeltaPitchC#:objectx,y,h,yaw,pitch,roll,cdy,cdp;IPlane5objIplane5=objTerraExporerasIPlane5;objIplane5.GetPosition(outx,outy,outh,outyaw,outpitch,outroll,outcdy,outcdp);Xtext.Text=x.ToString();Ytext.Text=y.ToString();Htext.Text=h.ToString();Yawtext.Text=yaw.ToString();Pitchtext.Text=pitch.ToString();Rolltext.Text=roll.ToString();CDYtext.Text=cdy.ToString();CDPtext.Text=cdp.ToString();VBScript:SubGetPosition()IPlane5.GetPositionx,y,height,yaw,pitch,roll,camaraPicth,camaraRollXV.value=xYV.value=yHV.value=heightYAWV.value=yawPV.value=pitchRV.value=rollCPV.value=camaraPicthCRV.value=camaraRollEndSub(4)MovePosition方法:设置移动到视角的位置[in]doubleX,水平方向坐标[in]doubleY,垂直方向坐标[in]doubleHeight,高度[in]doubleYaw,视角方位角度[in]doublePitch,视角上下倾斜角度[in]doubleRoll,左右倾斜角度[in]doubleCameraDeltaYaw,[in]doubleCameraDeltaPitch,[in,defaultvalue(0)]longFlagsC#:IPlane5objIPlane5=objTerraExplorerasIPlane5;objIPlane5.MovePosition(111,39,4000,0,0,0,0,0,1024);VBScript:SubMovePosition()SetIPlane5=TE.Interface(IPlane5)IPlane5.MovePosition108,39,2000,0,0,0,0,0,1EndSub(5)FlyToObject方法:飞行到物体[in]BSTRObjectID输入物体ID[in]ActionCodeCode飞行到模式C#:IInformationTree5objIInformationTree5=objTerraExplorerasIInformationTree5;intItemID=objIInformationTree5.FindItem(TestGroup\\TestBuilding);stringobjID=objIInformationTree5.GetTerraObjectID(ItemID);IPlane5objIPlane5=objTerraExplorerasIPlane5;objIPlane5.FlyToObject(objID,0);VBScript:SubFlyToObject()SetIPlane5=TE.interface(IPlane5)SetIInformationTree5=TE.interface(IInformationTree5)Ite
本文标题:skyline-API详细使用说明手册
链接地址:https://www.777doc.com/doc-1658127 .html