egovamap 0.15.20 → 0.15.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1960 +1,2074 @@
1
-
2
- var scene = null;
3
-
4
- function getCookie(name){
5
- var strCookie = window.document.cookie;
6
- var arrCookie = strCookie.split("; ");
7
- for(var i=0; i<arrCookie.length; i++){
8
- var arr = arrCookie[i].split("=");
9
- if(arr[0]==name) return arr[1];
10
- }
11
- return null;
12
- }
13
-
14
- function setCookie(name,value){
15
- window.document.cookie = name+"="+value;
16
- }
17
-
18
- function checkGlobeServerURL(url,callback){
19
- if(!url) return;
20
-
21
- var cookieUrl = getCookie("globeGisUrl");
22
- var gisProxyList = url.split(";");
23
- cookieUrl && gisProxyList.push(cookieUrl);
24
- if(gisProxyList.length<=1){
25
- setCookie("globeGisUrl",url);
26
- callback(url);
27
- return ;
28
- }
29
- var params = {isLoad:false};
30
- for(var i in gisProxyList){
31
- checkGlobeProxy(gisProxyList[i],params,callback);
32
- }
33
- }
34
-
35
- function checkGlobeProxy(proxyUrl,params,callback) {
36
- var img = new Image();
37
- if(proxyUrl.indexOf("http")!=0){
38
- proxyUrl = window.location.origin+"/"+proxyUrl;
39
- }
40
- img.src = proxyUrl + '/symbol/default.png';
41
- img.onload = function (e1) {
42
- if(!params.isLoad){
43
- params.isLoad = true;
44
- setCookie("globeGisUrl",proxyUrl);
45
- callback(proxyUrl);
46
- }
47
- img = null;
48
- };
49
- }
50
-
51
- //初始化获取三维地图相关的配置参数,从三维服务端获取
52
- function initGlobeParams(context, callback) {
53
- context.globeParams = context.globeParams || {};
54
- //是否开启三维源代码调试,发布系统不得开启此开关
55
- context.globeParams.debug = false;
56
- //三维地图被禁用了,不再初始化三维地图
57
- if (context.globeParams.disable) {
58
- return;
59
- }
60
- context.globeParams.humanID = context.humanID;
61
- context.globeParams.globeEnabled = context.globeEnabled;
62
- context.globeParams.globeServerURL = context.globeServerURL;
63
- //context.globeParams.misURL = context.misURL;
64
- if (callback) {
65
- callback();
66
- }
67
- }
68
-
69
- var EGovaGlobeMap = function ($container, pScene, prefix, mapConfig, context, callback) {
70
- var that = this;
71
- scene = pScene;
72
- var parentScene = pScene.pageId || "parentScene";
73
- var msgPrefix = prefix || "globemappage";
74
- //var config = parent.config || '';
75
- //var humanID = parent.humanID || '';
76
- var prefix = 'msgPrefix=' + msgPrefix + '&parentScene=' + parentScene;
77
- that.globeVisible = false;
78
- that.globeLoaded = false;
79
- that.isLoading = false;
80
-
81
- that.mapConfig = mapConfig;
82
- that.$globeMapFrame = null;
83
- that.globeMapContainer = null;
84
- that.mapContainer = null;
85
-
86
- that.globeMapContainer = $container.getElementsByClassName("globemap-container")[0];
87
- if (!that.globeMapContainer) {
88
- var globeMapHTML = '<iframe class="globemap-iframe" webkitAllowFullScreen="true" mozallowfullscreen="true" allowFullScreen="true"></iframe>';
89
- var element = document.createElement("div");
90
- element.classList.add("globemap-container");
91
- element.innerHTML = globeMapHTML;
92
- $container.appendChild(element);
93
- that.globeMapContainer = element;
94
- }
95
- that.$globeMapFrame = that.globeMapContainer.getElementsByClassName("globemap-iframe")[0];
96
- that.mapContainer = $container.getElementsByClassName("emap-container")[0];
97
- that.init = function () {
98
-
99
- var loadingGlobe = function(serverURL, callback){
100
- //判断是否采用了延迟加载,如果没有采用,就在初始化时加载地图
101
- if (!context.globeParams.lazyloading) {
102
- if (!that.globeLoaded && !that.isLoading) {
103
- var globeParams = context.globeParams;
104
- var globeConfig = {
105
- humanID: globeParams.humanID,
106
- globeEnabled: globeParams.globeEnabled,
107
- globeServerURL: globeParams.globeServerURL
108
- };
109
- that.globeConfig=globeConfig;
110
- globeConfig.globeServerURL = serverURL || globeConfig.globeServerURL;
111
- globeParams.globeServerURL = globeConfig.globeServerURL; //服务地址写回全局配置,其他地方可能会用到
112
- var proxyURL = serverURL + '/home/gis/proxy.htm';
113
- that.isLoading = true;
114
- var globeMapUrl = context.rootPath +context.assetsPath+ "/globe.html?" + prefix + '&serverURL=' + globeConfig.globeServerURL +
115
- "&proxyURL=" + proxyURL + "&humanID=" + globeConfig.humanID;
116
- if (context.globeParams.debug) {
117
- globeMapUrl += '&debug=true';
118
- }
119
- if (context.misURL) {
120
- globeMapUrl = globeMapUrl + '&misURL=' + context.misURL;
121
- }
122
- if (mapConfig != undefined && mapConfig.mapconfig3D != undefined) {
123
- for (var item in mapConfig.mapconfig3D) {
124
- globeMapUrl += "&" + item + "=" + encodeURIComponent(mapConfig.mapconfig3D[item]);
125
- }
126
- }
127
- if(context.initAnimation){
128
- for(var item in context.initAnimation){
129
- globeMapUrl += "&initAnimation_" + item + "=" + encodeURIComponent(context.initAnimation[item]);
130
- }
131
- }
132
- that.$globeMapFrame.src = globeMapUrl;
133
- that.$globeMapFrame.onload = function(){
134
- if(!this.contentDocument.documentElement.getElementsByTagName("head").item(0).outerHTML.includes("initGlobe.js")) {
135
- var mainScript = this.contentDocument.createElement("script");
136
- mainScript.setAttribute("type", "text/javascript");
137
- mainScript.setAttribute("src", serverURL + "/library/globe/api/initGlobe.js");
138
- this.contentDocument.documentElement.getElementsByTagName("head").item(0).appendChild(mainScript);
139
- }
140
- }
141
- }
142
- }
143
- //callback && callback();
144
- };
145
-
146
- context.globeCallBack = callback;
147
- checkGlobeServerURL(context.globeServerURL || context.gisServerURL, function(serverURL) {
148
- context.globeServerURL = serverURL;
149
- initGlobeParams(context, function(){
150
- loadingGlobe(context.globeServerURL, context.globeCallBack);
151
- });
152
- });
153
-
154
- //初始化时不显示地图
155
- that.closeGlobe();
156
- //YSP:这句代码需要加上,否则导致第一次二三维切换,位置不同步
157
- that.globeMapContainer.style.display = 'none';
158
- // 三维加载完毕后
159
- //that.bindEvent("globeLoadedCallback", that.onGlobeLoaded);
160
-
161
- that.bindEvent("globeLoadedCallback", function(){
162
- that.onGlobeLoaded(callback);
163
- });
164
-
165
- };
166
-
167
-
168
- /* 绑定事件 */
169
- that.bindEvent = function (msgId, msgHandler, stopOnTop) {
170
- if (scene == null)
171
- return;
172
- scene.on(msgPrefix + ":" + msgId, msgHandler, parentScene, stopOnTop);
173
- };
174
- /* 触发事件 */
175
- that.fireEvent = function (msgId, msgData, stopOnTop) {
176
- if (scene == null)
177
- return;
178
- scene.fire(msgPrefix + ":" + msgId, msgData, parentScene, stopOnTop);
179
- }
180
- /* 移除监听 */
181
- that.removeEventBind = function (msgId, stopOnTop) {
182
- if (scene == null)
183
- return;
184
- scene.remove(msgPrefix + ":" + msgId, parentScene, stopOnTop);
185
- }
186
-
187
- that.dispatchSceneEvent = function (msgId, msgData) {
188
- if (scene == null)
189
- return;
190
- scene.fire(msgPrefix + ":" + msgId, {args: msgData}, parentScene, false);
191
- }
192
-
193
- that.onGlobeLoaded = function (callback) {
194
- that.isLoading = false;
195
- that.globeLoaded = true;
196
- callback && callback();
197
- //设置工具条的样式和位置
198
- //that.fireEvent("setToolBarStyle", {args:["left", "H", true, {top:'70px',left:'20px'}]});
199
- }
200
-
201
- /** *****************************三维地图API************************ */
202
-
203
- /**
204
- * 三维窗口关闭
205
- */
206
- that.closeGlobe = function (evt) {
207
- that.globeMapContainer.style.display = 'block';
208
- that.globeMapContainer.style.height = '0';
209
- that.globeVisible = false;
210
- }
211
-
212
- /**
213
- * 三维显示
214
- *
215
- * @param res
216
- */
217
- that.openGlobe = function (evt) {
218
- if (!that.globeVisible) { // 初次定位时调整布局
219
- if (!that.globeLoaded && !that.isLoading) {
220
- var loadingGlobe = function (serverURL) {
221
- that.globeConfig=that.globeConfig||{};
222
- that.globeConfig.globeServerURL = serverURL || that.globeConfig.globeServerURL;
223
-
224
- // By hth 2021/4/12: 注释下面逻辑不明,注释掉
225
- // that.globeParams=that.globeParams||{};
226
- // that.globeParams.globeServerURL = that.globeConfig.globeServerURL; //服务地址写回全局配置,其他地方可能会用到
227
- var globeParams = context.globeParams;
228
- that.globeConfig.humanID = globeParams.humanID || that.globeConfig.humanID;
229
- that.globeConfig.globeServerURL = globeParams.globeServerURL || that.globeConfig.globeServerURL;
230
-
231
- var proxyURL = serverURL + '/home/gis/proxy.htm';
232
- that.isLoading = true;
233
- var globeMapUrl = context.rootPath +context.assetsPath + "/globe.html?" + prefix + '&serverURL=' + that.globeConfig.globeServerURL +
234
- "&proxyURL=" + proxyURL + "&humanID=" + that.globeConfig.humanID;
235
- if(context.globeParams.debug) {
236
- globeMapUrl += '&debug=true';
237
- }
238
- if (context.misURL) {
239
- globeMapUrl = globeMapUrl + '&misURL=' + context.misURL;
240
- }
241
- if (mapConfig != undefined && mapConfig.mapconfig3D != undefined) {
242
- for (var item in mapConfig.mapconfig3D) {
243
- globeMapUrl += "&" + item + "=" + encodeURIComponent(mapConfig.mapconfig3D[item]);
244
- }
245
- }
246
- if(context.initAnimation){
247
- for(var item in context.initAnimation){
248
- globeMapUrl += "&initAnimation_" + item + "=" + encodeURIComponent(context.initAnimation[item]);
249
- }
250
- }
251
- that.$globeMapFrame.src=globeMapUrl;
252
- that.$globeMapFrame.onload = function(){
253
- if(!this.contentDocument.documentElement.getElementsByTagName("head").item(0).outerHTML.includes("initGlobe.js")) {
254
- var mainScript = this.contentDocument.createElement("script");
255
- mainScript.setAttribute("type", "text/javascript");
256
- mainScript.setAttribute("src", serverURL + "/library/globe/api/initGlobe.js");
257
- this.contentDocument.documentElement.getElementsByTagName("head").item(0).appendChild(mainScript);
258
- }
259
- }
260
- }
261
- checkGlobeServerURL(context.globeServerURL || context.gisServerURL, function(serverURL) {
262
- context.globeServerURL = serverURL;
263
- if(context.globeParams!=undefined)
264
- loadingGlobe(context.globeServerURL)
265
- else
266
- initGlobeParams(context,function(){
267
- loadingGlobe(context.globeServerURL)
268
- });
269
- });
270
- }
271
-
272
- that.globeMapContainer.style.height = '100%';
273
- that.globeMapContainer.style.display = 'block';
274
- that.globeVisible = true;
275
- }
276
- }
277
-
278
- /**
279
- * 延时三维内部请求
280
- */
281
- that.delayRequest = function(time){
282
- if (scene == null)
283
- return;
284
-
285
- scene.fire((msgPrefix + ":delayRequest"), {args: [time]}, parentScene, false);
286
- }
287
-
288
- /**
289
- * 添加相机事件
290
- */
291
- that.getCameraMes = function(callback){
292
- if (scene == null)
293
- return;
294
- scene.fire((msgPrefix + ":getCameraMes"), {args: [callback]}, parentScene, false);
295
- }
296
-
297
- /**
298
- * 限制相机视角操作
299
- */
300
- that.setCameraLimitOptions = function(options){
301
- if (scene == null)
302
- return;
303
-
304
- scene.fire((msgPrefix + ":setCameraLimitOptions"), {args: [options]}, parentScene, false);
305
- }
306
-
307
- /**
308
- * 添加相机事件
309
- */
310
- that.addCameraEvent = function(id, fn, obj, type){
311
- if (scene == null)
312
- return;
313
-
314
- scene.fire((msgPrefix + ":addCameraEvent"), {args: [id, fn, obj, type]}, parentScene, false);
315
- };
316
-
317
- /**
318
- * 清除相机事件
319
- */
320
- that.removeCameraEvent = function(id){
321
- if (scene == null)
322
- return;
323
-
324
- scene.fire((msgPrefix + ":removeCameraEvent"), {args: [id]}, parentScene, false);
325
- };
326
-
327
- /**
328
- * 添加鼠标事件
329
- */
330
- that.addMouseEvent = function(id, fn, obj, type){
331
- if (scene == null)
332
- return;
333
- scene.fire((msgPrefix + ":addMouseEvent"), {args: [id, fn, obj, type]}, parentScene, false);
334
- };
335
-
336
- /**
337
- * 清除鼠标事件
338
- */
339
- that.removeMouseEvent = function(id){
340
- if (scene == null)
341
- return;
342
- scene.fire((msgPrefix + ":removeMouseEvent"), {args: [id]}, parentScene, false);
343
- };
344
-
345
- /**
346
- * 环视飞行
347
- */
348
- that.startLoopView = function(rotateTime){
349
- if (scene == null)
350
- return;
351
- scene.fire((msgPrefix + ":startLoopView"), {args: [rotateTime]}, parentScene, false);
352
- };
353
- /**
354
- * 播放飞行路径文件
355
- */
356
- that.flyPath=function (options) {
357
- if (scene == null)
358
- return;
359
- scene.fire((msgPrefix + ":flyPath"), {args: [options]}, parentScene, false);
360
- }
361
- that.pausePath=function(){
362
- if (scene == null)
363
- return;
364
- scene.fire((msgPrefix + ":pausePath"), {args: []}, parentScene, false);
365
- }
366
-
367
- that.flyTo=function(lon, lat, height, heading, pitch, roll, duration){
368
- if (scene == null)
369
- return;
370
- scene.fire((msgPrefix + ":flyTo"), {args: [lon, lat, height, heading, pitch, roll, duration]}, parentScene, false);
371
- }
372
-
373
- that.showPolylineTrail = function(infoJson, zoom, clear){
374
- if (scene == null)
375
- return;
376
- scene.fire((msgPrefix + ":showPolylineTrail"),{args:[infoJson, zoom, clear]},parentScene,false);
377
- }
378
-
379
- /* 绘制点 */
380
- that.showPoint = function(jsonInfo, zoom, clear, zoomOptions, layerName, clickCallback, mouseOverCallBack){
381
- if (scene == null)
382
- return;
383
-
384
- layerName = layerName || "point";
385
- var clickBackName = "showPointClick" + layerName;
386
- var mouseOverBackName = "showPointMouseMove" + layerName;
387
-
388
- that.removeEventBind(clickBackName);
389
- that.removeEventBind(mouseOverBackName);
390
- var clickEnable = false;
391
- var mouseOverEnable = false;
392
-
393
- if(clickCallback instanceof Function){
394
- that.bindEvent(clickBackName, function(evt) {
395
- clickCallback(evt.args);
396
- });
397
- clickEnable = true;
398
- }
399
-
400
- if(mouseOverCallBack instanceof Function){
401
- that.bindEvent(mouseOverBackName, function(evt) {
402
- mouseOverCallBack(evt.args);
403
- });
404
- mouseOverEnable = true;
405
- }
406
-
407
- scene.fire((msgPrefix + ":showPoint"), {args: [jsonInfo, zoom, clear, zoomOptions, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
408
-
409
- }
410
- //底图切换功能
411
- that.switchLayer = function (options) {
412
- if (scene == null)
413
- return;
414
- scene.fire((msgPrefix + ":switchLayer"), { args: [options] }, parentScene, false);
415
- }
416
- that.addBaseLayers=function(options,clear){
417
- if (scene == null)
418
- return;
419
- scene.fire((msgPrefix + ":addBaseLayers"), {args: [options,clear]}, parentScene, false);
420
- }
421
- //测距测面功能
422
- that.measure = function (options) {
423
- if (scene == null)
424
- return;
425
- scene.fire((msgPrefix + ":measure"), { args: [options] }, parentScene, false);
426
- }
427
- //服务配置功能
428
- that.configServiceLayer = function (jsonInfo, option, layerName) {
429
- if (scene == null)
430
- return;
431
- scene.fire((msgPrefix + ":configServiceLayer"), { args: [jsonInfo, option, layerName] }, parentScene, false);
432
- }
433
- /* 显示面*/
434
- that.showPolygon = function (jsonInfo, drawWay, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, circleDragCallback) {
435
- if (scene == null)
436
- return;
437
- // 移除监听
438
-
439
- layerName = layerName || "polygon";
440
- var clickBackName = "showPolygonClick" + layerName;
441
- var mouseOverBackName = "showPolygonMouseMove" + layerName;
442
- var dragCircleBackName = "dragCircle" + layerName;
443
-
444
- that.removeEventBind(clickBackName);
445
- that.removeEventBind(mouseOverBackName);
446
- that.removeEventBind(dragCircleBackName);
447
-
448
- var clickEnable = false;
449
- var mouseOverEnable = false;
450
- var dragCircleCallBackEnable = false;
451
-
452
- if (clickCallback instanceof Function) {
453
- that.bindEvent(clickBackName, function (evt) {
454
- clickCallback(evt.args);
455
- });
456
- clickEnable = true;
457
- }
458
-
459
- if (mouseOverCallBack instanceof Function) {
460
- that.bindEvent(mouseOverBackName, function (evt) {
461
- mouseOverCallBack(evt.args);
462
- });
463
- mouseOverEnable = true;
464
- }
465
-
466
- if (circleDragCallback instanceof Function) {
467
- that.bindEvent(dragCircleBackName, function (evt) {
468
- circleDragCallback(evt.args);
469
- });
470
- dragCircleCallBackEnable = true;
471
- }
472
-
473
- scene.fire((msgPrefix + ":showPolygon"), { args: [jsonInfo, drawWay, zoom, clear, options, layerName, clickEnable, mouseOverEnable,dragCircleCallBackEnable] }, parentScene, false);
474
- };
475
- /* 显示空中单点全景*/
476
- that.showMMSPoint = function(pointJsonInfo, radarJsonInfo, layerName, options, clickCallback, mouseOverCallBack){
477
- if (scene == null)
478
- return;
479
-
480
- layerName = layerName || "addMMSPoint";
481
-
482
- var clickBackName = "addMMSPointClick" + layerName;
483
- var mouseOverBackName = "addMMSPointMouseMove" + layerName;
484
-
485
- that.removeEventBind(clickBackName);
486
- that.removeEventBind(mouseOverBackName);
487
-
488
- var clickEnable = false;
489
- var mouseOverEnable = false;
490
-
491
- if (clickCallback instanceof Function) {
492
- that.bindEvent(clickBackName, function (evt) {
493
- clickCallback(evt.args);
494
- });
495
- clickEnable = true;
496
- }
497
-
498
- if (mouseOverCallBack instanceof Function) {
499
- that.bindEvent(mouseOverBackName, function (evt) {
500
- mouseOverCallBack(evt.args);
501
- });
502
- mouseOverEnable = true;
503
- }
504
-
505
- scene.fire((msgPrefix + ":showMMSPoint"), { args: [pointJsonInfo, radarJsonInfo, layerName, options, clickEnable, mouseOverEnable]}, parentScene, false);
506
- };
507
-
508
- /* 显示3dmodel*/
509
- that.add3dModel = function (jsonInfo, zoom, clear, options, layerName, clickCallback, mouseOverCallBack) {
510
- if (scene == null)
511
- return;
512
-
513
- layerName = layerName || "add3dModel";
514
-
515
- var clickBackName = "add3dModelClick" + layerName;
516
- var mouseOverBackName = "add3dModelMouseMove" + layerName;
517
-
518
- that.removeEventBind(clickBackName);
519
- that.removeEventBind(mouseOverBackName);
520
-
521
- var clickEnable = false;
522
- var mouseOverEnable = false;
523
-
524
- if (clickCallback instanceof Function) {
525
- that.bindEvent(clickBackName, function (evt) {
526
- clickCallback(evt.args);
527
- });
528
- clickEnable = true;
529
- }
530
-
531
- if (mouseOverCallBack instanceof Function) {
532
- that.bindEvent(mouseOverBackName, function (evt) {
533
- mouseOverCallBack(evt.args);
534
- });
535
- mouseOverEnable = true;
536
- }
537
-
538
- scene.fire((msgPrefix + ":add3dModel"), { args: [jsonInfo, zoom, clear, options, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
539
- };
540
-
541
- /* 模型操作 */
542
- that.setModelOperation = function (jsonInfo, zoom, clear, options, modelName) {
543
- if (scene == null)
544
- return;
545
-
546
- scene.fire((msgPrefix + ":setModelOperation"), { args: [jsonInfo, zoom, clear, options, modelName]}, parentScene, false);
547
- };
548
-
549
-
550
- /* 显示线 */
551
- that.showPolyline = function(jsonInfo, zoom, clear, zoomOptions, layerName, clickCallback, mouseOverCallBack){
552
- if (scene == null)
553
- return;
554
- // 移除监听
555
-
556
- layerName = layerName || "polyline";
557
- var clickBackName = "showPolylineClick" + layerName;
558
- var mouseOverBackName = "showPolylineMouseMove" + layerName;
559
-
560
- that.removeEventBind(clickBackName);
561
- that.removeEventBind(mouseOverBackName);
562
- var clickEnable = false;
563
- var mouseOverEnable = false;
564
-
565
- if(clickCallback instanceof Function){
566
- that.bindEvent(clickBackName, function(evt) {
567
- clickCallback(evt.args);
568
- });
569
- clickEnable = true;
570
- }
571
-
572
- if(mouseOverCallBack instanceof Function){
573
- that.bindEvent(mouseOverBackName, function(evt) {
574
- mouseOverCallBack(evt.args);
575
- });
576
- mouseOverEnable = true;
577
- }
578
-
579
- scene.fire((msgPrefix + ":showPolyline"), {args: [jsonInfo, zoom, clear, zoomOptions, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
580
- };
581
-
582
- /* 显示区域 */
583
- that.showDistrict= function(jsonInfo, zoom, clear, options, layerName, clickCallback, mouseOverCallBack){
584
- if (scene == null)
585
- return;
586
- // 移除监听
587
-
588
- layerName = layerName || "district";
589
- var clickBackName = "showDistrictClick" + layerName;
590
- var mouseOverBackName = "showDistrictMouseMove" + layerName;
591
-
592
- that.removeEventBind(clickBackName);
593
- that.removeEventBind(mouseOverBackName);
594
- var clickEnable = false;
595
- var mouseOverEnable = false;
596
-
597
- if(clickCallback instanceof Function){
598
- that.bindEvent(clickBackName, function(evt) {
599
- clickCallback(evt.args);
600
- });
601
- clickEnable = true;
602
- }
603
-
604
- if(mouseOverCallBack instanceof Function){
605
- that.bindEvent(mouseOverBackName, function(evt) {
606
- mouseOverCallBack(evt.args);
607
- });
608
- mouseOverEnable = true;
609
- }
610
-
611
- scene.fire((msgPrefix + ":showDistrict"), {args: [jsonInfo, zoom, clear, options, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
612
- };
613
-
614
- //鹰眼相关
615
- that.addEagleMap = function (options, containID) {
616
- if (scene == null)
617
- return;
618
- scene.fire((msgPrefix + ":addEagleMap"), { args: [options, containID] }, parentScene, false);
619
- };
620
-
621
- that.eagleMapVisible = function (visible) {
622
- if (scene == null)
623
- return;
624
- scene.fire((msgPrefix + ":eagleMapVisible"), { args: [visible] }, parentScene, false);
625
- };
626
-
627
- that.computerBar=function(jsonInfo, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack){
628
- if (scene == null)
629
- return;
630
- scene.fire((msgPrefix + ":computerBar"),{args:[jsonInfo, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack]},parentScene,false);
631
- };
632
-
633
- that.sceneSwitch=function(name, options){
634
- if (scene == null)
635
- return;
636
- scene.fire((msgPrefix + ":sceneSwitch"),{args:[name, options]},parentScene,false);
637
- };
638
-
639
- that.showWater=function(waterJsonUrl,waterRoadJsonUrl,options){
640
- if (scene == null)
641
- return;
642
- scene.fire((msgPrefix + ":showWater"),{args:[waterJsonUrl,waterRoadJsonUrl,options]},parentScene,false);
643
- };
644
-
645
- that.drawGeoJsonPolygon=function(options,layerName){
646
- if (scene == null)
647
- return;
648
- that.fireEvent("drawGeoJsonPolygon", {args: [options,layerName]}, false);
649
- };
650
-
651
- that.drawGeoJsonPoint=function(options,layerName){
652
- if (scene == null)
653
- return;
654
- that.fireEvent("drawGeoJsonPoint", {args: [options,layerName]}, false);
655
- };
656
-
657
- that.showMultiRecPostion=function(jsonInfo, zoom, labelInfo, clear,zoomOptions,callback){
658
- if (scene == null)
659
- return;
660
- scene.fire((msgPrefix + ":showMultiRecPostion"), {args: [jsonInfo, zoom, labelInfo, clear,zoomOptions,callback]}, parentScene, false);
661
- };
662
-
663
- that.showPolylineMovingGlow=function(jsonInfo, zoom, clear,zoomOptions){
664
- if (scene == null)
665
- return;
666
- scene.fire((msgPrefix + ":showPolylineMovingGlow"), {args: [jsonInfo, zoom, clear,zoomOptions]}, parentScene, false);
667
- };
668
-
669
- that.setGradientStyle=function(obj, style){
670
- if (scene == null)
671
- return;
672
- scene.fire((msgPrefix + ":setGradientStyle"), {args: [obj, style]}, parentScene, false);
673
- };
674
-
675
- that.setBuildingColor=function(obj, keyFiled, valueColors){
676
- if (scene == null)
677
- return;
678
- scene.fire((msgPrefix + ":setBuildingColor"), {args: [obj, keyFiled, valueColors]}, parentScene, false);
679
- };
680
-
681
- //hth 2021-08-31 移除第五个callback参数,经过确认前端金鑫那边调用本接口实际只使用了4个参数
682
- //切在register.js内部已经进行了callback事件触发
683
- that.showHeatImage3D = function(info, zoom, clear, options){
684
- if (scene == null)
685
- return;
686
-
687
- // that.removeEventBind("showHeatImage3DCallback");
688
-
689
- // if (callback !== undefined) {
690
- // that.bindEvent("showHeatImage3DCallback", function (evt) {
691
- // callback(evt.args);
692
- // });
693
- // }
694
-
695
- scene.fire((msgPrefix + ":showHeatImage3D"), {args: [info, zoom, clear, options]}, parentScene, false);
696
- };
697
-
698
- that.setHeatmapOptions=function(options, layerName, id){
699
- if (scene == null)
700
- return;
701
- scene.fire((msgPrefix + ":setHeatmapOptions"), {args: [options, layerName, id]}, parentScene, false);
702
- };
703
-
704
- that.clearHeatImage3D = function(){
705
- if (scene == null)
706
- return;
707
-
708
- scene.fire((msgPrefix + ":clearHeatImage3D"), {args: []}, parentScene, false);
709
- };
710
-
711
- that.updateHeatRec=function(levelNum){
712
- if (scene == null)
713
- return;
714
- scene.fire((msgPrefix + ":updateHeatRec"), {args: [levelNum]}, parentScene, false);
715
- }
716
-
717
- that.cartographicToWindow=function(coord,callback){
718
- if (scene == null)
719
- return;
720
- scene.fire((msgPrefix + ":cartographicToWindow"), {args: [coord,callback]}, parentScene, false);
721
- }
722
-
723
- /**
724
- * 模型回调信息
725
- */
726
- that.getModelClickMes = function(clickCallback) {
727
- if (scene == null)
728
- return;
729
-
730
- that.removeEventBind("getModelClickMesCallback");
731
- if (clickCallback != undefined) {
732
- that.bindEvent("getModelClickMesCallback", function (evt) {
733
- clickCallback(evt.args);
734
- });
735
- }
736
-
737
- scene.fire((msgPrefix + ":getModelClickMes"), {args: []}, parentScene, false);
738
- };
739
-
740
- /* 获取地图的当前范围 */
741
- that.getMapExtent = function (callback) {
742
- if (scene == null)
743
- return;
744
-
745
- // 移除监听
746
- scene.remove(msgPrefix + ":getMapExtentCallback", parentScene, false);
747
-
748
- scene.on(msgPrefix + ":getMapExtentCallback", function (evt) {
749
- // 移除监听
750
- scene.remove(msgPrefix + ":getMapExtentCallback", parentScene, false);
751
- callback(evt.args);
752
- }, parentScene, false);
753
- scene.fire((msgPrefix + ":getMapExtent"), {args: []}, parentScene, false);
754
- }
755
-
756
- /* 缩放到指定范围 */
757
- that.zoomToExtent = function (minX, minY, maxX, maxY, duration, rotate) {
758
- if (scene == null)
759
- return;
760
- duration = Number(duration);
761
- rotate = Boolean(rotate);
762
- that.fireEvent("zoomToExtent", {args: [Number(minX), Number(minY), Number(maxX), Number(maxY), duration, rotate]}, false);
763
- }
764
-
765
- /**地表热力 */
766
- that.addGlobeHeatMap = function(data, option, zoom){
767
- if (scene == null)
768
- return;
769
- that.fireEvent("addHeatMap", {args: [data, option, zoom]}, false);
770
- }
771
-
772
- /*清除地表热力*/
773
- that.removeGlobeHeatMap=function(){
774
- if (scene == null)
775
- return;
776
- scene.fire((msgPrefix + ":removeHeatMap"), {args: []}, parentScene, false);
777
- }
778
-
779
- /* 缩放到指定中心点和级别 */
780
- that.centerAndZoom = function(x, y, level, heading, picth, duration, opt) {
781
- if (scene == null)
782
- return;
783
- that.fireEvent("centerAndZoom", {args: [x, y, level, heading, picth, duration, opt]}, false);
784
- }
785
-
786
- /* 缩放到指定级别 */
787
- that.zoomToLevel = function (level, duration) {
788
- if (scene == null)
789
- return;
790
-
791
- that.fireEvent("zoomToLevel", {args: [level, duration]}, false);
792
- }
793
-
794
- //三维场景按照中心点旋转,更方便查看
795
- that.rotateScene = function (heading, pitch, roll, duration, callback) {
796
- if (scene == null)
797
- return;
798
- that.fireEvent("rotateScene", {args: [heading, pitch, roll, duration, callback]}, false);
799
- }
800
-
801
- /* 清除指定图形 */
802
- that.clearGraphic = function (id) {
803
- if (scene == null)
804
- return;
805
- if (typeof id != "string") {
806
- id = id.join(",");
807
- }
808
- scene.fire((msgPrefix + ":clearGraphic"), {args: [id]}, parentScene, false);
809
- }
810
-
811
- /* 清除全部图形 */
812
- that.clearAllGraphics = function (id) {
813
- if (scene == null)
814
- return;
815
- scene.fire((msgPrefix + ":clearAllGraphics"), {args: []}, parentScene, false);
816
- }
817
-
818
- /**
819
- * 清除一些动态绘制效果
820
- */
821
- that.clearAllDynamicGraphics = function(){
822
- if (scene == null)
823
- return;
824
-
825
- scene.fire((msgPrefix + ":clearAllDynamicGraphics"), {args: []}, parentScene, false);
826
- }
827
-
828
- /**
829
- *恢复初始化
830
- */
831
-
832
- that.restoreInitConfig = function () {
833
- if (scene == null)
834
- return;
835
-
836
- scene.fire((msgPrefix + ":restoreInitConfig"), {args: []}, parentScene, false);
837
- }
838
-
839
- /**
840
- * 图层操作 清除
841
- */
842
- that.clearLayer = function(name,callback){
843
- if (scene == null)
844
- return;
845
-
846
- scene.fire((msgPrefix + ":clearLayer"), {args: [name,callback]}, parentScene, false);
847
- }
848
-
849
- /**
850
- * 图层操作 清除所有
851
- */
852
- that.clearAllLayer = function(skipNames){
853
- if (scene == null)
854
- return;
855
-
856
- scene.fire((msgPrefix + ":clearAllLayer"), {args: [skipNames]}, parentScene, false);
857
- }
858
-
859
- /**
860
- * 获取所有图层名
861
- */
862
- that.getAllLayer = function(callback){
863
- if (scene == null)
864
- return;
865
-
866
- // 移除监听
867
- that.removeEventBind("getAllLayerCallback");
868
- that.bindEvent("getAllLayerCallback", function(evt){
869
- callback && callback(evt.args);
870
- });
871
-
872
- scene.fire((msgPrefix + ":getAllLayer"), {args: []}, parentScene, false);
873
-
874
- }
875
-
876
- /**
877
- * 图层操作 显隐切换
878
- */
879
- that.toggleLayer = function(name){
880
- if (scene == null)
881
- return;
882
-
883
- scene.fire((msgPrefix + ":toggleLayer"), {args: [name]}, parentScene, false);
884
- }
885
-
886
- /**
887
- * 图层操作 显示
888
- */
889
- that.showLayer = function(name){
890
- if (scene == null)
891
- return;
892
-
893
- scene.fire((msgPrefix + ":showLayer"), {args: [name]}, parentScene, false);
894
- }
895
-
896
- /**
897
- * 图层操作 隐藏
898
- */
899
- that.hideLayer = function(name){
900
- if (scene == null)
901
- return;
902
-
903
- scene.fire((msgPrefix + ":hideLayer"), {args: [name]}, parentScene, false);
904
- }
905
-
906
- /**
907
- * 图层操作 清除部分元素
908
- */
909
- that.clearLayerElement = function(name, ids){
910
- if (scene == null)
911
- return;
912
-
913
- scene.fire((msgPrefix + ":clearLayerElement"), {args: [name, ids]}, parentScene, false);
914
- }
915
-
916
- /**
917
- * 图层操作 点击元素
918
- */
919
- that.clickLayerElement = function(name, id){
920
- if (scene == null)
921
- return;
922
-
923
- scene.fire((msgPrefix + ":clickLayerElement"), {args: [name, id]}, parentScene, false);
924
- }
925
-
926
- /**
927
- * 图层操作 飞向元素
928
- */
929
- that.flyToLayerElement = function(name, id, options){
930
- if (scene == null)
931
- return;
932
-
933
- scene.fire((msgPrefix + ":flyToLayerElement"), {args: [name, id, options]}, parentScene, false);
934
- }
935
-
936
- /**
937
- * 控制图层显示级别
938
- */
939
-
940
- that.setLayerVisiableLevel = function(name, beginLevel, endLevel){
941
- if (scene == null)
942
- return;
943
-
944
- scene.fire((msgPrefix + ":setLayerVisiableLevel"), {args: [name, beginLevel, endLevel]}, parentScene, false);
945
- }
946
-
947
- that.getLayerVisiableLevel = function(name, callback){
948
- if (scene == null)
949
- return;
950
-
951
- that.removeEventBind("getLayerVisiableLevelCallback");
952
- if (callback != undefined) {
953
- that.bindEvent("getLayerVisiableLevelCallback", function (evt) {
954
- callback(evt.args);
955
- });
956
- }
957
- scene.fire((msgPrefix + ":getLayerVisiableLevel"), {args: [name]}, parentScene, false);
958
- }
959
-
960
- /**
961
- * 控制模型显示级别
962
- */
963
-
964
- that.setModelVisiableLevel = function(obj, beginLevel, endLevel){
965
- if (scene == null)
966
- return;
967
-
968
- scene.fire((msgPrefix + ":setModelVisiableLevel"), {args: [obj, beginLevel, endLevel]}, parentScene, false);
969
- }
970
-
971
- /**
972
- * 道路图层绘制 road
973
- */
974
- that.buildRoad = function(jsonInfo, zoom, clear, zoomOptions){
975
- if (scene == null)
976
- return;
977
-
978
- scene.fire((msgPrefix + ":buildRoad"), {args: [jsonInfo, zoom, clear, zoomOptions]}, parentScene, false);
979
- }
980
-
981
- /**
982
- * 绘制桥 buildBridge
983
- */
984
- that.buildBridge = function(jsonInfo, zoom, clear, options, layerName, clickCallback, mouseOverCallBack){
985
- if (scene == null)
986
- return;
987
- // 移除监听
988
-
989
- layerName = layerName || "bridge";
990
- var clickBackName = "buildBridgeClick" + layerName;
991
- var mouseOverBackName = "buildBridgeMouseMove" + layerName;
992
-
993
- that.removeEventBind(clickBackName);
994
- that.removeEventBind(mouseOverBackName);
995
- var clickEnable = false;
996
- var mouseOverEnable = false;
997
-
998
- if(clickCallback instanceof Function){
999
- that.bindEvent(clickBackName, function(evt) {
1000
- clickCallback(evt.args);
1001
- });
1002
- clickEnable = true;
1003
- }
1004
-
1005
- if(mouseOverCallBack instanceof Function){
1006
- that.bindEvent(mouseOverBackName, function(evt) {
1007
- mouseOverCallBack(evt.args);
1008
- });
1009
- mouseOverEnable = true;
1010
- }
1011
-
1012
- scene.fire((msgPrefix + ":buildBridge"), {args: [jsonInfo, zoom, clear, options, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
1013
- }
1014
-
1015
- /**
1016
- * 绘制桥 build管网
1017
- */
1018
- that.drawPipe = function(jsonInfo, zoom, clear, options, layerName){
1019
- if (scene == null)
1020
- return;
1021
- // 移除监听
1022
-
1023
- scene.fire((msgPrefix + ":drawPipe"), {args: [jsonInfo, zoom, clear, options, layerName]}, parentScene, false);
1024
- }
1025
-
1026
- /*清除指定图层*/
1027
- that.clearGraphicLayerByID=function(id){
1028
- if(scene==null)
1029
- return;
1030
- if (typeof id != "string") {
1031
- id = id.join(",");
1032
- }
1033
- scene.fire((msgPrefix + ":clearGraphicLayerByID"), {args: [id]}, parentScene, false);
1034
- }
1035
-
1036
- that.drawWaveCircle=function(jsonInfo, styleOption, zoom, clear, layerName){
1037
- if (scene == null)
1038
- return;
1039
- scene.fire((msgPrefix + ":drawWaveCircle"), {args: [jsonInfo, styleOption, zoom, clear, layerName]}, false);
1040
- }
1041
-
1042
- that.getPartLayerTree=function(callback){
1043
- if (scene == null)
1044
- return;
1045
- scene.fire((msgPrefix + ":getPartLayerTree"), {args: [callback]}, false);
1046
- }
1047
-
1048
- that.showGlobePartLayer=function(layerNames,beginLevel,endLevel){
1049
- if (scene == null)
1050
- return;
1051
- scene.fire((msgPrefix + ":showGlobePartLayer"), {args: [layerNames,beginLevel,endLevel]}, false);
1052
- }
1053
-
1054
- that.getPartStatisticsJsonInfo=function(usageId,regionCode,regionName,where,orderField,returnTree,callBack){
1055
- if (scene == null)
1056
- return;
1057
- scene.fire((msgPrefix + ":getPartStatisticsJsonInfo"), {args: [usageId,regionCode,regionName,where,orderField,returnTree,callBack]}, false);
1058
- }
1059
- /**
1060
- * 显示案件分布
1061
- */
1062
- that.showRecListDistribution=function(jsonInfo, zoom, clickCallback, labelInfo){
1063
- if (scene == null)
1064
- return;
1065
- that.removeEventBind("showRecListDistributionCallback");
1066
- if (clickCallback != undefined) {
1067
- that.bindEvent("showRecListDistributionCallback", function (evt) {
1068
- clickCallback(evt.args);
1069
- });
1070
- }
1071
- if(that.globeLoaded)
1072
- scene.fire((msgPrefix + ":showRecListDistribution"), {args:[jsonInfo, zoom, labelInfo]}, parentScene, false);
1073
- }
1074
-
1075
- that.showPatrolCurrentPosition=function(jsonInfo, zoom, clear, highLightType){
1076
- if (scene == null)
1077
- return;
1078
- that.fireEvent("showPatrolCurrentPosition", {args: [jsonInfo, zoom, clear, highLightType]}, false);
1079
- };
1080
- /* 显示多个自定义图标 */
1081
- that.showMultiObjectCurrentPosition = function (jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickCallback, mouseOverCallBack) {
1082
- if (scene == null)
1083
- return;
1084
- // 移除监听
1085
- var clickBackName = "showMultiObjectCurrentPositionClick";
1086
- var mouseOverBackName = "showMultiObjectCurrentPositionMouseover";
1087
-
1088
- if(tagName){
1089
- clickBackName += tagName;
1090
- mouseOverBackName += tagName;
1091
- }
1092
-
1093
- that.removeEventBind(clickBackName);
1094
- that.removeEventBind(mouseOverBackName);
1095
- var clickEnable = false;
1096
- var mouseOverEnable = false;
1097
-
1098
- if(clickCallback instanceof Function){
1099
- that.bindEvent(clickBackName, function(evt) {
1100
- clickCallback(evt.args);
1101
- });
1102
- clickEnable = true;
1103
- }
1104
-
1105
- if(mouseOverCallBack instanceof Function){
1106
- that.bindEvent(mouseOverBackName, function(evt) {
1107
- mouseOverCallBack(evt.args);
1108
- });
1109
- mouseOverEnable = true;
1110
- }
1111
-
1112
- scene.fire((msgPrefix + ":showMultiObjectCurrentPosition"), {args: [jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickEnable, mouseOverEnable]}, parentScene, false);
1113
- };
1114
-
1115
- /**
1116
- * 创建dom空标签
1117
- */
1118
- that.createInnerHtml = function(jsonInfo, zoom, clear, tagName, options, callback) {
1119
- if (scene == null)
1120
- return;
1121
-
1122
- // 移除监听
1123
- that.removeEventBind("createInnerHtmlCallback" + tagName);
1124
- var args = Array.prototype.slice.call(arguments);
1125
- if (arguments[arguments.length - 1] instanceof Function) {
1126
- callback = arguments[arguments.length - 1];
1127
- args = args.slice(0, args.length - 1);
1128
- }
1129
-
1130
- if (callback != undefined) {
1131
- that.bindEvent("createInnerHtmlCallback" + tagName, function (evt) {
1132
- callback(evt.args);
1133
- });
1134
- }
1135
- scene.fire((msgPrefix + ":createInnerHtml"), {args: args}, parentScene, false);
1136
- };
1137
-
1138
- /* 显示车辆人员轨迹 */
1139
- that.showObjectTrace = function (objectID, symbolType, dateTime, queryCondition, hideControlPanel, symbolPic, optimizeParams, infoCallback, updatePositionCallback, closeCallback, traceDigCallback) {
1140
- if (scene == null)
1141
- return;
1142
- // 人员轨迹查询依赖GIS服务端
1143
- if (context.gisServerURL) {
1144
- var options = {};
1145
- var serviceUrl = context.gisServerURL + '/home/gis/patrol/getobjecttrace.htm';
1146
- options.traceService = serviceUrl;
1147
- options.dateTime = dateTime;
1148
- options.queryCondition = queryCondition;
1149
- options.hideControlPanel = hideControlPanel;
1150
- options.symbolPic = symbolPic;
1151
- options.optimizeParams = optimizeParams;
1152
- options.infoCallback = infoCallback;
1153
- options.updatePositionCallback = updatePositionCallback;
1154
- options.closeCallback = closeCallback;
1155
- options.traceDigCallback = traceDigCallback;
1156
- scene.fire(msgPrefix + ":showObjectTrace", {
1157
- args: [objectID, symbolType, options]
1158
- }, parentScene);
1159
- } else {
1160
- console.error("没有配置二维GIS服务端地址");
1161
- }
1162
- };
1163
-
1164
- /* 显示车辆人员轨迹 */
1165
- that.addObjectTrace = function (jsonInfo, symbolType, clear, showControlPanel, traceID, options) {
1166
- if (scene == null)
1167
- return;
1168
-
1169
- scene.fire((msgPrefix + ":addObjectTrace"), {args: [jsonInfo, symbolType, clear, showControlPanel, traceID, options]}, parentScene, false);
1170
- };
1171
-
1172
- /*设置轨迹属性 */
1173
- that.setTraceOptions = function(options){
1174
- if (scene == null)
1175
- return;
1176
- scene.fire((msgPrefix + ":setTraceOptions"), {args: [options]}, parentScene, false);
1177
- };
1178
-
1179
- /**
1180
- * 移动的雷达
1181
- */
1182
- that.movingRadar= function (jsonInfo, zoom, clear, options, layerName) {
1183
- scene.fire(msgPrefix + ":movingRadar", {args: [jsonInfo, zoom, clear, options, layerName]}, parentScene);
1184
- }
1185
-
1186
- /**
1187
- * 移动的图标
1188
- */
1189
- that.movingBillboard = function (jsonInfo, zoom, clear, layerName, options, clickEnable, moveEnable) {
1190
- scene.fire(msgPrefix + ":movingBillboard", { args: [jsonInfo, zoom, clear, layerName, options, clickEnable, moveEnable] }, parentScene);
1191
- }
1192
-
1193
- /*雷达扫描*/
1194
- that.circleRadarEffect = function (info, zoom, clear, options, layerName) {
1195
- if (scene == null)
1196
- return;
1197
- scene.fire((msgPrefix + ":circleRadarEffect"), { args: [info, zoom, clear, options, layerName] }, parentScene, false);
1198
- }
1199
-
1200
- /*光线射线*/
1201
- that.lightRay = function (jsonInfo, zoom, clear, options, layerName) {
1202
- if (scene == null)
1203
- return;
1204
- scene.fire((msgPrefix + ":lightRay"), { args: [jsonInfo, zoom, clear, options, layerName] }, parentScene, false);
1205
- }
1206
-
1207
-
1208
- that.getbuildBypolygon = function (info, color, zoom, clear, options, layerName) {
1209
- if (scene == null)
1210
- return;
1211
- scene.fire((msgPrefix + ":getbuildBypolygon"), { args: [info, color, zoom, clear, options, layerName] }, parentScene, false);
1212
- }
1213
-
1214
-
1215
-
1216
- /* 点到点的迁徙接口*/
1217
- that.showPolylineMoveMap= function (info, layerName, clear, zoom,options) {
1218
- if (scene == null)
1219
- return;
1220
- scene.fire((msgPrefix + ":showPolylineMoveMap"), { args: [info, layerName, clear, zoom, options] }, parentScene, false);
1221
- }
1222
-
1223
- /* 视频投影 */
1224
- that.beginProjection = function (options) {
1225
- if (scene == null)
1226
- return;
1227
-
1228
- scene.fire((msgPrefix + ":beginProjection"), { args: [options] }, parentScene, false);
1229
- }
1230
-
1231
- /* 道路悬浮注记*/
1232
- that.showMultiRoadText = function (jsonInfo, zoom, clear, tagName, clickEnable, mouseOverEnable) {
1233
- if (scene == null)
1234
- return;
1235
- scene.fire((msgPrefix + ":showMultiRoadText"), { args: [jsonInfo, zoom, clear, tagName, clickEnable, mouseOverEnable] }, parentScene, false);
1236
- }
1237
-
1238
- that.limitGlobeRange = function (extent) {
1239
- if (scene == null)
1240
- return;
1241
- scene.fire((msgPrefix + ":limitGlobeRange"), {args: [extent]}, parentScene, false);
1242
- };
1243
-
1244
- that.addChart = function(jsonInfo, zoom, clear, options, layerName , clickCallback, mouseOverCallBack) {
1245
- if (scene == null)
1246
- return;
1247
-
1248
- layerName = layerName || "chart";
1249
-
1250
- var clickBackName = "addChartClick" + layerName;
1251
- var mouseOverBackName = "addChartMouseMove" + layerName;
1252
-
1253
- that.removeEventBind(clickBackName);
1254
- that.removeEventBind(mouseOverBackName);
1255
-
1256
- var clickEnable = false;
1257
- var mouseOverEnable = false;
1258
-
1259
- if(clickCallback instanceof Function){
1260
- that.bindEvent(clickBackName, function(evt) {
1261
- clickCallback(evt.args);
1262
- });
1263
- clickEnable = true;
1264
- }
1265
-
1266
- if(mouseOverCallBack instanceof Function){
1267
- that.bindEvent(mouseOverBackName, function(evt) {
1268
- mouseOverCallBack(evt.args);
1269
- });
1270
- mouseOverEnable = true;
1271
- }
1272
-
1273
- scene.fire((msgPrefix + ":addChart"), {args: [jsonInfo, zoom, clear, options, layerName , clickEnable, mouseOverEnable]}, parentScene, false);
1274
- };
1275
- /**
1276
- * 鼠标点击模型查询
1277
- * @param callback
1278
- */
1279
- that.queryModelInfo=function(callback,type){
1280
- if (scene == null)
1281
- return;
1282
- scene.fire((msgPrefix + ":queryModelClick"), {args: [callback,type]}, parentScene, false);
1283
- };
1284
- /**
1285
- * 删除三维柱状图
1286
- */
1287
- that.removeChart = function() {
1288
- if (scene == null)
1289
- return;
1290
- scene.fire((msgPrefix + ":removeChart"), {args: []}, parentScene, false);
1291
- };
1292
-
1293
- that.flyToPoint=function(x,y,height){
1294
- if (scene == null)
1295
- return;
1296
- scene.fire((msgPrefix + ":flyToPoint"), {args: [x,y,height]}, parentScene, false);
1297
- };
1298
-
1299
- that.fullExtent=function(){
1300
- if (scene == null)
1301
- return;
1302
-
1303
- scene.fire((msgPrefix + ":fullExtent"), {args: []}, parentScene, false);
1304
- };
1305
-
1306
- that.goUnderGround=function(height){
1307
- if(scene == null)
1308
- return;
1309
- scene.fire((msgPrefix + ":goUnderGround"), {args: [height]}, parentScene, false);
1310
- };
1311
-
1312
- /* 显示视频闪烁点*/
1313
- that.addVideoAlarm = function (coordX, coorY, successFunc, hitCallback) {
1314
- if (scene == null)
1315
- return;
1316
- scene.fire(msgPrefix + ":addVideoAlarm", {args: [coordX, coorY, successFunc, hitCallback]}, parentScene);
1317
- };
1318
-
1319
- /* 显示面板信息*/
1320
- that.createPanelInfo = function (entity, successFunc) {
1321
- if (scene == null)
1322
- return;
1323
- scene.fire(msgPrefix + ":createPanelInfo", {args: [entity, successFunc]}, parentScene);
1324
- };
1325
-
1326
- /* 显示面板信息*/
1327
- that.createAnimateCar = function (objectID, successFunc) {
1328
- if (scene == null)
1329
- return;
1330
- scene.fire(msgPrefix + ":createAnimateCar", {args: [ objectID, successFunc]}, parentScene);
1331
- };
1332
-
1333
- /*根据id号删除一个视频闪烁点*/
1334
- that.removeVideoAlarm = function (id) {
1335
- if (scene == null)
1336
- return;
1337
- scene.fire(msgPrefix + ":removeVideoAlarm", {args: [id]}, parentScene);
1338
- };
1339
- /*地图上标注返回坐标值*/
1340
- that.pointSelect = function(symbolType, mapZoom2Point, clickCallback){
1341
- if (scene == null)
1342
- return;
1343
- that.removeEventBind("pointSelectCallback");
1344
- if (clickCallback != undefined) {
1345
- that.bindEvent("pointSelectCallback", function (position) {
1346
- that.removeEventBind("pointSelectCallback");
1347
- var resultPosition=[position.args[0].longitude+','+position.args[0].latitude];
1348
- resultPosition.push(position.args[0]);
1349
- clickCallback(resultPosition);
1350
- });
1351
- }
1352
- scene.fire((msgPrefix + ":pointSelect"), {args:[symbolType, mapZoom2Point]}, parentScene, false);
1353
- };
1354
-
1355
- /*根据要素坐标定位显示要素*/
1356
- that.locateFeatureByCoords=function(geometries, type, ID, style, hStyle,zoom,keyFiled,labelField,labelStyle,randomColor,renderCanvas,singleSelected,options){
1357
- if (scene == null)
1358
- return;
1359
- scene.fire((msgPrefix + ":locateFeatureByCoords"), { args : [geometries, type, ID, style, hStyle, zoom,keyFiled,labelField,labelStyle,randomColor,renderCanvas,singleSelected,options] }, parentScene, false);
1360
- };
1361
- /* 要素查询 */
1362
- that.queryFeature = function(params, callback) {
1363
- // 移除监听
1364
- that.removeEventBind("queryFeatureCallback");
1365
-
1366
- if (callback != undefined) {
1367
- that.bindEvent("queryFeatureCallback", function(evt) {
1368
- callback(evt.args);
1369
- });
1370
- }
1371
- scene.fire(msgPrefix + ":queryFeature", {args: [params.layerID, params.where || null, params.geometry || null, params.outFields, params.outGeometry, params.pointTolorence||0,params.startIndex,params.maxFeatures,params.queryID]}, parentScene);
1372
- }
1373
- /*绘制图形*/
1374
- that.drawGraphic = function(graphic, zoom, clickCallback) {
1375
- if (scene == null)
1376
- return;
1377
- if (graphic.geometry instanceof Array) {
1378
- graphic.type=graphic.type||graphic.geometry[0].type;
1379
- scene.fire(msgPrefix + ":locateFeatureByCoords", { args : [ graphic.geometry, graphic.type, graphic.id, graphic.style,
1380
- graphic.hstyle, zoom,graphic.keyField,graphic.labelField,graphic.labelStyle,graphic.colorNumber] }, parentScene);
1381
- } else {
1382
- graphic.type=graphic.type||graphic.geometry.type;
1383
- scene.fire(msgPrefix + ":locateFeatureByCoords", { args : [ [ graphic.geometry ], graphic.type, graphic.id, graphic.style,
1384
- graphic.hstyle, zoom ] }, parentScene);
1385
- }
1386
- that.removeEventBind("locateFeatureByIDsCallback");
1387
- if (clickCallback != undefined) {
1388
- that.bindEvent("locateFeatureByIDsCallback", function(evt) {
1389
- clickCallback(evt.args);
1390
- });
1391
- }
1392
- };
1393
- /* 标识位置 */
1394
- that.markMap = function(projectTypeID, eventTypeID, actPropertyID, displayStyleID, layerID, clickCallback,cellIndexName,point) {
1395
- if (scene == null)
1396
- return;
1397
- var eventInfo={
1398
- actpropertyid: actPropertyID,
1399
- displaystyleid: displayStyleID,
1400
- eventtypeid: eventTypeID,
1401
- projecttypeid: projectTypeID
1402
- };
1403
- scene.fire((msgPrefix + ":markMap"), { args : [eventInfo,layerID,clickCallback] }, parentScene, false);
1404
- }
1405
- /*连续标注三维地图获取xy坐标*/
1406
- that.markMapXY = function(event,Callback){
1407
- if (scene == null)
1408
- return;
1409
- scene.fire((msgPrefix + ":markMapXY"), { args : [event,Callback] }, parentScene, false);
1410
- };
1411
- /*清除标注事件*/
1412
- that.removeMarkMapMouseHandler=function(){
1413
- if (scene == null)
1414
- return;
1415
- scene.fire((msgPrefix + ":removeMarkMapMouseHandler"), { args : [] }, parentScene, false);
1416
- };
1417
-
1418
- /**
1419
- * 绘制图形接口
1420
- * type 类型 point,polyline,polygon,circle
1421
- * style 样式
1422
- * clear 是否清除
1423
- * callback 回调函数返回绘制图形的坐标信息
1424
- **/
1425
- that.drawGeometry = function (type, style, clear, callback, option) {
1426
- if (scene == null)
1427
- return;
1428
- scene.fire((msgPrefix + ":drawGeometry"), { args : [type, style, clear, callback, option] }, parentScene, false);
1429
- };
1430
- that.showUserDrawGeometry = function (show,id) {
1431
- if (scene == null)
1432
- return;
1433
- scene.fire((msgPrefix + ":showUserDrawGeometry"), { args : [show,id] }, parentScene, false);
1434
- };
1435
-
1436
- that.addGraphic=function(params, addCallback){
1437
- if(scene == null)
1438
- return;
1439
- if(!params||!params[0])
1440
- return;
1441
- var type=params[0];
1442
- var style=params[1]||{"color":[215, 214, 111, 100]};
1443
- var clear=params[2]||true;
1444
- var callback=addCallback;
1445
- scene.fire((msgPrefix + ":drawGeometry"), { args : [type, style, clear, callback] }, parentScene, false);
1446
- };
1447
-
1448
-
1449
- //by hth,2020-12-29
1450
-
1451
- that.showMultiObjectToCluster = function(jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickCallBack, mouseOverEnable) {
1452
-
1453
- // 获取symbolUrl
1454
-
1455
- var defaultSymbolUrl = Array.isArray(jsonInfo) ? jsonInfo[0].symbolUrl : 'numImage.png';
1456
-
1457
- var hasCustomProperties = infoStyle.hasOwnProperty('customProperties')
1458
-
1459
- var defaultClusterImageInfo = {//自定义聚类图标。如果设置的话,要自己调"textStyle"以适应自己的"symbolUrl"
1460
-
1461
- symbolUrl: defaultSymbolUrl,
1462
-
1463
- horizontalOrigin: "center",
1464
-
1465
- verticalOrigin: "bottom",
1466
-
1467
- cssStyle: {
1468
-
1469
- "borderRadius": 500,//设置的很大话,就会形成半圆角
1470
-
1471
- "fillColor": "rgba(27,32,43,0.7)",//圆角矩形的颜色
1472
-
1473
- "borderLineWidth": 3,//圆角矩形的边框宽度
1474
-
1475
- "borderLineColor": "rgba(230,230,230,0.9)",//圆角矩形的边框颜色
1476
-
1477
- "paddingX": 15,//圆角矩形内边框padding(主要是为了让文字与边框有一定距离)
1478
-
1479
- "paddingY": 6,
1480
-
1481
- "marginBottom": 2 //下边框外距
1482
-
1483
- },
1484
-
1485
- textStyle : {
1486
-
1487
- "font" : "60px Helvetica",
1488
-
1489
- "fillColor" : "rgba(250,250,250,1.0)",
1490
-
1491
- "outlineColor" : "black",
1492
-
1493
- "outlineWidth" : 1.0,
1494
-
1495
- "padding":1,
1496
-
1497
- "textScale":0.5,
1498
-
1499
- "textStartX":40,
1500
-
1501
- "textStartY":15
1502
-
1503
- }
1504
-
1505
- }
1506
-
1507
- // 组装options数据
1508
-
1509
- var options = {
1510
-
1511
- clusterStyle: (hasCustomProperties && infoStyle.customProperties.clusterStyle) || 'clusterByGrid',
1512
-
1513
- zoom:zoom,
1514
-
1515
- scale: 0.9,
1516
-
1517
- clusterLimit: (hasCustomProperties && infoStyle.customProperties.clusterLimit) || undefined,
1518
-
1519
- symbolUrl: (hasCustomProperties && infoStyle.customProperties.symbolUrl) || defaultSymbolUrl,
1520
-
1521
- clear:clear,
1522
-
1523
- layerName: tagName,
1524
-
1525
- style: 'default',
1526
-
1527
- nearFarScalar: [8000, 1.0, 10000, 0.6],
1528
-
1529
- clickCallBack: clickCallBack,
1530
-
1531
- clusterImageInfo: (hasCustomProperties && infoStyle.customProperties.clusterImageInfo) || defaultClusterImageInfo,
1532
-
1533
- minSize: (hasCustomProperties && infoStyle.customProperties.minSize) || 6,
1534
-
1535
- geometricErrorScale: (hasCustomProperties && infoStyle.customProperties.geometricErrorScale) || 2
1536
-
1537
- }
1538
-
1539
- that.addClusterLayer({data:jsonInfo, options});
1540
-
1541
- }
1542
-
1543
- //添加聚类图层
1544
- that.addClusterLayer=function(data){
1545
- if(scene == null)
1546
- return;
1547
- var dataInfo = data.data;
1548
- var option=data.options;
1549
- if(option && option.addClusterWithAni){
1550
- scene.fire((msgPrefix + ":addClusterWithAni"), {args: [dataInfo, option]}, parentScene, false);
1551
- }else{
1552
- scene.fire((msgPrefix + ":addClusterLayer"), {args: [dataInfo, option]}, parentScene, false);
1553
- }
1554
- };
1555
- //获取所选择的三维模型信息
1556
- that.getSelectedLayerinfo = function (name, callback) {
1557
- if (scene == null)
1558
- return;
1559
- scene.fire((msgPrefix + ":getSelectedLayerinfo"), {args: [name, callback]}, parentScene, false);
1560
- };
1561
-
1562
- //three模型管理
1563
- that.threeModelManage = function (layerName, type, options, others) {
1564
- if (scene == null)
1565
- return;
1566
-
1567
- scene.fire((msgPrefix + ":threeModelManage"), { args: [layerName, type, options, others] }, parentScene, false);
1568
- }
1569
-
1570
- //烟花效果
1571
- that.fireWorkSystem = function (options) {
1572
- if (scene == null)
1573
- return;
1574
-
1575
- scene.fire((msgPrefix + ":fireWorkSystem"), { args: [options] }, parentScene, false);
1576
- }
1577
-
1578
- //烟花效果显隐控制
1579
- that.setFireWorkVisible = function (visible) {
1580
- if (scene == null)
1581
- return;
1582
-
1583
- scene.fire((msgPrefix + ":setFireWorkVisible"), { args: [visible] }, parentScene, false);
1584
- }
1585
-
1586
-
1587
- //开启地透
1588
- that.undergroundMode_on = function(alpha){
1589
- if (scene == null)
1590
- return;
1591
-
1592
- scene.fire((msgPrefix + ":undergroundMode_on"), {args: [alpha]}, parentScene, false);
1593
- }
1594
-
1595
- //关闭地透
1596
- that.undergroundMode_off = function(){
1597
- if (scene == null)
1598
- return;
1599
-
1600
- scene.fire((msgPrefix + ":undergroundMode_off"), {args: []}, parentScene, false);
1601
- }
1602
-
1603
- //平面坐标转经纬度
1604
- that.Plat2lonLat = function (positions, callback) {
1605
- if (scene == null)
1606
- return;
1607
- scene.fire((msgPrefix + ":Plat2lonLat"), {args: [positions, callback]}, parentScene, false);
1608
- };
1609
- //地面开挖接口
1610
- that.digsuface=function(positions,depth,callback){
1611
- if (scene == null)
1612
- return;
1613
- var options={
1614
- positions:positions,
1615
- depth:depth,
1616
- callback:callback
1617
- };
1618
- scene.fire((msgPrefix + ":digSurface_dig"), {args: [options]}, parentScene, false);
1619
- };
1620
-
1621
- //清除地面开挖
1622
- that.removeDigsuface=function(){
1623
- if (scene == null)
1624
- return;
1625
- scene.fire((msgPrefix + ":digSurface_remove"), {args: []}, parentScene, false);
1626
- };
1627
- that.clearDrawGeometry=function(){
1628
- if (scene == null)
1629
- return;
1630
- scene.fire((msgPrefix + ":cleardrawGeometry"), {args: []}, parentScene, false);
1631
- };
1632
-
1633
- //三维地图点击事件
1634
- that.addPickHandler = function (callback) {
1635
- if (scene == null)
1636
- return;
1637
- scene.fire((msgPrefix + ":addPickHandler"), {args: [callback]}, parentScene, false);
1638
- };
1639
- //右键查询
1640
- that.addRightClickHandler=function(callback){
1641
- if (scene == null)
1642
- return;
1643
- scene.fire((msgPrefix + ":addRightClickHandler"), {args: [callback]}, parentScene, false);
1644
- };
1645
-
1646
- that.pickModel = function (position,callback) {
1647
- if (scene == null)
1648
- return;
1649
- scene.fire((msgPrefix + ":pickModel"), {args: [callback]}, parentScene, false);
1650
- };
1651
- that.show2dMode=function(){
1652
- if (scene == null)
1653
- return;
1654
- scene.fire((msgPrefix + ":show2dMode"), {args: []}, parentScene, false);
1655
- };
1656
- that.show3dMode=function () {
1657
- if (scene == null)
1658
- return;
1659
- scene.fire((msgPrefix + ":show3dMode"), {args: []}, parentScene, false);
1660
- };
1661
- that.getSysLayerTree=function(callback){
1662
- if (scene == null)
1663
- return;
1664
- scene.fire((msgPrefix + ":getSysLayerTree"), {args: [callback]}, parentScene, false);
1665
- };
1666
- that.show2_5dMode=function(){
1667
- if (scene == null)
1668
- return;
1669
- scene.fire((msgPrefix + ":show2_5dMode"), {args: []}, parentScene, false);
1670
- };
1671
- that.showWall=function(jsonInfo, zoom, clear, zoomOptions, merge, layerName, clickEnable, mouseOverEnable){
1672
- if (scene == null)
1673
- return;
1674
- scene.fire((msgPrefix + ":showWall"), {args: [jsonInfo, zoom, clear, zoomOptions, merge, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
1675
- };
1676
-
1677
- /* 根据图层字段定位显示 */
1678
- that.locateFeatureByIDs = function(layerID, keyField, keyValue, clearMap, style, hStyle, bZoom, randomColor, labelfield, labelstyle, geometry, where, renderCanvas, singleSelected,options,extendProperty,layerTag, successFunc) {
1679
- if (scene == null)
1680
- return;
1681
-
1682
- if(scene.layerUsageConfig && scene.layerUsageConfig[layerID]){
1683
- keyField = keyField || scene.layerUsageConfig[layerID].keyFieldName;
1684
- }
1685
- scene.fire((msgPrefix + ":locateFeatureByIDs"), {args: [layerID, keyField, keyValue, clearMap, style, hStyle, bZoom, randomColor, labelfield, labelstyle, geometry, where, renderCanvas, singleSelected,options,extendProperty,layerTag, successFunc]}, parentScene, false);
1686
- };
1687
-
1688
- /**
1689
- * 区域查询
1690
- */
1691
- that.locateRegionByIDs = function(layerID, keyField, keyValue, style, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, successFunc) {
1692
- if (scene == null)
1693
- return;
1694
- if(scene.layerUsageConfig && scene.layerUsageConfig[layerID]){
1695
- keyField = keyField || scene.layerUsageConfig[layerID].keyFieldName;
1696
- var usageLabelField = scene.layerUsageConfig[layerID].labelFieldName;
1697
- }
1698
- scene.fire((msgPrefix + ":locateRegionByIDs"), {args: [layerID, keyField, keyValue, style, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, successFunc,usageLabelField]}, parentScene, false);
1699
- };
1700
-
1701
- that.drawGeoJsonGeometry=function(jsonInfos, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack){
1702
- if (scene == null)
1703
- return;
1704
- scene.fire((msgPrefix + ":drawGeoJsonGeometry"), {args: [jsonInfos, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack]}, parentScene, false);
1705
- }
1706
-
1707
-
1708
- that.pathPlan = function(origin, destination, callBack){
1709
- if (scene == null)
1710
- return;
1711
-
1712
- scene.fire((msgPrefix + ":pathPlan"), {args: [origin, destination, callBack]}, parentScene, false);
1713
- };
1714
-
1715
- that.getRoutePlanning=function(origin,destination,options,callback){
1716
- if (scene == null)
1717
- return;
1718
- scene.fire((msgPrefix + ":getRoutePlanning"), {args: [origin,destination,options,callback]}, parentScene, false);
1719
- };
1720
-
1721
- that.startMonomerQuery = function (type, clear, options, layerName, clickCallback) {
1722
- if (scene == null)
1723
- return;
1724
- // 移除监听
1725
- var clickBackName = "startMonomerQueryClick" + layerName;
1726
-
1727
- that.removeEventBind(clickBackName);
1728
- var clickEnable = false;
1729
-
1730
- if(clickCallback instanceof Function){
1731
- that.bindEvent(clickBackName, function(evt) {
1732
- clickCallback(evt.args);
1733
- });
1734
- clickEnable = true;
1735
- }
1736
-
1737
- scene.fire((msgPrefix + ":startMonomerQuery"), { args: [type, clear, options, layerName, clickEnable] }, parentScene, false);
1738
- }
1739
-
1740
-
1741
- that.superMonomerQuery = function(type, clear, options, layerName, clickEnable){
1742
- if (scene == null)
1743
- return;
1744
- scene.fire((msgPrefix + ":superMonomerQuery"), {args: [type, clear, options, layerName, clickEnable]}, parentScene, false);
1745
- };
1746
-
1747
- //s3m模型操作
1748
- that.setS3MOperation = function(type, LayerName, options){
1749
- if (scene == null)
1750
- return;
1751
-
1752
- scene.fire((msgPrefix + ":setS3MOperation"), {args: [type, LayerName, options]}, parentScene, false);
1753
- }
1754
-
1755
- that.createMonomerClamp = function(jsonInfo, zoom, clear, options, layerName, clickCallBack){
1756
- if (scene == null)
1757
- return;
1758
- scene.fire((msgPrefix + ":createMonomerClamp"), {args: [jsonInfo, zoom, clear, options, layerName, clickCallBack]}, parentScene, false);
1759
- };
1760
-
1761
- that.getPGlist = function(queryParam, queryCallBack){
1762
- if (scene == null)
1763
- return;
1764
- scene.fire((msgPrefix + ":getPGlist"), {args: [queryParam, queryCallBack]}, parentScene, false);
1765
- };
1766
-
1767
- that.enablePickGradientObj = function(callback){
1768
- if (scene == null) {
1769
- return
1770
- };
1771
-
1772
- that.removeEventBind("enablePickGradientObj");
1773
- if (callback != undefined) {
1774
- that.bindEvent("enablePickGradientObj", function (evt) {
1775
- callback(evt.args);
1776
- });
1777
- }
1778
-
1779
- scene.fire((msgPrefix + ":enablePickGradientObj"), {args: []}, parentScene, false);
1780
- };
1781
-
1782
- that.disablePickGradientObj = function(){
1783
- if (scene == null)
1784
- return;
1785
- scene.fire((msgPrefix + ":disablePickGradientObj"), {args: []}, parentScene, false);
1786
- };
1787
-
1788
- that.modifyAttributes = function(layerName, objID, newProperties, options, autoRevert){
1789
- if (scene == null)
1790
- return;
1791
- scene.fire((msgPrefix + ":modifyAttributes"), {args: [layerName, objID, newProperties, options, autoRevert]}, parentScene, false);
1792
- };
1793
- that.focusOnDistrict = function(config, positions, modelName, hideLayerNames){
1794
- if (scene == null)
1795
- return;
1796
- scene.fire((msgPrefix + ":focusOnDistrict"), {args: [config, positions, modelName, hideLayerNames]}, parentScene, false);
1797
- };
1798
- that.showLaserWall = function(coordinatesData, layerName, options){
1799
- if (scene == null)
1800
- return;
1801
- scene.fire((msgPrefix + ":showLaserWall"), {args: [coordinatesData, layerName, options]}, parentScene, false);
1802
- };
1803
- that.PipeLineOperation = function(layerName,operateType,zoom,clear,options){
1804
- if (scene == null)
1805
- return;
1806
- scene.fire((msgPrefix + ":PipeLineOperation"), {args: [layerName,operateType,zoom,clear,options]}, parentScene, false);
1807
- };
1808
- that.setCameraConfig = function(options){
1809
- if (scene == null)
1810
- return;
1811
- scene.fire((msgPrefix + ":setCameraConfig"), {args: [options]}, parentScene, false);
1812
- };
1813
- that.setFireEffect = function(options,zoom,clear,layerName){
1814
- if (scene == null)
1815
- return;
1816
- scene.fire((msgPrefix + ":setFireEffect"), {args: [options,zoom,clear,layerName]}, parentScene, false);
1817
- };
1818
- that.drawPoints = function(layerName, positions, options){
1819
- if (scene == null)
1820
- return;
1821
- scene.fire((msgPrefix + ":drawPoints"), {args: [layerName, positions, options]}, parentScene, false);
1822
- };
1823
- that.traceOperation = function(posArr, options){
1824
- if (scene == null)
1825
- return;
1826
- scene.fire((msgPrefix + ":traceOperation"), {args: [posArr, options]}, parentScene, false);
1827
- };
1828
- that.regionOperation = function(options, data){
1829
- if (scene == null)
1830
- return;
1831
- scene.fire((msgPrefix + ":regionOperation"), {args: [options, data]}, parentScene, false);
1832
- };
1833
- that.activeLayer = function(layerName, options, filter){
1834
- if (scene == null)
1835
- return;
1836
- scene.fire((msgPrefix + ":activeLayer"), {args: [layerName, options, filter]}, parentScene, false);
1837
- };
1838
- that.networkCloud = function(options, positions){
1839
- if (scene == null)
1840
- return;
1841
- scene.fire((msgPrefix + ":networkCloud"), {args: [options, positions]}, parentScene, false);
1842
- };
1843
- that.clearNetworkCloud = function(layerNames){
1844
- if (scene == null)
1845
- return;
1846
- scene.fire((msgPrefix + ":clearNetworkCloud"), {args: [layerNames]}, parentScene, false);
1847
- };
1848
- that.lineOperation = function(options, data){
1849
- if (scene == null)
1850
- return;
1851
- scene.fire((msgPrefix + ":lineOperation"), {args: [options, data]}, parentScene, false);
1852
- };
1853
- that.getMainSubTypeTree = function(params, callback){
1854
- if (scene == null)
1855
- return;
1856
- var cb = function (type, data) {
1857
- if (callback && type == 'getMainSubTypeTreeCallback') {
1858
- callback(data);
1859
- }
1860
- };
1861
- scene.fire((msgPrefix + ":getMainSubTypeTree"), {args: [params, cb]}, parentScene, false);
1862
- };
1863
- that.getRegion = function(params, callback){
1864
- if (scene == null)
1865
- return;
1866
- var cb = function (type, data) {
1867
- if (callback && type == 'getRegionCallback') {
1868
- callback(data);
1869
- }
1870
- };
1871
- scene.fire((msgPrefix + ":getRegion"), {args: [params, cb]}, parentScene, false);
1872
- };
1873
- that.getMapConfig = function(key, callback){
1874
- if (scene == null)
1875
- return;
1876
- scene.fire((msgPrefix + ":getMapConfig"), {args: [key, callback]}, parentScene, false);
1877
- };
1878
- that.addCIMMap = function(options) {
1879
- if (scene == null)
1880
- return;
1881
- scene.fire((msgPrefix + ":addCIMMap"), { args: [options] }, parentScene, false);
1882
- };
1883
- that.addCIMModel = function(options) {
1884
- if (scene == null)
1885
- return;
1886
- scene.fire((msgPrefix + ":addCIMModel"), { args: [options] }, parentScene, false);
1887
- };
1888
- that.setLayerVisible = function(options) {
1889
- if (scene == null)
1890
- return;
1891
- scene.fire((msgPrefix + ":setLayerVisible"), { args: [options] }, parentScene, false);
1892
- };
1893
- that.flyToLayer = function(options) {
1894
- if (scene == null)
1895
- return;
1896
- scene.fire((msgPrefix + ":flyToLayer"), { args: [options] }, parentScene, false);
1897
- };
1898
- that.controlCamera = function(options) {
1899
- if (scene == null)
1900
- return;
1901
- scene.fire((msgPrefix + ":controlCamera"), { args: [options] }, parentScene, false);
1902
- };
1903
- that.zoomIn = function() {
1904
- if (scene == null)
1905
- return;
1906
- scene.fire((msgPrefix + ":zoomIn"), { args: [] }, parentScene, false);
1907
- };
1908
- that.zoomOut = function(options) {
1909
- if (scene == null)
1910
- return;
1911
- scene.fire((msgPrefix + ":zoomOut"), { args: [options] }, parentScene, false);
1912
- };
1913
- that.measureDistance = function(options) {
1914
- if (scene == null)
1915
- return;
1916
- scene.fire((msgPrefix + ":measureDistance"), { args: [options] }, parentScene, false);
1917
- };
1918
- that.measureArea = function(options) {
1919
- if (scene == null)
1920
- return;
1921
- scene.fire((msgPrefix + ":measureArea"), { args: [options] }, parentScene, false);
1922
- };
1923
- that.measureHeight = function(options) {
1924
- if (scene == null)
1925
- return;
1926
- scene.fire((msgPrefix + ":measureHeight"), { args: [options] }, parentScene, false);
1927
- };
1928
- that.onUndergroundModel = function(alpha, distance) {
1929
- if (scene == null)
1930
- return;
1931
- scene.fire((msgPrefix + ":onUndergroundModel"), { args: [alpha, distance] }, parentScene, false);
1932
- };
1933
- that.offUndergroundModel = function() {
1934
- if (scene == null)
1935
- return;
1936
- scene.fire((msgPrefix + ":offUndergroundModel"), { args: [] }, parentScene, false);
1937
- };
1938
- that.addFlag = function(options) {
1939
- if (scene == null)
1940
- return;
1941
- scene.fire((msgPrefix + ":addFlag"), { args: [options] }, parentScene, false);
1942
- };
1943
- that.getPointInfo = function(options) {
1944
- if (scene == null)
1945
- return;
1946
- scene.fire((msgPrefix + ":getPointInfo"), { args: [options] }, parentScene, false);
1947
- };
1948
- //添加聚类图层
1949
- that.addClusterLayerCIM = function(dataInfo, option) {
1950
- if (scene == null)
1951
- return;
1952
- scene.fire((msgPrefix + ":addClusterLayer"), { args: [dataInfo, option] }, parentScene, false);
1953
- };
1954
- that.init();
1955
- };
1956
-
1957
- //在外面也可以调用checkGlobeServerURL函数
1958
- EGovaGlobeMap.checkGlobeServerURL = checkGlobeServerURL;
1959
-
1960
- export default EGovaGlobeMap;
1
+
2
+ var scene = null;
3
+
4
+ function getCookie(name){
5
+ var strCookie = window.document.cookie;
6
+ var arrCookie = strCookie.split("; ");
7
+ for(var i=0; i<arrCookie.length; i++){
8
+ var arr = arrCookie[i].split("=");
9
+ if(arr[0]==name) return arr[1];
10
+ }
11
+ return null;
12
+ }
13
+
14
+ function setCookie(name,value){
15
+ window.document.cookie = name+"="+value;
16
+ }
17
+
18
+ function checkGlobeServerURL(url,callback){
19
+ if(!url) return;
20
+
21
+ var cookieUrl = getCookie("globeGisUrl");
22
+ var gisProxyList = url.split(";");
23
+ cookieUrl && gisProxyList.push(cookieUrl);
24
+ if(gisProxyList.length<=1){
25
+ setCookie("globeGisUrl",url);
26
+ callback(url);
27
+ return ;
28
+ }
29
+ var params = {isLoad:false};
30
+ for(var i in gisProxyList){
31
+ checkGlobeProxy(gisProxyList[i],params,callback);
32
+ }
33
+ }
34
+
35
+ function checkGlobeProxy(proxyUrl,params,callback) {
36
+ var img = new Image();
37
+ if(proxyUrl.indexOf("http")!=0){
38
+ proxyUrl = window.location.origin+"/"+proxyUrl;
39
+ }
40
+ img.src = proxyUrl + '/symbol/default.png';
41
+ img.onload = function (e1) {
42
+ if(!params.isLoad){
43
+ params.isLoad = true;
44
+ setCookie("globeGisUrl",proxyUrl);
45
+ callback(proxyUrl);
46
+ }
47
+ img = null;
48
+ };
49
+ }
50
+
51
+ //初始化获取三维地图相关的配置参数,从三维服务端获取
52
+ function initGlobeParams(context, callback) {
53
+ context.globeParams = context.globeParams || {};
54
+ //是否开启三维源代码调试,发布系统不得开启此开关
55
+ context.globeParams.debug = false;
56
+ //三维地图被禁用了,不再初始化三维地图
57
+ if (context.globeParams.disable) {
58
+ return;
59
+ }
60
+ context.globeParams.humanID = context.humanID;
61
+ context.globeParams.globeEnabled = context.globeEnabled;
62
+ context.globeParams.globeServerURL = context.globeServerURL;
63
+ //context.globeParams.misURL = context.misURL;
64
+ if (callback) {
65
+ callback();
66
+ }
67
+ }
68
+
69
+ var EGovaGlobeMap = function ($container, pScene, prefix, mapConfig, context, callback) {
70
+ var that = this;
71
+ scene = pScene;
72
+ var parentScene = pScene.pageId || "parentScene";
73
+ var msgPrefix = prefix || "globemappage";
74
+ //var config = parent.config || '';
75
+ //var humanID = parent.humanID || '';
76
+ var prefix = 'msgPrefix=' + msgPrefix + '&parentScene=' + parentScene;
77
+ that.globeVisible = false;
78
+ that.globeLoaded = false;
79
+ that.isLoading = false;
80
+
81
+ that.mapConfig = mapConfig;
82
+ that.$globeMapFrame = null;
83
+ that.globeMapContainer = null;
84
+ that.mapContainer = null;
85
+
86
+ that.globeMapContainer = $container.getElementsByClassName("globemap-container")[0];
87
+ if (!that.globeMapContainer) {
88
+ var globeMapHTML = '<iframe class="globemap-iframe" webkitAllowFullScreen="true" mozallowfullscreen="true" allowFullScreen="true"></iframe>';
89
+ var element = document.createElement("div");
90
+ element.classList.add("globemap-container");
91
+ element.innerHTML = globeMapHTML;
92
+ $container.appendChild(element);
93
+ that.globeMapContainer = element;
94
+ }
95
+ that.$globeMapFrame = that.globeMapContainer.getElementsByClassName("globemap-iframe")[0];
96
+ that.mapContainer = $container.getElementsByClassName("emap-container")[0];
97
+ that.init = function () {
98
+
99
+ var loadingGlobe = function(serverURL, callback){
100
+ //判断是否采用了延迟加载,如果没有采用,就在初始化时加载地图
101
+ if (!context.globeParams.lazyloading) {
102
+ if (!that.globeLoaded && !that.isLoading) {
103
+ var globeParams = context.globeParams;
104
+ var globeConfig = {
105
+ humanID: globeParams.humanID,
106
+ globeEnabled: globeParams.globeEnabled,
107
+ globeServerURL: globeParams.globeServerURL
108
+ };
109
+ that.globeConfig=globeConfig;
110
+ globeConfig.globeServerURL = serverURL || globeConfig.globeServerURL;
111
+ globeParams.globeServerURL = globeConfig.globeServerURL; //服务地址写回全局配置,其他地方可能会用到
112
+ var proxyURL = serverURL + '/home/gis/proxy.htm';
113
+ that.isLoading = true;
114
+ var globeMapUrl = context.rootPath +context.assetsPath+ "/globe.html?" + prefix + '&serverURL=' + globeConfig.globeServerURL +
115
+ "&proxyURL=" + proxyURL + "&humanID=" + globeConfig.humanID;
116
+ if (context.globeParams.debug) {
117
+ globeMapUrl += '&debug=true';
118
+ }
119
+ if (context.misURL) {
120
+ globeMapUrl = globeMapUrl + '&misURL=' + context.misURL;
121
+ }
122
+ if (mapConfig != undefined && mapConfig.mapconfig3D != undefined) {
123
+ for (var item in mapConfig.mapconfig3D) {
124
+ globeMapUrl += "&" + item + "=" + encodeURIComponent(mapConfig.mapconfig3D[item]);
125
+ }
126
+ }
127
+ if(context.initAnimation){
128
+ for(var item in context.initAnimation){
129
+ globeMapUrl += "&initAnimation_" + item + "=" + encodeURIComponent(context.initAnimation[item]);
130
+ }
131
+ }
132
+ that.$globeMapFrame.src = globeMapUrl;
133
+ that.$globeMapFrame.onload = function(){
134
+ if(!this.contentDocument.documentElement.getElementsByTagName("head").item(0).outerHTML.includes("initGlobe.js")) {
135
+ var mainScript = this.contentDocument.createElement("script");
136
+ mainScript.setAttribute("type", "text/javascript");
137
+ mainScript.setAttribute("src", serverURL + "/library/globe/api/initGlobe.js");
138
+ this.contentDocument.documentElement.getElementsByTagName("head").item(0).appendChild(mainScript);
139
+ }
140
+ }
141
+ }
142
+ }
143
+ //callback && callback();
144
+ };
145
+
146
+ context.globeCallBack = callback;
147
+ checkGlobeServerURL(context.globeServerURL || context.gisServerURL, function(serverURL) {
148
+ context.globeServerURL = serverURL;
149
+ initGlobeParams(context, function(){
150
+ loadingGlobe(context.globeServerURL, context.globeCallBack);
151
+ });
152
+ });
153
+
154
+ //初始化时不显示地图
155
+ that.closeGlobe();
156
+ //YSP:这句代码需要加上,否则导致第一次二三维切换,位置不同步
157
+ that.globeMapContainer.style.display = 'none';
158
+ // 三维加载完毕后
159
+ //that.bindEvent("globeLoadedCallback", that.onGlobeLoaded);
160
+
161
+ that.bindEvent("globeLoadedCallback", function(){
162
+ that.onGlobeLoaded(callback);
163
+ });
164
+
165
+ };
166
+
167
+
168
+ /* 绑定事件 */
169
+ that.bindEvent = function (msgId, msgHandler, stopOnTop) {
170
+ if (scene == null)
171
+ return;
172
+ scene.on(msgPrefix + ":" + msgId, msgHandler, parentScene, stopOnTop);
173
+ };
174
+ /* 触发事件 */
175
+ that.fireEvent = function (msgId, msgData, stopOnTop) {
176
+ if (scene == null)
177
+ return;
178
+ scene.fire(msgPrefix + ":" + msgId, msgData, parentScene, stopOnTop);
179
+ }
180
+ /* 移除监听 */
181
+ that.removeEventBind = function (msgId, stopOnTop) {
182
+ if (scene == null)
183
+ return;
184
+ scene.remove(msgPrefix + ":" + msgId, parentScene, stopOnTop);
185
+ }
186
+
187
+ that.dispatchSceneEvent = function (msgId, msgData) {
188
+ if (scene == null)
189
+ return;
190
+ scene.fire(msgPrefix + ":" + msgId, {args: msgData}, parentScene, false);
191
+ }
192
+
193
+ that.onGlobeLoaded = function (callback) {
194
+ that.isLoading = false;
195
+ that.globeLoaded = true;
196
+ callback && callback();
197
+ //设置工具条的样式和位置
198
+ //that.fireEvent("setToolBarStyle", {args:["left", "H", true, {top:'70px',left:'20px'}]});
199
+ }
200
+
201
+ /** *****************************三维地图API************************ */
202
+
203
+ /**
204
+ * 三维窗口关闭
205
+ */
206
+ that.closeGlobe = function (evt) {
207
+ that.globeMapContainer.style.display = 'block';
208
+ that.globeMapContainer.style.height = '0';
209
+ that.globeVisible = false;
210
+ }
211
+
212
+ /**
213
+ * 三维显示
214
+ *
215
+ * @param res
216
+ */
217
+ that.openGlobe = function (evt) {
218
+ if (!that.globeVisible) { // 初次定位时调整布局
219
+ if (!that.globeLoaded && !that.isLoading) {
220
+ var loadingGlobe = function (serverURL) {
221
+ that.globeConfig=that.globeConfig||{};
222
+ that.globeConfig.globeServerURL = serverURL || that.globeConfig.globeServerURL;
223
+
224
+ // By hth 2021/4/12: 注释下面逻辑不明,注释掉
225
+ // that.globeParams=that.globeParams||{};
226
+ // that.globeParams.globeServerURL = that.globeConfig.globeServerURL; //服务地址写回全局配置,其他地方可能会用到
227
+ var globeParams = context.globeParams;
228
+ that.globeConfig.humanID = globeParams.humanID || that.globeConfig.humanID;
229
+ that.globeConfig.globeServerURL = globeParams.globeServerURL || that.globeConfig.globeServerURL;
230
+
231
+ var proxyURL = serverURL + '/home/gis/proxy.htm';
232
+ that.isLoading = true;
233
+ var globeMapUrl = context.rootPath +context.assetsPath + "/globe.html?" + prefix + '&serverURL=' + that.globeConfig.globeServerURL +
234
+ "&proxyURL=" + proxyURL + "&humanID=" + that.globeConfig.humanID;
235
+ if(context.globeParams.debug) {
236
+ globeMapUrl += '&debug=true';
237
+ }
238
+ if (context.misURL) {
239
+ globeMapUrl = globeMapUrl + '&misURL=' + context.misURL;
240
+ }
241
+ if (mapConfig != undefined && mapConfig.mapconfig3D != undefined) {
242
+ for (var item in mapConfig.mapconfig3D) {
243
+ globeMapUrl += "&" + item + "=" + encodeURIComponent(mapConfig.mapconfig3D[item]);
244
+ }
245
+ }
246
+ if(context.initAnimation){
247
+ for(var item in context.initAnimation){
248
+ globeMapUrl += "&initAnimation_" + item + "=" + encodeURIComponent(context.initAnimation[item]);
249
+ }
250
+ }
251
+ that.$globeMapFrame.src=globeMapUrl;
252
+ that.$globeMapFrame.onload = function(){
253
+ if(!this.contentDocument.documentElement.getElementsByTagName("head").item(0).outerHTML.includes("initGlobe.js")) {
254
+ var mainScript = this.contentDocument.createElement("script");
255
+ mainScript.setAttribute("type", "text/javascript");
256
+ mainScript.setAttribute("src", serverURL + "/library/globe/api/initGlobe.js");
257
+ this.contentDocument.documentElement.getElementsByTagName("head").item(0).appendChild(mainScript);
258
+ }
259
+ }
260
+ }
261
+ checkGlobeServerURL(context.globeServerURL || context.gisServerURL, function(serverURL) {
262
+ context.globeServerURL = serverURL;
263
+ if(context.globeParams!=undefined)
264
+ loadingGlobe(context.globeServerURL)
265
+ else
266
+ initGlobeParams(context,function(){
267
+ loadingGlobe(context.globeServerURL)
268
+ });
269
+ });
270
+ }
271
+
272
+ that.globeMapContainer.style.height = '100%';
273
+ that.globeMapContainer.style.display = 'block';
274
+ that.globeVisible = true;
275
+ }
276
+ }
277
+
278
+ /**
279
+ * 延时三维内部请求
280
+ */
281
+ that.delayRequest = function(time){
282
+ if (scene == null)
283
+ return;
284
+
285
+ scene.fire((msgPrefix + ":delayRequest"), {args: [time]}, parentScene, false);
286
+ }
287
+
288
+ /**
289
+ * 添加相机事件
290
+ */
291
+ that.getCameraMes = function(callback){
292
+ if (scene == null)
293
+ return;
294
+ scene.fire((msgPrefix + ":getCameraMes"), {args: [callback]}, parentScene, false);
295
+ }
296
+
297
+ /**
298
+ * 限制相机视角操作
299
+ */
300
+ that.setCameraLimitOptions = function(options){
301
+ if (scene == null)
302
+ return;
303
+
304
+ scene.fire((msgPrefix + ":setCameraLimitOptions"), {args: [options]}, parentScene, false);
305
+ }
306
+
307
+ /**
308
+ * 添加相机事件
309
+ */
310
+ that.addCameraEvent = function(id, fn, obj, type){
311
+ if (scene == null)
312
+ return;
313
+
314
+ scene.fire((msgPrefix + ":addCameraEvent"), {args: [id, fn, obj, type]}, parentScene, false);
315
+ };
316
+
317
+ /**
318
+ * 清除相机事件
319
+ */
320
+ that.removeCameraEvent = function(id){
321
+ if (scene == null)
322
+ return;
323
+
324
+ scene.fire((msgPrefix + ":removeCameraEvent"), {args: [id]}, parentScene, false);
325
+ };
326
+
327
+ /**
328
+ * 添加鼠标事件
329
+ */
330
+ that.addMouseEvent = function(id, fn, obj, type){
331
+ if (scene == null)
332
+ return;
333
+ scene.fire((msgPrefix + ":addMouseEvent"), {args: [id, fn, obj, type]}, parentScene, false);
334
+ };
335
+
336
+ /**
337
+ * 清除鼠标事件
338
+ */
339
+ that.removeMouseEvent = function(id){
340
+ if (scene == null)
341
+ return;
342
+ scene.fire((msgPrefix + ":removeMouseEvent"), {args: [id]}, parentScene, false);
343
+ };
344
+
345
+ /**
346
+ * 环视飞行
347
+ */
348
+ that.startLoopView = function(rotateTime){
349
+ if (scene == null)
350
+ return;
351
+ scene.fire((msgPrefix + ":startLoopView"), {args: [rotateTime]}, parentScene, false);
352
+ };
353
+ /**
354
+ * 播放飞行路径文件
355
+ */
356
+ that.flyPath=function (options) {
357
+ if (scene == null)
358
+ return;
359
+ scene.fire((msgPrefix + ":flyPath"), {args: [options]}, parentScene, false);
360
+ }
361
+ that.pausePath=function(){
362
+ if (scene == null)
363
+ return;
364
+ scene.fire((msgPrefix + ":pausePath"), {args: []}, parentScene, false);
365
+ }
366
+
367
+ that.flyTo=function(lon, lat, height, heading, pitch, roll, duration){
368
+ if (scene == null)
369
+ return;
370
+ scene.fire((msgPrefix + ":flyTo"), {args: [lon, lat, height, heading, pitch, roll, duration]}, parentScene, false);
371
+ }
372
+
373
+ that.showPolylineTrail = function(infoJson, zoom, clear){
374
+ if (scene == null)
375
+ return;
376
+ scene.fire((msgPrefix + ":showPolylineTrail"),{args:[infoJson, zoom, clear]},parentScene,false);
377
+ }
378
+
379
+ /* 绘制点 */
380
+ that.showPoint = function(jsonInfo, zoom, clear, zoomOptions, layerName, clickCallback, mouseOverCallBack){
381
+ if (scene == null)
382
+ return;
383
+
384
+ layerName = layerName || "point";
385
+ var clickBackName = "showPointClick" + layerName;
386
+ var mouseOverBackName = "showPointMouseMove" + layerName;
387
+
388
+ that.removeEventBind(clickBackName);
389
+ that.removeEventBind(mouseOverBackName);
390
+ var clickEnable = false;
391
+ var mouseOverEnable = false;
392
+
393
+ if(clickCallback instanceof Function){
394
+ that.bindEvent(clickBackName, function(evt) {
395
+ clickCallback(evt.args);
396
+ });
397
+ clickEnable = true;
398
+ }
399
+
400
+ if(mouseOverCallBack instanceof Function){
401
+ that.bindEvent(mouseOverBackName, function(evt) {
402
+ mouseOverCallBack(evt.args);
403
+ });
404
+ mouseOverEnable = true;
405
+ }
406
+
407
+ scene.fire((msgPrefix + ":showPoint"), {args: [jsonInfo, zoom, clear, zoomOptions, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
408
+
409
+ }
410
+ //底图切换功能
411
+ that.switchLayer = function (options) {
412
+ if (scene == null)
413
+ return;
414
+ scene.fire((msgPrefix + ":switchLayer"), { args: [options] }, parentScene, false);
415
+ }
416
+ that.addBaseLayers=function(options,clear){
417
+ if (scene == null)
418
+ return;
419
+ scene.fire((msgPrefix + ":addBaseLayers"), {args: [options,clear]}, parentScene, false);
420
+ }
421
+ //测距测面功能
422
+ that.measure = function (options) {
423
+ if (scene == null)
424
+ return;
425
+ scene.fire((msgPrefix + ":measure"), { args: [options] }, parentScene, false);
426
+ }
427
+ //服务配置功能
428
+ that.configServiceLayer = function (jsonInfo, option, layerName) {
429
+ if (scene == null)
430
+ return;
431
+ scene.fire((msgPrefix + ":configServiceLayer"), { args: [jsonInfo, option, layerName] }, parentScene, false);
432
+ }
433
+ /* 显示面*/
434
+ that.showPolygon = function (jsonInfo, drawWay, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, circleDragCallback) {
435
+ if (scene == null)
436
+ return;
437
+ // 移除监听
438
+
439
+ layerName = layerName || "polygon";
440
+ var clickBackName = "showPolygonClick" + layerName;
441
+ var mouseOverBackName = "showPolygonMouseMove" + layerName;
442
+ var dragCircleBackName = "dragCircle" + layerName;
443
+
444
+ that.removeEventBind(clickBackName);
445
+ that.removeEventBind(mouseOverBackName);
446
+ that.removeEventBind(dragCircleBackName);
447
+
448
+ var clickEnable = false;
449
+ var mouseOverEnable = false;
450
+ var dragCircleCallBackEnable = false;
451
+
452
+ if (clickCallback instanceof Function) {
453
+ that.bindEvent(clickBackName, function (evt) {
454
+ clickCallback(evt.args);
455
+ });
456
+ clickEnable = true;
457
+ }
458
+
459
+ if (mouseOverCallBack instanceof Function) {
460
+ that.bindEvent(mouseOverBackName, function (evt) {
461
+ mouseOverCallBack(evt.args);
462
+ });
463
+ mouseOverEnable = true;
464
+ }
465
+
466
+ if (circleDragCallback instanceof Function) {
467
+ that.bindEvent(dragCircleBackName, function (evt) {
468
+ circleDragCallback(evt.args);
469
+ });
470
+ dragCircleCallBackEnable = true;
471
+ }
472
+
473
+ scene.fire((msgPrefix + ":showPolygon"), { args: [jsonInfo, drawWay, zoom, clear, options, layerName, clickEnable, mouseOverEnable,dragCircleCallBackEnable] }, parentScene, false);
474
+ };
475
+ /* 显示空中单点全景*/
476
+ that.showMMSPoint = function(pointJsonInfo, radarJsonInfo, layerName, options, clickCallback, mouseOverCallBack){
477
+ if (scene == null)
478
+ return;
479
+
480
+ layerName = layerName || "addMMSPoint";
481
+
482
+ var clickBackName = "addMMSPointClick" + layerName;
483
+ var mouseOverBackName = "addMMSPointMouseMove" + layerName;
484
+
485
+ that.removeEventBind(clickBackName);
486
+ that.removeEventBind(mouseOverBackName);
487
+
488
+ var clickEnable = false;
489
+ var mouseOverEnable = false;
490
+
491
+ if (clickCallback instanceof Function) {
492
+ that.bindEvent(clickBackName, function (evt) {
493
+ clickCallback(evt.args);
494
+ });
495
+ clickEnable = true;
496
+ }
497
+
498
+ if (mouseOverCallBack instanceof Function) {
499
+ that.bindEvent(mouseOverBackName, function (evt) {
500
+ mouseOverCallBack(evt.args);
501
+ });
502
+ mouseOverEnable = true;
503
+ }
504
+
505
+ scene.fire((msgPrefix + ":showMMSPoint"), { args: [pointJsonInfo, radarJsonInfo, layerName, options, clickEnable, mouseOverEnable]}, parentScene, false);
506
+ };
507
+
508
+ /* 显示3dmodel*/
509
+ that.add3dModel = function (jsonInfo, zoom, clear, options, layerName, clickCallback, mouseOverCallBack) {
510
+ if (scene == null)
511
+ return;
512
+
513
+ layerName = layerName || "add3dModel";
514
+
515
+ var clickBackName = "add3dModelClick" + layerName;
516
+ var mouseOverBackName = "add3dModelMouseMove" + layerName;
517
+
518
+ that.removeEventBind(clickBackName);
519
+ that.removeEventBind(mouseOverBackName);
520
+
521
+ var clickEnable = false;
522
+ var mouseOverEnable = false;
523
+
524
+ if (clickCallback instanceof Function) {
525
+ that.bindEvent(clickBackName, function (evt) {
526
+ clickCallback(evt.args);
527
+ });
528
+ clickEnable = true;
529
+ }
530
+
531
+ if (mouseOverCallBack instanceof Function) {
532
+ that.bindEvent(mouseOverBackName, function (evt) {
533
+ mouseOverCallBack(evt.args);
534
+ });
535
+ mouseOverEnable = true;
536
+ }
537
+
538
+ scene.fire((msgPrefix + ":add3dModel"), { args: [jsonInfo, zoom, clear, options, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
539
+ };
540
+
541
+ /* 模型操作 */
542
+ that.setModelOperation = function (jsonInfo, zoom, clear, options, modelName) {
543
+ if (scene == null)
544
+ return;
545
+
546
+ scene.fire((msgPrefix + ":setModelOperation"), { args: [jsonInfo, zoom, clear, options, modelName]}, parentScene, false);
547
+ };
548
+
549
+
550
+ /* 显示线 */
551
+ that.showPolyline = function(jsonInfo, zoom, clear, zoomOptions, layerName, clickCallback, mouseOverCallBack){
552
+ if (scene == null)
553
+ return;
554
+ // 移除监听
555
+
556
+ layerName = layerName || "polyline";
557
+ var clickBackName = "showPolylineClick" + layerName;
558
+ var mouseOverBackName = "showPolylineMouseMove" + layerName;
559
+
560
+ that.removeEventBind(clickBackName);
561
+ that.removeEventBind(mouseOverBackName);
562
+ var clickEnable = false;
563
+ var mouseOverEnable = false;
564
+
565
+ if(clickCallback instanceof Function){
566
+ that.bindEvent(clickBackName, function(evt) {
567
+ clickCallback(evt.args);
568
+ });
569
+ clickEnable = true;
570
+ }
571
+
572
+ if(mouseOverCallBack instanceof Function){
573
+ that.bindEvent(mouseOverBackName, function(evt) {
574
+ mouseOverCallBack(evt.args);
575
+ });
576
+ mouseOverEnable = true;
577
+ }
578
+
579
+ scene.fire((msgPrefix + ":showPolyline"), {args: [jsonInfo, zoom, clear, zoomOptions, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
580
+ };
581
+
582
+ /* 显示区域 */
583
+ that.showDistrict= function(jsonInfo, zoom, clear, options, layerName, clickCallback, mouseOverCallBack){
584
+ if (scene == null)
585
+ return;
586
+ // 移除监听
587
+
588
+ layerName = layerName || "district";
589
+ var clickBackName = "showDistrictClick" + layerName;
590
+ var mouseOverBackName = "showDistrictMouseMove" + layerName;
591
+
592
+ that.removeEventBind(clickBackName);
593
+ that.removeEventBind(mouseOverBackName);
594
+ var clickEnable = false;
595
+ var mouseOverEnable = false;
596
+
597
+ if(clickCallback instanceof Function){
598
+ that.bindEvent(clickBackName, function(evt) {
599
+ clickCallback(evt.args);
600
+ });
601
+ clickEnable = true;
602
+ }
603
+
604
+ if(mouseOverCallBack instanceof Function){
605
+ that.bindEvent(mouseOverBackName, function(evt) {
606
+ mouseOverCallBack(evt.args);
607
+ });
608
+ mouseOverEnable = true;
609
+ }
610
+
611
+ scene.fire((msgPrefix + ":showDistrict"), {args: [jsonInfo, zoom, clear, options, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
612
+ };
613
+
614
+ //鹰眼相关
615
+ that.addEagleMap = function (options, containID) {
616
+ if (scene == null)
617
+ return;
618
+ scene.fire((msgPrefix + ":addEagleMap"), { args: [options, containID] }, parentScene, false);
619
+ };
620
+
621
+ that.eagleMapVisible = function (visible) {
622
+ if (scene == null)
623
+ return;
624
+ scene.fire((msgPrefix + ":eagleMapVisible"), { args: [visible] }, parentScene, false);
625
+ };
626
+
627
+ that.computerBar=function(jsonInfo, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack){
628
+ if (scene == null)
629
+ return;
630
+ scene.fire((msgPrefix + ":computerBar"),{args:[jsonInfo, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack]},parentScene,false);
631
+ };
632
+
633
+ that.sceneSwitch=function(name, options){
634
+ if (scene == null)
635
+ return;
636
+ scene.fire((msgPrefix + ":sceneSwitch"),{args:[name, options]},parentScene,false);
637
+ };
638
+
639
+ that.showWater=function(waterJsonUrl,waterRoadJsonUrl,options){
640
+ if (scene == null)
641
+ return;
642
+ scene.fire((msgPrefix + ":showWater"),{args:[waterJsonUrl,waterRoadJsonUrl,options]},parentScene,false);
643
+ };
644
+
645
+ that.drawGeoJsonPolygon=function(options,layerName){
646
+ if (scene == null)
647
+ return;
648
+ that.fireEvent("drawGeoJsonPolygon", {args: [options,layerName]}, false);
649
+ };
650
+
651
+ that.drawGeoJsonPoint=function(options,layerName){
652
+ if (scene == null)
653
+ return;
654
+ that.fireEvent("drawGeoJsonPoint", {args: [options,layerName]}, false);
655
+ };
656
+
657
+ that.showMultiRecPostion=function(jsonInfo, zoom, labelInfo, clear,zoomOptions,callback){
658
+ if (scene == null)
659
+ return;
660
+ scene.fire((msgPrefix + ":showMultiRecPostion"), {args: [jsonInfo, zoom, labelInfo, clear,zoomOptions,callback]}, parentScene, false);
661
+ };
662
+
663
+ that.showPolylineMovingGlow=function(jsonInfo, zoom, clear,zoomOptions){
664
+ if (scene == null)
665
+ return;
666
+ scene.fire((msgPrefix + ":showPolylineMovingGlow"), {args: [jsonInfo, zoom, clear,zoomOptions]}, parentScene, false);
667
+ };
668
+
669
+ that.setGradientStyle=function(obj, style){
670
+ if (scene == null)
671
+ return;
672
+ scene.fire((msgPrefix + ":setGradientStyle"), {args: [obj, style]}, parentScene, false);
673
+ };
674
+
675
+ that.setBuildingColor=function(obj, keyFiled, valueColors){
676
+ if (scene == null)
677
+ return;
678
+ scene.fire((msgPrefix + ":setBuildingColor"), {args: [obj, keyFiled, valueColors]}, parentScene, false);
679
+ };
680
+
681
+ //hth 2021-08-31 移除第五个callback参数,经过确认前端金鑫那边调用本接口实际只使用了4个参数
682
+ //切在register.js内部已经进行了callback事件触发
683
+ that.showHeatImage3D = function(info, zoom, clear, options){
684
+ if (scene == null)
685
+ return;
686
+
687
+ // that.removeEventBind("showHeatImage3DCallback");
688
+
689
+ // if (callback !== undefined) {
690
+ // that.bindEvent("showHeatImage3DCallback", function (evt) {
691
+ // callback(evt.args);
692
+ // });
693
+ // }
694
+
695
+ scene.fire((msgPrefix + ":showHeatImage3D"), {args: [info, zoom, clear, options]}, parentScene, false);
696
+ };
697
+
698
+ that.setHeatmapOptions=function(options, layerName, id){
699
+ if (scene == null)
700
+ return;
701
+ scene.fire((msgPrefix + ":setHeatmapOptions"), {args: [options, layerName, id]}, parentScene, false);
702
+ };
703
+
704
+ that.clearHeatImage3D = function(){
705
+ if (scene == null)
706
+ return;
707
+
708
+ scene.fire((msgPrefix + ":clearHeatImage3D"), {args: []}, parentScene, false);
709
+ };
710
+
711
+ that.updateHeatRec=function(levelNum){
712
+ if (scene == null)
713
+ return;
714
+ scene.fire((msgPrefix + ":updateHeatRec"), {args: [levelNum]}, parentScene, false);
715
+ }
716
+
717
+ that.cartographicToWindow=function(coord,callback){
718
+ if (scene == null)
719
+ return;
720
+ scene.fire((msgPrefix + ":cartographicToWindow"), {args: [coord,callback]}, parentScene, false);
721
+ }
722
+
723
+ /**
724
+ * 模型回调信息
725
+ */
726
+ that.getModelClickMes = function(clickCallback) {
727
+ if (scene == null)
728
+ return;
729
+
730
+ that.removeEventBind("getModelClickMesCallback");
731
+ if (clickCallback != undefined) {
732
+ that.bindEvent("getModelClickMesCallback", function (evt) {
733
+ clickCallback(evt.args);
734
+ });
735
+ }
736
+
737
+ scene.fire((msgPrefix + ":getModelClickMes"), {args: []}, parentScene, false);
738
+ };
739
+
740
+ /* 获取地图的当前范围 */
741
+ that.getMapExtent = function (callback) {
742
+ if (scene == null)
743
+ return;
744
+
745
+ // 移除监听
746
+ scene.remove(msgPrefix + ":getMapExtentCallback", parentScene, false);
747
+
748
+ scene.on(msgPrefix + ":getMapExtentCallback", function (evt) {
749
+ // 移除监听
750
+ scene.remove(msgPrefix + ":getMapExtentCallback", parentScene, false);
751
+ callback(evt.args);
752
+ }, parentScene, false);
753
+ scene.fire((msgPrefix + ":getMapExtent"), {args: []}, parentScene, false);
754
+ }
755
+
756
+ /* 缩放到指定范围 */
757
+ that.zoomToExtent = function (minX, minY, maxX, maxY, duration, rotate) {
758
+ if (scene == null)
759
+ return;
760
+ duration = Number(duration);
761
+ rotate = Boolean(rotate);
762
+ that.fireEvent("zoomToExtent", {args: [Number(minX), Number(minY), Number(maxX), Number(maxY), duration, rotate]}, false);
763
+ }
764
+
765
+ /**地表热力 */
766
+ that.addGlobeHeatMap = function(data, option, zoom){
767
+ if (scene == null)
768
+ return;
769
+ that.fireEvent("addHeatMap", {args: [data, option, zoom]}, false);
770
+ }
771
+
772
+ /*清除地表热力*/
773
+ that.removeGlobeHeatMap=function(){
774
+ if (scene == null)
775
+ return;
776
+ scene.fire((msgPrefix + ":removeHeatMap"), {args: []}, parentScene, false);
777
+ }
778
+
779
+ /* 缩放到指定中心点和级别 */
780
+ that.centerAndZoom = function(x, y, level, heading, picth, duration, opt) {
781
+ if (scene == null)
782
+ return;
783
+ that.fireEvent("centerAndZoom", {args: [x, y, level, heading, picth, duration, opt]}, false);
784
+ }
785
+
786
+ /* 缩放到指定级别 */
787
+ that.zoomToLevel = function (level, duration) {
788
+ if (scene == null)
789
+ return;
790
+
791
+ that.fireEvent("zoomToLevel", {args: [level, duration]}, false);
792
+ }
793
+
794
+ //三维场景按照中心点旋转,更方便查看
795
+ that.rotateScene = function (heading, pitch, roll, duration, callback) {
796
+ if (scene == null)
797
+ return;
798
+ that.fireEvent("rotateScene", {args: [heading, pitch, roll, duration, callback]}, false);
799
+ }
800
+
801
+ /* 清除指定图形 */
802
+ that.clearGraphic = function (id) {
803
+ if (scene == null)
804
+ return;
805
+ if (typeof id != "string") {
806
+ id = id.join(",");
807
+ }
808
+ scene.fire((msgPrefix + ":clearGraphic"), {args: [id]}, parentScene, false);
809
+ }
810
+
811
+ /* 清除全部图形 */
812
+ that.clearAllGraphics = function (id) {
813
+ if (scene == null)
814
+ return;
815
+ scene.fire((msgPrefix + ":clearAllGraphics"), {args: []}, parentScene, false);
816
+ }
817
+
818
+ /**
819
+ * 清除一些动态绘制效果
820
+ */
821
+ that.clearAllDynamicGraphics = function(){
822
+ if (scene == null)
823
+ return;
824
+
825
+ scene.fire((msgPrefix + ":clearAllDynamicGraphics"), {args: []}, parentScene, false);
826
+ }
827
+
828
+ /**
829
+ *恢复初始化
830
+ */
831
+
832
+ that.restoreInitConfig = function () {
833
+ if (scene == null)
834
+ return;
835
+
836
+ scene.fire((msgPrefix + ":restoreInitConfig"), {args: []}, parentScene, false);
837
+ }
838
+
839
+ /**
840
+ * 图层操作 清除
841
+ */
842
+ that.clearLayer = function(name,callback){
843
+ if (scene == null)
844
+ return;
845
+
846
+ scene.fire((msgPrefix + ":clearLayer"), {args: [name,callback]}, parentScene, false);
847
+ }
848
+
849
+ /**
850
+ * 图层操作 清除所有
851
+ */
852
+ that.clearAllLayer = function(skipNames){
853
+ if (scene == null)
854
+ return;
855
+
856
+ scene.fire((msgPrefix + ":clearAllLayer"), {args: [skipNames]}, parentScene, false);
857
+ }
858
+
859
+ /**
860
+ * 获取所有图层名
861
+ */
862
+ that.getAllLayer = function(callback){
863
+ if (scene == null)
864
+ return;
865
+
866
+ // 移除监听
867
+ that.removeEventBind("getAllLayerCallback");
868
+ that.bindEvent("getAllLayerCallback", function(evt){
869
+ callback && callback(evt.args);
870
+ });
871
+
872
+ scene.fire((msgPrefix + ":getAllLayer"), {args: []}, parentScene, false);
873
+
874
+ }
875
+
876
+ /**
877
+ * 图层操作 显隐切换
878
+ */
879
+ that.toggleLayer = function(name){
880
+ if (scene == null)
881
+ return;
882
+
883
+ scene.fire((msgPrefix + ":toggleLayer"), {args: [name]}, parentScene, false);
884
+ }
885
+
886
+ /**
887
+ * 图层操作 显示
888
+ */
889
+ that.showLayer = function(name){
890
+ if (scene == null)
891
+ return;
892
+
893
+ scene.fire((msgPrefix + ":showLayer"), {args: [name]}, parentScene, false);
894
+ }
895
+
896
+ /**
897
+ * 图层操作 隐藏
898
+ */
899
+ that.hideLayer = function(name){
900
+ if (scene == null)
901
+ return;
902
+
903
+ scene.fire((msgPrefix + ":hideLayer"), {args: [name]}, parentScene, false);
904
+ }
905
+
906
+ /**
907
+ * 图层操作 清除部分元素
908
+ */
909
+ that.clearLayerElement = function(name, ids){
910
+ if (scene == null)
911
+ return;
912
+
913
+ scene.fire((msgPrefix + ":clearLayerElement"), {args: [name, ids]}, parentScene, false);
914
+ }
915
+
916
+ /**
917
+ * 图层操作 点击元素
918
+ */
919
+ that.clickLayerElement = function(name, id){
920
+ if (scene == null)
921
+ return;
922
+
923
+ scene.fire((msgPrefix + ":clickLayerElement"), {args: [name, id]}, parentScene, false);
924
+ }
925
+
926
+ /**
927
+ * 图层操作 飞向元素
928
+ */
929
+ that.flyToLayerElement = function(name, id, options){
930
+ if (scene == null)
931
+ return;
932
+
933
+ scene.fire((msgPrefix + ":flyToLayerElement"), {args: [name, id, options]}, parentScene, false);
934
+ }
935
+
936
+ /**
937
+ * 控制图层显示级别
938
+ */
939
+
940
+ that.setLayerVisiableLevel = function(name, beginLevel, endLevel){
941
+ if (scene == null)
942
+ return;
943
+
944
+ scene.fire((msgPrefix + ":setLayerVisiableLevel"), {args: [name, beginLevel, endLevel]}, parentScene, false);
945
+ }
946
+
947
+ that.getLayerVisiableLevel = function(name, callback){
948
+ if (scene == null)
949
+ return;
950
+
951
+ that.removeEventBind("getLayerVisiableLevelCallback");
952
+ if (callback != undefined) {
953
+ that.bindEvent("getLayerVisiableLevelCallback", function (evt) {
954
+ callback(evt.args);
955
+ });
956
+ }
957
+ scene.fire((msgPrefix + ":getLayerVisiableLevel"), {args: [name]}, parentScene, false);
958
+ }
959
+
960
+ /**
961
+ * 控制模型显示级别
962
+ */
963
+
964
+ that.setModelVisiableLevel = function(obj, beginLevel, endLevel){
965
+ if (scene == null)
966
+ return;
967
+
968
+ scene.fire((msgPrefix + ":setModelVisiableLevel"), {args: [obj, beginLevel, endLevel]}, parentScene, false);
969
+ }
970
+
971
+ /**
972
+ * 道路图层绘制 road
973
+ */
974
+ that.buildRoad = function(jsonInfo, zoom, clear, zoomOptions){
975
+ if (scene == null)
976
+ return;
977
+
978
+ scene.fire((msgPrefix + ":buildRoad"), {args: [jsonInfo, zoom, clear, zoomOptions]}, parentScene, false);
979
+ }
980
+
981
+ /**
982
+ * 绘制桥 buildBridge
983
+ */
984
+ that.buildBridge = function(jsonInfo, zoom, clear, options, layerName, clickCallback, mouseOverCallBack){
985
+ if (scene == null)
986
+ return;
987
+ // 移除监听
988
+
989
+ layerName = layerName || "bridge";
990
+ var clickBackName = "buildBridgeClick" + layerName;
991
+ var mouseOverBackName = "buildBridgeMouseMove" + layerName;
992
+
993
+ that.removeEventBind(clickBackName);
994
+ that.removeEventBind(mouseOverBackName);
995
+ var clickEnable = false;
996
+ var mouseOverEnable = false;
997
+
998
+ if(clickCallback instanceof Function){
999
+ that.bindEvent(clickBackName, function(evt) {
1000
+ clickCallback(evt.args);
1001
+ });
1002
+ clickEnable = true;
1003
+ }
1004
+
1005
+ if(mouseOverCallBack instanceof Function){
1006
+ that.bindEvent(mouseOverBackName, function(evt) {
1007
+ mouseOverCallBack(evt.args);
1008
+ });
1009
+ mouseOverEnable = true;
1010
+ }
1011
+
1012
+ scene.fire((msgPrefix + ":buildBridge"), {args: [jsonInfo, zoom, clear, options, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
1013
+ }
1014
+
1015
+ /**
1016
+ * 绘制桥 build管网
1017
+ */
1018
+ that.drawPipe = function(jsonInfo, zoom, clear, options, layerName){
1019
+ if (scene == null)
1020
+ return;
1021
+ // 移除监听
1022
+
1023
+ scene.fire((msgPrefix + ":drawPipe"), {args: [jsonInfo, zoom, clear, options, layerName]}, parentScene, false);
1024
+ }
1025
+
1026
+ /*清除指定图层*/
1027
+ that.clearGraphicLayerByID=function(id){
1028
+ if(scene==null)
1029
+ return;
1030
+ if (typeof id != "string") {
1031
+ id = id.join(",");
1032
+ }
1033
+ scene.fire((msgPrefix + ":clearGraphicLayerByID"), {args: [id]}, parentScene, false);
1034
+ }
1035
+
1036
+ that.drawWaveCircle=function(jsonInfo, styleOption, zoom, clear, layerName){
1037
+ if (scene == null)
1038
+ return;
1039
+ scene.fire((msgPrefix + ":drawWaveCircle"), {args: [jsonInfo, styleOption, zoom, clear, layerName]}, false);
1040
+ }
1041
+
1042
+ that.getPartLayerTree=function(callback){
1043
+ if (scene == null)
1044
+ return;
1045
+ scene.fire((msgPrefix + ":getPartLayerTree"), {args: [callback]}, false);
1046
+ }
1047
+
1048
+ that.showGlobePartLayer=function(layerNames,beginLevel,endLevel){
1049
+ if (scene == null)
1050
+ return;
1051
+ scene.fire((msgPrefix + ":showGlobePartLayer"), {args: [layerNames,beginLevel,endLevel]}, false);
1052
+ }
1053
+
1054
+ that.getPartStatisticsJsonInfo=function(usageId,regionCode,regionName,where,orderField,returnTree,callBack){
1055
+ if (scene == null)
1056
+ return;
1057
+ scene.fire((msgPrefix + ":getPartStatisticsJsonInfo"), {args: [usageId,regionCode,regionName,where,orderField,returnTree,callBack]}, false);
1058
+ }
1059
+ /**
1060
+ * 显示案件分布
1061
+ */
1062
+ that.showRecListDistribution=function(jsonInfo, zoom, clickCallback, labelInfo){
1063
+ if (scene == null)
1064
+ return;
1065
+ that.removeEventBind("showRecListDistributionCallback");
1066
+ if (clickCallback != undefined) {
1067
+ that.bindEvent("showRecListDistributionCallback", function (evt) {
1068
+ clickCallback(evt.args);
1069
+ });
1070
+ }
1071
+ if(that.globeLoaded)
1072
+ scene.fire((msgPrefix + ":showRecListDistribution"), {args:[jsonInfo, zoom, labelInfo]}, parentScene, false);
1073
+ }
1074
+
1075
+ that.showPatrolCurrentPosition=function(jsonInfo, zoom, clear, highLightType){
1076
+ if (scene == null)
1077
+ return;
1078
+ that.fireEvent("showPatrolCurrentPosition", {args: [jsonInfo, zoom, clear, highLightType]}, false);
1079
+ };
1080
+ /* 显示多个自定义图标 */
1081
+ that.showMultiObjectCurrentPosition = function (jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickCallback, mouseOverCallBack) {
1082
+ if (scene == null)
1083
+ return;
1084
+ // 移除监听
1085
+ var clickBackName = "showMultiObjectCurrentPositionClick";
1086
+ var mouseOverBackName = "showMultiObjectCurrentPositionMouseover";
1087
+
1088
+ if(tagName){
1089
+ clickBackName += tagName;
1090
+ mouseOverBackName += tagName;
1091
+ }
1092
+
1093
+ that.removeEventBind(clickBackName);
1094
+ that.removeEventBind(mouseOverBackName);
1095
+ var clickEnable = false;
1096
+ var mouseOverEnable = false;
1097
+
1098
+ if(clickCallback instanceof Function){
1099
+ that.bindEvent(clickBackName, function(evt) {
1100
+ clickCallback(evt.args);
1101
+ });
1102
+ clickEnable = true;
1103
+ }
1104
+
1105
+ if(mouseOverCallBack instanceof Function){
1106
+ that.bindEvent(mouseOverBackName, function(evt) {
1107
+ mouseOverCallBack(evt.args);
1108
+ });
1109
+ mouseOverEnable = true;
1110
+ }
1111
+
1112
+ scene.fire((msgPrefix + ":showMultiObjectCurrentPosition"), {args: [jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickEnable, mouseOverEnable]}, parentScene, false);
1113
+ };
1114
+
1115
+ /**
1116
+ * 创建dom空标签
1117
+ */
1118
+ that.createInnerHtml = function(jsonInfo, zoom, clear, tagName, options, callback) {
1119
+ if (scene == null)
1120
+ return;
1121
+
1122
+ // 移除监听
1123
+ that.removeEventBind("createInnerHtmlCallback" + tagName);
1124
+ var args = Array.prototype.slice.call(arguments);
1125
+ if (arguments[arguments.length - 1] instanceof Function) {
1126
+ callback = arguments[arguments.length - 1];
1127
+ args = args.slice(0, args.length - 1);
1128
+ }
1129
+
1130
+ if (callback != undefined) {
1131
+ that.bindEvent("createInnerHtmlCallback" + tagName, function (evt) {
1132
+ callback(evt.args);
1133
+ });
1134
+ }
1135
+ scene.fire((msgPrefix + ":createInnerHtml"), {args: args}, parentScene, false);
1136
+ };
1137
+
1138
+ /* 显示车辆人员轨迹 */
1139
+ that.showObjectTrace = function (objectID, symbolType, dateTime, queryCondition, hideControlPanel, symbolPic, optimizeParams, infoCallback, updatePositionCallback, closeCallback, traceDigCallback) {
1140
+ if (scene == null)
1141
+ return;
1142
+ // 人员轨迹查询依赖GIS服务端
1143
+ if (context.gisServerURL) {
1144
+ var options = {};
1145
+ var serviceUrl = context.gisServerURL + '/home/gis/patrol/getobjecttrace.htm';
1146
+ options.traceService = serviceUrl;
1147
+ options.dateTime = dateTime;
1148
+ options.queryCondition = queryCondition;
1149
+ options.hideControlPanel = hideControlPanel;
1150
+ options.symbolPic = symbolPic;
1151
+ options.optimizeParams = optimizeParams;
1152
+ options.infoCallback = infoCallback;
1153
+ options.updatePositionCallback = updatePositionCallback;
1154
+ options.closeCallback = closeCallback;
1155
+ options.traceDigCallback = traceDigCallback;
1156
+ scene.fire(msgPrefix + ":showObjectTrace", {
1157
+ args: [objectID, symbolType, options]
1158
+ }, parentScene);
1159
+ } else {
1160
+ console.error("没有配置二维GIS服务端地址");
1161
+ }
1162
+ };
1163
+
1164
+ /* 显示车辆人员轨迹 */
1165
+ that.addObjectTrace = function (jsonInfo, symbolType, clear, showControlPanel, traceID, options) {
1166
+ if (scene == null)
1167
+ return;
1168
+
1169
+ scene.fire((msgPrefix + ":addObjectTrace"), {args: [jsonInfo, symbolType, clear, showControlPanel, traceID, options]}, parentScene, false);
1170
+ };
1171
+
1172
+ /*设置轨迹属性 */
1173
+ that.setTraceOptions = function(options){
1174
+ if (scene == null)
1175
+ return;
1176
+ scene.fire((msgPrefix + ":setTraceOptions"), {args: [options]}, parentScene, false);
1177
+ };
1178
+
1179
+ /**
1180
+ * 移动的雷达
1181
+ */
1182
+ that.movingRadar= function (jsonInfo, zoom, clear, options, layerName) {
1183
+ scene.fire(msgPrefix + ":movingRadar", {args: [jsonInfo, zoom, clear, options, layerName]}, parentScene);
1184
+ }
1185
+
1186
+ /**
1187
+ * 移动的图标
1188
+ */
1189
+ that.movingBillboard = function (jsonInfo, zoom, clear, layerName, options, clickEnable, moveEnable) {
1190
+ scene.fire(msgPrefix + ":movingBillboard", { args: [jsonInfo, zoom, clear, layerName, options, clickEnable, moveEnable] }, parentScene);
1191
+ }
1192
+
1193
+ /*雷达扫描*/
1194
+ that.circleRadarEffect = function (info, zoom, clear, options, layerName) {
1195
+ if (scene == null)
1196
+ return;
1197
+ scene.fire((msgPrefix + ":circleRadarEffect"), { args: [info, zoom, clear, options, layerName] }, parentScene, false);
1198
+ }
1199
+
1200
+ /*光线射线*/
1201
+ that.lightRay = function (jsonInfo, zoom, clear, options, layerName) {
1202
+ if (scene == null)
1203
+ return;
1204
+ scene.fire((msgPrefix + ":lightRay"), { args: [jsonInfo, zoom, clear, options, layerName] }, parentScene, false);
1205
+ }
1206
+
1207
+
1208
+ that.getbuildBypolygon = function (info, color, zoom, clear, options, layerName) {
1209
+ if (scene == null)
1210
+ return;
1211
+ scene.fire((msgPrefix + ":getbuildBypolygon"), { args: [info, color, zoom, clear, options, layerName] }, parentScene, false);
1212
+ }
1213
+
1214
+
1215
+
1216
+ /* 点到点的迁徙接口*/
1217
+ that.showPolylineMoveMap= function (info, layerName, clear, zoom,options) {
1218
+ if (scene == null)
1219
+ return;
1220
+ scene.fire((msgPrefix + ":showPolylineMoveMap"), { args: [info, layerName, clear, zoom, options] }, parentScene, false);
1221
+ }
1222
+
1223
+ /* 视频投影 */
1224
+ that.beginProjection = function (options) {
1225
+ if (scene == null)
1226
+ return;
1227
+
1228
+ scene.fire((msgPrefix + ":beginProjection"), { args: [options] }, parentScene, false);
1229
+ }
1230
+
1231
+ /* 道路悬浮注记*/
1232
+ that.showMultiRoadText = function (jsonInfo, zoom, clear, tagName, clickEnable, mouseOverEnable) {
1233
+ if (scene == null)
1234
+ return;
1235
+ scene.fire((msgPrefix + ":showMultiRoadText"), { args: [jsonInfo, zoom, clear, tagName, clickEnable, mouseOverEnable] }, parentScene, false);
1236
+ }
1237
+
1238
+ that.limitGlobeRange = function (extent) {
1239
+ if (scene == null)
1240
+ return;
1241
+ scene.fire((msgPrefix + ":limitGlobeRange"), {args: [extent]}, parentScene, false);
1242
+ };
1243
+
1244
+ that.addChart = function(jsonInfo, zoom, clear, options, layerName , clickCallback, mouseOverCallBack) {
1245
+ if (scene == null)
1246
+ return;
1247
+
1248
+ layerName = layerName || "chart";
1249
+
1250
+ var clickBackName = "addChartClick" + layerName;
1251
+ var mouseOverBackName = "addChartMouseMove" + layerName;
1252
+
1253
+ that.removeEventBind(clickBackName);
1254
+ that.removeEventBind(mouseOverBackName);
1255
+
1256
+ var clickEnable = false;
1257
+ var mouseOverEnable = false;
1258
+
1259
+ if(clickCallback instanceof Function){
1260
+ that.bindEvent(clickBackName, function(evt) {
1261
+ clickCallback(evt.args);
1262
+ });
1263
+ clickEnable = true;
1264
+ }
1265
+
1266
+ if(mouseOverCallBack instanceof Function){
1267
+ that.bindEvent(mouseOverBackName, function(evt) {
1268
+ mouseOverCallBack(evt.args);
1269
+ });
1270
+ mouseOverEnable = true;
1271
+ }
1272
+
1273
+ scene.fire((msgPrefix + ":addChart"), {args: [jsonInfo, zoom, clear, options, layerName , clickEnable, mouseOverEnable]}, parentScene, false);
1274
+ };
1275
+ /**
1276
+ * 鼠标点击模型查询
1277
+ * @param callback
1278
+ */
1279
+ that.queryModelInfo=function(callback,type){
1280
+ if (scene == null)
1281
+ return;
1282
+ scene.fire((msgPrefix + ":queryModelClick"), {args: [callback,type]}, parentScene, false);
1283
+ };
1284
+ /**
1285
+ * 删除三维柱状图
1286
+ */
1287
+ that.removeChart = function() {
1288
+ if (scene == null)
1289
+ return;
1290
+ scene.fire((msgPrefix + ":removeChart"), {args: []}, parentScene, false);
1291
+ };
1292
+
1293
+ that.flyToPoint=function(x,y,height){
1294
+ if (scene == null)
1295
+ return;
1296
+ scene.fire((msgPrefix + ":flyToPoint"), {args: [x,y,height]}, parentScene, false);
1297
+ };
1298
+
1299
+ that.fullExtent=function(){
1300
+ if (scene == null)
1301
+ return;
1302
+
1303
+ scene.fire((msgPrefix + ":fullExtent"), {args: []}, parentScene, false);
1304
+ };
1305
+
1306
+ that.goUnderGround=function(height){
1307
+ if(scene == null)
1308
+ return;
1309
+ scene.fire((msgPrefix + ":goUnderGround"), {args: [height]}, parentScene, false);
1310
+ };
1311
+
1312
+ /* 显示视频闪烁点*/
1313
+ that.addVideoAlarm = function (coordX, coorY, successFunc, hitCallback) {
1314
+ if (scene == null)
1315
+ return;
1316
+ scene.fire(msgPrefix + ":addVideoAlarm", {args: [coordX, coorY, successFunc, hitCallback]}, parentScene);
1317
+ };
1318
+
1319
+ /* 显示面板信息*/
1320
+ that.createPanelInfo = function (entity, successFunc) {
1321
+ if (scene == null)
1322
+ return;
1323
+ scene.fire(msgPrefix + ":createPanelInfo", {args: [entity, successFunc]}, parentScene);
1324
+ };
1325
+
1326
+ /* 显示面板信息*/
1327
+ that.createAnimateCar = function (objectID, successFunc) {
1328
+ if (scene == null)
1329
+ return;
1330
+ scene.fire(msgPrefix + ":createAnimateCar", {args: [ objectID, successFunc]}, parentScene);
1331
+ };
1332
+
1333
+ /*根据id号删除一个视频闪烁点*/
1334
+ that.removeVideoAlarm = function (id) {
1335
+ if (scene == null)
1336
+ return;
1337
+ scene.fire(msgPrefix + ":removeVideoAlarm", {args: [id]}, parentScene);
1338
+ };
1339
+ /*地图上标注返回坐标值*/
1340
+ that.pointSelect = function(symbolType, mapZoom2Point, clickCallback){
1341
+ if (scene == null)
1342
+ return;
1343
+ that.removeEventBind("pointSelectCallback");
1344
+ if (clickCallback != undefined) {
1345
+ that.bindEvent("pointSelectCallback", function (position) {
1346
+ that.removeEventBind("pointSelectCallback");
1347
+ var resultPosition=[position.args[0].longitude+','+position.args[0].latitude];
1348
+ resultPosition.push(position.args[0]);
1349
+ clickCallback(resultPosition);
1350
+ });
1351
+ }
1352
+ scene.fire((msgPrefix + ":pointSelect"), {args:[symbolType, mapZoom2Point]}, parentScene, false);
1353
+ };
1354
+
1355
+ /*根据要素坐标定位显示要素*/
1356
+ that.locateFeatureByCoords=function(geometries, type, ID, style, hStyle,zoom,keyFiled,labelField,labelStyle,randomColor,renderCanvas,singleSelected,options){
1357
+ if (scene == null)
1358
+ return;
1359
+ scene.fire((msgPrefix + ":locateFeatureByCoords"), { args : [geometries, type, ID, style, hStyle, zoom,keyFiled,labelField,labelStyle,randomColor,renderCanvas,singleSelected,options] }, parentScene, false);
1360
+ };
1361
+ /* 要素查询 */
1362
+ that.queryFeature = function(params, callback) {
1363
+ // 移除监听
1364
+ that.removeEventBind("queryFeatureCallback");
1365
+
1366
+ if (callback != undefined) {
1367
+ that.bindEvent("queryFeatureCallback", function(evt) {
1368
+ callback(evt.args);
1369
+ });
1370
+ }
1371
+ scene.fire(msgPrefix + ":queryFeature", {args: [params.layerID, params.where || null, params.geometry || null, params.outFields, params.outGeometry, params.pointTolorence||0,params.startIndex,params.maxFeatures,params.queryID]}, parentScene);
1372
+ }
1373
+ /*绘制图形*/
1374
+ that.drawGraphic = function(graphic, zoom, clickCallback) {
1375
+ if (scene == null)
1376
+ return;
1377
+ if (graphic.geometry instanceof Array) {
1378
+ graphic.type=graphic.type||graphic.geometry[0].type;
1379
+ scene.fire(msgPrefix + ":locateFeatureByCoords", { args : [ graphic.geometry, graphic.type, graphic.id, graphic.style,
1380
+ graphic.hstyle, zoom,graphic.keyField,graphic.labelField,graphic.labelStyle,graphic.colorNumber] }, parentScene);
1381
+ } else {
1382
+ graphic.type=graphic.type||graphic.geometry.type;
1383
+ scene.fire(msgPrefix + ":locateFeatureByCoords", { args : [ [ graphic.geometry ], graphic.type, graphic.id, graphic.style,
1384
+ graphic.hstyle, zoom ] }, parentScene);
1385
+ }
1386
+ that.removeEventBind("locateFeatureByIDsCallback");
1387
+ if (clickCallback != undefined) {
1388
+ that.bindEvent("locateFeatureByIDsCallback", function(evt) {
1389
+ clickCallback(evt.args);
1390
+ });
1391
+ }
1392
+ };
1393
+ /* 标识位置 */
1394
+ that.markMap = function(projectTypeID, eventTypeID, actPropertyID, displayStyleID, layerID, clickCallback,cellIndexName,point) {
1395
+ if (scene == null)
1396
+ return;
1397
+ var eventInfo={
1398
+ actpropertyid: actPropertyID,
1399
+ displaystyleid: displayStyleID,
1400
+ eventtypeid: eventTypeID,
1401
+ projecttypeid: projectTypeID
1402
+ };
1403
+ scene.fire((msgPrefix + ":markMap"), { args : [eventInfo,layerID,clickCallback] }, parentScene, false);
1404
+ }
1405
+ /*连续标注三维地图获取xy坐标*/
1406
+ that.markMapXY = function(event,Callback){
1407
+ if (scene == null)
1408
+ return;
1409
+ scene.fire((msgPrefix + ":markMapXY"), { args : [event,Callback] }, parentScene, false);
1410
+ };
1411
+ /*清除标注事件*/
1412
+ that.removeMarkMapMouseHandler=function(){
1413
+ if (scene == null)
1414
+ return;
1415
+ scene.fire((msgPrefix + ":removeMarkMapMouseHandler"), { args : [] }, parentScene, false);
1416
+ };
1417
+
1418
+ /**
1419
+ * 绘制图形接口
1420
+ * type 类型 point,polyline,polygon,circle
1421
+ * style 样式
1422
+ * clear 是否清除
1423
+ * callback 回调函数返回绘制图形的坐标信息
1424
+ **/
1425
+ that.drawGeometry = function (type, style, clear, callback, option) {
1426
+ if (scene == null)
1427
+ return;
1428
+ scene.fire((msgPrefix + ":drawGeometry"), { args : [type, style, clear, callback, option] }, parentScene, false);
1429
+ };
1430
+ that.showUserDrawGeometry = function (show,id) {
1431
+ if (scene == null)
1432
+ return;
1433
+ scene.fire((msgPrefix + ":showUserDrawGeometry"), { args : [show,id] }, parentScene, false);
1434
+ };
1435
+
1436
+ that.addGraphic=function(params, addCallback){
1437
+ if(scene == null)
1438
+ return;
1439
+ if(!params||!params[0])
1440
+ return;
1441
+ var type=params[0];
1442
+ var style=params[1]||{"color":[215, 214, 111, 100]};
1443
+ var clear=params[2]||true;
1444
+ var callback=addCallback;
1445
+ scene.fire((msgPrefix + ":drawGeometry"), { args : [type, style, clear, callback] }, parentScene, false);
1446
+ };
1447
+
1448
+
1449
+ //by hth,2020-12-29
1450
+
1451
+ that.showMultiObjectToCluster = function(jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickCallBack, mouseOverEnable) {
1452
+
1453
+ // 获取symbolUrl
1454
+
1455
+ var defaultSymbolUrl = Array.isArray(jsonInfo) ? jsonInfo[0].symbolUrl : 'numImage.png';
1456
+
1457
+ var hasCustomProperties = infoStyle.hasOwnProperty('customProperties')
1458
+
1459
+ var defaultClusterImageInfo = {//自定义聚类图标。如果设置的话,要自己调"textStyle"以适应自己的"symbolUrl"
1460
+
1461
+ symbolUrl: defaultSymbolUrl,
1462
+
1463
+ horizontalOrigin: "center",
1464
+
1465
+ verticalOrigin: "bottom",
1466
+
1467
+ cssStyle: {
1468
+
1469
+ "borderRadius": 500,//设置的很大话,就会形成半圆角
1470
+
1471
+ "fillColor": "rgba(27,32,43,0.7)",//圆角矩形的颜色
1472
+
1473
+ "borderLineWidth": 3,//圆角矩形的边框宽度
1474
+
1475
+ "borderLineColor": "rgba(230,230,230,0.9)",//圆角矩形的边框颜色
1476
+
1477
+ "paddingX": 15,//圆角矩形内边框padding(主要是为了让文字与边框有一定距离)
1478
+
1479
+ "paddingY": 6,
1480
+
1481
+ "marginBottom": 2 //下边框外距
1482
+
1483
+ },
1484
+
1485
+ textStyle : {
1486
+
1487
+ "font" : "60px Helvetica",
1488
+
1489
+ "fillColor" : "rgba(250,250,250,1.0)",
1490
+
1491
+ "outlineColor" : "black",
1492
+
1493
+ "outlineWidth" : 1.0,
1494
+
1495
+ "padding":1,
1496
+
1497
+ "textScale":0.5,
1498
+
1499
+ "textStartX":40,
1500
+
1501
+ "textStartY":15
1502
+
1503
+ }
1504
+
1505
+ }
1506
+
1507
+ // 组装options数据
1508
+
1509
+ var options = {
1510
+
1511
+ clusterStyle: (hasCustomProperties && infoStyle.customProperties.clusterStyle) || 'clusterByGrid',
1512
+
1513
+ zoom:zoom,
1514
+
1515
+ scale: 0.9,
1516
+
1517
+ clusterLimit: (hasCustomProperties && infoStyle.customProperties.clusterLimit) || undefined,
1518
+
1519
+ symbolUrl: (hasCustomProperties && infoStyle.customProperties.symbolUrl) || defaultSymbolUrl,
1520
+
1521
+ clear:clear,
1522
+
1523
+ layerName: tagName,
1524
+
1525
+ style: 'default',
1526
+
1527
+ nearFarScalar: [8000, 1.0, 10000, 0.6],
1528
+
1529
+ clickCallBack: clickCallBack,
1530
+
1531
+ clusterImageInfo: (hasCustomProperties && infoStyle.customProperties.clusterImageInfo) || defaultClusterImageInfo,
1532
+
1533
+ minSize: (hasCustomProperties && infoStyle.customProperties.minSize) || 6,
1534
+
1535
+ geometricErrorScale: (hasCustomProperties && infoStyle.customProperties.geometricErrorScale) || 2
1536
+
1537
+ }
1538
+
1539
+ that.addClusterLayer({data:jsonInfo, options});
1540
+
1541
+ }
1542
+
1543
+ //添加聚类图层
1544
+ that.addClusterLayer=function(data){
1545
+ if(scene == null)
1546
+ return;
1547
+ var dataInfo = data.data;
1548
+ var option=data.options;
1549
+ if(option && option.addClusterWithAni){
1550
+ scene.fire((msgPrefix + ":addClusterWithAni"), {args: [dataInfo, option]}, parentScene, false);
1551
+ }else{
1552
+ scene.fire((msgPrefix + ":addClusterLayer"), {args: [dataInfo, option]}, parentScene, false);
1553
+ }
1554
+ };
1555
+ //获取所选择的三维模型信息
1556
+ that.getSelectedLayerinfo = function (name, callback) {
1557
+ if (scene == null)
1558
+ return;
1559
+ scene.fire((msgPrefix + ":getSelectedLayerinfo"), {args: [name, callback]}, parentScene, false);
1560
+ };
1561
+
1562
+ //three模型管理
1563
+ that.threeModelManage = function (layerName, type, options, others) {
1564
+ if (scene == null)
1565
+ return;
1566
+
1567
+ scene.fire((msgPrefix + ":threeModelManage"), { args: [layerName, type, options, others] }, parentScene, false);
1568
+ }
1569
+
1570
+ //烟花效果
1571
+ that.fireWorkSystem = function (options) {
1572
+ if (scene == null)
1573
+ return;
1574
+
1575
+ scene.fire((msgPrefix + ":fireWorkSystem"), { args: [options] }, parentScene, false);
1576
+ }
1577
+
1578
+ //烟花效果显隐控制
1579
+ that.setFireWorkVisible = function (visible) {
1580
+ if (scene == null)
1581
+ return;
1582
+
1583
+ scene.fire((msgPrefix + ":setFireWorkVisible"), { args: [visible] }, parentScene, false);
1584
+ }
1585
+
1586
+
1587
+ //开启地透
1588
+ that.undergroundMode_on = function(alpha){
1589
+ if (scene == null)
1590
+ return;
1591
+
1592
+ scene.fire((msgPrefix + ":undergroundMode_on"), {args: [alpha]}, parentScene, false);
1593
+ }
1594
+
1595
+ //关闭地透
1596
+ that.undergroundMode_off = function(){
1597
+ if (scene == null)
1598
+ return;
1599
+
1600
+ scene.fire((msgPrefix + ":undergroundMode_off"), {args: []}, parentScene, false);
1601
+ }
1602
+
1603
+ //平面坐标转经纬度
1604
+ that.Plat2lonLat = function (positions, callback) {
1605
+ if (scene == null)
1606
+ return;
1607
+ scene.fire((msgPrefix + ":Plat2lonLat"), {args: [positions, callback]}, parentScene, false);
1608
+ };
1609
+ //地面开挖接口
1610
+ that.digsuface=function(positions,depth,callback){
1611
+ if (scene == null)
1612
+ return;
1613
+ var options={
1614
+ positions:positions,
1615
+ depth:depth,
1616
+ callback:callback
1617
+ };
1618
+ scene.fire((msgPrefix + ":digSurface_dig"), {args: [options]}, parentScene, false);
1619
+ };
1620
+
1621
+ //清除地面开挖
1622
+ that.removeDigsuface=function(){
1623
+ if (scene == null)
1624
+ return;
1625
+ scene.fire((msgPrefix + ":digSurface_remove"), {args: []}, parentScene, false);
1626
+ };
1627
+ that.clearDrawGeometry=function(){
1628
+ if (scene == null)
1629
+ return;
1630
+ scene.fire((msgPrefix + ":cleardrawGeometry"), {args: []}, parentScene, false);
1631
+ };
1632
+
1633
+ //三维地图点击事件
1634
+ that.addPickHandler = function (callback) {
1635
+ if (scene == null)
1636
+ return;
1637
+ scene.fire((msgPrefix + ":addPickHandler"), {args: [callback]}, parentScene, false);
1638
+ };
1639
+ //右键查询
1640
+ that.addRightClickHandler=function(callback){
1641
+ if (scene == null)
1642
+ return;
1643
+ scene.fire((msgPrefix + ":addRightClickHandler"), {args: [callback]}, parentScene, false);
1644
+ };
1645
+
1646
+ that.pickModel = function (position,callback) {
1647
+ if (scene == null)
1648
+ return;
1649
+ scene.fire((msgPrefix + ":pickModel"), {args: [callback]}, parentScene, false);
1650
+ };
1651
+ that.show2dMode=function(){
1652
+ if (scene == null)
1653
+ return;
1654
+ scene.fire((msgPrefix + ":show2dMode"), {args: []}, parentScene, false);
1655
+ };
1656
+ that.show3dMode=function () {
1657
+ if (scene == null)
1658
+ return;
1659
+ scene.fire((msgPrefix + ":show3dMode"), {args: []}, parentScene, false);
1660
+ };
1661
+ that.getSysLayerTree=function(callback){
1662
+ if (scene == null)
1663
+ return;
1664
+ scene.fire((msgPrefix + ":getSysLayerTree"), {args: [callback]}, parentScene, false);
1665
+ };
1666
+ that.show2_5dMode=function(){
1667
+ if (scene == null)
1668
+ return;
1669
+ scene.fire((msgPrefix + ":show2_5dMode"), {args: []}, parentScene, false);
1670
+ };
1671
+ that.showWall=function(jsonInfo, zoom, clear, zoomOptions, merge, layerName, clickEnable, mouseOverEnable){
1672
+ if (scene == null)
1673
+ return;
1674
+ scene.fire((msgPrefix + ":showWall"), {args: [jsonInfo, zoom, clear, zoomOptions, merge, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
1675
+ };
1676
+
1677
+ /* 根据图层字段定位显示 */
1678
+ that.locateFeatureByIDs = function(layerID, keyField, keyValue, clearMap, style, hStyle, bZoom, randomColor, labelfield, labelstyle, geometry, where, renderCanvas, singleSelected,options,extendProperty,layerTag, successFunc) {
1679
+ if (scene == null)
1680
+ return;
1681
+
1682
+ if(scene.layerUsageConfig && scene.layerUsageConfig[layerID]){
1683
+ keyField = keyField || scene.layerUsageConfig[layerID].keyFieldName;
1684
+ }
1685
+ scene.fire((msgPrefix + ":locateFeatureByIDs"), {args: [layerID, keyField, keyValue, clearMap, style, hStyle, bZoom, randomColor, labelfield, labelstyle, geometry, where, renderCanvas, singleSelected,options,extendProperty,layerTag, successFunc]}, parentScene, false);
1686
+ };
1687
+
1688
+ /**
1689
+ * 区域查询
1690
+ */
1691
+ that.locateRegionByIDs = function(layerID, keyField, keyValue, style, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, successFunc) {
1692
+ if (scene == null)
1693
+ return;
1694
+ if(scene.layerUsageConfig && scene.layerUsageConfig[layerID]){
1695
+ keyField = keyField || scene.layerUsageConfig[layerID].keyFieldName;
1696
+ var usageLabelField = scene.layerUsageConfig[layerID].labelFieldName;
1697
+ }
1698
+ scene.fire((msgPrefix + ":locateRegionByIDs"), {args: [layerID, keyField, keyValue, style, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, successFunc,usageLabelField]}, parentScene, false);
1699
+ };
1700
+
1701
+ that.drawGeoJsonGeometry=function(jsonInfos, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack){
1702
+ if (scene == null)
1703
+ return;
1704
+ scene.fire((msgPrefix + ":drawGeoJsonGeometry"), {args: [jsonInfos, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack]}, parentScene, false);
1705
+ }
1706
+
1707
+
1708
+ that.pathPlan = function(origin, destination, callBack){
1709
+ if (scene == null)
1710
+ return;
1711
+
1712
+ scene.fire((msgPrefix + ":pathPlan"), {args: [origin, destination, callBack]}, parentScene, false);
1713
+ };
1714
+
1715
+ that.getRoutePlanning=function(origin,destination,options,callback){
1716
+ if (scene == null)
1717
+ return;
1718
+ scene.fire((msgPrefix + ":getRoutePlanning"), {args: [origin,destination,options,callback]}, parentScene, false);
1719
+ };
1720
+
1721
+ that.startMonomerQuery = function (type, clear, options, layerName, clickCallback) {
1722
+ if (scene == null)
1723
+ return;
1724
+ // 移除监听
1725
+ var clickBackName = "startMonomerQueryClick" + layerName;
1726
+
1727
+ that.removeEventBind(clickBackName);
1728
+ var clickEnable = false;
1729
+
1730
+ if(clickCallback instanceof Function){
1731
+ that.bindEvent(clickBackName, function(evt) {
1732
+ clickCallback(evt.args);
1733
+ });
1734
+ clickEnable = true;
1735
+ }
1736
+
1737
+ scene.fire((msgPrefix + ":startMonomerQuery"), { args: [type, clear, options, layerName, clickEnable] }, parentScene, false);
1738
+ }
1739
+
1740
+
1741
+ that.superMonomerQuery = function(type, clear, options, layerName, clickEnable){
1742
+ if (scene == null)
1743
+ return;
1744
+ scene.fire((msgPrefix + ":superMonomerQuery"), {args: [type, clear, options, layerName, clickEnable]}, parentScene, false);
1745
+ };
1746
+
1747
+ //s3m模型操作
1748
+ that.setS3MOperation = function(type, LayerName, options){
1749
+ if (scene == null)
1750
+ return;
1751
+
1752
+ scene.fire((msgPrefix + ":setS3MOperation"), {args: [type, LayerName, options]}, parentScene, false);
1753
+ }
1754
+
1755
+ that.createMonomerClamp = function(jsonInfo, zoom, clear, options, layerName, clickCallBack){
1756
+ if (scene == null)
1757
+ return;
1758
+ scene.fire((msgPrefix + ":createMonomerClamp"), {args: [jsonInfo, zoom, clear, options, layerName, clickCallBack]}, parentScene, false);
1759
+ };
1760
+
1761
+ that.getPGlist = function(queryParam, queryCallBack){
1762
+ if (scene == null)
1763
+ return;
1764
+ scene.fire((msgPrefix + ":getPGlist"), {args: [queryParam, queryCallBack]}, parentScene, false);
1765
+ };
1766
+
1767
+ that.enablePickGradientObj = function(callback){
1768
+ if (scene == null) {
1769
+ return
1770
+ };
1771
+
1772
+ that.removeEventBind("enablePickGradientObj");
1773
+ if (callback != undefined) {
1774
+ that.bindEvent("enablePickGradientObj", function (evt) {
1775
+ callback(evt.args);
1776
+ });
1777
+ }
1778
+
1779
+ scene.fire((msgPrefix + ":enablePickGradientObj"), {args: []}, parentScene, false);
1780
+ };
1781
+
1782
+ that.disablePickGradientObj = function(){
1783
+ if (scene == null)
1784
+ return;
1785
+ scene.fire((msgPrefix + ":disablePickGradientObj"), {args: []}, parentScene, false);
1786
+ };
1787
+
1788
+ that.modifyAttributes = function(layerName, objID, newProperties, options, autoRevert){
1789
+ if (scene == null)
1790
+ return;
1791
+ scene.fire((msgPrefix + ":modifyAttributes"), {args: [layerName, objID, newProperties, options, autoRevert]}, parentScene, false);
1792
+ };
1793
+ that.focusOnDistrict = function(config, positions, modelName, hideLayerNames){
1794
+ if (scene == null)
1795
+ return;
1796
+ scene.fire((msgPrefix + ":focusOnDistrict"), {args: [config, positions, modelName, hideLayerNames]}, parentScene, false);
1797
+ };
1798
+ that.showLaserWall = function(coordinatesData, layerName, options){
1799
+ if (scene == null)
1800
+ return;
1801
+ scene.fire((msgPrefix + ":showLaserWall"), {args: [coordinatesData, layerName, options]}, parentScene, false);
1802
+ };
1803
+ that.PipeLineOperation = function(layerName,operateType,zoom,clear,options){
1804
+ if (scene == null)
1805
+ return;
1806
+ scene.fire((msgPrefix + ":PipeLineOperation"), {args: [layerName,operateType,zoom,clear,options]}, parentScene, false);
1807
+ };
1808
+ that.setCameraConfig = function(options){
1809
+ if (scene == null)
1810
+ return;
1811
+ scene.fire((msgPrefix + ":setCameraConfig"), {args: [options]}, parentScene, false);
1812
+ };
1813
+ that.setFireEffect = function(options,zoom,clear,layerName){
1814
+ if (scene == null)
1815
+ return;
1816
+ scene.fire((msgPrefix + ":setFireEffect"), {args: [options,zoom,clear,layerName]}, parentScene, false);
1817
+ };
1818
+ that.drawPoints = function(layerName, positions, options){
1819
+ if (scene == null)
1820
+ return;
1821
+ scene.fire((msgPrefix + ":drawPoints"), {args: [layerName, positions, options]}, parentScene, false);
1822
+ };
1823
+ that.traceOperation = function(posArr, options){
1824
+ if (scene == null)
1825
+ return;
1826
+ scene.fire((msgPrefix + ":traceOperation"), {args: [posArr, options]}, parentScene, false);
1827
+ };
1828
+ that.regionOperation = function(options, data){
1829
+ if (scene == null)
1830
+ return;
1831
+ scene.fire((msgPrefix + ":regionOperation"), {args: [options, data]}, parentScene, false);
1832
+ };
1833
+ that.activeLayer = function(layerName, options, filter){
1834
+ if (scene == null)
1835
+ return;
1836
+ scene.fire((msgPrefix + ":activeLayer"), {args: [layerName, options, filter]}, parentScene, false);
1837
+ };
1838
+ that.networkCloud = function(options, positions){
1839
+ if (scene == null)
1840
+ return;
1841
+ scene.fire((msgPrefix + ":networkCloud"), {args: [options, positions]}, parentScene, false);
1842
+ };
1843
+ that.clearNetworkCloud = function(layerNames){
1844
+ if (scene == null)
1845
+ return;
1846
+ scene.fire((msgPrefix + ":clearNetworkCloud"), {args: [layerNames]}, parentScene, false);
1847
+ };
1848
+ that.lineOperation = function(options, data){
1849
+ if (scene == null)
1850
+ return;
1851
+ scene.fire((msgPrefix + ":lineOperation"), {args: [options, data]}, parentScene, false);
1852
+ };
1853
+ that.getMainSubTypeTree = function(params, callback){
1854
+ if (scene == null)
1855
+ return;
1856
+ var cb = function (type, data) {
1857
+ if (callback && type == 'getMainSubTypeTreeCallback') {
1858
+ callback(data);
1859
+ }
1860
+ };
1861
+ scene.fire((msgPrefix + ":getMainSubTypeTree"), {args: [params, cb]}, parentScene, false);
1862
+ };
1863
+ that.getRegion = function(params, callback){
1864
+ if (scene == null)
1865
+ return;
1866
+ var cb = function (type, data) {
1867
+ if (callback && type == 'getRegionCallback') {
1868
+ callback(data);
1869
+ }
1870
+ };
1871
+ scene.fire((msgPrefix + ":getRegion"), {args: [params, cb]}, parentScene, false);
1872
+ };
1873
+ that.getMapConfig = function(key, callback){
1874
+ if (scene == null)
1875
+ return;
1876
+ scene.fire((msgPrefix + ":getMapConfig"), {args: [key, callback]}, parentScene, false);
1877
+ };
1878
+ that.addCIMMap = function(options) {
1879
+ if (scene == null)
1880
+ return;
1881
+ scene.fire((msgPrefix + ":addCIMMap"), { args: [options] }, parentScene, false);
1882
+ };
1883
+ that.addCIMModel = function(options) {
1884
+ if (scene == null)
1885
+ return;
1886
+ scene.fire((msgPrefix + ":addCIMModel"), { args: [options] }, parentScene, false);
1887
+ };
1888
+ that.setLayerVisible = function(options) {
1889
+ if (scene == null)
1890
+ return;
1891
+ scene.fire((msgPrefix + ":setLayerVisible"), { args: [options] }, parentScene, false);
1892
+ };
1893
+ that.flyToLayer = function(options) {
1894
+ if (scene == null)
1895
+ return;
1896
+ scene.fire((msgPrefix + ":flyToLayer"), { args: [options] }, parentScene, false);
1897
+ };
1898
+ that.controlCamera = function(options) {
1899
+ if (scene == null)
1900
+ return;
1901
+ scene.fire((msgPrefix + ":controlCamera"), { args: [options] }, parentScene, false);
1902
+ };
1903
+ that.zoomIn = function() {
1904
+ if (scene == null)
1905
+ return;
1906
+ scene.fire((msgPrefix + ":zoomIn"), { args: [] }, parentScene, false);
1907
+ };
1908
+ that.zoomOut = function(options) {
1909
+ if (scene == null)
1910
+ return;
1911
+ scene.fire((msgPrefix + ":zoomOut"), { args: [options] }, parentScene, false);
1912
+ };
1913
+ that.measureDistance = function(options) {
1914
+ if (scene == null)
1915
+ return;
1916
+ scene.fire((msgPrefix + ":measureDistance"), { args: [options] }, parentScene, false);
1917
+ };
1918
+ that.measureArea = function(options) {
1919
+ if (scene == null)
1920
+ return;
1921
+ scene.fire((msgPrefix + ":measureArea"), { args: [options] }, parentScene, false);
1922
+ };
1923
+ that.measureHeight = function(options) {
1924
+ if (scene == null)
1925
+ return;
1926
+ scene.fire((msgPrefix + ":measureHeight"), { args: [options] }, parentScene, false);
1927
+ };
1928
+ that.onUndergroundModel = function(alpha, distance) {
1929
+ if (scene == null)
1930
+ return;
1931
+ scene.fire((msgPrefix + ":onUndergroundModel"), { args: [alpha, distance] }, parentScene, false);
1932
+ };
1933
+ that.offUndergroundModel = function() {
1934
+ if (scene == null)
1935
+ return;
1936
+ scene.fire((msgPrefix + ":offUndergroundModel"), { args: [] }, parentScene, false);
1937
+ };
1938
+ that.addFlag = function(options) {
1939
+ if (scene == null)
1940
+ return;
1941
+ scene.fire((msgPrefix + ":addFlag"), { args: [options] }, parentScene, false);
1942
+ };
1943
+ that.getPointInfo = function(options) {
1944
+ if (scene == null)
1945
+ return;
1946
+ scene.fire((msgPrefix + ":getPointInfo"), { args: [options] }, parentScene, false);
1947
+ };
1948
+ //添加聚类图层
1949
+ that.addClusterLayerCIM = function(dataInfo, option) {
1950
+ if (scene == null)
1951
+ return;
1952
+ scene.fire((msgPrefix + ":addClusterLayer"), { args: [dataInfo, option] }, parentScene, false);
1953
+ };
1954
+ //可视域分析
1955
+ that.startViewer = function(options) {
1956
+ if (scene == null)
1957
+ return;
1958
+ scene.fire((msgPrefix + ":startViewer"), { args: [options] }, parentScene, false);
1959
+ };
1960
+ that.removeViewer = function() {
1961
+ if (scene == null)
1962
+ return;
1963
+ scene.fire((msgPrefix + ":removeViewer"), { args: [] }, parentScene, false);
1964
+ };
1965
+ that.setViewerOptions = function(options) {
1966
+ if (scene == null)
1967
+ return;
1968
+ scene.fire((msgPrefix + ":setViewerOptions"), { args: [options] }, parentScene, false);
1969
+ };
1970
+ that.showSkyLine = function(options) {
1971
+ if (scene == null)
1972
+ return;
1973
+ scene.fire((msgPrefix + ":showSkyLine"), { args: [options] }, parentScene, false);
1974
+ };
1975
+ that.clearSkyLine = function() {
1976
+ if (scene == null)
1977
+ return;
1978
+ scene.fire((msgPrefix + ":clearSkyLine"), { args: [] }, parentScene, false);
1979
+ };
1980
+ that.setLineOptions = function(options) {
1981
+ if (scene == null)
1982
+ return;
1983
+ scene.fire((msgPrefix + ":setLineOptions"), { args: [options] }, parentScene, false);
1984
+ };
1985
+ that.bufferAnalysis = function(options,clear,update) {
1986
+ if (scene == null)
1987
+ return;
1988
+ scene.fire((msgPrefix + ":bufferAnalysis"), { args: [options,clear,update] }, parentScene, false);
1989
+ };
1990
+ that.clearBufferAnalysis = function(options) {
1991
+ if (scene == null)
1992
+ return;
1993
+ scene.fire((msgPrefix + ":clearBufferAnalysis"), { args: [] }, parentScene, false);
1994
+ };
1995
+ that.addModelClickEvent = function(callback) {
1996
+ if (scene == null)
1997
+ return;
1998
+ scene.fire((msgPrefix + ":addModelClickEvent"), { args: [callback] }, parentScene, false);
1999
+ };
2000
+ that.removeModelClickEvent = function() {
2001
+ if (scene == null)
2002
+ return;
2003
+ scene.fire((msgPrefix + ":removeModelClickEvent"), { args: [] }, parentScene, false);
2004
+ };
2005
+ that.getBIMTree = function(option, callback) {
2006
+ if (scene == null)
2007
+ return;
2008
+ scene.fire((msgPrefix + ":getBIMTree"), { args: [option, callback] }, parentScene, false);
2009
+ };
2010
+ that.setBIMTree = function(option) {
2011
+ if (scene == null)
2012
+ return;
2013
+ scene.fire((msgPrefix + ":setBIMTree"), { args: [option] }, parentScene, false);
2014
+ };
2015
+ that.clearBimSelect = function() {
2016
+ if (scene == null)
2017
+ return;
2018
+ scene.fire((msgPrefix + ":clearBimSelect"), { args: [] }, parentScene, false);
2019
+ };
2020
+ that.visibilityAnalysis = function(type) {
2021
+ if (scene == null)
2022
+ return;
2023
+ scene.fire((msgPrefix + ":visibilityAnalysis"), { args: [type] }, parentScene, false);
2024
+ };
2025
+ that.clearVisibilityAnalysis = function() {
2026
+ if (scene == null)
2027
+ return;
2028
+ scene.fire((msgPrefix + ":clearVisibilityAnalysis"), { args: [] }, parentScene, false);
2029
+ };
2030
+ that.addCIMTerrain = function(options) {
2031
+ if (scene == null)
2032
+ return;
2033
+ scene.fire((msgPrefix + ":addCIMTerrain"), { args: [options] }, parentScene, false);
2034
+ };
2035
+ that.flytoPosition = function(lon, lat, height) {
2036
+ if (scene == null)
2037
+ return;
2038
+ scene.fire((msgPrefix + ":flytoPosition"), { args: [lon, lat, height] }, parentScene, false);
2039
+ };
2040
+ //开启日照分析
2041
+ that.openSunshineAnalysis = function() {
2042
+ if (scene == null)
2043
+ return;
2044
+ scene.fire((msgPrefix + ":openSunshineAnalysis"), { args: [] }, parentScene, false);
2045
+ };
2046
+ that.sunshineAnalysis = function(date) {
2047
+ if (scene == null)
2048
+ return;
2049
+ scene.fire((msgPrefix + ":sunshineAnalysis"), { args: [date] }, parentScene, false);
2050
+ };
2051
+ that.closeSunshineAnalysis = function() {
2052
+ if (scene == null)
2053
+ return;
2054
+ scene.fire((msgPrefix + ":closeSunshineAnalysis"), { args: [] }, parentScene, false);
2055
+ };
2056
+ //设置天气
2057
+ that.setViewConfig = function(type, options) {
2058
+ if (scene == null)
2059
+ return;
2060
+ scene.fire((msgPrefix + ":setViewConfig"), { args: [type, options] }, parentScene, false);
2061
+ };
2062
+ //管网高亮显示
2063
+ that.searchAndShowPipe = function(url, options, color, clear) {
2064
+ if (scene == null)
2065
+ return;
2066
+ scene.fire((msgPrefix + ":searchAndShowPipe"), { args: [url, options, color, clear] }, parentScene, false);
2067
+ };
2068
+ that.init();
2069
+ };
2070
+
2071
+ //在外面也可以调用checkGlobeServerURL函数
2072
+ EGovaGlobeMap.checkGlobeServerURL = checkGlobeServerURL;
2073
+
2074
+ export default EGovaGlobeMap;