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
| /*
| * @Description:
| * @Version: 1.0
| * @Author: yangsx
| * @Date: 2019-12-09 19:01:40
| * @LastEditors: yangsx
| * @LastEditTime: 2019-12-14 14:44:57
| */
| define([
| "dojo",
| "dojo/_base/declare",
| "dojo/_base/lang",
| "base/BaseWidget",
| "dojo/text!widgets/task/template.html",
| "base/AppEvent",
| "base/ConfigData",
| "widgets/task/config",
| "dojo/dom",
| "dojo/dom-construct",
| "dojo/dom-attr",
| "dojo/dom-style",
| "dojo/on",
| "esri/layers/ArcGISDynamicMapServiceLayer",
| "esri/layers/ArcGISTiledMapServiceLayer",
| "esri/layers/FeatureLayer",
| "controls/tab/TabControl",
| "esri/dijit/SymbolStyler",
| "esri/styles/basic",
| "dojo/_base/array",
| "esri/InfoTemplate",
| "esri/tasks/query",
| "esri/tasks/QueryTask",
| "esri/Color",
| "esri/toolbars/edit",
| "esri/graphic",
| "esri/geometry/Point",
| "esri/geometry/Polyline",
| "esri/geometry/Polygon",
| "esri/geometry/Extent",
| "esri/tasks/FeatureSet",
| "esri/renderers/HeatmapRenderer",
| "esri/symbols/SimpleLineSymbol",
| "esri/symbols/SimpleFillSymbol",
| "esri/symbols/PictureMarkerSymbol",
| "esri/symbols/SimpleMarkerSymbol",
| "esri/SpatialReference",
| "esri/tasks/GeometryService",
| "esri/tasks/ProjectParameters",
| "esri/layers/GraphicsLayer",
| "esri/layers/LabelLayer",
| "esri/symbols/TextSymbol",
| "esri/renderers/SimpleRenderer",
| "esri/renderers/ClassBreaksRenderer",
| "esri/tasks/Geoprocessor",
| "esri/tasks/DataFile",
| "esri/geometry/webMercatorUtils",
| "esri/symbols/Font",
| "esri/geometry/ScreenPoint",
| "esri/layers/ImageParameters",
| "esri/geometry/geometryEngine",
| "esri/dijit/PopupTemplate",
| "widgets/clientManagement/FlareClusterLayer_v3",
| 'dojo/topic',
| "dojo/domReady!"
| ], function (
| dojo,
| declare,
| lang,
| BaseWidget,
| template,
| AppEvent,
| ConfigData,
| config,
| dom,
| domConstruct,
| domAttr,
| domStyle,
| on,
| ArcGISDynamicMapServiceLayer,
| ArcGISTiledMapServiceLayer,
| FeatureLayer,
| TabControl,
| SymbolStyler,
| basic,
| arrayUtils,
| InfoTemplate,
| Query,
| QueryTask,
| Color,
| Edit,
| Graphic,
| Point,
| Polyline,
| Polygon,
| Extent,
| FeatureSet,
| HeatmapRenderer,
| SimpleLineSymbol,
| SimpleFillSymbol,
| PictureMarkerSymbol,
| SimpleMarkerSymbol,
| SpatialReference,
| GeometryService,
| ProjectParameters,
| GraphicsLayer,
| LabelLayer,
| TextSymbol,
| SimpleRenderer,
| ClassBreaksRenderer,
| Geoprocessor,
| DataFile,
| webMercatorUtils,
| Font,
| ScreenPoint,
| ImageParameters,
| geometryEngine,
| PopupTemplate,
| FlareClusterLayer,
| topic
| ) {
| var Widget = declare([BaseWidget], {
| widgetName: "task",
| label: "分发处置",
| templateString: template,
| _map: null,
| objThis: null,
| _siteLayer: new GraphicsLayer(),
| layuiLayer: null,
| layuiLadate: null,
| tabIndex: 0,
|
| // 保留添加实体图层的变量
| addEntitys: null,
| addEntitystra: null,
| entitysData: [],
|
|
| // 巡逻区域或者巡逻路线的描述
| routeOrRegionDescribe: null,
|
| // 用来记录巡逻区域或者巡逻路线的下标的
| patrolIndex: 0,
|
| // 拖拽
| isDown: false,
| x: 0,
| y: 0,
| offset: null,
| moveThis: null,
| // 电子围栏需要新增的Id
| newElectronicFenceId: null,
|
| // 新增路线时,派发人员,人员名称,以及人员id
| peopleRealName: null,
| pepleRealId: null,
| constructor: function (options, srcRefNode) {
| this._map = options.map;
| objThis = this;
|
| this.addEntitys = new GraphicsLayer({
| id: 'addEntitys'
| });
| this.addEntitystra = new GraphicsLayer({
| id: 'addEntitystra'
| });
|
| // 添加点面线的图层
| this.addPolygonEntitys = new GraphicsLayer({
| id: 'addPolygonEntitys'
| });
| // 添加所有图层的地方
| this.entityPolygonAll = new GraphicsLayer({
| id: 'entityPolygonAll'
| });
|
|
| this._map.addLayer(this.addEntitys);
| this._map.addLayer(this.addEntitystra);
|
|
| this._map.addLayer(this.addPolygonEntitys);
| this._map.addLayer(this.entityPolygonAll);
|
| },
|
| startup: function () {
|
| objThis._map.addLayer(objThis._siteLayer);
|
|
| },
|
| getQueryStringByKey: function (key) {
| return (document.location.search.match(new RegExp("(?:^\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1];
| },
| location: function (ces) {
| var that = this;
| that.addEntitystra.clear();
| $.ajax({
| url: "/api/trar/selectLists?rid=" + ces.rwid + "&uid=" + ces.id,
| type: 'get',
| success: function (res) {
| if (res == "" || res == null){
| return;
| }
| var baid = res;
| var entityData = '';
| var entityArr = [];
| entityData = baid.match(/\(([^)]*)\)/);
| if (entityData && entityData != '') {
| entityData = entityData[1].split(',');
| for (var j = 0; j < entityData.length; j++) {
| entityArr.push([Number(entityData[j].split(' ')[0]), Number(entityData[j].split(' ')[1])]);
| }
|
| }
| that.addPolygonAlltra(that.addEntitystra, entityArr);
| that._map.centerAndZoom(new esri.geometry.Point(entityArr[Math.ceil(entityArr.length / 2)][0], entityArr[Math.ceil(entityArr.length / 2)][1], new esri.SpatialReference({wkid: 4326})), 14);
| }
| })
| },
| open: function () {
| var that = this;
| topic.subscribe("location", lang.hitch(this, this.location));
| var baid = decodeURI(that.getQueryStringByKey('baid'));
| var entityData = '';
| var entityArr = [];
| entityData = baid.match(/\(([^)]*)\)/);
| // 此时result=["(dsfasjfj3124123)", "dsfasjfj3124123"];
| if (entityData && entityData != '') {
| entityData = entityData[1].split(',');
| console.log(entityData, 1)
| for (var j = 0; j < entityData.length; j++) {
| entityArr.push([Number(entityData[j].split(' ')[0]), Number(entityData[j].split(' ')[1])]);
| // entityArr.push([Number(b[0]), Number(b[1])]);
| }
|
| }
| console.log(entityArr, 2)
| that.addPolygonAll(that.addEntitys, entityArr);
| that._map.centerAndZoom(new esri.geometry.Point(entityArr[Math.ceil(entityArr.length / 2)][0], entityArr[Math.ceil(entityArr.length / 2)][1], new esri.SpatialReference({wkid: 4326})), 14);
|
| },
| close: function () {
|
| },
| addPolygonAlltra: function (entitys, rings) {
| // entitys.clear();
| var graphic = null;
| var polylineSymbol = new SimpleLineSymbol();
| polylineSymbol.color = "#990707";
| polylineSymbol.width = 4;
| var polyline = new Polyline({
| "paths": [rings],
| "spatialReference": {
| "wkid": 4326
| }
| });
| graphic = new Graphic(polyline, polylineSymbol)
| entitys.add(graphic);
| },
| addPolygonAll: function (entitys, rings) {
| // entitys.clear();
| var graphic = null;
| var polylineSymbol = new SimpleLineSymbol();
| polylineSymbol.color = [255, 0, 0, 1];
| polylineSymbol.width = 4;
| var polyline = new Polyline({
| "paths": [rings],
| "spatialReference": {
| "wkid": 4326
| }
| });
| graphic = new Graphic(polyline, polylineSymbol)
| entitys.add(graphic);
| },
| addPoint: function (entitys, lgtd, lttd, img) {
| var symbol = new esri.symbol.PictureMarkerSymbol(img, 22, 32);
| symbol.xoffset = 0;
| symbol.yoffset = -2;
| var pt = new Point(lgtd, lttd, new SpatialReference({
| wkid: 4326
| }));
| var graphic = new esri.Graphic(pt, symbol);
| entitys.add(graphic);
| },
| /**
| * 添加实体的公共方法
| * @param {*} entitys 实体类
| * @param {Array} entityContent 存放每个点详细数据的数组
| * @param {string} name 实体的名字
| * @param {*} item 实体数据
| * @param {*} lgtd 经度
| * @param {*} lttd 纬度
| * @param {*} outlineColors 颜色
| */
| createEntitys: function (entitys, lgtd, lttd, image) {
|
| var symbol = new esri.symbol.PictureMarkerSymbol(image, 44, 44);
|
| var width = 44;
| var height = 44;
| var pt = new Point(lgtd, lttd, new SpatialReference({
| wkid: 4326
| }));
|
| var graphic = new esri.Graphic(pt, symbol);
|
| setInterval(function () {
| if (width >= 60) {
| width = 44;
| height = 44;
| }
| width += 1;
| height += 1;
| symbol.width = width;
| symbol.height = height;
| graphic.setSymbol(symbol)
| entitys.add(graphic);
| }, 50)
|
| },
| /**
| * 添加闪烁实体的公共方法
| * @param {*} entitys 实体类
| * @param {*} lgtd 经度
| * @param {*} lttd 纬度
| * @param {*} color 颜色
| */
| createTwinkleEntitys: function (entitys, lgtd, lttd, image, color) {
| var symbol = new esri.symbol.PictureMarkerSymbol(image, 64, 64);
| var width = 64;
| var height = 64;
| var pt = new Point(lgtd, lttd, new SpatialReference({
| wkid: 4326
| }));
|
| var graphic = new esri.Graphic(pt, symbol);
|
| setInterval(function () {
| if (width >= 80) {
| width = 64;
| height = 64;
| }
| width += 1;
| height += 1;
| symbol.width = width;
| symbol.height = height;
| graphic.setSymbol(symbol)
| entitys.add(graphic);
| }, 50)
| },
| addPoints: function (entitys, lgtd, lttd, img) {
| var symbol = new esri.symbol.PictureMarkerSymbol(img, 20, 20);
| var pt = new Point(lgtd, lttd, new SpatialReference({
| wkid: 4326
| }));
| var graphic = new esri.Graphic(pt, symbol);
| entitys.add(graphic);
| }
| });
| return Widget;
| });
|
|