zoukankan      html  css  js  c++  java
  • Skyline软件二次开发初级——8如何在WEB页面中的三维地图上管理信息树

    1.创建组:

    <html>
        <head>
            <title>Node 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()
            {
                
    var NewEngland    = SGWorld.ProjectTree.CreateGroup("New England");
                
    var Vermont =       SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.7520643.911270,00.00-85800000.0), "Vermont", SGWorld.Creator.CreateLabelStyle(), NewEngland       , "Vermont" );
                
    var Maine =         SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-69.4041445.125940,00.00-85800000.0), "Maine", SGWorld.Creator.CreateLabelStyle(), NewEngland         , "Maine"  );
                
    var Massachusetts = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.8845542.342160,00.00-85800000.0), "Massachusetts", SGWorld.Creator.CreateLabelStyle(), NewEngland , "Massachusetts" );
                
    var RhodeIsland =   SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.5707341.629530,00.00-85800000.0), "Rhode Island", SGWorld.Creator.CreateLabelStyle(), NewEngland  , "Rhode Island" );
                
    var Connecticut =   SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.6429541.579120,00.00-85800000.0), "Connecticut", SGWorld.Creator.CreateLabelStyle(), NewEngland   , "Connecticut"  );


                SGWorld.Navigate.FlyTo(Vermont);
                
                
                
    // Display a message to the user
                popup = SGWorld.Creator.CreatePopupMessage("Nodes hierarchy sample");
                popup.InnerText 
    = "This sample shows how to group several nodes - locations in this case,\n" +
                                  
    "and add them to the SkylineGlobe nodes hierarchy.";
                popup.Align 
    = "TopLeft";
                SGWorld.Window.ShowPopup(popup);  
                
            }
            
            
    function Uninit()
            {
                
    if(SGWorld.Project.Name == "")
                    
    return;
                SGWorld.ProjectTree.DeleteItem(SGWorld.ProjectTree.FindItem(
    "New England"));
                
    if(popup)
                    SGWorld.Window.RemovePopup(popup);

            }
            
            
    </script>
        </head>
        <body onload="Init();" onunload="Uninit()">
        </body>
    </html>

    2.对象数据:

    <html>
        <head>
            <title>Node 2</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()
            {

                var NewEngland = SGWorld.ProjectTree.CreateGroup("New England");
                var Vermont = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.7520643.91127000.00, -85800000.0), "Vermont", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Vermont");
                var Maine = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-69.4041445.12594000.00, -85800000.0), "Maine", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Maine");
                var Massachusetts = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.8845542.34216000.00, -85800000.0), "Massachusetts", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Massachusetts");
                var RhodeIsland = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.5707341.62953000.00, -85800000.0), "Rhode Island", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Rhode Island");
                var Connecticut = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.6429541.57912000.00, -85800000.0), "Connecticut", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Connecticut");

                SGWorld.Navigate.FlyTo(Vermont);
                
                // setting attributes to the nodes

                Vermont.ClientData("population") = 562758;
                Maine.ClientData("population") = 1227928;
                Massachusetts.ClientData("population") = 6016425;
                RhodeIsland.ClientData("population") = 1003464;
                Connecticut.ClientData("population") = 3287116;

                var newEnglandPopulation =
                                    parseInt(Vermont.ClientData("population")) +
                                    parseInt(Maine.ClientData("population")) +
                                    parseInt(Massachusetts.ClientData("population")) +
                                    parseInt(RhodeIsland.ClientData("population")) +
                                    parseInt(Connecticut.ClientData("population"));
                
                
                // Display a message to the user
                popup = SGWorld.Creator.CreatePopupMessage("Nodes hierarchy sample");
                popup.InnerHTML = "This sample shows how to set and retrieve attribute information to a object.<br><br>" +
                                  "The total population of <b>New England</b> in 1990 was: " + newEnglandPopulation;
                popup.Align = "TopLeft";
                SGWorld.Window.ShowPopup(popup);  
                
            }
            
            function Uninit()
            {
                if(SGWorld.Project.Name == "")
                    return;
                SGWorld.ProjectTree.DeleteItem(SGWorld.ProjectTree.FindItem("New England"));
                if(popup)
                    SGWorld.Window.RemovePopup(popup);

            }
            
            </script>
        </head>
        <body onload="Init();" onunload="Uninit()">
        </body>
    </html>

    3.遍历对象:

    <html>
        <head>
            <title>Node 3</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()
            {
                            
                
    var group = createNewEnglandNode();

                popup 
    = SGWorld.Creator.CreatePopupMessage("Nodes hierarchy sample","",0,0,400,200);
                popup.InnerHTML 
    = "This sample shows how to traverse the node hierarchy.<br><br>";

                
    // 11 is get child
                var node = SGWorld.ProjectTree.GetNextItem(group, 11);
                
    while (node > 0)
                {
                    
    var object = SGWorld.ProjectTree.GetObject(node);
                    popup.innerHTML 
    += "The population of <b>" + object.TreeItem.Name + "</b> is: " + object.ClientData("population"+ "<br>";
                    
    // 13 is get next sibling
                    node = SGWorld.ProjectTree.GetNextItem(node, 13);
                }
                
                popup.align 
    = "TopLeft";
                SGWorld.Window.ShowPopup(popup);              
            }
            
            
            
            
            
            
    function createNewEnglandNode()
            {
                
    var NewEngland = SGWorld.ProjectTree.CreateGroup("New England");
                
    var Vermont = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.7520643.91127000.00-85800000.0), "Vermont", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Vermont");
                
    var Maine = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-69.4041445.12594000.00-85800000.0), "Maine", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Maine");
                
    var Massachusetts = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.8845542.34216000.00-85800000.0), "Massachusetts", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Massachusetts");
                
    var RhodeIsland = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.5707341.62953000.00-85800000.0), "Rhode Island", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Rhode Island");
                
    var Connecticut = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.6429541.57912000.00-85800000.0), "Connecticut", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Connecticut");

                SGWorld.Navigate.FlyTo(Vermont);

                
    // setting attributes to the nodes

                Vermont.ClientData(
    "population"= 562758;
                Maine.ClientData(
    "population"= 1227928;
                Massachusetts.ClientData(
    "population"= 6016425;
                RhodeIsland.ClientData(
    "population"= 1003464;
                Connecticut.ClientData(
    "population"= 3287116;

                
    return NewEngland;
            }
            
            
            
    function Uninit()
            {
                
    if(SGWorld.Project.Name == "")
                    
    return;
                SGWorld.ProjectTree.DeleteItem(SGWorld.ProjectTree.FindItem(
    "New England"));
                
    if(popup)
                    SGWorld.Window.RemovePopup(popup);

            }
            
            
    </script>
        </head>
        <body onload="Init();" onunload="Uninit()">
        </body>
    </html>

    4.搜索树节点:

    <html>
        <head>
            <title>Node 5</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()
            {
                
    // Create the "New England" group node and its  children
                var NewEngland = createNewEnglandNode();
                
                popup 
    = SGWorld.Creator.CreatePopupMessage("Nodes hierarchy sample","",0,0,350,150);
                popup.InnerHTML 
    = "This sample shows how to search the nodes heirarchy tree.<br><br>";
                popup.InnerHTML 
    += "<b><u>Search Results:</u></b><br>";
        
            
                
    var RhodeIsland = SGWorld.ProjectTree.FindItem("\\New England\\Rhode Island");
                
    if (RhodeIsland > 0)
                    popup.InnerHTML 
    += "The population of <b>Rhode Island</b> is: " + SGWorld.ProjectTree.GetObject(RhodeIsland).ClientData("population"+ "<br>"
                
                popup.align 
    = "TopLeft";
                SGWorld.Window.ShowPopup(popup);              
            }





            
    function createNewEnglandNode()
            {
                
    var NewEngland = SGWorld.ProjectTree.CreateGroup("New England");
                
    var Vermont = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.7520643.91127000.00-85800000.0), "Vermont", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Vermont");
                
    var Maine = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-69.4041445.12594000.00-85800000.0), "Maine", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Maine");
                
    var Massachusetts = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.8845542.34216000.00-85800000.0), "Massachusetts", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Massachusetts");
                
    var RhodeIsland = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.5707341.62953000.00-85800000.0), "Rhode Island", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Rhode Island");
                
    var Connecticut = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.6429541.57912000.00-85800000.0), "Connecticut", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Connecticut");

                SGWorld.Navigate.FlyTo(Vermont);

                
    // setting attributes to the nodes

                Vermont.ClientData(
    "population"= 562758;
                Maine.ClientData(
    "population"= 1227928;
                Massachusetts.ClientData(
    "population"= 6016425;
                RhodeIsland.ClientData(
    "population"= 1003464;
                Connecticut.ClientData(
    "population"= 3287116;

                
    return NewEngland;
            }
            
            
            
    function Uninit()
            {
                
    if(SGWorld.Project.Name == "")
                    
    return;
                SGWorld.ProjectTree.DeleteItem(SGWorld.ProjectTree.FindItem(
    "New England"));
                
    if(popup)
                    SGWorld.Window.RemovePopup(popup);

            }
            
            
    </script>
        </head>
        <body onload="Init();" onunload="Uninit()">
        </body>
    </html>

    5.删除树节点:

    <html>
        <head>
            <title>Node 7</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()
            {

                
    // Create the "New England" group node and its  children
                var NewEngland = createNewEnglandNode();


                popup 
    = SGWorld.Creator.CreatePopupMessage("Nodes hierarchy sample"""00350150);
                popup.InnerText 
    = "This sample shows how to remove (delete) nodes.";            
                popup.Align 
    = "TopLeft";
                SGWorld.Window.ShowPopup(popup);
                setTimeout(DeleteObjects, 
    100);

            }

            
    function DeleteObjects()
            {
                alert(
    "Click OK to remove Maine and Vermont from the New England group");

                
    var nodeToDelete = SGWorld.ProjectTree.FindItem("\\New England\\Maine");
                SGWorld.ProjectTree.DeleteItem(nodeToDelete);
                nodeToDelete 
    = SGWorld.ProjectTree.FindItem("\\New England\\Vermont");
                SGWorld.ProjectTree.DeleteItem(nodeToDelete);                                
            }

            
    function createNewEnglandNode()
            {
                
    var NewEngland = SGWorld.ProjectTree.CreateGroup("New England");
                
    var Vermont = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.7520643.91127000.00-85800000.0), "Vermont", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Vermont");
                
    var Maine = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-69.4041445.12594000.00-85800000.0), "Maine", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Maine");
                
    var Massachusetts = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.8845542.34216000.00-85800000.0), "Massachusetts", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Massachusetts");
                
    var RhodeIsland = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.5707341.62953000.00-85800000.0), "Rhode Island", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Rhode Island");
                
    var Connecticut = SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-72.6429541.57912000.00-85800000.0), "Connecticut", SGWorld.Creator.CreateLabelStyle(), NewEngland, "Connecticut");

                SGWorld.Navigate.FlyTo(Vermont);

                
    // setting attributes to the nodes

                Vermont.ClientData(
    "population"= 562758;
                Maine.ClientData(
    "population"= 1227928;
                Massachusetts.ClientData(
    "population"= 6016425;
                RhodeIsland.ClientData(
    "population"= 1003464;
                Connecticut.ClientData(
    "population"= 3287116;

                
    return NewEngland;
            }


            
    function Uninit()
            {
                
    if(SGWorld.Project.Name == "")
                    
    return;
                SGWorld.ProjectTree.DeleteItem(SGWorld.ProjectTree.FindItem(
    "New England"));
                
    if(popup)
                    SGWorld.Window.RemovePopup(popup);

            }
            
            
    </script>
        </head>
        <body onload="Init();" onunload="Uninit()">
        </body>
    </html>
  • 相关阅读:
    Perl 正则匹配经验记录
    Linux——高效玩转命令行
    推荐一个SAM文件或者bam文件中flag含义解释工具
    单端测序(Single- ead)和双端测序(Pai ed-end和Mate-pai )的关系
    区别samtools faid产生的.fai文件功能和bwa index 产生的四个文件的功能
    Perl新接触的小命令
    Perl调用外部命令(其他脚本、系统命令)的方法和区别
    Linux——命令
    学习《Python金融实战》中文版PDF+英文版PDF+源代码
    学习《深度学习与计算机视觉算法原理框架应用》《大数据架构详解从数据获取到深度学习》PDF代码
  • 原文地址:https://www.cnblogs.com/yitianhe/p/2699672.html
Copyright © 2011-2022 走看看