Skyline 二次开发入门
  4NehIVQcgnjb 2023年11月02日 56 0

简介:

       erraExplorePro提供了一整套的API,供二次开发使用,它提供了一些访问外部信息的方法,比如:数据库或矢量数据的。所有这些以COM协议为基础的界面都可以通过脚本语言管理,也可通过非脚本语言控制(如:C++或Visual Basic)来开发(c/s)。

       TerraExplorePro也可以设置ActiveX控件。它作为ActiveX控件通常被应用在可视化界面的3D窗口、信息树、导航图的操作。

 方法介绍:


CreatePolyline

创建线对象;


Create2DPolygon

创建多边形对象;

CreateRectangle

创建矩形对象;

CreateRegularPolygon

创建正多边形对象;

CreateCircle

创建圆对象;

Create3DPolygon

创建三维多边形对象;

CreateBuilding

创建建筑物对象;

CreateBox

创建箱子对象;

CreatePyramid

创建金字塔对象;

CreateCylinder

创建圆柱体对象;

CreateCone

创建圆锥体对象;

CreateEllipse

创建椭圆对象;

CreateArc

创建弧对象;

CreateArrow

创建箭头对象;

Create3DArrow

创建三维箭头对象;

CreateSphere

创建球体对象;

CreateModel

创建模型对象;

CreateLabel

创建标签对象;

CreateLabelEx

创建扩展的标签对象;

CreateLocation

创建位置对象;

CreateTreeHotlink

创建树消息连接对象;

CreateRoute

创建路径对象;

CreateMessage

创建消息对象;

GetObject

获得对象;

CreateImageLabel

创建影像标签对象;

CreateImageLabelEx

创建影像标签对象;

CreateDynamicObject

创建动态对象;

CreateImageryLayer

创建 影像图层对象;

CreateElevationLayer

创建高程层;

CreateVideoOnTerrain

创建视频对象;

CreatePointCloudModel

创建点云模型对象;

CreateFromStream

保留,当前不可用;

GetFirstObjectPosition

保留,当前不可用;

GetNextObject

保留,当前不可用;

GetInfoTreeItemID

获取信息树中对象ItemID值;

SetObjectParam

保留,当前不可用;

GetObjectParam

保留,当前不可用;

CreateTerrainModifier

创建地形修整对象;

CreateHoleOnTerrain

创建地形开洞对象;

代码示例:

【C#】

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using TerraExplorerX;

 

namespace ExCodeIObjMgr

{

    public partial class Form1 : Form

    {

        private TerraExplorer TE;

        private ITerraExplorer51 TE51;

        private IPlane5 IPlane;

        private IObjectManager51 IObjectManager;

 

        public Form1()

        {

            InitializeComponent();

 

            this.TE = new TerraExplorerClass();

            this.TE51 = (ITerraExplorer51)TE;

            this.IPlane = (IPlane5)TE;

            IObjectManager = (IObjectManager51)TE;

 

            TE51.Load(Application.StartupPath + "\\Default.fly");

        }

 

        private void btnCreateLabel_Click(object sender, EventArgs e)

        {

            LabelStruct myls = new LabelStruct();

            myls.Text = "Skyline";

            ITerrainLabel5 myLabel = null;

            myLabel = IObjectManager.CreateLabel(myls, 120, 38, 10000, HeightStyleCode.HSC_TERRAIN_ABSOLUTE, 0, "Skyline");

            myLabel.Text = "Skyline";

            myLabel.ScaleFactor = 6000;

            myLabel.LimitGrowth = 1;

            myLabel.Distance = 1111111;

 

            IPlane.FlyToObject(myLabel.ID, ActionCode.AC_FLYTO);

        }

    }

}

【javascript】

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="IObjectManager51.aspx.cs" Inherits="ExCode_IObjectManager51" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

   <title>Skyline二次开发教程【配套示例】</title>   

    <script type ="text/javascript">

        function Init() {

            var TE = _$SGCreateTEObj();

            var ITerraExplorer = TE.interface("ITerraExplorer51");

            ITerraExplorer.Load("D:\\2010售前演示系统\\WPFA-DEMO\\WPFA-DEMO\\bin\\Debug\\FLY\\Default.fly");

        }

        function AddLabel() {

            var myobj = createlabel(120, 38, 10000, "Skyline");

            var IPlane = TE.interface("IPlane5");

            IPlane.FlyToObject(myobj.ID,0);

        }
        function createlabel(x, y, h, value) {

            var TE = _$SGCreateTEObj();

            if (tempLabel != null) {

                var IInformationTree = TE.interface("IInformationTree5");

                IInformationTree.DeleteItem(tempLabel.InfoTreeItemID);

            }

            var IObjectManager = TE.interface("IObjectManager51");

            var LabelInfo = new Object;

            LabelInfo.Text = value;

            LabelInfo.Scale = 20000;

            LabelInfo.FontName = "宋体";

            LabelInfo.FontStyle = 1;

            LabelInfo.FontSize = 10;

            LabelInfo.FgColor = 0x00ffff;

            LabelInfo.BgColor = 0x0d0d0d;

            LabelInfo.LineToGroundType = 1;

            LabelInfo.AlignLabelHorizontal = 2;

            LabelInfo.AlignLabelVertical = 1;

            var gid = 0;

            var tempLabel = IObjectManager.CreateLabel(LabelInfo, x, y, 10, 0, gid, value);

            tempLabel.Distance = h;

            tempLabel.LimitGrowth = true;

 

            var myMessageID = IObjectManager.CreateMessage(5, 0, 0, 32 + 2, "Skyline", -1, 10, 10, 200, 300, 0);

            tempLabel.MessageID = myMessageID.ID;

 

            return tempLabel;

        } 
        function _$SGCreateTEObj() {

            var obj = window.document.getElementById("TE");

            if (obj == null) {

                obj = document.createElement('object');

                document.body.appendChild(obj);

                obj.name = "TE";

                obj.id = "TE";

                obj.classid = "CLSID:3a4f9191-65a8-11d5-85c1-0001023952c1";

            }

            return obj;

        }
        function _$SGWorldParam() {

            this.x = 0;

            this.y = 0;

            this.h = 0;

            this.yaw = 0;

            this.pitch = 0;

            this.roll = 0;

            this.OID = 0;

            this.OType = 0;

        } 

    </script>

    <script type ="text/vbscript">

    sub GetPosition(param)

        Dim dx,dy,dh,dyaw,dpitch,droll,dcyaw,dcpitch

        Dim IPlane

        Set IPlane = TE.interface("IPlane5")

        IPlane.GetPosition dx,dy,dh,dyaw,dpitch,droll,dcyaw,dcpitch

        param.x = dx

        param.y = dy

        param.h = dh

        param.yaw = dyaw+dcyaw

        param.pitch = dpitch+dcpitch

        param.roll = droll

        param = dh

    end sub

    </script>

</head>

<body onload = "Init()">

    <form id="form1" runat="server">

    <div id = "Title">

        <input id="Button1" type="button" value="添加标注" onclick = "AddLabel()" />

        </div>

    <div id="Main">

        <object id="TerraExplorer3DWindow" classid="CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1"

            width="521" height="521">

        </object>

    </div>

    </form>

</body>

</html>
【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  X5zJxoD00Cah   2023年11月19日   42   0   0 管理系统githtml
  X5zJxoD00Cah   2023年11月26日   49   0   0 Pythonhtml
  zhRhucGD3dLm   2023年11月22日   42   0   0 属性选择器选择器html
  lh6O4DgR0ZQ8   2023年11月19日   37   0   0 Systemide多态