112
13693261870
2024-04-22 7e275acee90c914685ca53f04ec6a4b74e46abbf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html>
<head>
    <title>checkbox.html</title>
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache" content="no-cache" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-control" content="no-cache" />
    <link href="imgs/favicon.ico" rel="icon" type="image/x-icon" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
 
    <style>
        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
    <script>
        function getQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substring(1).match(reg);
            if (r != null) {
                return decodeURI(r[2]);
            };
            return null;
        }
 
        window.onload = function () {
            init();
        }
 
        function init() {
            var groups = ["2m影像", "16m影像", "植被覆盖度"];
            var select = document.getElementById("select");
 
            for (var i in groups) {
                var groupName = groups[i];
                var item = SGWorld.ProjectTree.FindItem(groupName);
                if (!item) continue;
                SGWorld.ProjectTree.SetVisibility(item, false);
 
                var names = getLayers(groupName);
                if (names.length) {
                    for (var i in names) {
                        var op = document.createElement("option");
                        op.text = groupName + "\\" + names[i];
                        if (0 == i) op.selected = true;
                        select.add(op);
                    }
                }
            }
 
            select.onchange = selectChanged;
            setImageLayer();
        }
 
        function getLayers(groupName) {
            var item = SGWorld.ProjectTree.FindItem(groupName);
            if (!item) return [];
 
            var names = [];
            var id = SGWorld.ProjectTree.GetNextItem(item, 11); // 11-CHILD
            while (id) {
                var name = SGWorld.ProjectTree.GetItemName(id);
                names.push(name);
 
                id = SGWorld.ProjectTree.GetNextItem(id, 13); // 13-NEXT
            }
 
            return names;
        }
 
        function selectChanged(e) {
            setImageLayer();
        }
 
        var lastItem = null;
 
        function setImageLayer() {
            if (lastItem) {
                SGWorld.ProjectTree.SetVisibility(lastItem, false);
                lastItem = null;
            }
 
            var select = document.getElementById("select");
            var text = select.options[select.selectedIndex].text;
 
            var item = SGWorld.ProjectTree.FindItem(text);
            if (item) {
                SGWorld.ProjectTree.SetVisibility(item, true);
                lastItem = item;
            }
        }
    </script>
</head>
<body>
    <select id="select" style="width: 170px; text-align: center;"></select><object id="SGWorld" classid="CLSID:3a4f9199-65a8-11d5-85c1-0001023952c1"></object>
</body>
</html>