13693261870
2024-04-02 2a1b873b4b78b508d5d53c57992e734c56619df8
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
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);
    form.on('checkbox(All)', function (data) {
        let currentTime = data.elem.title;
        let layerId = sgworld.ProjectTree.FindItem(urlPathName + "\\" + currentTime + "\\" + currentTime);
        let layer = sgworld.ProjectTree.GetObject(layerId);
        let Hex = data.elem.value; //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);
        }
 
    });
 
});
;
 
//获取色块值并且展示出来
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);
        let CurrentColor = getRandomColor();
 
 
        html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '"  value="' + CurrentColor + '">';
 
        //if (timeArr[i] == "2012") {
        //    let RGB = colorRgb("#EA0000");
        //    //alert(RGB);
        //    html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '"  value="RGB(' + RGB + ')">';
        //}
        //if (timeArr[i] == "2013") {
        //    let RGB = colorRgb("#f8aba6");
        //    html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '" value="RGB(' + RGB + ')">';
        //}
        //if (timeArr[i] == "2014") {
        //    let RGB = colorRgb("#46A3FF");
        //    html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '"  value="RGB(' + RGB + ')">';
        //}
        //if (timeArr[i] == "2015") {
        //    let RGB = colorRgb("#00FFFF");
        //    html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '"  value="RGB(' + RGB + ')">';
        //}
        //if (timeArr[i] == "2016") {
        //    let RGB = colorRgb("#00DB00");
        //    html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '"  value="RGB(' + RGB + ')">';
        //}
        //if (timeArr[i] == "2017") {
        //    let RGB = colorRgb("#F9F900");
        //    html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '"  value="RGB(' + RGB + ')">';
        //}
        //if (timeArr[i] == "2018") {
        //    let RGB = colorRgb("#FF8000");
        //    html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '"  value="RGB(' + RGB + ')">';
        //}
        //if (timeArr[i] == "2019") {
        //    let RGB = colorRgb("#9b95c9");
        //    html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '"  value="RGB(' + RGB + ')">';
        //}
 
        if (i == timeArr.length - 1) {
            //html += '<input type="checkbox" name="message"  lay-skin="primary"  lay-filter="All"  checked="checked"  title="' + timeArr[i] + '"  value="RGB(4,143,248)">';
            let layerId = sgworld.ProjectTree.FindItem(urlPathName + "\\" + timeArr[i] + "\\" + timeArr[i]);
            let layer = sgworld.ProjectTree.GetObject(layerId);
            layer.FeatureGroups.Item(0).SetProperty('Line Color', CurrentColor);
        }
        // else {
        //    html += '<input type="checkbox" name="message"  lay-skin="primary"     lay-filter="All"  title="' + timeArr[i] + '"  value="RGB(' + R + ',' + G + ',' + B + ')">';
        //}
      
    }
    $(".message").empty();
    $(".message").append(html);
    form.render();
}
 
 
function getRandomColor(){
    var str = "#";
    var arr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
    for (var i = 0; i < 6; i++) {
        var num = parseInt(Math.random() * 16);
        str += arr[num];
    }
    return str;
}