赣州市洪水风险预警系统三维版本
guoshilong
2023-02-27 4d8c6dd77427e8e581fda17b6b65ba86bfb7a815
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
///////////////////////////////////////////////////////////////////////////
// Copyright © 2018 NarutoGIS. All Rights Reserved.
// 模块描述: 山洪信息
///////////////////////////////////////////////////////////////////////////
define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/_base/array',
    'dojo/_base/html',
    "dojo/topic",
    'jimu/BaseWidget',
    'dojo/on',
    'dstore/Memory',
    'dstore/Trackable',
    'dgrid/Grid',
    'dgrid/Keyboard',
    'dgrid/Selection',
    'dstore/RequestMemory',
    'dgrid/test/data/createSyncStore',
    './CommonPointLayer3D'
],
    function (declare,
        lang,
        array,
        html,
        topic,
        BaseWidget,
        on,
        Memory,
        Trackable,
        Grid,
        Keyboard,
        Selection,
        RequestMemory,
        createSyncStore,
        CommonPointLayer3D
    ) {
        return declare([BaseWidget], {
            baseClass: 'jimu-widget-ShanHong',
            name: 'ShanHong',
            layer: null,
            startup: function () {
                // 山洪的config配置
 
                // {
                //     "name": "山洪信息",
                //         "uri": "widgets/ShanHong/Widget"
                // },
 
 
 
                this.inherited(arguments);
                var self = this;
                // select 选择,下拉选择,地图重置
                $('.shselect').change(function () {
                    // 表格清空
                    $("#shgrid")[0].innerHTML = '';
                    // 城市名称
                    var county = $(this).val();
                    // 不同的区域,相机飞的位置不同
                    if (county == "赣州市") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(115.257787, 25.885506, 549263.35)
                        });
                        self.createList(self.datas);
                        return
                    }
                    var dateJson = [];
                    self.datas.forEach((item, index) => {
                        if (item.cnnm == county) {
                            dateJson.push(item);
                        }
                    })
                    if (county == "信丰县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(114.93, 25.28, 110000),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "大余县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(114.35, 25.40, 100000),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "上犹县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(114.22, 25.90, 100000),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "崇义县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(114.14, 25.65, 100100),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "安远县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(115.38, 25.26, 150305),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "龙南县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(114.68, 24.74, 100505),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "定南县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(115.03, 24.84, 100050),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "全南县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(114.52, 24.90, 140030),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "宁都县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(116.02, 26.54, 160900),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "于都县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(115.42, 25.99, 133055),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "兴国县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(115.35, 26.38, 140106),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "会昌县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(115.78, 25.47, 155200),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "寻乌县") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(115.65, 24.91, 124060),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    } else if (county == "南康市") {
                        self.map.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(114.75, 25.90, 159050),
                            easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT
                        });
                    }
                    self.createList(dateJson);
                })
                this.layer = new CommonPointLayer3D({
                    id: 'shLayer',
                    map: this.map
                });
 
 
 
            },
 
            onMinimize: function () {
                this.resize();
            },
 
            onMaximize: function () {
                this.resize();
            },
            onOpen: function () {
                //面板打开的时候触发 (when open this panel trigger)
                $('.load-box-list').show();
                this.layer ? this.layer.setVis(true) : '';
                // 面板打开时,相机的经纬度为赣州中心的经纬度,高度,自定
                this.map.camera.flyTo({
                    destination: Cesium.Cartesian3.fromDegrees(115.257787, 25.885506, 549263.35)
                });
                var self = this;
                $('.shselect').val("赣州市");
                $.ajax({
                    url: 'http://localhost:82/blade-ycreal/torrent/query?',
                    type: 'get',
                    dataType: 'JSON',
                    success: function (result) {
                        self.datas = result.data;
                        $('.load-box-list').hide();
                        // 添加表格
                        self.createList(result.data);
                    }
                });
                /*dojo.xhrGet({
                    url: this.folderUrl + "/dates.json",
                    handleAs: "json",
                    preventCache: true,
                    load: function (json, ioargs) {
                        var aa = [];
                        // 对数据做处理
                        for (var i = 0; i < json.data.length; i++) {
                            var obj = json.data[i];
                            var newobj = {};
                            for (var j = 0; j < obj.fieldNames.length; j++) {
                                newobj[obj.fieldNames[j]] = obj.fieldValues[j];
                            }
                            json.data[i] = newobj;
                            json.data[i].NUM = i+1;
                        }
                        debugger
                        self.datas = json.data;
                        // 添加表格
                        self.createList(json.data);
                    },
                    error: function (error, ioargs) {}
                });*/
 
 
                // 发送请求
 
            },
 
            onClose: function () {
                //面板关闭的时候触发 (when this panel is closed trigger)
                this.layer ? this.layer.setVis(false) : '';
            },
 
            resize: function () {
 
            },
 
            destroy: function () {
                this.inherited(arguments);
            },
 
            //关键字过滤
            query: function () {
                var text = this.keyNode.value;
                if (text != "" && text.length > 0) {
                    var list = array.filter(this.datas, function (g) {
                        if (g.name.indexOf(text) > -1) {
                            return true;
                        } else {
                            return false;
                        }
                    }, this);
                    this.grid.refresh();
                    this.grid.renderArray(list);
                    //同时显示到layer
                    this.layer.getData(list);
                } else {
                    this.grid.refresh();
                    this.grid.renderArray(this.datas);
                    //同时显示到layer
                    this.layer.getData(this.datas);
                }
            },
 
            //http://dgrid.io/tutorials/1.0/hello_dgrid/
            createList: function (dataList) {
 
                var CustomGrid = declare([Grid, Keyboard, Selection]);
                var grid = new CustomGrid({
                    columns: {
                        siteId: '序号',
                        name: '流域名称',
                        sectcd: '控制断面代码'
                    },
                    selectionMode: 'single', // for Selection; only select a single row at a time
                    cellNavigation: false // for Keyboard; allow only row-level keyboard navigation
                }, 'shgrid');
                grid.startup();
                grid.on('dgrid-select', lang.hitch(this, function (event) {
                    setTimeout(function () {
                        topic.publish("gis/map/setCenter", {
                            'lgtd': event.rows[0].data.lgtd,
                            'lttd': event.rows[0].data.lttd
                        }); //进行地图定位
                    }, 300);
                }));
                grid.renderArray(dataList);
                //同时显示到layer
                this.layer.getData(dataList);
                this.grid = grid;
            }
        });
    });