• Skyline软件二次开发初级——9如何在WEB页面中的三维地图上进行交互


    1.屏幕坐标转换为空间坐标:

    <html>
        <head>
            <title>Coordinates 1</title>
            <object id="SGWorld" classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1" style="visibility:hidden;height:0 "></object>
            <script type="text/javascript">
            
            
    var popup = null;
            
            
            
    function Init()
            {

                SGWorld.AttachEvent(
    "onLButtonUp", onLButtonUp);
                SGWorld.Window.ShowMessageBarText(
    "Click on terrain to get information"2);
                popup 
    = SGWorld.Creator.CreatePopupMessage("3D Window sample");            
            }


            
    function onLButtonUp(flags, x,y)
            {

                
    var ret = SGWorld.Window.PixelToWorld(x, y);

                
    if ((ret.Type & 0x00000020== 0)
                {
                    popup.InnerHTML 
    = "x: " + ret.Position.X.toFixed(5+ "<br>";
                    popup.InnerHTML 
    += "y: " + ret.Position.Y.toFixed(5+ "<br>";

                    
    if (ret.ObjectID)
                    {
                        
    var object = SGWorld.Creator.GetObject(ret.ObjectID);
                        popup.InnerHTML 
    += "<br><u>Object detected:</u><br>";
                        
    if(object.TreeItem)
                            popup.InnerHTML 
    += "Name: \"" + object.TreeItem.Name + "\"<br>";
                        
    else
                            popup.InnerHTML 
    += "Object is not in project tree<br>";
                        popup.InnerHTML 
    += "Type: " + object.ObjectType + "<br>";
                    }
                }
                
    else
                {
                    popup.InnerHTML 
    = "Hit the sky";
                }
                    
                popup.Width 
    = 250;
                popup.Align 
    = "TopLeft";
                SGWorld.Window.ShowPopup(popup);  
                    
                
    return false// let the system continue processing the event
            }
            
            
            
    function Uninit()
            {
                
    if(SGWorld.Project.Name == "")
                    
    return;
                SGWorld.Window.HideMessageBarText();
                
    if(popup)
                    SGWorld.Window.RemovePopup(popup);      
            }
            
            
    </script>
        </head>
        <body onload="Init();" onunload="Uninit()">
        </body>
    </html>
  • 相关阅读:
    iOS编程中比较两个日期的大小
    sqlite第三方类库:FMDB使用
    ios日期格式转换
    UISwipeGestureRecognizer 左右事件捕捉
    iOS7.0中UILabel高度调整注意事项
    【java基础】Java反射机制
    【struts2】ActionContext与ServletActionContext
    【struts2】OGNL
    【struts2】值栈(后篇)
    【struts2】值栈(前篇)
  • 原文地址:https://www.cnblogs.com/yitianhe/p/2699678.html
Copyright © 2020-2023  润新知