sgworld = window.external.createSgworld();
var url = window.location.href.substring(0, window.location.href.lastIndexOf('/') + 1);
var lb = new leftBottomDatlog();
var rb = new rightBottomDatlog();
var lc = new leftCenterDatlog();
new CusScrollBar({
contentSelector: '.scroll_cont1', //滚动内容区
barSelector: '.scroll_bar1', //滚动条
sliderSelector: '.scroll_slider1' //滚动滑块
});
$(function () {
init();
Close();
})
function init() {
var Rhtml = "";
var SonRootType = getUrlParam("type");
let CurrentRoot = YingYongDataSencond.filter(function (item) { return item.Type == SonRootType });
$.each(CurrentRoot[0].ChildRen, function (j, value) {
Rhtml += '
' +
((value.name.length > 12) ? value.name.substring(0, 12) : value.name) + '';
//if (value.timeZhou != "false") {
// Rhtml += '
';
//}
//if (value.legend != "false") {
// Rhtml += '
';
//}
//if (value.chart != "false") {
// Rhtml += '
';
//}
Rhtml += "";
$(".name").attr("title", CurrentRoot[0].sname);
$(".name").text((CurrentRoot[0].sname.length > 9) ? CurrentRoot[0].sname.substring(0, 9) : CurrentRoot[0].sname);
});
$("ul").empty();
$("ul").append(Rhtml);
SonClick();
//都兰矿产和重点区自然资源遥感巡查解译产品特殊处理
if (SonRootType == "DLZD" || SonRootType == "DLKC") {
return;
}
window.external.createPmDialogDock("右中", url + "legendQL.html?sk=" + CurrentRoot[0].id , lc.width, lc.height, lc.top, lc.left, lc.bottom, lc.right);
window.external.createPmDialogDock("右下", url + "chart/chartQL.html?type=" + CurrentRoot[0].Type, rb.width, rb.height, rb.top, rb.left, rb.bottom, rb.right);
};
//$.ajax({
// url: "../Ashx/Third.ashx",
// type: "post",
// data: { Action: "GetThirdData", id: pid },//81258c6425be4694af2575731f4e8831
// dataType: "json",
// async: true,
// success: function (result) {
// $.each(result, function (c, value) {
// Rhtml += '
' +
// ((value.name.length > 12) ? value.name.substring(0, 12) : value.name) + '';
// if (value.timeZhou != "false") {
// Rhtml += '
';
// }
// if (value.legend != "false") {
// Rhtml += '
';
// }
// if (value.chart != "false") {
// Rhtml += '
';
// }
// Rhtml += "";
// $(".name").attr("title", value.pname);
// $(".name").text((value.pname.length > 9) ? value.pname.substring(0, 9) : value.pname);
// });
// $("ul").empty();
// $("ul").append(Rhtml);
// SonClick();
// window.external.createPmDialogDock("右中", url + "legendQL.html?sk=" + pid, lc.width, lc.height, lc.top, lc.left, lc.bottom, lc.right);
// window.external.createPmDialogDock("右下", url + "chart/chartQL.html", rb.width, rb.height, rb.top, rb.left, rb.bottom, rb.right);
// }
//});
//}
//关闭点击事件
function Close() {
$(".imgx").click(function () {
//调用弹出层方法
window.external.InvokeScript("左上", "ReFresh", "");
//关闭图层
sgworld.ProjectTree.SetVisibility("", false);
sgworld.ProjectTree.SetVisibility(sgworld.ProjectTree.FindItem("qinghai"), true);
window.external.closeDialog("右上");
window.external.closeDialog("右中");
window.external.closeDialog("左下");
window.external.closeDialog("右下");
});
}
//子项点击事件
var timeStr = "";
var pointType = "";
function SonClick() {
$("span").click(function () {
var urlPathName = $(this).attr("data-url");
pointType = $(this).attr("data-type");
var layerId = sgworld.ProjectTree.FindItem(urlPathName);
if (layerId == "") return;
var Isclose = $(this).attr("data-close");
//关闭其他图层
//sgworld.ProjectTree.SetVisibility("", false);
if (layerId == "") {
return false;
};
if (Isclose == "f") {
sgworld.ProjectTree.SetVisibility(layerId, true);
if (layerId == "") {
return false;
}
if (sgworld.ProjectTree.GetObject(layerId) == null && sgworld.ProjectTree.IsGroup(layerId)) {
let sonId= sgworld.ProjectTree.GetNextItem(layerId,11);
sgworld.Navigate.FlyTo(sonId);
} else {
sgworld.Navigate.FlyTo(layerId);
}
$(this).attr("data-close", "t");
$(this).css("color", "#31CFBE");
} else {
var layerId = sgworld.ProjectTree.FindItem(urlPathName);
if (layerId == "") {
return false;
}
sgworld.ProjectTree.SetVisibility(layerId, false);
$(this).attr("data-close", "f");
$(this).css("color", "#FFFFFF");
}
});
}
function clickLine(urlPathName) {
urlPathName = urlPathName.replace(new RegExp(/=/g), "\\");
if (localStorage.getItem("rootUrl") == "" | localStorage.getItem("rootUrl") == null | localStorage.getItem("rootUrl") == "undefined") {
localStorage.setItem("rootUrl", urlPathName);
} else {
if (localStorage.getItem("rootUrl") != urlPathName) {
localStorage.setItem("rootUrl", urlPathName);
localStorage.setItem("CheckPointYear", "");
}
}
window.external.createPmDialogDock("左下", url + "timeLine.html?tm=" + timeStr, lb.width, lb.height, lb.top, lb.left, lb.bottom, lb.right);
}
let leg = false;
function clickImg(parm) {
if (leg == false) {
window.external.createPmDialogDock("右下", url + "legendQL.html", rb.width, rb.height, rb.top, rb.left, rb.bottom, rb.right);
leg = true;
} else {
window.external.closeDialog("右下");
leg = false;
}
}
function clickImg(parm) {
var layer = sgworld.ProjectTree.FindItem(parm);
var obj = sgworld.ProjectTree.GetObject(layer);
if (obj.Visibility.show) {
sgworld.ProjectTree.SetVisibility(layer, false);
var parm1 = parm + "3d";
var layer3d = sgworld.ProjectTree.FindItem(parm1);
sgworld.ProjectTree.SetVisibility(layer3d, true);
} else {
sgworld.ProjectTree.SetVisibility(layer, true);
var parm1 = parm + "3d";
var layer3d = sgworld.ProjectTree.FindItem(parm1);
sgworld.ProjectTree.SetVisibility(layer3d, false);
}
}
function disPlay(fileName, type) {
var layer = sgworld.ProjectTree.FindItem(fileName);
if (layer == '') return;
switch (type) {
case 'normal':
break;
case '3Dpolygon':
displayAs(layer, type);
break;
case 'float':
displayAs(layer, type);
break;
}
}
function displayAs(ID, type) {
var classStr = "<[index]*20 + 20>0";
var floatStr = "<[index]*100 + 200>0";
var obj = sgworld.ProjectTree.GetObject(ID);
// if(obj.FeatureGroups.Item(0).DisplayAs == 6 || obj.FeatureGroups.Item(0).GetProperty("Altitude Method") ==10 || obj.FeatureGroups.Item(0).GetProperty("Fill Opacity")==0.9){
// obj.FeatureGroups.Item(0).DisplayAs = 2;
// obj.FeatureGroups.Item(0).SetProperty("Altitude Method",12);
// obj.FeatureGroups.Item(0).SetProperty("Fill Opacity",0.7);
// return false;
// }
alert(obj.FeatureGroups.Polygon)
switch (type) {
case '3Dpolygon':
obj.FeatureGroups.Item(0).DisplayAs = 6;
obj.Position.AltitudeType = 0;
obj.FeatureGroups.Item(0).SetClassification("Height", classStr);
// obj.Refresh();
//obj.FeatureGroups.Item(0).SetProperty("Altitude",50);
obj.FeatureGroups.Item(0).SetProperty("Fill Opacity", 0.7);
obj.Refresh();
break;
case 'float':
alert(3);
obj.FeatureGroups.Item(0).SetProperty("Altitude Method", 10);
obj.FeatureGroups.Item(0).SetClassification("Altitude", floatStr);
obj.FeatureGroups.Item(0).SetProperty("Fill Opacity", 0.9);
obj.Refresh();
alert(4);
break;
}
}