Skyline TEP5.1.3二次开发入门——初级(五)

6.5  ITerrain5

主要用来获取三维场景中基础信息,包括MPT的投影信息、坐标信息、地形高度和地表透明度等;

 

MPTName

返回当前使用的MPT文件名,如果当前未装载MPT文件,则返回“NO_MPT”;

GroupKey

定义工程的组键值;

SystemKey

定义工程的坐标系统键值;

DatumKey

定义工程的数据键值;

UnitKey

定义测量单位;

EPSG

定义工程的EPSG代码;

Description

用户定义描述(TerraExplorer Pro中Project中的Description设置);

Opacity

地表透明度(0.1-1);

GetGroundHeight

用此方法获取当前坐标距离地面的距离高度;

GetGroundHeightEx

用此方法获取当前坐标距离地面的距离高度,同时如果该坐标点上存有对象,可以获得该对象的ObjectID;

GetExtent

返回当前所使用的地形数据的范围;

 

 

代码示例:

【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 ExCodeITerrain

{

    public partial class Form1 : Form

    {

        private TerraExplorer TE;

        private ITerraExplorer51 TE51;

        private ITerrain5 ITerrain;

       

        public Form1()

        {

            InitializeComponent();

 

            this.TE = new TerraExplorerClass();

            this.TE51 = (ITerraExplorer51)TE;

            ITerrain = (ITerrain5)TE;

 

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

        }

 

        private void btnStart_Click(object sender, EventArgs e)

        {

            MessageBox.Show("$MPTName:"+ITerrain.MPTName+"\r\n"+

                "$GroupKey:" + ITerrain.GroupKey + "\r\n" +

                "$SystemKey:" + ITerrain.SystemKey + "\r\n" +

                "$DatumKey:" + ITerrain.DatumKey + "\r\n" +

                "$UnitKey:" + ITerrain.UnitKey + "\r\n" +

                "$EPSG:" + ITerrain.EPSG.ToString() + "\r\n" +

                "$Description:" + ITerrain.Description + "\r\n" +

                "$Opacity:"+ITerrain.Opacity.ToString());

        }

    }

}

【javascript】

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

 

<!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 Test() {

            var ITerrain = TE.interface("ITerrain5");

            alert("$MPTName:" + ITerrain.MPTName + "\r\n" +

                "$GroupKey:" + ITerrain.GroupKey + "\r\n" +

                "$SystemKey:" + ITerrain.SystemKey + "\r\n" +

                "$DatumKey:" + ITerrain.DatumKey + "\r\n" +

                "$UnitKey:" + ITerrain.UnitKey + "\r\n" +

                "$EPSG:" + ITerrain.EPSG + "\r\n" +

                "$Description:" + ITerrain.Description + "\r\n" +

                "$Opacity:" + ITerrain.Opacity);

 

        }

        //------------------------------------------------------------

        // 创ä建三维对象 赵贺 2009.01.25.

        //------------------------------------------------------------

        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;

        }

    </script>

</head>

<body onload = "Init()">

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

    <div id = "Title">

    <input id="Button1" type="button" value="测试" onclick = "Test()" />

    </div>

    <div id="Main">

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

            width="521" height="521">

        </object>

    </div>

    </form>

</body>

</html>

 

 

转载于:https://www.cnblogs.com/yitianhe/archive/2011/05/16/2047943.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值