示例代码:

<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  />
    <input  />
    <input  />
    <div ></div>
    <object ></object>
    <object ></object>
    <!--<object ></object>-->
</body>
</html>

  运行后测试效果:

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

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

 

相关文章: