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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
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);
}