skyline属性查询

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script>

        //--------------
        // Init

        var lastFW = null;
        var lastLD = null;
        var lastobj = null;
        var tintcolor = null;
        var messageid = "";
        var ifkey = false;

        function Init() {
			SGWorld.AttachEvent("OnLButtonClicked", OnLButtonClicked);
			SGWorld.AttachEvent("OnFrame", OnFrame);
			SGWorld.AttachEvent("OnSGWorldMessage", OnSGWorldMessage);
			tintcolor = SGWorld.Creator.CreateColor(0, 255, 0, 125);
        }

        function OnSGWorldMessage(MessageID, SourceObjectID) {

            try {
                var cto = SGWorld.Creator.GetObject(SourceObjectID);
                var layerid = cto.LayerID;
                if (layerid == undefined)
                    return;
                var layer = SGWorld.ProjectTree.GetLayer(layerid);
                var layername = SGWorld.ProjectTree.GetItemName(layerid);

                if (layername == "build_model" || layername == "Building_DL") {

                    if (ifkey) {

                        if (lastLD != null) {
                            lastLD.Show = 1;
                        }
                        SGWorld.ProjectTree.SetVisibility(layerid, 0);
                        ifkey = false;
                        return true;
                    }

                    if (lastFW != null) {
                        if (lastFW != cto) {
                            lastFW.Tint.abgrColor = 0x00000000;
                        }
                        lastFW = cto;
                    } else {
                        lastFW = cto;
                    }

                    if (cto.Tint.abgrColor == "" || cto.Tint.abgrColor == "0" || cto.Tint.abgrColor == 0x00000000 || cto.Tint.abgrColor == 0) {
                        cto.Tint = tintcolor;
                        // cto.Tint.abgrColor=0xff0000aa;
                    } else {
                        cto.Tint.abgrColor = 0x00000000;
                    }

                } else if (layername == "poly_dl") {

                }
            } catch (e) {
            }

        }

        function OnFrame() {
            var mouseInfo = SGWorld.Window.GetMouseInfo()
            //将平面坐标转换为球面坐标
            var worldPst = SGWorld.Window.PixelToWorld(mouseInfo.x, mouseInfo.y, -1);
            var type = worldPst.Type;
            var focusID = worldPst.ObjectID;
            if (type == "1" || type == "8192") {
                try {
                    var cto = SGWorld.Creator.GetObject(focusID);


                    if (lastobj != null) {
                        if (lastobj != cto) {
                            lastobj.Tint.abgrColor = 0x00000000;
                        }
                        lastobj = cto;
                    } else {
                        lastobj = cto;
                    }

                    if (cto.Tint.abgrColor == "" || cto.Tint.abgrColor == "0" || cto.Tint.abgrColor == 0x00000000 || cto.Tint.abgrColor == 0) {
                        cto.Tint.abgrColor = 0x330000ff;
                    } else {
                        cto.Tint.abgrColor = 0x00000000;
                    }
                } catch (e) {
                    if (lastobj != null) {
                        lastobj.Tint.abgrColor = 0x00000000;
                    }
                }
            } else {
                if (lastobj != null) {
                    lastobj.Tint.abgrColor = 0x00000000;
                }
            }
        }

	
        function OnLButtonClicked(flag, x, y) {
		
            var mouseInfo = SGWorld.Window.GetMouseInfo();
            //将平面坐标转换为球面坐标
            var worldPst = SGWorld.Window.PixelToWorld(mouseInfo.x, mouseInfo.y, -1);
            var type = worldPst.Type;
            var focusID = worldPst.ObjectID;
			//alert(focusID);
			if(focusID!=""){
			
            var cto = SGWorld.Creator.GetObject(focusID);
			
			/*
			var data = new Array();
			data.push('<table border=1><tbody>');
			for (var i = 0; i < cto.FeatureAttributes.Count; i++) {
				data.push('<tr>');
				data.push('<th>' + cto.FeatureAttributes.Item(i).Name.toString() + ":" + '</th>');
        
				data.push('<td>' + cto.FeatureAttributes.Item(i).Value.toString() + '</td>');
				data.push('</tr>');
			}
			data.push('</tbody></table>');
			*/
			//动态的创建表格,注意innerHTML的本质是将标签里面的内容给替换掉。
			var str = "";
			str += '<table border=1><tbody>';
			var count = cto.FeatureAttributes.Count;
			if(count!=0){
				for (var i = 0; i < count; i++) {
				str +='<tr>';
				str +='<th>' + cto.FeatureAttributes.Item(i).Name.toString() + ":" + '</th>';
				str +='<td>' + cto.FeatureAttributes.Item(i).Value.toString() + '</td>';
				str +='</tr>';
			}
			//var s = data.join('');
			str += '</tbody></table>';
			}
			//alert(s);
			document.getElementById('table').innerHTML = str;
			}
		}

        function onunload() {
            if (lastLD != null) {
                try {
                    lastLD.Show = 1;
                } catch (e) {
                }
            }
            SGWorld.DetachEvent("OnFrame", OnFrame);
            SGWorld.DetachEvent("OnSGWorldMessage", OnSGWorldMessage);
            SGWorld.DetachEvent("OnLButtonClicked", OnLButtonClicked);
            //SGWorld.DetachEvent("OnMButtonUp",OnMButtonUp);
        }

    </script>
    <!--测试是否可以画线-->
    <!--<script>-->
    <!--function Init() {-->
    <!--SGWorld.Command.Execute(1012,4);-->
    <!--}-->
    <!--</script>-->
</head>

<body leftmargin="0" topmargin="0" marginheight="0" style="border:0;overflow:auto;" id="body" οnlοad="Init()"
      οnunlοad="onunload()">

<object id="SGWorld" classid="CLSID:3A4F9199-65A8-11D5-85C1-0001023952C1"></object>

<div id="table">

 </div>
<!--<!–表格–>-->
<!--<table border="1" cellpadding="1" style="background-color: #E8E8E8;width: 100%;height: 300px">-->
    <!--<colgroup>-->
        <!--<col span="1" style="background-color:#E0E0E0">-->
        <!--<col style="background-color:#F8F8F8">-->
    <!--</colgroup>-->
    <!--<tr>-->
        <!--<th id="attr" colspan="2">Attributes</th>-->
    <!--</tr>-->

    <!--<tr>-->
        <!--<th id="title_name">Name:</th>-->
        <!--<td id="name_content">null</td>-->
    <!--</tr>-->
    <!--<tr>-->
        <!--<th id="x">X:</th>-->
        <!--<td id="x_content">null</td>-->
    <!--</tr>-->
    <!--<tr>-->
        <!--<th id="y">Y:</th>-->
        <!--<td id="y_content">null</td>-->
    <!--</tr>-->
    <!--<tr>-->
        <!--<th id="z">Z:</th>-->
        <!--<td id="z_content">null</td>-->
    <!--</tr>-->
<!--</table>-->
</body>
</html>




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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值