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();
|
});
|