SkylineGlobe 支持火狐和谷歌浏览器的可运行示例代码

示例代码:

<html>
<head>
    <title>3dml的Feature对象选中和隐藏</title>
    <script type="text/javascript">
        function LoadFly() {
            try {
                var sg = CreateSGObj();  //window.document.getElementById("sgworld");
                sg.open("E:\\2014\\NJ\\FLY\\Default1.FLY");
            }
            catch (e) {
                alert(e);
            }
        }

        function StartF() {
            try {
                var sg = window.document.getElementById("sgworld"); //CreateSGObj();
                sg.attachEvent("OnLButtonDown", OnLButtonDown);
            }
            catch (e) {
                alert(e);
            }
        }

        function EndF() {
            var sg = CreateSGObj();
            sg.DetachEvent("OnLButtonDown", OnLButtonDown);
        }

        function OnLButtonDown(Flags, X, Y) {
            try {
                var sg = CreateSGObj();
                var iwp = sg.Window.PixelToWorld(X, Y, 8192);

                var pIFeature = sg.Creator.GetObject(iwp.ObjectID);

                pIFeature.Tint.abgrColor = 0x66FF0000;
                //pIFeature.Show = false;
                //var divobj = window.document.getElementById("res");
                //divobj.innerText = iwp.ObjectID + "****" + pIFeature.ParentGroupID;
                //var strResult = "";
                //for (var j = 0; j < pIFeature.FeatureAttributes.Count; j++) {
                //    var pIFeatureAttribute = pIFeature.FeatureAttributes.Item(j);
                //    strResult = strResult + "<td>" + pIFeatureAttribute.Name + "*" + pIFeatureAttribute.Value + "</td>";
                //}
                //divobj.innerText = divobj.innerText + strResult;
            }
            catch (e)
            { }

            return false;

        }

        //------------------------------------------------------------
        // 创建sgworld对象  赵贺 2015.06.09. TEPro6.6
        //------------------------------------------------------------
        function CreateSGObj() {
            var obj = $("sgworld");
            if (obj == null) {
                obj = document.createElement('object');
                obj.setAttribute("name", "sgworld");
                obj.setAttribute("id", "sgworld");
                obj.setAttribute("type", "application/x-skyline");
                obj.setAttribute("clsid", "{3A4F9199-65a8-11d5-85c1-0001023952c1}");
                document.body.appendChild(obj);
            }
            return obj;
        }
        function $(id) {
            return window.document.getElementById(id);
        }
    </script>

</head>
<body>
    <input id="Button1" type="button" value="加载FLY" οnclick="LoadFly()" />
    <input id="Button3" type="button" value="开始" οnclick="StartF()" />
    <input id="Button2" type="button" value="结束" οnclick="EndF()" />
    <div id="res"></div>
    <object id="tex" type="application/x-skyline" clsid="{3A4F9192-65A8-11D5-85C1-0001023952C1}" style="width: 500px; height: 400px;"></object>
    <object id="texTree" type="application/x-skyline" clsid="{3a4f9193-65a8-11d5-85c1-0001023952c1}" style="width: 300px; height: 400px;"></object>
    <!--<object id="sgworld" type="application/x-skyline"  clsid="{3A4F9199-65a8-11d5-85c1-0001023952c1}" style="width:0px;height:0px;"></object>-->
</body>
</html>

  运行后测试效果:

 

转载于:https://www.cnblogs.com/yitianhe/p/4654026.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值