zoukankan      html  css  js  c++  java
  • SkylineGlobe TEPro 6.6.1 二次开发导出KML或者KMZ文件示例代码

    其实Skyline的fly文件跟kml文件很像很像,只不过一个是编码加密的,另一个早已经成为OGC的通用标准;

    喜欢Skyline的小伙伴们试试下面的代码吧,细心的人能发现彩蛋哦。

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <meta http-equiv="X-UA-Compatible" content="IE=9" />
        <script type="text/javascript" language="javascript">
            function ExportKML()
            {
                $("result").innerText = "";
                var sg = CreateSGObj();
                var objid = sg.ProjectTree.GetNextItem(sg.ProjectTree.RootID, 10);
                if (sg.ProjectTree.IsGroup(objid))
                {
                    var kmlpath = sg.ProjectTree.SaveAsKml(sg.ProjectTree.GetItemName(objid) + ".kml", objid);
                    //如果不指定kml文件后缀名,则导出的是kmz文件
                    $("result").innerText = kmlpath;
                }
            }
            /*  
            功能:   创建sgworld对象
            备注:   赵贺 2015.06.23.
            */
            function CreateSGObj() {
                var obj = $("sgworld");
                if (obj == null) {
                    obj = document.createElement('object');
                    document.body.appendChild(obj);
                    obj.name = "sgworld";
                    obj.id = "sgworld";
                    obj.classid = "CLSID:3A4F9199-65a8-11d5-85c1-0001023952c1";
                }
                return obj;
            }
            function $(id) {
                return window.document.getElementById(id);
            }
        </script>
    </head>
    <body>
        <table>        
            <tr>
                <td colspan="4">                
                    <input id="btnExportKML" type="button" value="选择组导出KML" onclick="ExportKML()" />
                </td>
            </tr>
            <tr>
                <td>
                    <div id="result">
                    </div>
                </td>
            </tr>
        </table>
         <object id="TerraExplorer3DWindow" classid="CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1" style="500px;height:400px;"></object>
        <object id="TerraExplorerInformationWindow" classid="CLSID:3a4f9193-65a8-11d5-85c1-0001023952c1" style="300px;height:400px;"></object>
    </body>
    </html>
  • 相关阅读:
    Educational Codeforces Round 97 (Rated for Div. 2)
    2020 计蒜之道 线上决赛
    kuangbin 莫队专题
    Codeforces Round #677 (Div. 3)
    Codeforces Round #674 (Div. 3)
    Elasticsearch Alias:别名
    Elasticsearch 集群重要配置的修改
    Elasticsearch文档版本冲突原理与解决
    redis操作详情
    对密码必须包含字母,数字,特殊字符正则表达式理解
  • 原文地址:https://www.cnblogs.com/yitianhe/p/5944999.html
Copyright © 2011-2022 走看看