0

我正在尝试让 kmltree 工作。正在加载 kmz,但树不会展开以显示子元素。他也没有出现正确的文件夹图标。可能有关系?
任何人都看到我可能做错了什么?

    <!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8">
        <title>Simple Example</title>
        <script src="http://www.google.com/jsapi?key=ABCD"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <!-- earth-api-utility-library dependencies -->
        <script src="http://geojs.googlecode.com/svn/trunk/dist/geo.pack.js"></script>
        <script src="http://earth-api-utility-library.googlecode.com/svn/trunk/extensions/dist/extensions.pack.js">
        </script>
        <!-- kmltree source files -->
        <link rel="stylesheet" href="../dist/kmltree.css" media="screen">
        <script src="../dist/kmltree.min.js"></script>

        <script>
            google.load("earth", "1");

            function init() {
                google.earth.createInstance('map3d', initCB, failureCB);
            }

            function initCB(instance) {
                ge = instance;
                ge.getWindow().setVisibility(true);

                var gex = gex = new GEarthExtensions(ge);

                var tree = kmltree({
                    url: 'http://kmltree.googlecode.com/hg/examples/kml/hello.kml',
                    gex: gex, 
                    mapElement: $('#map3d'), 
                    element: $('#tree'),
                });

                tree.load();
            }

            function failureCB(errorCode) {
                alert('failed to load plugin');
            }

            $(document).ready(init);

        </script>
    </head>
    <body>
        <div id="tree" style="float:left; width:300px; height: 400px;"></div>
        <div id="map3d" style="float:left; height: 400px; width: 600px;"></div>
    </body>
</html>
4

1 回答 1

0

我只是遇到了同样的问题,并通过将“kmltree.css”文件中的所有“images/..”链接的路径适应我的实际文件夹设置来解决它,例如,如果你同时放置原始的“images”和“css” “根目录中的文件夹,您必须将路径更改为“../images..”。

于 2014-01-30T14:57:23.810 回答