zoukankan      html  css  js  c++  java
  • SkylineGlobe 如何实现二次开发加载KML文件

    示例代码如下:

    <!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>
        <script type="text/javascript" language="javascript">
            function LoadKML() {
                try {
                    var sg = CreateSGObj();
                    var kmlLayer = sg.Creator.CreateKMLLayer(abspath()+"/Binoculars.kml","");                
                }
                catch (e) {
                    alert(e);
                }
            }
            
            /*  
            功能:   创建sgworld对象
            备注:   赵贺 2011.04.01.
            */
    
            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:3a4f9197-65a8-11d5-85c1-0001023952c1";
                }
                return obj;
            }
            function $(id) {
                return window.document.getElementById(id);
            }
    
            //--------------
            // abspath
            function abspath() {
                var abspath = unescape(window.location.href);
    
                // Remove query String 
                var index = abspath.indexOf("?");
                if (index > 0) abspath = abspath.substr(0, index - 1);
    
                index = abspath.lastIndexOf("/");
                var index2 = abspath.lastIndexOf("\");
    
                index = (index > index2) ? index : index2;
                if (index <= 0) return abspath;
    
                abspath = abspath.substring(0, index);
    
                if (abspath.substring(0, 1) == "/") abspath = abspath.slice(1);
    
                var re = /file:////gi;
                if (abspath.match(re) != null) abspath = abspath.replace(re, ""); // if this is indeed a local file, we strip the "file://" prefix from it.    
    
                return (abspath);
            }
        </script>
    </head>
    <body >
        <input id="Button1" type="button" value="加载KML" onclick="LoadKML()" />
        <object id="TE3DWindow" classid="CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1" width="1000px"
            height="600px">
        </object>
        <OBJECT ID="TerraExplorerInformationWindow" CLASSID="CLSID:3a4f9193-65a8-11d5-85c1-0001023952c1" width="200px"
            height="600px" ></OBJECT>
    </body>
    </html>
  • 相关阅读:
    【BUG修复】视频综合管理平台EasyNVS首页设备接入情况显示与实际不符如何调整?
    数据库连接池
    手写SORM(simple object relation mapping)框架3—DBManager和TableContext的设计
    jdbc—总结
    jdbc—CLOB和BLOB
    jdbc—时间处理
    jdbc—事务
    递归(最大公约数)
    C++ return
    函数参数
  • 原文地址:https://www.cnblogs.com/yitianhe/p/4158089.html
Copyright © 2011-2022 走看看