基于廊坊系统为基础,国防科技大学系统演示Demo
surprise
2024-04-28 c310c155e3e91e6b285b3fb3519a3ef7c6690d66
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
105
106
107
108
109
110
111
112
113
114
115
window.SG = null;
var Index = {
    menuFlag: true,
    treePlay: '演示方案\\方案1',
    objTypes: [19, 23, 26, 29, 34, 36, 38, 39, 40],
    init: function () {
        var flag = Detect.detectIE();
        if (!flag) {
            this.showDownload();
            return;
        }
        this.initSG();
    },
    // 显示下载
    showDownload: function () {
        $("#mapView").hide();
        $("#download").show();
        var a = document.getElementById('aDownload');
        a.href = LFData + "/soft/TEv7.4.zip";
    },
    initSG: function () {
        TEInfoEx.AttachTo3dWindow(TEWinEx);
 
        SG = TEWinEx.CreateInstance("TerraExplorerX.SGWorld74"); // SGWorld74,SGWorld71,SGWorld66
        SG.AttachEvent("OnLoadFinished", this.loadFinished);
        SG.Open(app.fly);
    },
    loadFinished: function () {
        $("#TEInfoEx").addClass("rb");
        SG.ProjectTree.ShowSearchTool = false;
        SG.DetachEvent("OnLoadFinished", Index.loadFinished);
        // var layers = [];
        // Index.getLayers("", layers);
        // Index.ininTrees("layers", layers);
        // Index.flyToStart();
    },
    //
    getLayers: function (pid, layers) {
        var next = SG.ProjectTree.GetNextItem(pid, 11);
        while (next) {
            var name = SG.ProjectTree.GetItemName(next);
            var visible = SG.ProjectTree.GetVisibility(next);
            if (SG.ProjectTree.IsGroup(next)) {
                if (SG.ProjectTree.IsLayer(next)) {
                    layers.push({ "id": next, "title": name, "pid": pid, checked: visible, });
                } else {
                    var item = { "id": next, "title": name, "pid": pid, "children": [], checked: visible, spread: true };
                    this.getLayers(next, item.children);
                    layers.push(item);
                }
            } else {
                var obj = SG.ProjectTree.GetObject(next);
                if (this.objTypes.indexOf(obj.ObjectType) > -1) {
                    layers.push({ "id": next, "title": name, "pid": pid, checked: visible, });
                }
            }
 
            next = SG.ProjectTree.GetNextItem(next, 13);
        }
    },
    // 初始化目录树
    ininTrees: function (id, data) {
        layui.use(["tree"], function () {
            app.tree = layui.tree.render({
                data: data,
                elem: "#layers",
                showLine: true,
                showCheckbox: true,
                oncheck: function (obj) {
                    if (Index.isLoading)
                        return;
                    Index.isLoading = true;
                    SG.ProjectTree.SetVisibility(obj.data.id, obj.checked);
                    Index.isLoading = false;
                },
                click: function (obj) {
                    if (Index.isLoading)
                        return;
                    var std = SG.ProjectTree.GetObject(obj.data.id);
                    if (std.ObjectType == 34) {
                        std.play(0);
                    } else {
                        SG.Navigate.FlyTo(obj.data.id);
                    }
 
                }
            });
        });
    },
    showMenu: function (res) {
        switch (res) {
            case 1:
                SG.Command.Execute(1028, null)
                break;
            case 2:
                SG.Command.Execute(2314, 0);
                break;
            case 3:
                var model_ID = SG.ProjectTree.FindItem(this.treePlay);
                var model_value = SG.ProjectTree.GetObject(model_ID);
                model_value.play(0);
                break;
        }
        // if(this.menuFlag){
        //     $("#rightCont").addClass('left_content_show')
        // }else{
        //     $("#rightCont").removeClass('left_content_show')
        // }
        // this.menuFlag = !this.menuFlag;
    }
}
 
$(function () {
    Index.init();
});