sgworld = window.external.createSgworld();
|
var form = null;
|
var element = null;
|
var lc = new leftCenterDatlog();
|
//注意:折叠面板 依赖 element 模块,否则无法进行功能性操作
|
var title;
|
window.onload = function () {
|
new CusScrollBar({
|
contentSelector: '.scroll_cont1', //滚动内容区
|
barSelector: '.scroll_bar1', //滚动条
|
sliderSelector: '.scroll_slider1' //滚动滑块
|
});
|
|
|
layui.use(['element', 'form'], function () {
|
element = layui.element;
|
form = layui.form;
|
GetColor();
|
var titleOrgin = "";
|
title = decodeURI(getUrlParam("typeName"));//localStorage.getItem("typeName");
|
titleOrgin = title;
|
$(".ttitle").empty();
|
if (title.length > 11) {
|
title = title.substring(0, 11);
|
}
|
$(".ttitle").append(title);
|
$(".ttitle").attr({ title: titleOrgin });
|
form.on('checkbox(pYc)', function (data) {
|
window.event.stopPropagation();
|
});
|
GetYX();
|
});
|
|
}
|
|
|
var skFirst = [];
|
//获取一级菜单选中事件
|
var qxF = false;
|
function qx1() {
|
if (qxF == false) {
|
qxF = true;
|
var checkItem = $("input:checkbox[name='title']");
|
checkItem.each(function (index, item) {
|
$(item).attr('checked', true);
|
});
|
form.render();
|
} else {
|
qxF = false;
|
var checkItem = $("input:checkbox[name='title']");
|
checkItem.each(function (index, item) {
|
$(item).removeAttr('checked');
|
});
|
form.render();
|
}
|
}
|
|
//获取二级菜单选中事件
|
var qxS = false;
|
var skSecond = [];
|
function qx2() {
|
if (qxS == false) {
|
qxS = true;
|
var checkItem = $("input:checkbox[name='message']");
|
checkItem.each(function (index, item) {
|
$(item).attr('checked', true);
|
});
|
form.render();
|
} else {
|
qxS = false;
|
var checkItem = $("input:checkbox[name='message']");
|
checkItem.each(function (index, item) {
|
$(item).removeAttr('checked');
|
});
|
form.render();
|
}
|
}
|
|
|
var url = getRootPath();
|
var tempWmserjiID = null;
|
//确定菜单
|
function sure() {
|
//debugger;
|
//try {
|
// sgworld.ProjectTree.DeleteItem(sgworld.ProjectTree.FindItem("WMSServices"));
|
//} catch (e) { }
|
//if (temID != null) {
|
// sgworld.ProjectTree.DeleteItem(temID);
|
// temID = null;
|
//}
|
//if (tempWmserjiID != null) {
|
// sgworld.ProjectTree.DeleteItem(tempWmserjiID);
|
// tempWmserjiID = null;
|
//}
|
//if (layerId != null) {
|
// sgworld.ProjectTree.DeleteItem(layerId);
|
// layerId = null;
|
//}
|
var yiji = [];
|
var erji = [];
|
var first = "";
|
var whereFirst = "";
|
var checkFirst = $("input:checkbox[name='title']:checked");
|
$.each(checkFirst, function (index, value) {
|
first += value.title + "*";
|
yiji.push(TypeCode[value.title] == undefined ? value.getAttribute("data-code") : TypeCode[value.title]);
|
if (yiji.indexOf("") >= 0) {
|
yiji.splice(yiji.indexOf(""), 1);
|
}
|
if (value.getAttribute("data-code") == "06" && erjiName.indexOf("dibiaoshui") != -1) {
|
yiji.pop();
|
}
|
whereFirst += ("YJFL='" + value.getAttribute("data-code")) + "' OR ";
|
});
|
|
var second = "";
|
var whereSecond = "";
|
var checkSecond = $("input:checkbox[name='message']:checked");
|
$.each(checkSecond, function (index, value) {
|
second += value.title + "*";
|
erji.push(TypeCode[value.title] == undefined ? value.getAttribute("data-code") : TypeCode[value.title]);
|
if (title.indexOf("都兰县土地资源") != -1) {
|
var qux = ['0808', '0809', '0705', '0706', '0707', '0102', '0201'];
|
for (var i = 0; i < qux.length; i++) {
|
var idsx = erji.indexOf(qux[i]);
|
if (idsx != -1)
|
erji.splice(idsx, 1);
|
}
|
}
|
whereSecond += ("EJFL='" + value.getAttribute("data-code") + "' OR ");
|
});
|
|
if (getUrlParam("tableType") == "DLDZ") {
|
var arr = [];
|
var urlPathname = decodeURI(getUrlParam("urlPath"));//localStorage.getItem("pathName");
|
var pId = sgworld.ProjectTree.FindItem(urlPathname);
|
sgworld.ProjectTree.SetVisibility(pId, false);
|
var SonId = sgworld.ProjectTree.GetNextItem(pId, 11);
|
arr.push(SonId);
|
while (SonId) {
|
SonId = sgworld.ProjectTree.GetNextItem(SonId, 13);
|
if (SonId != "") {
|
arr.push(SonId);
|
}
|
}
|
setTimeout(function () {
|
sgworld.ProjectTree.SetVisibility(pId, true);
|
//循环获取过滤内容
|
for (var i = 0; i < arr.length; i++) {
|
var layerDLDZ = sgworld.ProjectTree.GetObject(arr[i]);
|
// alert(layerDLDZ.StreamStatus);
|
var ty = layerDLDZ.GeometryType;
|
if (ty == 0) {
|
if (whereFirst != "" & whereSecond != "") {
|
layerDLDZ.Load();
|
layerDLDZ.Refresh();
|
layerDLDZ.Filter = (whereFirst + whereSecond.substring(0, whereSecond.length - 3));
|
}
|
if (whereFirst != "" & whereSecond == "") {
|
layerDLDZ.Load();
|
layerDLDZ.Filter = (whereFirst.substring(0, whereFirst.length - 3));
|
layerDLDZ.Refresh();
|
}
|
if (whereFirst == "" & whereSecond != "") {
|
layerDLDZ.Load();
|
layerDLDZ.Filter = (whereSecond.substring(0, whereSecond.length - 3));
|
layerDLDZ.Refresh();
|
}
|
}
|
}
|
}, 1000)
|
} else {
|
second = second.substring(0, second.length - 1);
|
if (second == "") {
|
window.external.closeDialog("右中");
|
|
} else {
|
window.external.createPmDialogDock("右中", url + "legend.html?sk=" + second + "&type=" + getUrlParam("tableType"), lc.width, lc.height, lc.top, lc.left, lc.bottom, lc.right);
|
}
|
if (whereFirst != "" & whereSecond != "") {
|
tempWmserjiID = getWms(erjiName, erji);
|
|
}
|
|
if (whereFirst == "" & whereSecond != "") {
|
tempWmserjiID = getWms(erjiName, erji);
|
|
}
|
|
if (whereFirst != "" & whereSecond == "") {
|
tempWmserjiID = getWms(Tname, yiji);
|
|
}
|
}
|
}
|
|
//获取文本框数值
|
var FSLevel = false;
|
function GetColor() {
|
var TableName = getUrlParam("tableType");// localStorage.getItem("type");
|
var TableColor = GetCmpareTable(TableName);
|
$.ajax({
|
url: "../../../Ashx/DataQH.ashx",
|
type: "post",
|
data: { Action: "GetColor", colorTable: TableColor },
|
dataType: "json",
|
async: false,
|
success: function (result) {
|
//判断使用一级菜单还是二级菜单
|
var ContainParent = false;
|
for (var i = 0; i < result.length; i++) {
|
if (result[i].Type == "parent") {
|
ContainParent = true;
|
break;
|
}
|
}
|
//初始化日期
|
var html = "";
|
var h1 = "";
|
if (ContainParent) {
|
$.each(result, function (index, value) {
|
if (value.Type == "parent") {
|
if (html == "") {
|
html += '<div class="layui-collapse layui-form"><div class="layui-colla-item"><div class="layui-colla-title">' +
|
'<div class="lct"><input type="checkbox" name="title" data-code="' + value.Code + '" lay-skin="primary" title="' + value.Name + '" lay-filter="pYc"' +
|
'value="rgb(' + value.R + ',' + value.G + ',' + value.B + ')"></div><div><img src="img/加号.png" /></div></div><div class="layui-colla-content">' +
|
'<div class="layui-form-item"><div class="layui-input-block">';
|
} else {
|
html += '</div></div></div></div></div><div class="layui-collapse layui-form"><div class="layui-colla-item"><div class="layui-colla-title">' +
|
'<div class="lct"><input type="checkbox" name="title" data-code="' + value.Code + '" lay-skin="primary" title="' + value.Name + '" lay-filter="pYc"' +
|
'value="rgb(' + value.R + ',' + value.G + ',' + value.B + ')"></div><div><img src="img/加号.png" /></div></div><div class="layui-colla-content">' +
|
'<div class="layui-form-item"><div class="layui-input-block">';
|
}
|
} else if (value.Type == "Gparent") {
|
return;
|
} else {
|
html += '<input type="checkbox" name="message" data-code="' + value.Code + '" lay-skin="primary" title="' + value.Name + '" value="rgb(' + value.R + ',' + value.G + ',' + value.B + ')">';
|
}
|
if (result.length - 1 == index) {
|
html += '</div></div></div></div></div></div>';
|
}
|
})
|
|
FSLevel = false;
|
} else {
|
$.each(result, function (index, value) {
|
html += '<div class="layui-collapse layui-form"><div class="layui-colla-item"><div class="layui-colla-title">' +
|
'<div class="lct"><input type="checkbox" name="title" data-code="' + value.Code + '" lay-skin="primary" title="' + value.Name + '" lay-filter="pYc"' +
|
'value="rgb(' + value.R + ',' + value.G + ',' + value.B + ')"></div><div></div></div>';
|
})
|
html + '<div class="layui-collapse layui-form">' + html + '</div>';
|
$(".imgSecondT").css("display", "none");
|
|
FSLevel = true;
|
};
|
$(".scroll_cont1").empty();
|
$(".scroll_cont1").append(html);
|
form.render();
|
element.render();
|
}
|
});
|
}
|
//设置请求wms的方法
|
function getWms(layername, layers) {
|
let OrginLayerId = sgworld.ProjectTree.FindItem("WMSServices");
|
if (OrginLayerId != "") sgworld.ProjectTree.DeleteItem(OrginLayerId);
|
|
var lys = "";
|
var level;
|
var params = "";
|
if (layers == null) {
|
lys = "";
|
} else {
|
lys = layers.join(",");
|
params = lys;
|
}
|
var wmsStr = "[INFO]\rMPP=0.000000703125\rUrl=http://118.213.95.33:8092/gisserver/wmsserver/" + layername + "?version=1.3.0&request=GetMap&layers=" + lys + "&styles=&crs=CRS%3A84&bbox=89.41422474919496%2C31.6010630992594%2C103.04868373490258%2C39.207201101000074&width=256&height=256&format=image%2Fjpeg&transparent=false";
|
var wmsLayer = sgworld.Creator.CreateImageryLayer("wms", -180, 90, 180, -90,
|
"<EXT><ExtInfo><![CDATA[" + wmsStr + "]]></ExtInfo><ExtType>wms</ExtType></EXT>", "gisplg.rct", "",
|
"WMSServices");
|
//layerId = wmsLayer.ID;
|
if (layername.indexOf("yiji") != -1) {
|
level = "YJFL-" + layername;
|
} else {
|
level = "EJFL-" + layername;
|
}
|
wmsLayer.ClientData("level") = level;
|
wmsLayer.ClientData("parms") = params;
|
wmsLayer.NullValue = 16777215;
|
wmsLayer.NullTolerance = 60;
|
wmsLayer.FillStyle.Color.SetAlpha(0.7);
|
wmsLayer.UseNull = true;
|
return wmsLayer.ID;
|
}
|
//加载影像数据
|
var layer = "", layerId = "";
|
var layer1 = "", layer1Id = "";
|
var Tname = null;
|
var erjiName = "";
|
var tempGroupID;
|
function GetYX(year) {
|
sgworld.ProjectTree.SetVisibility("", false);
|
if (year == undefined) {
|
year = "";
|
}
|
if (year == "" || year == undefined) {
|
tempGroupID = sgworld.ProjectTree.FindItem("应用数据\\都兰影像\\2019");
|
tempGroupID == "" ? tempGroupID = "" : sgworld.ProjectTree.SetVisibility(tempGroupID, true);
|
}
|
else {
|
sgworld.ProjectTree.SetVisibility(tempGroupID, false);
|
tempGroupID = sgworld.ProjectTree.FindItem("应用数据\\都兰影像\\" + year);
|
tempGroupID == "" ? tempGroupID = "" : sgworld.ProjectTree.SetVisibility(tempGroupID, true);
|
}
|
let MyType = getUrlParam("tableType");
|
let CurrentRoot = YingYongDataSencond.filter(function (item) { return item.Type == MyType });
|
if (CurrentRoot[0].ChildRen != undefined) {
|
let RootSon = null;
|
if (year == "") {
|
RootSon = CurrentRoot[0].ChildRen;
|
} else {
|
RootSon = CurrentRoot[0].ChildRen.filter(function (item) { return item.time == year });
|
}
|
let AllName = CurrentRoot[0].rootname + "\\" + CurrentRoot[0].name + "\\" + CurrentRoot[0].sname + "\\" + RootSon[0].name;
|
if (MyType == "DLDZ") {
|
let AllItemID = sgworld.ProjectTree.FindItem(AllName);
|
if (AllItemID == "") return;
|
sgworld.ProjectTree.SetVisibility(AllItemID, true);
|
|
let InitName = CurrentRoot[0].rootname + "\\" + CurrentRoot[0].name + "\\" + CurrentRoot[0].sname + "\\init";
|
let InitID = sgworld.ProjectTree.FindItem(InitName);
|
if (InitID == "") return;
|
sgworld.Navigate.FlyTo(InitID);
|
// sgworld.Navigate.FlyTo(sgworld.ProjectTree.FindItem(AllName + "\\init"));
|
//sgworld.ProjectTree.SetVisibility(sgworld.ProjectTree.FindItem(decodeURI(getUrlParam("urlPath")) + "\\" + name, true));
|
//sgworld.ProjectTree.SetVisibility(sgworld.ProjectTree.FindItem(decodeURI(getUrlParam("urlPath")) + "\\" + name, true));
|
//sgworld.Navigate.FlyTo(sgworld.ProjectTree.FindItem(decodeURI(getUrlParam("urlPath")) + "\\init"));
|
//localStorage.setItem("pathName", decodeURI(getUrlParam("urlPath")) + "\\" + name);
|
} else {
|
let parentId = sgworld.ProjectTree.FindItem(AllName);
|
let FisrtSonId = sgworld.ProjectTree.GetNextItem(parentId, 11);
|
Tname = sgworld.ProjectTree.GetItemName(FisrtSonId);
|
var obj = LayerText[Tname];
|
Tname = obj.Tname;
|
erjiName = obj.erjiName;
|
layerId = getWms(Tname, null);
|
//let TN ="" ;//decodeURI(getUrlParam("urlPath")) + "\\" + name;
|
//let parentId = sgworld.ProjectTree.FindItem(TN);
|
//let FisrtSonId = sgworld.ProjectTree.GetNextItem(parentId, 11);
|
//Tname = sgworld.ProjectTree.GetItemName(FisrtSonId);
|
////Tname = sgworld.ProjectTree.GetItemName(sgworld.ProjectTree.GetNextItem(sgworld.ProjectTree.FindItem(decodeURI(getUrlParam("urlPath")) + "\\" + name), 11));
|
//var obj = LayerText[Tname];
|
//Tname = obj.Tname;
|
//erjiName = obj.erjiName;
|
//layerId = getWms(Tname, null);
|
}
|
}
|
}
|
|
|
function closeCurrent() {
|
window.external.closeDialog("右中");
|
window.external.closeDialog("左下");
|
window.external.closeDialog("右上");
|
window.external.closeDialog("右下");
|
window.external.InvokeScript("左上", "ReFresh", "");
|
//关闭图层
|
sgworld.ProjectTree.SetVisibility("", false);
|
sgworld.ProjectTree.SetVisibility(sgworld.ProjectTree.FindItem("qinghai"), true);
|
}
|