zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    adb、monkey常用命令
    震惊!90%的程序员不知道的Java知识!
    Android,重新出发!
    Fiddler 手机抓包 手机联网异常解决方案
    技术贴汇总
    Android开发日常-listview滚动方法梳理
    JavaScript基本语法
    Spring Boot Profile
    Spring Boot配置文件占位符
    @PropertySource和@ImportSource
  • 原文地址:https://www.cnblogs.com/yitianhe/p/2699678.html
Copyright © 2011-2022 走看看