new CusScrollBar({ contentSelector: '.scroll_cont1', //滚动内容区 barSelector: '.scroll_bar1', //滚动条 sliderSelector: '.scroll_slider1' //滚动滑块 }); sgworld = window.external.createSgworld(); var urlPathName = ""; var form = null; layui.use('form', function () { form = layui.form; var timeStr = decodeURI(getUrlParam("tm")); urlPathName = decodeURI(getUrlParam("urlPathName")); GetSk(timeStr, urlPathName); setCheck(urlPathName) form.on('checkbox(All)', function (data) { var fullPath = urlPathName; var currentTime = data.elem.title; //var color = $(this).next().css("backgroundColor"); var color = data.elem.value; color = color.slice(4, color.indexOf(")")); var r = parseInt(color.split(",")[0]); var g = parseInt(color.split(",")[1]); var b = parseInt(color.split(",")[2]); var c = sgworld.Creator.CreateColor(r, g, b, 1); var ye = currentTime; var bjPath = fullPath + "\\" + ye + "\\" + ye + "边界"; var lxPath = fullPath + "\\" + ye + "\\" + ye + "裂隙"; var bjId = sgworld.ProjectTree.FindItem(bjPath); var lxId = sgworld.ProjectTree.FindItem(lxPath); var bjObj = sgworld.ProjectTree.GetObject(bjId); var lxObj = sgworld.ProjectTree.GetObject(lxId); var v = $(this).attr("checked"); if ($(this).attr("checked") == "checked") { bjObj.FeatureGroups.SetProperty("Line Color", c.abgrColor); lxObj.FeatureGroups.Item(0).SetProperty("Line Color", c.abgrColor); sgworld.ProjectTree.SetVisibility(lxId, true); sgworld.ProjectTree.SetVisibility(bjId, true); } else { var bj = sgworld.Creator.CreateColor(255, 0, 0, 1); var lx = sgworld.Creator.CreateColor(255, 255, 0, 1); bjObj.FeatureGroups.SetProperty("Line Color", bj.abgrColor); lxObj.FeatureGroups.Item(0).SetProperty("Line Color", lx.abgrColor); sgworld.ProjectTree.SetVisibility(lxId, false); sgworld.ProjectTree.SetVisibility(bjId, false); } /* let currentTime = data.elem.title; let layerId = sgworld.ProjectTree.FindItem(urlPathName + "\\" + currentTime + "\\" + currentTime); let layer = sgworld.ProjectTree.GetObject(layerId); let Hex = colorRGBtoHex(data.elem.value); layer.FeatureGroups.Item(0).SetProperty('Line Color', Hex); if (data.elem.checked == true) { sgworld.ProjectTree.SetVisibility(layerId, true); } else { sgworld.ProjectTree.SetVisibility(layerId, false); } */ }); }); fullPath = urlPathName; $("input[type='checkbox']").click(function () { var color = $(this).next().css("backgroundColor"); color = color.slice(4, color.indexOf(")")); var r = parseInt(color.split(",")[0]); var g = parseInt(color.split(",")[1]); var b = parseInt(color.split(",")[2]); var c = sgworld.Creator.CreateColor(r, g, b, 1); var ye = $(this).attr("title"); var bjPath = fullPath + "\\" + ye + "\\" + ye + "边界"; var lxPath = fullPath + "\\" + ye + "\\" + ye + "裂隙"; var bjId = sgworld.ProjectTree.FindItem(bjPath); var lxId = sgworld.ProjectTree.FindItem(lxPath); var bjObj = sgworld.ProjectTree.GetObject(bjId); var lxObj = sgworld.ProjectTree.GetObject(lxId); var v = $(this).attr("checked"); if ($(this).attr("checked") == "checked") { bjObj.FeatureGroups.SetProperty("Line Color", c.abgrColor); lxObj.FeatureGroups.Item(0).SetProperty("Line Color", c.abgrColor); sgworld.ProjectTree.SetVisibility(lxId, true); sgworld.ProjectTree.SetVisibility(bjId, true); } else { var bj = sgworld.Creator.CreateColor(255, 0, 0, 1); var lx = sgworld.Creator.CreateColor(255, 255, 0, 1); bjObj.FeatureGroups.SetProperty("Line Color", bj.abgrColor); lxObj.FeatureGroups.Item(0).SetProperty("Line Color", lx.abgrColor); sgworld.ProjectTree.SetVisibility(lxId, false); sgworld.ProjectTree.SetVisibility(bjId, false); } }); //获取色块值并且展示出来 function GetSk(parm0, parm1) { var timeArr = parm0.split('+'); let html = ""; for (var i = 0; i < timeArr.length; i++) { var R = parseInt(Math.random() * 255); var G = parseInt(Math.random() * 255); var B = parseInt(Math.random() * 255); html += ''; } $(".message").empty(); $(".message").append(html); form.render(); } //设置牛心山选择 function setCheck(fullPath) { var dYear = localStorage.getItem("CheckPointYear"); $("input[type='checkbox']").each(function () { $(this).attr("checked", false); $(this).attr("disabled", false); var ye = $(this).attr("title"); var bjPath = fullPath + "\\" + ye + "\\" + ye + "边界"; var lxPath = fullPath + "\\" + ye + "\\" + ye + "裂隙"; var bjId = sgworld.ProjectTree.FindItem(bjPath); var lxId = sgworld.ProjectTree.FindItem(lxPath); var bjObj = sgworld.ProjectTree.GetObject(bjId); var lxObj = sgworld.ProjectTree.GetObject(lxId); var bj = sgworld.Creator.CreateColor(255, 0, 0, 1); var lx = sgworld.Creator.CreateColor(255, 255, 0, 1); bjObj.FeatureGroups.SetProperty("Line Color", bj.abgrColor); lxObj.FeatureGroups.Item(0).SetProperty("Line Color", lx.abgrColor); if (dYear == $(this).attr("title")) { $(this).attr("checked", true); $(this).attr("disabled", true); } else if (dYear == null) { if ($(this).attr("title") == "2019") { $(this).attr("checked", true); $(this).attr("disabled", true); } } }); $("input[type='checkbox']").change(function () { var color = $(this).next().css("backgroundColor"); color = color.slice(4, color.indexOf(")")); var r = parseInt(color.split(",")[0]); var g = parseInt(color.split(",")[1]); var b = parseInt(color.split(",")[2]); var c = sgworld.Creator.CreateColor(r, g, b, 1); var ye = $(this).attr("title"); var bjPath = fullPath + "\\" + ye + "\\" + ye + "边界"; var lxPath = fullPath + "\\" + ye + "\\" + ye + "裂隙"; var bjId = sgworld.ProjectTree.FindItem(bjPath); var lxId = sgworld.ProjectTree.FindItem(lxPath); var bjObj = sgworld.ProjectTree.GetObject(bjId); var lxObj = sgworld.ProjectTree.GetObject(lxId); var v = $(this).attr("checked"); if ($(this).attr("checked") == "checked") { bjObj.FeatureGroups.SetProperty("Line Color", c.abgrColor); lxObj.FeatureGroups.Item(0).SetProperty("Line Color", c.abgrColor); sgworld.ProjectTree.SetVisibility(lxId, true); sgworld.ProjectTree.SetVisibility(bjId, true); } else { var bj = sgworld.Creator.CreateColor(255, 0, 0, 1); var lx = sgworld.Creator.CreateColor(255, 255, 0, 1); bjObj.FeatureGroups.SetProperty("Line Color", bj.abgrColor); lxObj.FeatureGroups.Item(0).SetProperty("Line Color", lx.abgrColor); sgworld.ProjectTree.SetVisibility(lxId, false); sgworld.ProjectTree.SetVisibility(bjId, false); } }); }