egovamap 0.17.20 → 0.17.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,2203 +1,2203 @@
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.zoomByRegionCode = function (regionCode, options, callback) {
796
- if (scene == null)
797
- return;
798
-
799
- that.fireEvent("zoomByRegionCode", {args: [regionCode, options, callback]}, false);
800
- }
801
-
802
- //三维场景按照中心点旋转,更方便查看
803
- that.rotateScene = function (heading, pitch, roll, duration, callback) {
804
- if (scene == null)
805
- return;
806
- that.fireEvent("rotateScene", {args: [heading, pitch, roll, duration, callback]}, false);
807
- }
808
-
809
- /* 清除指定图形 */
810
- that.clearGraphic = function (id) {
811
- if (scene == null)
812
- return;
813
- if (typeof id != "string") {
814
- id = id.join(",");
815
- }
816
- scene.fire((msgPrefix + ":clearGraphic"), {args: [id]}, parentScene, false);
817
- }
818
-
819
- /* 清除全部图形 */
820
- that.clearAllGraphics = function (id) {
821
- if (scene == null)
822
- return;
823
- scene.fire((msgPrefix + ":clearAllGraphics"), {args: []}, parentScene, false);
824
- }
825
-
826
- /**
827
- * 清除一些动态绘制效果
828
- */
829
- that.clearAllDynamicGraphics = function(){
830
- if (scene == null)
831
- return;
832
-
833
- scene.fire((msgPrefix + ":clearAllDynamicGraphics"), {args: []}, parentScene, false);
834
- }
835
-
836
- /**
837
- *恢复初始化
838
- */
839
-
840
- that.restoreInitConfig = function () {
841
- if (scene == null)
842
- return;
843
-
844
- scene.fire((msgPrefix + ":restoreInitConfig"), {args: []}, parentScene, false);
845
- }
846
-
847
- /**
848
- * 图层操作 清除
849
- */
850
- that.clearLayer = function(name,callback){
851
- if (scene == null)
852
- return;
853
-
854
- scene.fire((msgPrefix + ":clearLayer"), {args: [name,callback]}, parentScene, false);
855
- }
856
-
857
- /**
858
- * 图层操作 清除所有
859
- */
860
- that.clearAllLayer = function(skipNames){
861
- if (scene == null)
862
- return;
863
-
864
- scene.fire((msgPrefix + ":clearAllLayer"), {args: [skipNames]}, parentScene, false);
865
- }
866
-
867
- /**
868
- * 获取所有图层名
869
- */
870
- that.getAllLayer = function(callback){
871
- if (scene == null)
872
- return;
873
-
874
- // 移除监听
875
- that.removeEventBind("getAllLayerCallback");
876
- that.bindEvent("getAllLayerCallback", function(evt){
877
- callback && callback(evt.args);
878
- });
879
-
880
- scene.fire((msgPrefix + ":getAllLayer"), {args: []}, parentScene, false);
881
-
882
- }
883
-
884
- /**
885
- * 图层操作 显隐切换
886
- */
887
- that.toggleLayer = function(name){
888
- if (scene == null)
889
- return;
890
-
891
- scene.fire((msgPrefix + ":toggleLayer"), {args: [name]}, parentScene, false);
892
- }
893
-
894
- /**
895
- * 图层操作 显示
896
- */
897
- that.showLayer = function(name){
898
- if (scene == null)
899
- return;
900
-
901
- scene.fire((msgPrefix + ":showLayer"), {args: [name]}, parentScene, false);
902
- }
903
-
904
- /**
905
- * 图层操作 隐藏
906
- */
907
- that.hideLayer = function(name){
908
- if (scene == null)
909
- return;
910
-
911
- scene.fire((msgPrefix + ":hideLayer"), {args: [name]}, parentScene, false);
912
- }
913
-
914
- /**
915
- * 图层操作 清除部分元素
916
- */
917
- that.clearLayerElement = function(name, ids){
918
- if (scene == null)
919
- return;
920
-
921
- scene.fire((msgPrefix + ":clearLayerElement"), {args: [name, ids]}, parentScene, false);
922
- }
923
-
924
- /**
925
- * 图层操作 点击元素
926
- */
927
- that.clickLayerElement = function(name, id){
928
- if (scene == null)
929
- return;
930
-
931
- scene.fire((msgPrefix + ":clickLayerElement"), {args: [name, id]}, parentScene, false);
932
- }
933
-
934
- /**
935
- * 图层操作 飞向元素
936
- */
937
- that.flyToLayerElement = function(name, id, options){
938
- if (scene == null)
939
- return;
940
-
941
- scene.fire((msgPrefix + ":flyToLayerElement"), {args: [name, id, options]}, parentScene, false);
942
- }
943
-
944
- /**
945
- * 控制图层显示级别
946
- */
947
-
948
- that.setLayerVisiableLevel = function(name, beginLevel, endLevel){
949
- if (scene == null)
950
- return;
951
-
952
- scene.fire((msgPrefix + ":setLayerVisiableLevel"), {args: [name, beginLevel, endLevel]}, parentScene, false);
953
- }
954
-
955
- that.getLayerVisiableLevel = function(name, callback){
956
- if (scene == null)
957
- return;
958
-
959
- that.removeEventBind("getLayerVisiableLevelCallback");
960
- if (callback != undefined) {
961
- that.bindEvent("getLayerVisiableLevelCallback", function (evt) {
962
- callback(evt.args);
963
- });
964
- }
965
- scene.fire((msgPrefix + ":getLayerVisiableLevel"), {args: [name]}, parentScene, false);
966
- }
967
-
968
- /**
969
- * 控制模型显示级别
970
- */
971
-
972
- that.setModelVisiableLevel = function(obj, beginLevel, endLevel){
973
- if (scene == null)
974
- return;
975
-
976
- scene.fire((msgPrefix + ":setModelVisiableLevel"), {args: [obj, beginLevel, endLevel]}, parentScene, false);
977
- }
978
-
979
- /**
980
- * 道路图层绘制 road
981
- */
982
- that.buildRoad = function(jsonInfo, zoom, clear, zoomOptions){
983
- if (scene == null)
984
- return;
985
-
986
- scene.fire((msgPrefix + ":buildRoad"), {args: [jsonInfo, zoom, clear, zoomOptions]}, parentScene, false);
987
- }
988
-
989
- /**
990
- * 绘制桥 buildBridge
991
- */
992
- that.buildBridge = function(jsonInfo, zoom, clear, options, layerName, clickCallback, mouseOverCallBack){
993
- if (scene == null)
994
- return;
995
- // 移除监听
996
-
997
- layerName = layerName || "bridge";
998
- var clickBackName = "buildBridgeClick" + layerName;
999
- var mouseOverBackName = "buildBridgeMouseMove" + layerName;
1000
-
1001
- that.removeEventBind(clickBackName);
1002
- that.removeEventBind(mouseOverBackName);
1003
- var clickEnable = false;
1004
- var mouseOverEnable = false;
1005
-
1006
- if(clickCallback instanceof Function){
1007
- that.bindEvent(clickBackName, function(evt) {
1008
- clickCallback(evt.args);
1009
- });
1010
- clickEnable = true;
1011
- }
1012
-
1013
- if(mouseOverCallBack instanceof Function){
1014
- that.bindEvent(mouseOverBackName, function(evt) {
1015
- mouseOverCallBack(evt.args);
1016
- });
1017
- mouseOverEnable = true;
1018
- }
1019
-
1020
- scene.fire((msgPrefix + ":buildBridge"), {args: [jsonInfo, zoom, clear, options, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
1021
- }
1022
-
1023
- /**
1024
- * 绘制桥 build管网
1025
- */
1026
- that.drawPipe = function(jsonInfo, zoom, clear, options, layerName){
1027
- if (scene == null)
1028
- return;
1029
- // 移除监听
1030
-
1031
- scene.fire((msgPrefix + ":drawPipe"), {args: [jsonInfo, zoom, clear, options, layerName]}, parentScene, false);
1032
- }
1033
-
1034
- /*清除指定图层*/
1035
- that.clearGraphicLayerByID=function(id){
1036
- if(scene==null)
1037
- return;
1038
- if (typeof id != "string") {
1039
- id = id.join(",");
1040
- }
1041
- scene.fire((msgPrefix + ":clearGraphicLayerByID"), {args: [id]}, parentScene, false);
1042
- }
1043
-
1044
- that.drawWaveCircle=function(jsonInfo, styleOption, zoom, clear, layerName){
1045
- if (scene == null)
1046
- return;
1047
- scene.fire((msgPrefix + ":drawWaveCircle"), {args: [jsonInfo, styleOption, zoom, clear, layerName]}, false);
1048
- }
1049
-
1050
- that.getPartLayerTree=function(callback){
1051
- if (scene == null)
1052
- return;
1053
- scene.fire((msgPrefix + ":getPartLayerTree"), {args: [callback]}, false);
1054
- }
1055
-
1056
- that.showGlobePartLayer=function(layerNames,beginLevel,endLevel){
1057
- if (scene == null)
1058
- return;
1059
- scene.fire((msgPrefix + ":showGlobePartLayer"), {args: [layerNames,beginLevel,endLevel]}, false);
1060
- }
1061
-
1062
- that.getPartStatisticsJsonInfo=function(usageId,regionCode,regionName,where,orderField,returnTree,callBack){
1063
- if (scene == null)
1064
- return;
1065
- scene.fire((msgPrefix + ":getPartStatisticsJsonInfo"), {args: [usageId,regionCode,regionName,where,orderField,returnTree,callBack]}, false);
1066
- }
1067
- /**
1068
- * 显示案件分布
1069
- */
1070
- that.showRecListDistribution=function(jsonInfo, zoom, clickCallback, labelInfo){
1071
- if (scene == null)
1072
- return;
1073
- that.removeEventBind("showRecListDistributionCallback");
1074
- if (clickCallback != undefined) {
1075
- that.bindEvent("showRecListDistributionCallback", function (evt) {
1076
- clickCallback(evt.args);
1077
- });
1078
- }
1079
- if(that.globeLoaded)
1080
- scene.fire((msgPrefix + ":showRecListDistribution"), {args:[jsonInfo, zoom, labelInfo]}, parentScene, false);
1081
- }
1082
-
1083
- that.showPatrolCurrentPosition=function(jsonInfo, zoom, clear, highLightType){
1084
- if (scene == null)
1085
- return;
1086
- that.fireEvent("showPatrolCurrentPosition", {args: [jsonInfo, zoom, clear, highLightType]}, false);
1087
- };
1088
- /* 显示多个自定义图标 */
1089
- that.showMultiObjectCurrentPosition = function (jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickCallback, mouseOverCallBack) {
1090
- if (scene == null)
1091
- return;
1092
- // 移除监听
1093
- var clickBackName = "showMultiObjectCurrentPositionClick";
1094
- var mouseOverBackName = "showMultiObjectCurrentPositionMouseover";
1095
-
1096
- if(tagName){
1097
- clickBackName += tagName;
1098
- mouseOverBackName += tagName;
1099
- }
1100
-
1101
- that.removeEventBind(clickBackName);
1102
- that.removeEventBind(mouseOverBackName);
1103
- var clickEnable = false;
1104
- var mouseOverEnable = false;
1105
-
1106
- if(clickCallback instanceof Function){
1107
- that.bindEvent(clickBackName, function(evt) {
1108
- clickCallback(evt.args);
1109
- });
1110
- clickEnable = true;
1111
- }
1112
-
1113
- if(mouseOverCallBack instanceof Function){
1114
- that.bindEvent(mouseOverBackName, function(evt) {
1115
- mouseOverCallBack(evt.args);
1116
- });
1117
- mouseOverEnable = true;
1118
- }
1119
-
1120
- scene.fire((msgPrefix + ":showMultiObjectCurrentPosition"), {args: [jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickEnable, mouseOverEnable]}, parentScene, false);
1121
- };
1122
-
1123
- /**
1124
- * 创建dom空标签
1125
- */
1126
- that.createInnerHtml = function(jsonInfo, zoom, clear, tagName, options, callback) {
1127
- if (scene == null)
1128
- return;
1129
-
1130
- // 移除监听
1131
- that.removeEventBind("createInnerHtmlCallback" + tagName);
1132
- var args = Array.prototype.slice.call(arguments);
1133
- if (arguments[arguments.length - 1] instanceof Function) {
1134
- callback = arguments[arguments.length - 1];
1135
- args = args.slice(0, args.length - 1);
1136
- }
1137
-
1138
- if (callback != undefined) {
1139
- that.bindEvent("createInnerHtmlCallback" + tagName, function (evt) {
1140
- callback(evt.args);
1141
- });
1142
- }
1143
- scene.fire((msgPrefix + ":createInnerHtml"), {args: args}, parentScene, false);
1144
- };
1145
-
1146
- /* 显示车辆人员轨迹 */
1147
- that.showObjectTrace = function (objectID, symbolType, dateTime, queryCondition, hideControlPanel, symbolPic, optimizeParams, infoCallback, updatePositionCallback, closeCallback, traceDigCallback) {
1148
- if (scene == null)
1149
- return;
1150
- // 人员轨迹查询依赖GIS服务端
1151
- if (context.gisServerURL) {
1152
- var options = {};
1153
- var serviceUrl = context.gisServerURL + '/home/gis/patrol/getobjecttrace.htm';
1154
- options.traceService = serviceUrl;
1155
- options.dateTime = dateTime;
1156
- options.queryCondition = queryCondition;
1157
- options.hideControlPanel = hideControlPanel;
1158
- options.symbolPic = symbolPic;
1159
- options.optimizeParams = optimizeParams;
1160
- options.infoCallback = infoCallback;
1161
- options.updatePositionCallback = updatePositionCallback;
1162
- options.closeCallback = closeCallback;
1163
- options.traceDigCallback = traceDigCallback;
1164
- scene.fire(msgPrefix + ":showObjectTrace", {
1165
- args: [objectID, symbolType, options]
1166
- }, parentScene);
1167
- } else {
1168
- console.error("没有配置二维GIS服务端地址");
1169
- }
1170
- };
1171
-
1172
- /* 显示车辆人员轨迹 */
1173
- that.addObjectTrace = function (jsonInfo, symbolType, clear, showControlPanel, traceID, options) {
1174
- if (scene == null)
1175
- return;
1176
-
1177
- scene.fire((msgPrefix + ":addObjectTrace"), {args: [jsonInfo, symbolType, clear, showControlPanel, traceID, options]}, parentScene, false);
1178
- };
1179
-
1180
- /*设置轨迹属性 */
1181
- that.setTraceOptions = function(options){
1182
- if (scene == null)
1183
- return;
1184
- scene.fire((msgPrefix + ":setTraceOptions"), {args: [options]}, parentScene, false);
1185
- };
1186
-
1187
- /**
1188
- * 移动的雷达
1189
- */
1190
- that.movingRadar= function (jsonInfo, zoom, clear, options, layerName) {
1191
- scene.fire(msgPrefix + ":movingRadar", {args: [jsonInfo, zoom, clear, options, layerName]}, parentScene);
1192
- }
1193
-
1194
- /**
1195
- * 移动的图标
1196
- */
1197
- that.movingBillboard = function (jsonInfo, zoom, clear, layerName, options, clickEnable, moveEnable) {
1198
- scene.fire(msgPrefix + ":movingBillboard", { args: [jsonInfo, zoom, clear, layerName, options, clickEnable, moveEnable] }, parentScene);
1199
- }
1200
-
1201
- /*雷达扫描*/
1202
- that.circleRadarEffect = function (info, zoom, clear, options, layerName) {
1203
- if (scene == null)
1204
- return;
1205
- scene.fire((msgPrefix + ":circleRadarEffect"), { args: [info, zoom, clear, options, layerName] }, parentScene, false);
1206
- }
1207
-
1208
- /*光线射线*/
1209
- that.lightRay = function (jsonInfo, zoom, clear, options, layerName) {
1210
- if (scene == null)
1211
- return;
1212
- scene.fire((msgPrefix + ":lightRay"), { args: [jsonInfo, zoom, clear, options, layerName] }, parentScene, false);
1213
- }
1214
-
1215
-
1216
- that.getbuildBypolygon = function (info, color, zoom, clear, options, layerName) {
1217
- if (scene == null)
1218
- return;
1219
- scene.fire((msgPrefix + ":getbuildBypolygon"), { args: [info, color, zoom, clear, options, layerName] }, parentScene, false);
1220
- }
1221
-
1222
-
1223
-
1224
- /* 点到点的迁徙接口*/
1225
- that.showPolylineMoveMap= function (info, layerName, clear, zoom,options) {
1226
- if (scene == null)
1227
- return;
1228
- scene.fire((msgPrefix + ":showPolylineMoveMap"), { args: [info, layerName, clear, zoom, options] }, parentScene, false);
1229
- }
1230
-
1231
- /* 视频投影 */
1232
- that.beginProjection = function (options) {
1233
- if (scene == null)
1234
- return;
1235
-
1236
- scene.fire((msgPrefix + ":beginProjection"), { args: [options] }, parentScene, false);
1237
- }
1238
-
1239
- /* 道路悬浮注记*/
1240
- that.showMultiRoadText = function (jsonInfo, zoom, clear, tagName, clickEnable, mouseOverEnable) {
1241
- if (scene == null)
1242
- return;
1243
- scene.fire((msgPrefix + ":showMultiRoadText"), { args: [jsonInfo, zoom, clear, tagName, clickEnable, mouseOverEnable] }, parentScene, false);
1244
- }
1245
-
1246
- that.limitGlobeRange = function (extent) {
1247
- if (scene == null)
1248
- return;
1249
- scene.fire((msgPrefix + ":limitGlobeRange"), {args: [extent]}, parentScene, false);
1250
- };
1251
-
1252
- that.addChart = function(jsonInfo, zoom, clear, options, layerName , clickCallback, mouseOverCallBack) {
1253
- if (scene == null)
1254
- return;
1255
-
1256
- layerName = layerName || "chart";
1257
-
1258
- var clickBackName = "addChartClick" + layerName;
1259
- var mouseOverBackName = "addChartMouseMove" + layerName;
1260
-
1261
- that.removeEventBind(clickBackName);
1262
- that.removeEventBind(mouseOverBackName);
1263
-
1264
- var clickEnable = false;
1265
- var mouseOverEnable = false;
1266
-
1267
- if(clickCallback instanceof Function){
1268
- that.bindEvent(clickBackName, function(evt) {
1269
- clickCallback(evt.args);
1270
- });
1271
- clickEnable = true;
1272
- }
1273
-
1274
- if(mouseOverCallBack instanceof Function){
1275
- that.bindEvent(mouseOverBackName, function(evt) {
1276
- mouseOverCallBack(evt.args);
1277
- });
1278
- mouseOverEnable = true;
1279
- }
1280
-
1281
- scene.fire((msgPrefix + ":addChart"), {args: [jsonInfo, zoom, clear, options, layerName , clickEnable, mouseOverEnable]}, parentScene, false);
1282
- };
1283
- /**
1284
- * 鼠标点击模型查询
1285
- * @param callback
1286
- */
1287
- that.queryModelInfo=function(callback,type){
1288
- if (scene == null)
1289
- return;
1290
- scene.fire((msgPrefix + ":queryModelClick"), {args: [callback,type]}, parentScene, false);
1291
- };
1292
- /**
1293
- * 删除三维柱状图
1294
- */
1295
- that.removeChart = function() {
1296
- if (scene == null)
1297
- return;
1298
- scene.fire((msgPrefix + ":removeChart"), {args: []}, parentScene, false);
1299
- };
1300
-
1301
- that.flyToPoint=function(x,y,height){
1302
- if (scene == null)
1303
- return;
1304
- scene.fire((msgPrefix + ":flyToPoint"), {args: [x,y,height]}, parentScene, false);
1305
- };
1306
-
1307
- that.fullExtent=function(){
1308
- if (scene == null)
1309
- return;
1310
-
1311
- scene.fire((msgPrefix + ":fullExtent"), {args: []}, parentScene, false);
1312
- };
1313
-
1314
- that.goUnderGround=function(height){
1315
- if(scene == null)
1316
- return;
1317
- scene.fire((msgPrefix + ":goUnderGround"), {args: [height]}, parentScene, false);
1318
- };
1319
-
1320
- /* 显示视频闪烁点*/
1321
- that.addVideoAlarm = function (coordX, coorY, successFunc, hitCallback) {
1322
- if (scene == null)
1323
- return;
1324
- scene.fire(msgPrefix + ":addVideoAlarm", {args: [coordX, coorY, successFunc, hitCallback]}, parentScene);
1325
- };
1326
-
1327
- /* 显示面板信息*/
1328
- that.createPanelInfo = function (entity, successFunc) {
1329
- if (scene == null)
1330
- return;
1331
- scene.fire(msgPrefix + ":createPanelInfo", {args: [entity, successFunc]}, parentScene);
1332
- };
1333
-
1334
- /* 显示面板信息*/
1335
- that.createAnimateCar = function (objectID, successFunc) {
1336
- if (scene == null)
1337
- return;
1338
- scene.fire(msgPrefix + ":createAnimateCar", {args: [ objectID, successFunc]}, parentScene);
1339
- };
1340
-
1341
- /*根据id号删除一个视频闪烁点*/
1342
- that.removeVideoAlarm = function (id) {
1343
- if (scene == null)
1344
- return;
1345
- scene.fire(msgPrefix + ":removeVideoAlarm", {args: [id]}, parentScene);
1346
- };
1347
- /*地图上标注返回坐标值*/
1348
- that.pointSelect = function(symbolType, mapZoom2Point, clickCallback){
1349
- if (scene == null)
1350
- return;
1351
- that.removeEventBind("pointSelectCallback");
1352
- if (clickCallback != undefined) {
1353
- that.bindEvent("pointSelectCallback", function (position) {
1354
- that.removeEventBind("pointSelectCallback");
1355
- var resultPosition=[position.args[0].longitude+','+position.args[0].latitude];
1356
- resultPosition.push(position.args[0]);
1357
- clickCallback(resultPosition);
1358
- });
1359
- }
1360
- scene.fire((msgPrefix + ":pointSelect"), {args:[symbolType, mapZoom2Point]}, parentScene, false);
1361
- };
1362
-
1363
- /*根据要素坐标定位显示要素*/
1364
- that.locateFeatureByCoords=function(geometries, type, ID, style, hStyle,zoom,keyFiled,labelField,labelStyle,randomColor,renderCanvas,singleSelected,options){
1365
- if (scene == null)
1366
- return;
1367
- scene.fire((msgPrefix + ":locateFeatureByCoords"), { args : [geometries, type, ID, style, hStyle, zoom,keyFiled,labelField,labelStyle,randomColor,renderCanvas,singleSelected,options] }, parentScene, false);
1368
- };
1369
- /* 要素查询 */
1370
- that.queryFeature = function(params, callback) {
1371
- // 移除监听
1372
- that.removeEventBind("queryFeatureCallback");
1373
-
1374
- if (callback != undefined) {
1375
- that.bindEvent("queryFeatureCallback", function(evt) {
1376
- callback(evt.args);
1377
- });
1378
- }
1379
- 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);
1380
- }
1381
- /*绘制图形*/
1382
- that.drawGraphic = function(graphic, zoom, clickCallback) {
1383
- if (scene == null)
1384
- return;
1385
- if (graphic.geometry instanceof Array) {
1386
- graphic.type=graphic.type||graphic.geometry[0].type;
1387
- scene.fire(msgPrefix + ":locateFeatureByCoords", { args : [ graphic.geometry, graphic.type, graphic.id, graphic.style,
1388
- graphic.hstyle, zoom,graphic.keyField,graphic.labelField,graphic.labelStyle,graphic.colorNumber] }, parentScene);
1389
- } else {
1390
- graphic.type=graphic.type||graphic.geometry.type;
1391
- scene.fire(msgPrefix + ":locateFeatureByCoords", { args : [ [ graphic.geometry ], graphic.type, graphic.id, graphic.style,
1392
- graphic.hstyle, zoom ] }, parentScene);
1393
- }
1394
- that.removeEventBind("locateFeatureByIDsCallback");
1395
- if (clickCallback != undefined) {
1396
- that.bindEvent("locateFeatureByIDsCallback", function(evt) {
1397
- clickCallback(evt.args);
1398
- });
1399
- }
1400
- };
1401
- /* 标识位置 */
1402
- that.markMap = function(projectTypeID, eventTypeID, actPropertyID, displayStyleID, layerID, clickCallback,cellIndexName,point) {
1403
- if (scene == null)
1404
- return;
1405
- var eventInfo={
1406
- actpropertyid: actPropertyID,
1407
- displaystyleid: displayStyleID,
1408
- eventtypeid: eventTypeID,
1409
- projecttypeid: projectTypeID
1410
- };
1411
- scene.fire((msgPrefix + ":markMap"), { args : [eventInfo,layerID,clickCallback] }, parentScene, false);
1412
- }
1413
- /*连续标注三维地图获取xy坐标*/
1414
- that.markMapXY = function(event,Callback){
1415
- if (scene == null)
1416
- return;
1417
- scene.fire((msgPrefix + ":markMapXY"), { args : [event,Callback] }, parentScene, false);
1418
- };
1419
- /*清除标注事件*/
1420
- that.removeMarkMapMouseHandler=function(){
1421
- if (scene == null)
1422
- return;
1423
- scene.fire((msgPrefix + ":removeMarkMapMouseHandler"), { args : [] }, parentScene, false);
1424
- };
1425
-
1426
- /**
1427
- * 绘制图形接口
1428
- * type 类型 point,polyline,polygon,circle
1429
- * style 样式
1430
- * clear 是否清除
1431
- * callback 回调函数返回绘制图形的坐标信息
1432
- **/
1433
- that.drawGeometry = function (type, style, clear, callback, option) {
1434
- if (scene == null)
1435
- return;
1436
- scene.fire((msgPrefix + ":drawGeometry"), { args : [type, style, clear, callback, option] }, parentScene, false);
1437
- };
1438
- that.showUserDrawGeometry = function (show,id) {
1439
- if (scene == null)
1440
- return;
1441
- scene.fire((msgPrefix + ":showUserDrawGeometry"), { args : [show,id] }, parentScene, false);
1442
- };
1443
-
1444
- that.addGraphic=function(params, addCallback){
1445
- if(scene == null)
1446
- return;
1447
- if(!params||!params[0])
1448
- return;
1449
- var type=params[0];
1450
- var style=params[1]||{"color":[215, 214, 111, 100]};
1451
- var clear=params[2]||true;
1452
- var callback=addCallback;
1453
- scene.fire((msgPrefix + ":drawGeometry"), { args : [type, style, clear, callback] }, parentScene, false);
1454
- };
1455
-
1456
-
1457
- //by hth,2020-12-29
1458
-
1459
- that.showMultiObjectToCluster = function(jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickCallBack, mouseOverEnable) {
1460
-
1461
- // 获取symbolUrl
1462
-
1463
- var defaultSymbolUrl = Array.isArray(jsonInfo) ? jsonInfo[0].symbolUrl : 'numImage.png';
1464
-
1465
- var hasCustomProperties = infoStyle.hasOwnProperty('customProperties')
1466
-
1467
- var defaultClusterImageInfo = {//自定义聚类图标。如果设置的话,要自己调"textStyle"以适应自己的"symbolUrl"
1468
-
1469
- symbolUrl: defaultSymbolUrl,
1470
-
1471
- horizontalOrigin: "center",
1472
-
1473
- verticalOrigin: "bottom",
1474
-
1475
- cssStyle: {
1476
-
1477
- "borderRadius": 500,//设置的很大话,就会形成半圆角
1478
-
1479
- "fillColor": "rgba(27,32,43,0.7)",//圆角矩形的颜色
1480
-
1481
- "borderLineWidth": 3,//圆角矩形的边框宽度
1482
-
1483
- "borderLineColor": "rgba(230,230,230,0.9)",//圆角矩形的边框颜色
1484
-
1485
- "paddingX": 15,//圆角矩形内边框padding(主要是为了让文字与边框有一定距离)
1486
-
1487
- "paddingY": 6,
1488
-
1489
- "marginBottom": 2 //下边框外距
1490
-
1491
- },
1492
-
1493
- textStyle : {
1494
-
1495
- "font" : "60px Helvetica",
1496
-
1497
- "fillColor" : "rgba(250,250,250,1.0)",
1498
-
1499
- "outlineColor" : "black",
1500
-
1501
- "outlineWidth" : 1.0,
1502
-
1503
- "padding":1,
1504
-
1505
- "textScale":0.5,
1506
-
1507
- "textStartX":40,
1508
-
1509
- "textStartY":15
1510
-
1511
- }
1512
-
1513
- }
1514
-
1515
- // 组装options数据
1516
-
1517
- var options = {
1518
-
1519
- clusterStyle: (hasCustomProperties && infoStyle.customProperties.clusterStyle) || 'clusterByGrid',
1520
-
1521
- zoom:zoom,
1522
-
1523
- scale: 0.9,
1524
-
1525
- clusterLimit: (hasCustomProperties && infoStyle.customProperties.clusterLimit) || undefined,
1526
-
1527
- symbolUrl: (hasCustomProperties && infoStyle.customProperties.symbolUrl) || defaultSymbolUrl,
1528
-
1529
- clear:clear,
1530
-
1531
- layerName: tagName,
1532
-
1533
- style: 'default',
1534
-
1535
- nearFarScalar: [8000, 1.0, 10000, 0.6],
1536
-
1537
- clickCallBack: clickCallBack,
1538
-
1539
- clusterImageInfo: (hasCustomProperties && infoStyle.customProperties.clusterImageInfo) || defaultClusterImageInfo,
1540
-
1541
- minSize: (hasCustomProperties && infoStyle.customProperties.minSize) || 6,
1542
-
1543
- geometricErrorScale: (hasCustomProperties && infoStyle.customProperties.geometricErrorScale) || 2
1544
-
1545
- }
1546
-
1547
- that.addClusterLayer({data:jsonInfo, options});
1548
-
1549
- }
1550
-
1551
- //添加聚类图层
1552
- that.addClusterLayer=function(data){
1553
- if(scene == null)
1554
- return;
1555
- var dataInfo = data.data;
1556
- var option=data.options;
1557
- if(option && option.addClusterWithAni){
1558
- scene.fire((msgPrefix + ":addClusterWithAni"), {args: [dataInfo, option]}, parentScene, false);
1559
- }else{
1560
- scene.fire((msgPrefix + ":addClusterLayer"), {args: [dataInfo, option]}, parentScene, false);
1561
- }
1562
- };
1563
- //获取所选择的三维模型信息
1564
- that.getSelectedLayerinfo = function (name, callback) {
1565
- if (scene == null)
1566
- return;
1567
- scene.fire((msgPrefix + ":getSelectedLayerinfo"), {args: [name, callback]}, parentScene, false);
1568
- };
1569
-
1570
- //three模型管理
1571
- that.threeModelManage = function (layerName, type, options, others) {
1572
- if (scene == null)
1573
- return;
1574
-
1575
- scene.fire((msgPrefix + ":threeModelManage"), { args: [layerName, type, options, others] }, parentScene, false);
1576
- }
1577
-
1578
- //烟花效果
1579
- that.fireWorkSystem = function (options) {
1580
- if (scene == null)
1581
- return;
1582
-
1583
- scene.fire((msgPrefix + ":fireWorkSystem"), { args: [options] }, parentScene, false);
1584
- }
1585
-
1586
- //烟花效果显隐控制
1587
- that.setFireWorkVisible = function (visible) {
1588
- if (scene == null)
1589
- return;
1590
-
1591
- scene.fire((msgPrefix + ":setFireWorkVisible"), { args: [visible] }, parentScene, false);
1592
- }
1593
-
1594
-
1595
- //开启地透
1596
- that.undergroundMode_on = function(alpha){
1597
- if (scene == null)
1598
- return;
1599
-
1600
- scene.fire((msgPrefix + ":undergroundMode_on"), {args: [alpha]}, parentScene, false);
1601
- }
1602
-
1603
- //关闭地透
1604
- that.undergroundMode_off = function(){
1605
- if (scene == null)
1606
- return;
1607
-
1608
- scene.fire((msgPrefix + ":undergroundMode_off"), {args: []}, parentScene, false);
1609
- }
1610
-
1611
- //平面坐标转经纬度
1612
- that.Plat2lonLat = function (positions, callback) {
1613
- if (scene == null)
1614
- return;
1615
- scene.fire((msgPrefix + ":Plat2lonLat"), {args: [positions, callback]}, parentScene, false);
1616
- };
1617
- //地面开挖接口
1618
- that.digsuface=function(positions,depth,callback){
1619
- if (scene == null)
1620
- return;
1621
- var options={
1622
- positions:positions,
1623
- depth:depth,
1624
- callback:callback
1625
- };
1626
- scene.fire((msgPrefix + ":digSurface_dig"), {args: [options]}, parentScene, false);
1627
- };
1628
-
1629
- //清除地面开挖
1630
- that.removeDigsuface=function(){
1631
- if (scene == null)
1632
- return;
1633
- scene.fire((msgPrefix + ":digSurface_remove"), {args: []}, parentScene, false);
1634
- };
1635
- that.clearDrawGeometry=function(){
1636
- if (scene == null)
1637
- return;
1638
- scene.fire((msgPrefix + ":cleardrawGeometry"), {args: []}, parentScene, false);
1639
- };
1640
-
1641
- //三维地图点击事件
1642
- that.addPickHandler = function (callback) {
1643
- if (scene == null)
1644
- return;
1645
- scene.fire((msgPrefix + ":addPickHandler"), {args: [callback]}, parentScene, false);
1646
- };
1647
- //右键查询
1648
- that.addRightClickHandler=function(callback){
1649
- if (scene == null)
1650
- return;
1651
- scene.fire((msgPrefix + ":addRightClickHandler"), {args: [callback]}, parentScene, false);
1652
- };
1653
-
1654
- that.pickModel = function (position,callback) {
1655
- if (scene == null)
1656
- return;
1657
- scene.fire((msgPrefix + ":pickModel"), {args: [callback]}, parentScene, false);
1658
- };
1659
- that.show2dMode=function(){
1660
- if (scene == null)
1661
- return;
1662
- scene.fire((msgPrefix + ":show2dMode"), {args: []}, parentScene, false);
1663
- };
1664
- that.show3dMode=function () {
1665
- if (scene == null)
1666
- return;
1667
- scene.fire((msgPrefix + ":show3dMode"), {args: []}, parentScene, false);
1668
- };
1669
- that.getSysLayerTree=function(callback){
1670
- if (scene == null)
1671
- return;
1672
- scene.fire((msgPrefix + ":getSysLayerTree"), {args: [callback]}, parentScene, false);
1673
- };
1674
- that.show2_5dMode=function(){
1675
- if (scene == null)
1676
- return;
1677
- scene.fire((msgPrefix + ":show2_5dMode"), {args: []}, parentScene, false);
1678
- };
1679
- that.showWall=function(jsonInfo, zoom, clear, zoomOptions, merge, layerName, clickEnable, mouseOverEnable){
1680
- if (scene == null)
1681
- return;
1682
- scene.fire((msgPrefix + ":showWall"), {args: [jsonInfo, zoom, clear, zoomOptions, merge, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
1683
- };
1684
-
1685
- /* 根据图层字段定位显示 */
1686
- that.locateFeatureByIDs = function(layerID, keyField, keyValue, clearMap, style, hStyle, bZoom, randomColor, labelfield, labelstyle, geometry, where, renderCanvas, singleSelected,options,extendProperty,layerTag, successFunc) {
1687
- if (scene == null)
1688
- return;
1689
-
1690
- if(scene.layerUsageConfig && scene.layerUsageConfig[layerID]){
1691
- keyField = keyField || scene.layerUsageConfig[layerID].keyFieldName;
1692
- }
1693
- 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);
1694
- };
1695
-
1696
- /**
1697
- * 区域查询
1698
- */
1699
- that.locateRegionByIDs = function(layerID, keyField, keyValue, style, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, successFunc) {
1700
- if (scene == null)
1701
- return;
1702
- if(scene.layerUsageConfig && scene.layerUsageConfig[layerID]){
1703
- keyField = keyField || scene.layerUsageConfig[layerID].keyFieldName;
1704
- var usageLabelField = scene.layerUsageConfig[layerID].labelFieldName;
1705
- }
1706
- scene.fire((msgPrefix + ":locateRegionByIDs"), {args: [layerID, keyField, keyValue, style, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, successFunc,usageLabelField]}, parentScene, false);
1707
- };
1708
-
1709
- that.drawGeoJsonGeometry=function(jsonInfos, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack){
1710
- if (scene == null)
1711
- return;
1712
- scene.fire((msgPrefix + ":drawGeoJsonGeometry"), {args: [jsonInfos, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack]}, parentScene, false);
1713
- }
1714
-
1715
-
1716
- that.pathPlan = function(origin, destination, callBack){
1717
- if (scene == null)
1718
- return;
1719
-
1720
- scene.fire((msgPrefix + ":pathPlan"), {args: [origin, destination, callBack]}, parentScene, false);
1721
- };
1722
-
1723
- that.getRoutePlanning=function(origin,destination,options,callback){
1724
- if (scene == null)
1725
- return;
1726
- scene.fire((msgPrefix + ":getRoutePlanning"), {args: [origin,destination,options,callback]}, parentScene, false);
1727
- };
1728
-
1729
- that.startMonomerQuery = function (type, clear, options, layerName, clickCallback) {
1730
- if (scene == null)
1731
- return;
1732
- // 移除监听
1733
- var clickBackName = "startMonomerQueryClick" + layerName;
1734
-
1735
- that.removeEventBind(clickBackName);
1736
- var clickEnable = false;
1737
-
1738
- if(clickCallback instanceof Function){
1739
- that.bindEvent(clickBackName, function(evt) {
1740
- clickCallback(evt.args);
1741
- });
1742
- clickEnable = true;
1743
- }
1744
-
1745
- scene.fire((msgPrefix + ":startMonomerQuery"), { args: [type, clear, options, layerName, clickEnable] }, parentScene, false);
1746
- }
1747
-
1748
-
1749
- that.superMonomerQuery = function(type, clear, options, layerName, clickEnable){
1750
- if (scene == null)
1751
- return;
1752
- scene.fire((msgPrefix + ":superMonomerQuery"), {args: [type, clear, options, layerName, clickEnable]}, parentScene, false);
1753
- };
1754
-
1755
- //s3m模型操作
1756
- that.setS3MOperation = function(type, LayerName, options){
1757
- if (scene == null)
1758
- return;
1759
-
1760
- scene.fire((msgPrefix + ":setS3MOperation"), {args: [type, LayerName, options]}, parentScene, false);
1761
- }
1762
-
1763
- that.createMonomerClamp = function(jsonInfo, zoom, clear, options, layerName, clickCallBack){
1764
- if (scene == null)
1765
- return;
1766
- scene.fire((msgPrefix + ":createMonomerClamp"), {args: [jsonInfo, zoom, clear, options, layerName, clickCallBack]}, parentScene, false);
1767
- };
1768
-
1769
- that.getPGlist = function(queryParam, queryCallBack){
1770
- if (scene == null)
1771
- return;
1772
- scene.fire((msgPrefix + ":getPGlist"), {args: [queryParam, queryCallBack]}, parentScene, false);
1773
- };
1774
-
1775
- that.enablePickGradientObj = function(callback){
1776
- if (scene == null) {
1777
- return
1778
- };
1779
-
1780
- that.removeEventBind("enablePickGradientObj");
1781
- if (callback != undefined) {
1782
- that.bindEvent("enablePickGradientObj", function (evt) {
1783
- callback(evt.args);
1784
- });
1785
- }
1786
-
1787
- scene.fire((msgPrefix + ":enablePickGradientObj"), {args: []}, parentScene, false);
1788
- };
1789
-
1790
- that.disablePickGradientObj = function(){
1791
- if (scene == null)
1792
- return;
1793
- scene.fire((msgPrefix + ":disablePickGradientObj"), {args: []}, parentScene, false);
1794
- };
1795
-
1796
- that.modifyAttributes = function(layerName, objID, newProperties, options, autoRevert){
1797
- if (scene == null)
1798
- return;
1799
- scene.fire((msgPrefix + ":modifyAttributes"), {args: [layerName, objID, newProperties, options, autoRevert]}, parentScene, false);
1800
- };
1801
- that.focusOnDistrict = function(config, positions, modelName, hideLayerNames){
1802
- if (scene == null)
1803
- return;
1804
- scene.fire((msgPrefix + ":focusOnDistrict"), {args: [config, positions, modelName, hideLayerNames]}, parentScene, false);
1805
- };
1806
- that.showLaserWall = function(coordinatesData, layerName, options){
1807
- if (scene == null)
1808
- return;
1809
- scene.fire((msgPrefix + ":showLaserWall"), {args: [coordinatesData, layerName, options]}, parentScene, false);
1810
- };
1811
- that.PipeLineOperation = function(layerName,operateType,zoom,clear,options){
1812
- if (scene == null)
1813
- return;
1814
- scene.fire((msgPrefix + ":PipeLineOperation"), {args: [layerName,operateType,zoom,clear,options]}, parentScene, false);
1815
- };
1816
- that.setCameraConfig = function(options){
1817
- if (scene == null)
1818
- return;
1819
- scene.fire((msgPrefix + ":setCameraConfig"), {args: [options]}, parentScene, false);
1820
- };
1821
- that.setFireEffect = function(options,zoom,clear,layerName){
1822
- if (scene == null)
1823
- return;
1824
- scene.fire((msgPrefix + ":setFireEffect"), {args: [options,zoom,clear,layerName]}, parentScene, false);
1825
- };
1826
- that.drawPoints = function(layerName, positions, options){
1827
- if (scene == null)
1828
- return;
1829
- scene.fire((msgPrefix + ":drawPoints"), {args: [layerName, positions, options]}, parentScene, false);
1830
- };
1831
- that.traceOperation = function(posArr, options){
1832
- if (scene == null)
1833
- return;
1834
- scene.fire((msgPrefix + ":traceOperation"), {args: [posArr, options]}, parentScene, false);
1835
- };
1836
- that.regionOperation = function(options, data){
1837
- if (scene == null)
1838
- return;
1839
- scene.fire((msgPrefix + ":regionOperation"), {args: [options, data]}, parentScene, false);
1840
- };
1841
- that.activeLayer = function(layerName, options, filter){
1842
- if (scene == null)
1843
- return;
1844
- scene.fire((msgPrefix + ":activeLayer"), {args: [layerName, options, filter]}, parentScene, false);
1845
- };
1846
- that.networkCloud = function(options, positions){
1847
- if (scene == null)
1848
- return;
1849
- scene.fire((msgPrefix + ":networkCloud"), {args: [options, positions]}, parentScene, false);
1850
- };
1851
- that.clearNetworkCloud = function(layerNames){
1852
- if (scene == null)
1853
- return;
1854
- scene.fire((msgPrefix + ":clearNetworkCloud"), {args: [layerNames]}, parentScene, false);
1855
- };
1856
- that.lineOperation = function(options, data){
1857
- if (scene == null)
1858
- return;
1859
- scene.fire((msgPrefix + ":lineOperation"), {args: [options, data]}, parentScene, false);
1860
- };
1861
- that.getMainSubTypeTree = function(params, callback){
1862
- if (scene == null)
1863
- return;
1864
- var cb = function (type, data) {
1865
- if (callback && type == 'getMainSubTypeTreeCallback') {
1866
- callback(data);
1867
- }
1868
- };
1869
- scene.fire((msgPrefix + ":getMainSubTypeTree"), {args: [params, cb]}, parentScene, false);
1870
- };
1871
- that.getRegion = function(params, callback){
1872
- if (scene == null)
1873
- return;
1874
- var cb = function (type, data) {
1875
- if (callback && type == 'getRegionCallback') {
1876
- callback(data);
1877
- }
1878
- };
1879
- scene.fire((msgPrefix + ":getRegion"), {args: [params, cb]}, parentScene, false);
1880
- };
1881
- that.getMapConfig = function(key, callback){
1882
- if (scene == null)
1883
- return;
1884
- scene.fire((msgPrefix + ":getMapConfig"), {args: [key, callback]}, parentScene, false);
1885
- };
1886
- that.addCIMMap = function(options) {
1887
- if (scene == null)
1888
- return;
1889
- scene.fire((msgPrefix + ":addCIMMap"), { args: [options] }, parentScene, false);
1890
- };
1891
- that.addCIMModel = function(options) {
1892
- if (scene == null)
1893
- return;
1894
- scene.fire((msgPrefix + ":addCIMModel"), { args: [options] }, parentScene, false);
1895
- };
1896
- that.setLayerVisible = function(options) {
1897
- if (scene == null)
1898
- return;
1899
- scene.fire((msgPrefix + ":setLayerVisible"), { args: [options] }, parentScene, false);
1900
- };
1901
- that.flyToLayer = function(options) {
1902
- if (scene == null)
1903
- return;
1904
- scene.fire((msgPrefix + ":flyToLayer"), { args: [options] }, parentScene, false);
1905
- };
1906
- that.controlCamera = function(options) {
1907
- if (scene == null)
1908
- return;
1909
- scene.fire((msgPrefix + ":controlCamera"), { args: [options] }, parentScene, false);
1910
- };
1911
- that.zoomIn = function() {
1912
- if (scene == null)
1913
- return;
1914
- scene.fire((msgPrefix + ":zoomIn"), { args: [] }, parentScene, false);
1915
- };
1916
- that.zoomOut = function(options) {
1917
- if (scene == null)
1918
- return;
1919
- scene.fire((msgPrefix + ":zoomOut"), { args: [options] }, parentScene, false);
1920
- };
1921
- that.measureDistance = function(options) {
1922
- if (scene == null)
1923
- return;
1924
- scene.fire((msgPrefix + ":measureDistance"), { args: [options] }, parentScene, false);
1925
- };
1926
- that.measureArea = function(options) {
1927
- if (scene == null)
1928
- return;
1929
- scene.fire((msgPrefix + ":measureArea"), { args: [options] }, parentScene, false);
1930
- };
1931
- that.measureHeight = function(options) {
1932
- if (scene == null)
1933
- return;
1934
- scene.fire((msgPrefix + ":measureHeight"), { args: [options] }, parentScene, false);
1935
- };
1936
- that.onUndergroundModel = function(alpha, distance) {
1937
- if (scene == null)
1938
- return;
1939
- scene.fire((msgPrefix + ":onUndergroundModel"), { args: [alpha, distance] }, parentScene, false);
1940
- };
1941
- that.offUndergroundModel = function() {
1942
- if (scene == null)
1943
- return;
1944
- scene.fire((msgPrefix + ":offUndergroundModel"), { args: [] }, parentScene, false);
1945
- };
1946
- that.addFlag = function(options) {
1947
- if (scene == null)
1948
- return;
1949
- scene.fire((msgPrefix + ":addFlag"), { args: [options] }, parentScene, false);
1950
- };
1951
- that.getPointInfo = function(options) {
1952
- if (scene == null)
1953
- return;
1954
- scene.fire((msgPrefix + ":getPointInfo"), { args: [options] }, parentScene, false);
1955
- };
1956
- //添加聚类图层
1957
- that.addClusterLayerCIM = function(dataInfo, option) {
1958
- if (scene == null)
1959
- return;
1960
- scene.fire((msgPrefix + ":addClusterLayer"), { args: [dataInfo, option] }, parentScene, false);
1961
- };
1962
- //可视域分析
1963
- that.startViewer = function(options) {
1964
- if (scene == null)
1965
- return;
1966
- scene.fire((msgPrefix + ":startViewer"), { args: [options] }, parentScene, false);
1967
- };
1968
- that.removeViewer = function() {
1969
- if (scene == null)
1970
- return;
1971
- scene.fire((msgPrefix + ":removeViewer"), { args: [] }, parentScene, false);
1972
- };
1973
- that.setViewerOptions = function(options) {
1974
- if (scene == null)
1975
- return;
1976
- scene.fire((msgPrefix + ":setViewerOptions"), { args: [options] }, parentScene, false);
1977
- };
1978
- that.showSkyLine = function(options) {
1979
- if (scene == null)
1980
- return;
1981
- scene.fire((msgPrefix + ":showSkyLine"), { args: [options] }, parentScene, false);
1982
- };
1983
- that.clearSkyLine = function() {
1984
- if (scene == null)
1985
- return;
1986
- scene.fire((msgPrefix + ":clearSkyLine"), { args: [] }, parentScene, false);
1987
- };
1988
- that.setLineOptions = function(options) {
1989
- if (scene == null)
1990
- return;
1991
- scene.fire((msgPrefix + ":setLineOptions"), { args: [options] }, parentScene, false);
1992
- };
1993
- that.bufferAnalysis = function(options,clear,update,callback) {
1994
- if (scene == null)
1995
- return;
1996
- scene.fire((msgPrefix + ":bufferAnalysis"), { args: [options,clear,update,callback] }, parentScene, false);
1997
- };
1998
- that.clearBufferAnalysis = function(options) {
1999
- if (scene == null)
2000
- return;
2001
- scene.fire((msgPrefix + ":clearBufferAnalysis"), { args: [] }, parentScene, false);
2002
- };
2003
- that.addModelClickEvent = function(callback) {
2004
- if (scene == null)
2005
- return;
2006
- scene.fire((msgPrefix + ":addModelClickEvent"), { args: [callback] }, parentScene, false);
2007
- };
2008
- that.removeModelClickEvent = function() {
2009
- if (scene == null)
2010
- return;
2011
- scene.fire((msgPrefix + ":removeModelClickEvent"), { args: [] }, parentScene, false);
2012
- };
2013
- that.getBIMTree = function(option, callback) {
2014
- if (scene == null)
2015
- return;
2016
- scene.fire((msgPrefix + ":getBIMTree"), { args: [option, callback] }, parentScene, false);
2017
- };
2018
- that.setBIMTree = function(option) {
2019
- if (scene == null)
2020
- return;
2021
- scene.fire((msgPrefix + ":setBIMTree"), { args: [option] }, parentScene, false);
2022
- };
2023
- that.clearBimSelect = function() {
2024
- if (scene == null)
2025
- return;
2026
- scene.fire((msgPrefix + ":clearBimSelect"), { args: [] }, parentScene, false);
2027
- };
2028
- that.visibilityAnalysis = function(type) {
2029
- if (scene == null)
2030
- return;
2031
- scene.fire((msgPrefix + ":visibilityAnalysis"), { args: [type] }, parentScene, false);
2032
- };
2033
- that.clearVisibilityAnalysis = function() {
2034
- if (scene == null)
2035
- return;
2036
- scene.fire((msgPrefix + ":clearVisibilityAnalysis"), { args: [] }, parentScene, false);
2037
- };
2038
- that.addCIMTerrain = function(options) {
2039
- if (scene == null)
2040
- return;
2041
- scene.fire((msgPrefix + ":addCIMTerrain"), { args: [options] }, parentScene, false);
2042
- };
2043
- that.flytoPosition = function(lon, lat, height) {
2044
- if (scene == null)
2045
- return;
2046
- scene.fire((msgPrefix + ":flytoPosition"), { args: [lon, lat, height] }, parentScene, false);
2047
- };
2048
- //开启日照分析
2049
- that.openSunshineAnalysis = function() {
2050
- if (scene == null)
2051
- return;
2052
- scene.fire((msgPrefix + ":openSunshineAnalysis"), { args: [] }, parentScene, false);
2053
- };
2054
- that.sunshineAnalysis = function(date) {
2055
- if (scene == null)
2056
- return;
2057
- scene.fire((msgPrefix + ":sunshineAnalysis"), { args: [date] }, parentScene, false);
2058
- };
2059
- that.closeSunshineAnalysis = function() {
2060
- if (scene == null)
2061
- return;
2062
- scene.fire((msgPrefix + ":closeSunshineAnalysis"), { args: [] }, parentScene, false);
2063
- };
2064
- //设置天气
2065
- that.setViewConfig = function(type, options) {
2066
- if (scene == null)
2067
- return;
2068
- scene.fire((msgPrefix + ":setViewConfig"), { args: [type, options] }, parentScene, false);
2069
- };
2070
- //管网高亮显示
2071
- that.searchAndShowPipe = function(url, options, color, clear) {
2072
- if (scene == null)
2073
- return;
2074
- scene.fire((msgPrefix + ":searchAndShowPipe"), { args: [url, options, color, clear] }, parentScene, false);
2075
- };
2076
- that.splitView = function(options) {
2077
- if (scene == null)
2078
- return;
2079
- scene.fire((msgPrefix + ":splitView"), { args: [options] }, parentScene, false);
2080
- };
2081
- //4.13
2082
- //淹没分析
2083
- that.drawRange = function(type) {
2084
- if (scene == null)
2085
- return;
2086
- scene.fire((msgPrefix + ":drawRange"), { args: [type] }, parentScene, false);
2087
- };
2088
- that.floodAnalysis = function(options) {
2089
- if (scene == null)
2090
- return;
2091
- scene.fire((msgPrefix + ":floodAnalysis"), { args: [options] }, parentScene, false);
2092
- };
2093
- that.clearFloodAnalysis = function() {
2094
- if (scene == null)
2095
- return;
2096
- scene.fire((msgPrefix + ":clearFloodAnalysis"), { args: [] }, parentScene, false);
2097
- };
2098
- //空间分析
2099
- that.currencyDraw = function(type) {
2100
- if (scene == null)
2101
- return;
2102
- scene.fire((msgPrefix + ":currencyDraw"), { args: [type] }, parentScene, false);
2103
- };
2104
- that.intersect = function() {
2105
- if (scene == null)
2106
- return;
2107
- scene.fire((msgPrefix + ":intersect"), { args: [] }, parentScene, false);
2108
- };
2109
- that.spatialAnalysisClear = function() {
2110
- if (scene == null)
2111
- return;
2112
- scene.fire((msgPrefix + ":spatialAnalysisClear"), { args: [] }, parentScene, false);
2113
- };
2114
- //挖掘分析
2115
- that.openDigSurface = function(options) {
2116
- if (scene == null)
2117
- return;
2118
- scene.fire((msgPrefix + ":openDigSurface"), { args: [options] }, parentScene, false);
2119
- };
2120
- that.closeDigSurface = function() {
2121
- if (scene == null)
2122
- return;
2123
- scene.fire((msgPrefix + ":closeDigSurface"), { args: [] }, parentScene, false);
2124
- };
2125
- //设置图层显隐
2126
- that.setLayerAlpha = function(options) {
2127
- if (scene == null)
2128
- return;
2129
- scene.fire((msgPrefix + ":setLayerAlpha"), { args: [options] }, parentScene, false);
2130
- };
2131
- //打开天气设置
2132
- that.changeWeather = function(options) {
2133
- if (scene == null)
2134
- return;
2135
- scene.fire((msgPrefix + ":changeWeather"), { args: [options] }, parentScene, false);
2136
- };
2137
- //关闭天气效果
2138
- that.closeWeather = function() {
2139
- if (scene == null)
2140
- return;
2141
- scene.fire((msgPrefix + ":closeWeather"), { args: [] }, parentScene, false);
2142
- };
2143
- //模型容差
2144
- that.changeModelTolerance = function(options) {
2145
- if (scene == null)
2146
- return;
2147
- scene.fire((msgPrefix + ":changeModelTolerance"), { args: [options] }, parentScene, false);
2148
- };
2149
- //获取模型容差
2150
- that.getModelTolerance = function(options) {
2151
- if (scene == null)
2152
- return;
2153
- scene.fire((msgPrefix + ":getModelTolerance"), { args: [options] }, parentScene, false);
2154
- };
2155
- //设置天空盒
2156
- that.setSkyBox = function(name, imgType) {
2157
- if (scene == null)
2158
- return;
2159
- scene.fire((msgPrefix + ":setSkyBox"), { args: [name, imgType] }, parentScene, false);
2160
- };
2161
- //打开pbr
2162
- that.showPbrPanel = function(style) {
2163
- if (scene == null)
2164
- return;
2165
- scene.fire((msgPrefix + ":showPbrPanel"), { args: [style] }, parentScene, false);
2166
- };
2167
- that.hidePbrPanel = function() {
2168
- if (scene == null)
2169
- return;
2170
- scene.fire((msgPrefix + ":hidePbrPanel"), { args: [] }, parentScene, false);
2171
- };
2172
- that.showPop = function(property, keyPropety, position) {
2173
- if (scene == null)
2174
- return;
2175
- scene.fire((msgPrefix + ":showPop"), { args: [property, keyPropety, position] }, parentScene, false);
2176
- };
2177
- that.union = function() {
2178
- if (scene == null)
2179
- return;
2180
- scene.fire((msgPrefix + ":union"), { args: [] }, parentScene, false);
2181
- };
2182
- that.difference = function() {
2183
- if (scene == null)
2184
- return;
2185
- scene.fire((msgPrefix + ":difference"), { args: [] }, parentScene, false);
2186
- };
2187
- that.splitComparison = function(bool) {
2188
- if (scene == null)
2189
- return;
2190
- scene.fire((msgPrefix + ":splitComparison"), { args: [bool] }, parentScene, false);
2191
- };
2192
- that.addCIMVector = function(options) {
2193
- if (scene == null)
2194
- return;
2195
- scene.fire((msgPrefix + ":addCIMVector"), { args: [options] }, parentScene, false);
2196
- };
2197
- that.init();
2198
- };
2199
-
2200
- //在外面也可以调用checkGlobeServerURL函数
2201
- EGovaGlobeMap.checkGlobeServerURL = checkGlobeServerURL;
2202
-
2203
- 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.zoomByRegionCode = function (regionCode, options, callback) {
796
+ if (scene == null)
797
+ return;
798
+
799
+ that.fireEvent("zoomByRegionCode", {args: [regionCode, options, callback]}, false);
800
+ }
801
+
802
+ //三维场景按照中心点旋转,更方便查看
803
+ that.rotateScene = function (heading, pitch, roll, duration, callback) {
804
+ if (scene == null)
805
+ return;
806
+ that.fireEvent("rotateScene", {args: [heading, pitch, roll, duration, callback]}, false);
807
+ }
808
+
809
+ /* 清除指定图形 */
810
+ that.clearGraphic = function (id) {
811
+ if (scene == null)
812
+ return;
813
+ if (typeof id != "string") {
814
+ id = id.join(",");
815
+ }
816
+ scene.fire((msgPrefix + ":clearGraphic"), {args: [id]}, parentScene, false);
817
+ }
818
+
819
+ /* 清除全部图形 */
820
+ that.clearAllGraphics = function (id) {
821
+ if (scene == null)
822
+ return;
823
+ scene.fire((msgPrefix + ":clearAllGraphics"), {args: []}, parentScene, false);
824
+ }
825
+
826
+ /**
827
+ * 清除一些动态绘制效果
828
+ */
829
+ that.clearAllDynamicGraphics = function(){
830
+ if (scene == null)
831
+ return;
832
+
833
+ scene.fire((msgPrefix + ":clearAllDynamicGraphics"), {args: []}, parentScene, false);
834
+ }
835
+
836
+ /**
837
+ *恢复初始化
838
+ */
839
+
840
+ that.restoreInitConfig = function () {
841
+ if (scene == null)
842
+ return;
843
+
844
+ scene.fire((msgPrefix + ":restoreInitConfig"), {args: []}, parentScene, false);
845
+ }
846
+
847
+ /**
848
+ * 图层操作 清除
849
+ */
850
+ that.clearLayer = function(name,callback){
851
+ if (scene == null)
852
+ return;
853
+
854
+ scene.fire((msgPrefix + ":clearLayer"), {args: [name,callback]}, parentScene, false);
855
+ }
856
+
857
+ /**
858
+ * 图层操作 清除所有
859
+ */
860
+ that.clearAllLayer = function(skipNames){
861
+ if (scene == null)
862
+ return;
863
+
864
+ scene.fire((msgPrefix + ":clearAllLayer"), {args: [skipNames]}, parentScene, false);
865
+ }
866
+
867
+ /**
868
+ * 获取所有图层名
869
+ */
870
+ that.getAllLayer = function(callback){
871
+ if (scene == null)
872
+ return;
873
+
874
+ // 移除监听
875
+ that.removeEventBind("getAllLayerCallback");
876
+ that.bindEvent("getAllLayerCallback", function(evt){
877
+ callback && callback(evt.args);
878
+ });
879
+
880
+ scene.fire((msgPrefix + ":getAllLayer"), {args: []}, parentScene, false);
881
+
882
+ }
883
+
884
+ /**
885
+ * 图层操作 显隐切换
886
+ */
887
+ that.toggleLayer = function(name){
888
+ if (scene == null)
889
+ return;
890
+
891
+ scene.fire((msgPrefix + ":toggleLayer"), {args: [name]}, parentScene, false);
892
+ }
893
+
894
+ /**
895
+ * 图层操作 显示
896
+ */
897
+ that.showLayer = function(name){
898
+ if (scene == null)
899
+ return;
900
+
901
+ scene.fire((msgPrefix + ":showLayer"), {args: [name]}, parentScene, false);
902
+ }
903
+
904
+ /**
905
+ * 图层操作 隐藏
906
+ */
907
+ that.hideLayer = function(name){
908
+ if (scene == null)
909
+ return;
910
+
911
+ scene.fire((msgPrefix + ":hideLayer"), {args: [name]}, parentScene, false);
912
+ }
913
+
914
+ /**
915
+ * 图层操作 清除部分元素
916
+ */
917
+ that.clearLayerElement = function(name, ids){
918
+ if (scene == null)
919
+ return;
920
+
921
+ scene.fire((msgPrefix + ":clearLayerElement"), {args: [name, ids]}, parentScene, false);
922
+ }
923
+
924
+ /**
925
+ * 图层操作 点击元素
926
+ */
927
+ that.clickLayerElement = function(name, id){
928
+ if (scene == null)
929
+ return;
930
+
931
+ scene.fire((msgPrefix + ":clickLayerElement"), {args: [name, id]}, parentScene, false);
932
+ }
933
+
934
+ /**
935
+ * 图层操作 飞向元素
936
+ */
937
+ that.flyToLayerElement = function(name, id, options){
938
+ if (scene == null)
939
+ return;
940
+
941
+ scene.fire((msgPrefix + ":flyToLayerElement"), {args: [name, id, options]}, parentScene, false);
942
+ }
943
+
944
+ /**
945
+ * 控制图层显示级别
946
+ */
947
+
948
+ that.setLayerVisiableLevel = function(name, beginLevel, endLevel){
949
+ if (scene == null)
950
+ return;
951
+
952
+ scene.fire((msgPrefix + ":setLayerVisiableLevel"), {args: [name, beginLevel, endLevel]}, parentScene, false);
953
+ }
954
+
955
+ that.getLayerVisiableLevel = function(name, callback){
956
+ if (scene == null)
957
+ return;
958
+
959
+ that.removeEventBind("getLayerVisiableLevelCallback");
960
+ if (callback != undefined) {
961
+ that.bindEvent("getLayerVisiableLevelCallback", function (evt) {
962
+ callback(evt.args);
963
+ });
964
+ }
965
+ scene.fire((msgPrefix + ":getLayerVisiableLevel"), {args: [name]}, parentScene, false);
966
+ }
967
+
968
+ /**
969
+ * 控制模型显示级别
970
+ */
971
+
972
+ that.setModelVisiableLevel = function(obj, beginLevel, endLevel){
973
+ if (scene == null)
974
+ return;
975
+
976
+ scene.fire((msgPrefix + ":setModelVisiableLevel"), {args: [obj, beginLevel, endLevel]}, parentScene, false);
977
+ }
978
+
979
+ /**
980
+ * 道路图层绘制 road
981
+ */
982
+ that.buildRoad = function(jsonInfo, zoom, clear, zoomOptions){
983
+ if (scene == null)
984
+ return;
985
+
986
+ scene.fire((msgPrefix + ":buildRoad"), {args: [jsonInfo, zoom, clear, zoomOptions]}, parentScene, false);
987
+ }
988
+
989
+ /**
990
+ * 绘制桥 buildBridge
991
+ */
992
+ that.buildBridge = function(jsonInfo, zoom, clear, options, layerName, clickCallback, mouseOverCallBack){
993
+ if (scene == null)
994
+ return;
995
+ // 移除监听
996
+
997
+ layerName = layerName || "bridge";
998
+ var clickBackName = "buildBridgeClick" + layerName;
999
+ var mouseOverBackName = "buildBridgeMouseMove" + layerName;
1000
+
1001
+ that.removeEventBind(clickBackName);
1002
+ that.removeEventBind(mouseOverBackName);
1003
+ var clickEnable = false;
1004
+ var mouseOverEnable = false;
1005
+
1006
+ if(clickCallback instanceof Function){
1007
+ that.bindEvent(clickBackName, function(evt) {
1008
+ clickCallback(evt.args);
1009
+ });
1010
+ clickEnable = true;
1011
+ }
1012
+
1013
+ if(mouseOverCallBack instanceof Function){
1014
+ that.bindEvent(mouseOverBackName, function(evt) {
1015
+ mouseOverCallBack(evt.args);
1016
+ });
1017
+ mouseOverEnable = true;
1018
+ }
1019
+
1020
+ scene.fire((msgPrefix + ":buildBridge"), {args: [jsonInfo, zoom, clear, options, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
1021
+ }
1022
+
1023
+ /**
1024
+ * 绘制桥 build管网
1025
+ */
1026
+ that.drawPipe = function(jsonInfo, zoom, clear, options, layerName){
1027
+ if (scene == null)
1028
+ return;
1029
+ // 移除监听
1030
+
1031
+ scene.fire((msgPrefix + ":drawPipe"), {args: [jsonInfo, zoom, clear, options, layerName]}, parentScene, false);
1032
+ }
1033
+
1034
+ /*清除指定图层*/
1035
+ that.clearGraphicLayerByID=function(id){
1036
+ if(scene==null)
1037
+ return;
1038
+ if (typeof id != "string") {
1039
+ id = id.join(",");
1040
+ }
1041
+ scene.fire((msgPrefix + ":clearGraphicLayerByID"), {args: [id]}, parentScene, false);
1042
+ }
1043
+
1044
+ that.drawWaveCircle=function(jsonInfo, styleOption, zoom, clear, layerName){
1045
+ if (scene == null)
1046
+ return;
1047
+ scene.fire((msgPrefix + ":drawWaveCircle"), {args: [jsonInfo, styleOption, zoom, clear, layerName]}, false);
1048
+ }
1049
+
1050
+ that.getPartLayerTree=function(callback){
1051
+ if (scene == null)
1052
+ return;
1053
+ scene.fire((msgPrefix + ":getPartLayerTree"), {args: [callback]}, false);
1054
+ }
1055
+
1056
+ that.showGlobePartLayer=function(layerNames,beginLevel,endLevel){
1057
+ if (scene == null)
1058
+ return;
1059
+ scene.fire((msgPrefix + ":showGlobePartLayer"), {args: [layerNames,beginLevel,endLevel]}, false);
1060
+ }
1061
+
1062
+ that.getPartStatisticsJsonInfo=function(usageId,regionCode,regionName,where,orderField,returnTree,callBack){
1063
+ if (scene == null)
1064
+ return;
1065
+ scene.fire((msgPrefix + ":getPartStatisticsJsonInfo"), {args: [usageId,regionCode,regionName,where,orderField,returnTree,callBack]}, false);
1066
+ }
1067
+ /**
1068
+ * 显示案件分布
1069
+ */
1070
+ that.showRecListDistribution=function(jsonInfo, zoom, clickCallback, labelInfo){
1071
+ if (scene == null)
1072
+ return;
1073
+ that.removeEventBind("showRecListDistributionCallback");
1074
+ if (clickCallback != undefined) {
1075
+ that.bindEvent("showRecListDistributionCallback", function (evt) {
1076
+ clickCallback(evt.args);
1077
+ });
1078
+ }
1079
+ if(that.globeLoaded)
1080
+ scene.fire((msgPrefix + ":showRecListDistribution"), {args:[jsonInfo, zoom, labelInfo]}, parentScene, false);
1081
+ }
1082
+
1083
+ that.showPatrolCurrentPosition=function(jsonInfo, zoom, clear, highLightType){
1084
+ if (scene == null)
1085
+ return;
1086
+ that.fireEvent("showPatrolCurrentPosition", {args: [jsonInfo, zoom, clear, highLightType]}, false);
1087
+ };
1088
+ /* 显示多个自定义图标 */
1089
+ that.showMultiObjectCurrentPosition = function (jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickCallback, mouseOverCallBack) {
1090
+ if (scene == null)
1091
+ return;
1092
+ // 移除监听
1093
+ var clickBackName = "showMultiObjectCurrentPositionClick";
1094
+ var mouseOverBackName = "showMultiObjectCurrentPositionMouseover";
1095
+
1096
+ if(tagName){
1097
+ clickBackName += tagName;
1098
+ mouseOverBackName += tagName;
1099
+ }
1100
+
1101
+ that.removeEventBind(clickBackName);
1102
+ that.removeEventBind(mouseOverBackName);
1103
+ var clickEnable = false;
1104
+ var mouseOverEnable = false;
1105
+
1106
+ if(clickCallback instanceof Function){
1107
+ that.bindEvent(clickBackName, function(evt) {
1108
+ clickCallback(evt.args);
1109
+ });
1110
+ clickEnable = true;
1111
+ }
1112
+
1113
+ if(mouseOverCallBack instanceof Function){
1114
+ that.bindEvent(mouseOverBackName, function(evt) {
1115
+ mouseOverCallBack(evt.args);
1116
+ });
1117
+ mouseOverEnable = true;
1118
+ }
1119
+
1120
+ scene.fire((msgPrefix + ":showMultiObjectCurrentPosition"), {args: [jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickEnable, mouseOverEnable]}, parentScene, false);
1121
+ };
1122
+
1123
+ /**
1124
+ * 创建dom空标签
1125
+ */
1126
+ that.createInnerHtml = function(jsonInfo, zoom, clear, tagName, options, callback) {
1127
+ if (scene == null)
1128
+ return;
1129
+
1130
+ // 移除监听
1131
+ that.removeEventBind("createInnerHtmlCallback" + tagName);
1132
+ var args = Array.prototype.slice.call(arguments);
1133
+ if (arguments[arguments.length - 1] instanceof Function) {
1134
+ callback = arguments[arguments.length - 1];
1135
+ args = args.slice(0, args.length - 1);
1136
+ }
1137
+
1138
+ if (callback != undefined) {
1139
+ that.bindEvent("createInnerHtmlCallback" + tagName, function (evt) {
1140
+ callback(evt.args);
1141
+ });
1142
+ }
1143
+ scene.fire((msgPrefix + ":createInnerHtml"), {args: args}, parentScene, false);
1144
+ };
1145
+
1146
+ /* 显示车辆人员轨迹 */
1147
+ that.showObjectTrace = function (objectID, symbolType, dateTime, queryCondition, hideControlPanel, symbolPic, optimizeParams, infoCallback, updatePositionCallback, closeCallback, traceDigCallback) {
1148
+ if (scene == null)
1149
+ return;
1150
+ // 人员轨迹查询依赖GIS服务端
1151
+ if (context.gisServerURL) {
1152
+ var options = {};
1153
+ var serviceUrl = context.gisServerURL + '/home/gis/patrol/getobjecttrace.htm';
1154
+ options.traceService = serviceUrl;
1155
+ options.dateTime = dateTime;
1156
+ options.queryCondition = queryCondition;
1157
+ options.hideControlPanel = hideControlPanel;
1158
+ options.symbolPic = symbolPic;
1159
+ options.optimizeParams = optimizeParams;
1160
+ options.infoCallback = infoCallback;
1161
+ options.updatePositionCallback = updatePositionCallback;
1162
+ options.closeCallback = closeCallback;
1163
+ options.traceDigCallback = traceDigCallback;
1164
+ scene.fire(msgPrefix + ":showObjectTrace", {
1165
+ args: [objectID, symbolType, options]
1166
+ }, parentScene);
1167
+ } else {
1168
+ console.error("没有配置二维GIS服务端地址");
1169
+ }
1170
+ };
1171
+
1172
+ /* 显示车辆人员轨迹 */
1173
+ that.addObjectTrace = function (jsonInfo, symbolType, clear, showControlPanel, traceID, options) {
1174
+ if (scene == null)
1175
+ return;
1176
+
1177
+ scene.fire((msgPrefix + ":addObjectTrace"), {args: [jsonInfo, symbolType, clear, showControlPanel, traceID, options]}, parentScene, false);
1178
+ };
1179
+
1180
+ /*设置轨迹属性 */
1181
+ that.setTraceOptions = function(options){
1182
+ if (scene == null)
1183
+ return;
1184
+ scene.fire((msgPrefix + ":setTraceOptions"), {args: [options]}, parentScene, false);
1185
+ };
1186
+
1187
+ /**
1188
+ * 移动的雷达
1189
+ */
1190
+ that.movingRadar= function (jsonInfo, zoom, clear, options, layerName) {
1191
+ scene.fire(msgPrefix + ":movingRadar", {args: [jsonInfo, zoom, clear, options, layerName]}, parentScene);
1192
+ }
1193
+
1194
+ /**
1195
+ * 移动的图标
1196
+ */
1197
+ that.movingBillboard = function (jsonInfo, zoom, clear, layerName, options, clickEnable, moveEnable) {
1198
+ scene.fire(msgPrefix + ":movingBillboard", { args: [jsonInfo, zoom, clear, layerName, options, clickEnable, moveEnable] }, parentScene);
1199
+ }
1200
+
1201
+ /*雷达扫描*/
1202
+ that.circleRadarEffect = function (info, zoom, clear, options, layerName) {
1203
+ if (scene == null)
1204
+ return;
1205
+ scene.fire((msgPrefix + ":circleRadarEffect"), { args: [info, zoom, clear, options, layerName] }, parentScene, false);
1206
+ }
1207
+
1208
+ /*光线射线*/
1209
+ that.lightRay = function (jsonInfo, zoom, clear, options, layerName) {
1210
+ if (scene == null)
1211
+ return;
1212
+ scene.fire((msgPrefix + ":lightRay"), { args: [jsonInfo, zoom, clear, options, layerName] }, parentScene, false);
1213
+ }
1214
+
1215
+
1216
+ that.getbuildBypolygon = function (info, color, zoom, clear, options, layerName) {
1217
+ if (scene == null)
1218
+ return;
1219
+ scene.fire((msgPrefix + ":getbuildBypolygon"), { args: [info, color, zoom, clear, options, layerName] }, parentScene, false);
1220
+ }
1221
+
1222
+
1223
+
1224
+ /* 点到点的迁徙接口*/
1225
+ that.showPolylineMoveMap= function (info, layerName, clear, zoom,options) {
1226
+ if (scene == null)
1227
+ return;
1228
+ scene.fire((msgPrefix + ":showPolylineMoveMap"), { args: [info, layerName, clear, zoom, options] }, parentScene, false);
1229
+ }
1230
+
1231
+ /* 视频投影 */
1232
+ that.beginProjection = function (options) {
1233
+ if (scene == null)
1234
+ return;
1235
+
1236
+ scene.fire((msgPrefix + ":beginProjection"), { args: [options] }, parentScene, false);
1237
+ }
1238
+
1239
+ /* 道路悬浮注记*/
1240
+ that.showMultiRoadText = function (jsonInfo, zoom, clear, tagName, clickEnable, mouseOverEnable) {
1241
+ if (scene == null)
1242
+ return;
1243
+ scene.fire((msgPrefix + ":showMultiRoadText"), { args: [jsonInfo, zoom, clear, tagName, clickEnable, mouseOverEnable] }, parentScene, false);
1244
+ }
1245
+
1246
+ that.limitGlobeRange = function (extent) {
1247
+ if (scene == null)
1248
+ return;
1249
+ scene.fire((msgPrefix + ":limitGlobeRange"), {args: [extent]}, parentScene, false);
1250
+ };
1251
+
1252
+ that.addChart = function(jsonInfo, zoom, clear, options, layerName , clickCallback, mouseOverCallBack) {
1253
+ if (scene == null)
1254
+ return;
1255
+
1256
+ layerName = layerName || "chart";
1257
+
1258
+ var clickBackName = "addChartClick" + layerName;
1259
+ var mouseOverBackName = "addChartMouseMove" + layerName;
1260
+
1261
+ that.removeEventBind(clickBackName);
1262
+ that.removeEventBind(mouseOverBackName);
1263
+
1264
+ var clickEnable = false;
1265
+ var mouseOverEnable = false;
1266
+
1267
+ if(clickCallback instanceof Function){
1268
+ that.bindEvent(clickBackName, function(evt) {
1269
+ clickCallback(evt.args);
1270
+ });
1271
+ clickEnable = true;
1272
+ }
1273
+
1274
+ if(mouseOverCallBack instanceof Function){
1275
+ that.bindEvent(mouseOverBackName, function(evt) {
1276
+ mouseOverCallBack(evt.args);
1277
+ });
1278
+ mouseOverEnable = true;
1279
+ }
1280
+
1281
+ scene.fire((msgPrefix + ":addChart"), {args: [jsonInfo, zoom, clear, options, layerName , clickEnable, mouseOverEnable]}, parentScene, false);
1282
+ };
1283
+ /**
1284
+ * 鼠标点击模型查询
1285
+ * @param callback
1286
+ */
1287
+ that.queryModelInfo=function(callback,type){
1288
+ if (scene == null)
1289
+ return;
1290
+ scene.fire((msgPrefix + ":queryModelClick"), {args: [callback,type]}, parentScene, false);
1291
+ };
1292
+ /**
1293
+ * 删除三维柱状图
1294
+ */
1295
+ that.removeChart = function() {
1296
+ if (scene == null)
1297
+ return;
1298
+ scene.fire((msgPrefix + ":removeChart"), {args: []}, parentScene, false);
1299
+ };
1300
+
1301
+ that.flyToPoint=function(x,y,height){
1302
+ if (scene == null)
1303
+ return;
1304
+ scene.fire((msgPrefix + ":flyToPoint"), {args: [x,y,height]}, parentScene, false);
1305
+ };
1306
+
1307
+ that.fullExtent=function(){
1308
+ if (scene == null)
1309
+ return;
1310
+
1311
+ scene.fire((msgPrefix + ":fullExtent"), {args: []}, parentScene, false);
1312
+ };
1313
+
1314
+ that.goUnderGround=function(height){
1315
+ if(scene == null)
1316
+ return;
1317
+ scene.fire((msgPrefix + ":goUnderGround"), {args: [height]}, parentScene, false);
1318
+ };
1319
+
1320
+ /* 显示视频闪烁点*/
1321
+ that.addVideoAlarm = function (coordX, coorY, successFunc, hitCallback) {
1322
+ if (scene == null)
1323
+ return;
1324
+ scene.fire(msgPrefix + ":addVideoAlarm", {args: [coordX, coorY, successFunc, hitCallback]}, parentScene);
1325
+ };
1326
+
1327
+ /* 显示面板信息*/
1328
+ that.createPanelInfo = function (entity, successFunc) {
1329
+ if (scene == null)
1330
+ return;
1331
+ scene.fire(msgPrefix + ":createPanelInfo", {args: [entity, successFunc]}, parentScene);
1332
+ };
1333
+
1334
+ /* 显示面板信息*/
1335
+ that.createAnimateCar = function (objectID, successFunc) {
1336
+ if (scene == null)
1337
+ return;
1338
+ scene.fire(msgPrefix + ":createAnimateCar", {args: [ objectID, successFunc]}, parentScene);
1339
+ };
1340
+
1341
+ /*根据id号删除一个视频闪烁点*/
1342
+ that.removeVideoAlarm = function (id) {
1343
+ if (scene == null)
1344
+ return;
1345
+ scene.fire(msgPrefix + ":removeVideoAlarm", {args: [id]}, parentScene);
1346
+ };
1347
+ /*地图上标注返回坐标值*/
1348
+ that.pointSelect = function(symbolType, mapZoom2Point, clickCallback){
1349
+ if (scene == null)
1350
+ return;
1351
+ that.removeEventBind("pointSelectCallback");
1352
+ if (clickCallback != undefined) {
1353
+ that.bindEvent("pointSelectCallback", function (position) {
1354
+ that.removeEventBind("pointSelectCallback");
1355
+ var resultPosition=[position.args[0].longitude+','+position.args[0].latitude];
1356
+ resultPosition.push(position.args[0]);
1357
+ clickCallback(resultPosition);
1358
+ });
1359
+ }
1360
+ scene.fire((msgPrefix + ":pointSelect"), {args:[symbolType, mapZoom2Point]}, parentScene, false);
1361
+ };
1362
+
1363
+ /*根据要素坐标定位显示要素*/
1364
+ that.locateFeatureByCoords=function(geometries, type, ID, style, hStyle,zoom,keyFiled,labelField,labelStyle,randomColor,renderCanvas,singleSelected,options){
1365
+ if (scene == null)
1366
+ return;
1367
+ scene.fire((msgPrefix + ":locateFeatureByCoords"), { args : [geometries, type, ID, style, hStyle, zoom,keyFiled,labelField,labelStyle,randomColor,renderCanvas,singleSelected,options] }, parentScene, false);
1368
+ };
1369
+ /* 要素查询 */
1370
+ that.queryFeature = function(params, callback) {
1371
+ // 移除监听
1372
+ that.removeEventBind("queryFeatureCallback");
1373
+
1374
+ if (callback != undefined) {
1375
+ that.bindEvent("queryFeatureCallback", function(evt) {
1376
+ callback(evt.args);
1377
+ });
1378
+ }
1379
+ 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);
1380
+ }
1381
+ /*绘制图形*/
1382
+ that.drawGraphic = function(graphic, zoom, clickCallback) {
1383
+ if (scene == null)
1384
+ return;
1385
+ if (graphic.geometry instanceof Array) {
1386
+ graphic.type=graphic.type||graphic.geometry[0].type;
1387
+ scene.fire(msgPrefix + ":locateFeatureByCoords", { args : [ graphic.geometry, graphic.type, graphic.id, graphic.style,
1388
+ graphic.hstyle, zoom,graphic.keyField,graphic.labelField,graphic.labelStyle,graphic.colorNumber] }, parentScene);
1389
+ } else {
1390
+ graphic.type=graphic.type||graphic.geometry.type;
1391
+ scene.fire(msgPrefix + ":locateFeatureByCoords", { args : [ [ graphic.geometry ], graphic.type, graphic.id, graphic.style,
1392
+ graphic.hstyle, zoom ] }, parentScene);
1393
+ }
1394
+ that.removeEventBind("locateFeatureByIDsCallback");
1395
+ if (clickCallback != undefined) {
1396
+ that.bindEvent("locateFeatureByIDsCallback", function(evt) {
1397
+ clickCallback(evt.args);
1398
+ });
1399
+ }
1400
+ };
1401
+ /* 标识位置 */
1402
+ that.markMap = function(projectTypeID, eventTypeID, actPropertyID, displayStyleID, layerID, clickCallback,cellIndexName,point) {
1403
+ if (scene == null)
1404
+ return;
1405
+ var eventInfo={
1406
+ actpropertyid: actPropertyID,
1407
+ displaystyleid: displayStyleID,
1408
+ eventtypeid: eventTypeID,
1409
+ projecttypeid: projectTypeID
1410
+ };
1411
+ scene.fire((msgPrefix + ":markMap"), { args : [eventInfo,layerID,clickCallback] }, parentScene, false);
1412
+ }
1413
+ /*连续标注三维地图获取xy坐标*/
1414
+ that.markMapXY = function(event,Callback){
1415
+ if (scene == null)
1416
+ return;
1417
+ scene.fire((msgPrefix + ":markMapXY"), { args : [event,Callback] }, parentScene, false);
1418
+ };
1419
+ /*清除标注事件*/
1420
+ that.removeMarkMapMouseHandler=function(){
1421
+ if (scene == null)
1422
+ return;
1423
+ scene.fire((msgPrefix + ":removeMarkMapMouseHandler"), { args : [] }, parentScene, false);
1424
+ };
1425
+
1426
+ /**
1427
+ * 绘制图形接口
1428
+ * type 类型 point,polyline,polygon,circle
1429
+ * style 样式
1430
+ * clear 是否清除
1431
+ * callback 回调函数返回绘制图形的坐标信息
1432
+ **/
1433
+ that.drawGeometry = function (type, style, clear, callback, option) {
1434
+ if (scene == null)
1435
+ return;
1436
+ scene.fire((msgPrefix + ":drawGeometry"), { args : [type, style, clear, callback, option] }, parentScene, false);
1437
+ };
1438
+ that.showUserDrawGeometry = function (show,id) {
1439
+ if (scene == null)
1440
+ return;
1441
+ scene.fire((msgPrefix + ":showUserDrawGeometry"), { args : [show,id] }, parentScene, false);
1442
+ };
1443
+
1444
+ that.addGraphic=function(params, addCallback){
1445
+ if(scene == null)
1446
+ return;
1447
+ if(!params||!params[0])
1448
+ return;
1449
+ var type=params[0];
1450
+ var style=params[1]||{"color":[215, 214, 111, 100]};
1451
+ var clear=params[2]||true;
1452
+ var callback=addCallback;
1453
+ scene.fire((msgPrefix + ":drawGeometry"), { args : [type, style, clear, callback] }, parentScene, false);
1454
+ };
1455
+
1456
+
1457
+ //by hth,2020-12-29
1458
+
1459
+ that.showMultiObjectToCluster = function(jsonInfo, zoom, clear, highLightType, infoStyle, renderCanvas, tagName, clickCallBack, mouseOverEnable) {
1460
+
1461
+ // 获取symbolUrl
1462
+
1463
+ var defaultSymbolUrl = Array.isArray(jsonInfo) ? jsonInfo[0].symbolUrl : 'numImage.png';
1464
+
1465
+ var hasCustomProperties = infoStyle.hasOwnProperty('customProperties')
1466
+
1467
+ var defaultClusterImageInfo = {//自定义聚类图标。如果设置的话,要自己调"textStyle"以适应自己的"symbolUrl"
1468
+
1469
+ symbolUrl: defaultSymbolUrl,
1470
+
1471
+ horizontalOrigin: "center",
1472
+
1473
+ verticalOrigin: "bottom",
1474
+
1475
+ cssStyle: {
1476
+
1477
+ "borderRadius": 500,//设置的很大话,就会形成半圆角
1478
+
1479
+ "fillColor": "rgba(27,32,43,0.7)",//圆角矩形的颜色
1480
+
1481
+ "borderLineWidth": 3,//圆角矩形的边框宽度
1482
+
1483
+ "borderLineColor": "rgba(230,230,230,0.9)",//圆角矩形的边框颜色
1484
+
1485
+ "paddingX": 15,//圆角矩形内边框padding(主要是为了让文字与边框有一定距离)
1486
+
1487
+ "paddingY": 6,
1488
+
1489
+ "marginBottom": 2 //下边框外距
1490
+
1491
+ },
1492
+
1493
+ textStyle : {
1494
+
1495
+ "font" : "60px Helvetica",
1496
+
1497
+ "fillColor" : "rgba(250,250,250,1.0)",
1498
+
1499
+ "outlineColor" : "black",
1500
+
1501
+ "outlineWidth" : 1.0,
1502
+
1503
+ "padding":1,
1504
+
1505
+ "textScale":0.5,
1506
+
1507
+ "textStartX":40,
1508
+
1509
+ "textStartY":15
1510
+
1511
+ }
1512
+
1513
+ }
1514
+
1515
+ // 组装options数据
1516
+
1517
+ var options = {
1518
+
1519
+ clusterStyle: (hasCustomProperties && infoStyle.customProperties.clusterStyle) || 'clusterByGrid',
1520
+
1521
+ zoom:zoom,
1522
+
1523
+ scale: 0.9,
1524
+
1525
+ clusterLimit: (hasCustomProperties && infoStyle.customProperties.clusterLimit) || undefined,
1526
+
1527
+ symbolUrl: (hasCustomProperties && infoStyle.customProperties.symbolUrl) || defaultSymbolUrl,
1528
+
1529
+ clear:clear,
1530
+
1531
+ layerName: tagName,
1532
+
1533
+ style: 'default',
1534
+
1535
+ nearFarScalar: [8000, 1.0, 10000, 0.6],
1536
+
1537
+ clickCallBack: clickCallBack,
1538
+
1539
+ clusterImageInfo: (hasCustomProperties && infoStyle.customProperties.clusterImageInfo) || defaultClusterImageInfo,
1540
+
1541
+ minSize: (hasCustomProperties && infoStyle.customProperties.minSize) || 6,
1542
+
1543
+ geometricErrorScale: (hasCustomProperties && infoStyle.customProperties.geometricErrorScale) || 2
1544
+
1545
+ }
1546
+
1547
+ that.addClusterLayer({data:jsonInfo, options});
1548
+
1549
+ }
1550
+
1551
+ //添加聚类图层
1552
+ that.addClusterLayer=function(data){
1553
+ if(scene == null)
1554
+ return;
1555
+ var dataInfo = data.data;
1556
+ var option=data.options;
1557
+ if(option && option.addClusterWithAni){
1558
+ scene.fire((msgPrefix + ":addClusterWithAni"), {args: [dataInfo, option]}, parentScene, false);
1559
+ }else{
1560
+ scene.fire((msgPrefix + ":addClusterLayer"), {args: [dataInfo, option]}, parentScene, false);
1561
+ }
1562
+ };
1563
+ //获取所选择的三维模型信息
1564
+ that.getSelectedLayerinfo = function (name, callback) {
1565
+ if (scene == null)
1566
+ return;
1567
+ scene.fire((msgPrefix + ":getSelectedLayerinfo"), {args: [name, callback]}, parentScene, false);
1568
+ };
1569
+
1570
+ //three模型管理
1571
+ that.threeModelManage = function (layerName, type, options, others) {
1572
+ if (scene == null)
1573
+ return;
1574
+
1575
+ scene.fire((msgPrefix + ":threeModelManage"), { args: [layerName, type, options, others] }, parentScene, false);
1576
+ }
1577
+
1578
+ //烟花效果
1579
+ that.fireWorkSystem = function (options) {
1580
+ if (scene == null)
1581
+ return;
1582
+
1583
+ scene.fire((msgPrefix + ":fireWorkSystem"), { args: [options] }, parentScene, false);
1584
+ }
1585
+
1586
+ //烟花效果显隐控制
1587
+ that.setFireWorkVisible = function (visible) {
1588
+ if (scene == null)
1589
+ return;
1590
+
1591
+ scene.fire((msgPrefix + ":setFireWorkVisible"), { args: [visible] }, parentScene, false);
1592
+ }
1593
+
1594
+
1595
+ //开启地透
1596
+ that.undergroundMode_on = function(alpha){
1597
+ if (scene == null)
1598
+ return;
1599
+
1600
+ scene.fire((msgPrefix + ":undergroundMode_on"), {args: [alpha]}, parentScene, false);
1601
+ }
1602
+
1603
+ //关闭地透
1604
+ that.undergroundMode_off = function(){
1605
+ if (scene == null)
1606
+ return;
1607
+
1608
+ scene.fire((msgPrefix + ":undergroundMode_off"), {args: []}, parentScene, false);
1609
+ }
1610
+
1611
+ //平面坐标转经纬度
1612
+ that.Plat2lonLat = function (positions, callback) {
1613
+ if (scene == null)
1614
+ return;
1615
+ scene.fire((msgPrefix + ":Plat2lonLat"), {args: [positions, callback]}, parentScene, false);
1616
+ };
1617
+ //地面开挖接口
1618
+ that.digsuface=function(positions,depth,callback){
1619
+ if (scene == null)
1620
+ return;
1621
+ var options={
1622
+ positions:positions,
1623
+ depth:depth,
1624
+ callback:callback
1625
+ };
1626
+ scene.fire((msgPrefix + ":digSurface_dig"), {args: [options]}, parentScene, false);
1627
+ };
1628
+
1629
+ //清除地面开挖
1630
+ that.removeDigsuface=function(){
1631
+ if (scene == null)
1632
+ return;
1633
+ scene.fire((msgPrefix + ":digSurface_remove"), {args: []}, parentScene, false);
1634
+ };
1635
+ that.clearDrawGeometry=function(){
1636
+ if (scene == null)
1637
+ return;
1638
+ scene.fire((msgPrefix + ":cleardrawGeometry"), {args: []}, parentScene, false);
1639
+ };
1640
+
1641
+ //三维地图点击事件
1642
+ that.addPickHandler = function (callback) {
1643
+ if (scene == null)
1644
+ return;
1645
+ scene.fire((msgPrefix + ":addPickHandler"), {args: [callback]}, parentScene, false);
1646
+ };
1647
+ //右键查询
1648
+ that.addRightClickHandler=function(callback){
1649
+ if (scene == null)
1650
+ return;
1651
+ scene.fire((msgPrefix + ":addRightClickHandler"), {args: [callback]}, parentScene, false);
1652
+ };
1653
+
1654
+ that.pickModel = function (position,callback) {
1655
+ if (scene == null)
1656
+ return;
1657
+ scene.fire((msgPrefix + ":pickModel"), {args: [callback]}, parentScene, false);
1658
+ };
1659
+ that.show2dMode=function(){
1660
+ if (scene == null)
1661
+ return;
1662
+ scene.fire((msgPrefix + ":show2dMode"), {args: []}, parentScene, false);
1663
+ };
1664
+ that.show3dMode=function () {
1665
+ if (scene == null)
1666
+ return;
1667
+ scene.fire((msgPrefix + ":show3dMode"), {args: []}, parentScene, false);
1668
+ };
1669
+ that.getSysLayerTree=function(callback){
1670
+ if (scene == null)
1671
+ return;
1672
+ scene.fire((msgPrefix + ":getSysLayerTree"), {args: [callback]}, parentScene, false);
1673
+ };
1674
+ that.show2_5dMode=function(){
1675
+ if (scene == null)
1676
+ return;
1677
+ scene.fire((msgPrefix + ":show2_5dMode"), {args: []}, parentScene, false);
1678
+ };
1679
+ that.showWall=function(jsonInfo, zoom, clear, zoomOptions, merge, layerName, clickEnable, mouseOverEnable){
1680
+ if (scene == null)
1681
+ return;
1682
+ scene.fire((msgPrefix + ":showWall"), {args: [jsonInfo, zoom, clear, zoomOptions, merge, layerName, clickEnable, mouseOverEnable]}, parentScene, false);
1683
+ };
1684
+
1685
+ /* 根据图层字段定位显示 */
1686
+ that.locateFeatureByIDs = function(layerID, keyField, keyValue, clearMap, style, hStyle, bZoom, randomColor, labelfield, labelstyle, geometry, where, renderCanvas, singleSelected,options,extendProperty,layerTag, successFunc) {
1687
+ if (scene == null)
1688
+ return;
1689
+
1690
+ if(scene.layerUsageConfig && scene.layerUsageConfig[layerID]){
1691
+ keyField = keyField || scene.layerUsageConfig[layerID].keyFieldName;
1692
+ }
1693
+ 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);
1694
+ };
1695
+
1696
+ /**
1697
+ * 区域查询
1698
+ */
1699
+ that.locateRegionByIDs = function(layerID, keyField, keyValue, style, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, successFunc) {
1700
+ if (scene == null)
1701
+ return;
1702
+ if(scene.layerUsageConfig && scene.layerUsageConfig[layerID]){
1703
+ keyField = keyField || scene.layerUsageConfig[layerID].keyFieldName;
1704
+ var usageLabelField = scene.layerUsageConfig[layerID].labelFieldName;
1705
+ }
1706
+ scene.fire((msgPrefix + ":locateRegionByIDs"), {args: [layerID, keyField, keyValue, style, zoom, clear, options, layerName, clickCallback, mouseOverCallBack, successFunc,usageLabelField]}, parentScene, false);
1707
+ };
1708
+
1709
+ that.drawGeoJsonGeometry=function(jsonInfos, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack){
1710
+ if (scene == null)
1711
+ return;
1712
+ scene.fire((msgPrefix + ":drawGeoJsonGeometry"), {args: [jsonInfos, zoom, clear, options, layerName, clickCallBack, mouseOverCallBack]}, parentScene, false);
1713
+ }
1714
+
1715
+
1716
+ that.pathPlan = function(origin, destination, callBack){
1717
+ if (scene == null)
1718
+ return;
1719
+
1720
+ scene.fire((msgPrefix + ":pathPlan"), {args: [origin, destination, callBack]}, parentScene, false);
1721
+ };
1722
+
1723
+ that.getRoutePlanning=function(origin,destination,options,callback){
1724
+ if (scene == null)
1725
+ return;
1726
+ scene.fire((msgPrefix + ":getRoutePlanning"), {args: [origin,destination,options,callback]}, parentScene, false);
1727
+ };
1728
+
1729
+ that.startMonomerQuery = function (type, clear, options, layerName, clickCallback) {
1730
+ if (scene == null)
1731
+ return;
1732
+ // 移除监听
1733
+ var clickBackName = "startMonomerQueryClick" + layerName;
1734
+
1735
+ that.removeEventBind(clickBackName);
1736
+ var clickEnable = false;
1737
+
1738
+ if(clickCallback instanceof Function){
1739
+ that.bindEvent(clickBackName, function(evt) {
1740
+ clickCallback(evt.args);
1741
+ });
1742
+ clickEnable = true;
1743
+ }
1744
+
1745
+ scene.fire((msgPrefix + ":startMonomerQuery"), { args: [type, clear, options, layerName, clickEnable] }, parentScene, false);
1746
+ }
1747
+
1748
+
1749
+ that.superMonomerQuery = function(type, clear, options, layerName, clickEnable){
1750
+ if (scene == null)
1751
+ return;
1752
+ scene.fire((msgPrefix + ":superMonomerQuery"), {args: [type, clear, options, layerName, clickEnable]}, parentScene, false);
1753
+ };
1754
+
1755
+ //s3m模型操作
1756
+ that.setS3MOperation = function(type, LayerName, options){
1757
+ if (scene == null)
1758
+ return;
1759
+
1760
+ scene.fire((msgPrefix + ":setS3MOperation"), {args: [type, LayerName, options]}, parentScene, false);
1761
+ }
1762
+
1763
+ that.createMonomerClamp = function(jsonInfo, zoom, clear, options, layerName, clickCallBack){
1764
+ if (scene == null)
1765
+ return;
1766
+ scene.fire((msgPrefix + ":createMonomerClamp"), {args: [jsonInfo, zoom, clear, options, layerName, clickCallBack]}, parentScene, false);
1767
+ };
1768
+
1769
+ that.getPGlist = function(queryParam, queryCallBack){
1770
+ if (scene == null)
1771
+ return;
1772
+ scene.fire((msgPrefix + ":getPGlist"), {args: [queryParam, queryCallBack]}, parentScene, false);
1773
+ };
1774
+
1775
+ that.enablePickGradientObj = function(callback){
1776
+ if (scene == null) {
1777
+ return
1778
+ };
1779
+
1780
+ that.removeEventBind("enablePickGradientObj");
1781
+ if (callback != undefined) {
1782
+ that.bindEvent("enablePickGradientObj", function (evt) {
1783
+ callback(evt.args);
1784
+ });
1785
+ }
1786
+
1787
+ scene.fire((msgPrefix + ":enablePickGradientObj"), {args: []}, parentScene, false);
1788
+ };
1789
+
1790
+ that.disablePickGradientObj = function(){
1791
+ if (scene == null)
1792
+ return;
1793
+ scene.fire((msgPrefix + ":disablePickGradientObj"), {args: []}, parentScene, false);
1794
+ };
1795
+
1796
+ that.modifyAttributes = function(layerName, objID, newProperties, options, autoRevert){
1797
+ if (scene == null)
1798
+ return;
1799
+ scene.fire((msgPrefix + ":modifyAttributes"), {args: [layerName, objID, newProperties, options, autoRevert]}, parentScene, false);
1800
+ };
1801
+ that.focusOnDistrict = function(config, positions, modelName, hideLayerNames){
1802
+ if (scene == null)
1803
+ return;
1804
+ scene.fire((msgPrefix + ":focusOnDistrict"), {args: [config, positions, modelName, hideLayerNames]}, parentScene, false);
1805
+ };
1806
+ that.showLaserWall = function(coordinatesData, layerName, options){
1807
+ if (scene == null)
1808
+ return;
1809
+ scene.fire((msgPrefix + ":showLaserWall"), {args: [coordinatesData, layerName, options]}, parentScene, false);
1810
+ };
1811
+ that.PipeLineOperation = function(layerName,operateType,zoom,clear,options){
1812
+ if (scene == null)
1813
+ return;
1814
+ scene.fire((msgPrefix + ":PipeLineOperation"), {args: [layerName,operateType,zoom,clear,options]}, parentScene, false);
1815
+ };
1816
+ that.setCameraConfig = function(options){
1817
+ if (scene == null)
1818
+ return;
1819
+ scene.fire((msgPrefix + ":setCameraConfig"), {args: [options]}, parentScene, false);
1820
+ };
1821
+ that.setFireEffect = function(options,zoom,clear,layerName){
1822
+ if (scene == null)
1823
+ return;
1824
+ scene.fire((msgPrefix + ":setFireEffect"), {args: [options,zoom,clear,layerName]}, parentScene, false);
1825
+ };
1826
+ that.drawPoints = function(layerName, positions, options){
1827
+ if (scene == null)
1828
+ return;
1829
+ scene.fire((msgPrefix + ":drawPoints"), {args: [layerName, positions, options]}, parentScene, false);
1830
+ };
1831
+ that.traceOperation = function(posArr, options){
1832
+ if (scene == null)
1833
+ return;
1834
+ scene.fire((msgPrefix + ":traceOperation"), {args: [posArr, options]}, parentScene, false);
1835
+ };
1836
+ that.regionOperation = function(options, data){
1837
+ if (scene == null)
1838
+ return;
1839
+ scene.fire((msgPrefix + ":regionOperation"), {args: [options, data]}, parentScene, false);
1840
+ };
1841
+ that.activeLayer = function(layerName, options, filter){
1842
+ if (scene == null)
1843
+ return;
1844
+ scene.fire((msgPrefix + ":activeLayer"), {args: [layerName, options, filter]}, parentScene, false);
1845
+ };
1846
+ that.networkCloud = function(options, positions){
1847
+ if (scene == null)
1848
+ return;
1849
+ scene.fire((msgPrefix + ":networkCloud"), {args: [options, positions]}, parentScene, false);
1850
+ };
1851
+ that.clearNetworkCloud = function(layerNames){
1852
+ if (scene == null)
1853
+ return;
1854
+ scene.fire((msgPrefix + ":clearNetworkCloud"), {args: [layerNames]}, parentScene, false);
1855
+ };
1856
+ that.lineOperation = function(options, data){
1857
+ if (scene == null)
1858
+ return;
1859
+ scene.fire((msgPrefix + ":lineOperation"), {args: [options, data]}, parentScene, false);
1860
+ };
1861
+ that.getMainSubTypeTree = function(params, callback){
1862
+ if (scene == null)
1863
+ return;
1864
+ var cb = function (type, data) {
1865
+ if (callback && type == 'getMainSubTypeTreeCallback') {
1866
+ callback(data);
1867
+ }
1868
+ };
1869
+ scene.fire((msgPrefix + ":getMainSubTypeTree"), {args: [params, cb]}, parentScene, false);
1870
+ };
1871
+ that.getRegion = function(params, callback){
1872
+ if (scene == null)
1873
+ return;
1874
+ var cb = function (type, data) {
1875
+ if (callback && type == 'getRegionCallback') {
1876
+ callback(data);
1877
+ }
1878
+ };
1879
+ scene.fire((msgPrefix + ":getRegion"), {args: [params, cb]}, parentScene, false);
1880
+ };
1881
+ that.getMapConfig = function(key, callback){
1882
+ if (scene == null)
1883
+ return;
1884
+ scene.fire((msgPrefix + ":getMapConfig"), {args: [key, callback]}, parentScene, false);
1885
+ };
1886
+ that.addCIMMap = function(options) {
1887
+ if (scene == null)
1888
+ return;
1889
+ scene.fire((msgPrefix + ":addCIMMap"), { args: [options] }, parentScene, false);
1890
+ };
1891
+ that.addCIMModel = function(options) {
1892
+ if (scene == null)
1893
+ return;
1894
+ scene.fire((msgPrefix + ":addCIMModel"), { args: [options] }, parentScene, false);
1895
+ };
1896
+ that.setLayerVisible = function(options) {
1897
+ if (scene == null)
1898
+ return;
1899
+ scene.fire((msgPrefix + ":setLayerVisible"), { args: [options] }, parentScene, false);
1900
+ };
1901
+ that.flyToLayer = function(options) {
1902
+ if (scene == null)
1903
+ return;
1904
+ scene.fire((msgPrefix + ":flyToLayer"), { args: [options] }, parentScene, false);
1905
+ };
1906
+ that.controlCamera = function(options) {
1907
+ if (scene == null)
1908
+ return;
1909
+ scene.fire((msgPrefix + ":controlCamera"), { args: [options] }, parentScene, false);
1910
+ };
1911
+ that.zoomIn = function() {
1912
+ if (scene == null)
1913
+ return;
1914
+ scene.fire((msgPrefix + ":zoomIn"), { args: [] }, parentScene, false);
1915
+ };
1916
+ that.zoomOut = function(options) {
1917
+ if (scene == null)
1918
+ return;
1919
+ scene.fire((msgPrefix + ":zoomOut"), { args: [options] }, parentScene, false);
1920
+ };
1921
+ that.measureDistance = function(options) {
1922
+ if (scene == null)
1923
+ return;
1924
+ scene.fire((msgPrefix + ":measureDistance"), { args: [options] }, parentScene, false);
1925
+ };
1926
+ that.measureArea = function(options) {
1927
+ if (scene == null)
1928
+ return;
1929
+ scene.fire((msgPrefix + ":measureArea"), { args: [options] }, parentScene, false);
1930
+ };
1931
+ that.measureHeight = function(options) {
1932
+ if (scene == null)
1933
+ return;
1934
+ scene.fire((msgPrefix + ":measureHeight"), { args: [options] }, parentScene, false);
1935
+ };
1936
+ that.onUndergroundModel = function(alpha, distance) {
1937
+ if (scene == null)
1938
+ return;
1939
+ scene.fire((msgPrefix + ":onUndergroundModel"), { args: [alpha, distance] }, parentScene, false);
1940
+ };
1941
+ that.offUndergroundModel = function() {
1942
+ if (scene == null)
1943
+ return;
1944
+ scene.fire((msgPrefix + ":offUndergroundModel"), { args: [] }, parentScene, false);
1945
+ };
1946
+ that.addFlag = function(options) {
1947
+ if (scene == null)
1948
+ return;
1949
+ scene.fire((msgPrefix + ":addFlag"), { args: [options] }, parentScene, false);
1950
+ };
1951
+ that.getPointInfo = function(options) {
1952
+ if (scene == null)
1953
+ return;
1954
+ scene.fire((msgPrefix + ":getPointInfo"), { args: [options] }, parentScene, false);
1955
+ };
1956
+ //添加聚类图层
1957
+ that.addClusterLayerCIM = function(dataInfo, option) {
1958
+ if (scene == null)
1959
+ return;
1960
+ scene.fire((msgPrefix + ":addClusterLayer"), { args: [dataInfo, option] }, parentScene, false);
1961
+ };
1962
+ //可视域分析
1963
+ that.startViewer = function(options) {
1964
+ if (scene == null)
1965
+ return;
1966
+ scene.fire((msgPrefix + ":startViewer"), { args: [options] }, parentScene, false);
1967
+ };
1968
+ that.removeViewer = function() {
1969
+ if (scene == null)
1970
+ return;
1971
+ scene.fire((msgPrefix + ":removeViewer"), { args: [] }, parentScene, false);
1972
+ };
1973
+ that.setViewerOptions = function(options) {
1974
+ if (scene == null)
1975
+ return;
1976
+ scene.fire((msgPrefix + ":setViewerOptions"), { args: [options] }, parentScene, false);
1977
+ };
1978
+ that.showSkyLine = function(options) {
1979
+ if (scene == null)
1980
+ return;
1981
+ scene.fire((msgPrefix + ":showSkyLine"), { args: [options] }, parentScene, false);
1982
+ };
1983
+ that.clearSkyLine = function() {
1984
+ if (scene == null)
1985
+ return;
1986
+ scene.fire((msgPrefix + ":clearSkyLine"), { args: [] }, parentScene, false);
1987
+ };
1988
+ that.setLineOptions = function(options) {
1989
+ if (scene == null)
1990
+ return;
1991
+ scene.fire((msgPrefix + ":setLineOptions"), { args: [options] }, parentScene, false);
1992
+ };
1993
+ that.bufferAnalysis = function(options,clear,update,callback) {
1994
+ if (scene == null)
1995
+ return;
1996
+ scene.fire((msgPrefix + ":bufferAnalysis"), { args: [options,clear,update,callback] }, parentScene, false);
1997
+ };
1998
+ that.clearBufferAnalysis = function(options) {
1999
+ if (scene == null)
2000
+ return;
2001
+ scene.fire((msgPrefix + ":clearBufferAnalysis"), { args: [] }, parentScene, false);
2002
+ };
2003
+ that.addModelClickEvent = function(callback) {
2004
+ if (scene == null)
2005
+ return;
2006
+ scene.fire((msgPrefix + ":addModelClickEvent"), { args: [callback] }, parentScene, false);
2007
+ };
2008
+ that.removeModelClickEvent = function() {
2009
+ if (scene == null)
2010
+ return;
2011
+ scene.fire((msgPrefix + ":removeModelClickEvent"), { args: [] }, parentScene, false);
2012
+ };
2013
+ that.getBIMTree = function(option, callback) {
2014
+ if (scene == null)
2015
+ return;
2016
+ scene.fire((msgPrefix + ":getBIMTree"), { args: [option, callback] }, parentScene, false);
2017
+ };
2018
+ that.setBIMTree = function(option) {
2019
+ if (scene == null)
2020
+ return;
2021
+ scene.fire((msgPrefix + ":setBIMTree"), { args: [option] }, parentScene, false);
2022
+ };
2023
+ that.clearBimSelect = function() {
2024
+ if (scene == null)
2025
+ return;
2026
+ scene.fire((msgPrefix + ":clearBimSelect"), { args: [] }, parentScene, false);
2027
+ };
2028
+ that.visibilityAnalysis = function(type) {
2029
+ if (scene == null)
2030
+ return;
2031
+ scene.fire((msgPrefix + ":visibilityAnalysis"), { args: [type] }, parentScene, false);
2032
+ };
2033
+ that.clearVisibilityAnalysis = function() {
2034
+ if (scene == null)
2035
+ return;
2036
+ scene.fire((msgPrefix + ":clearVisibilityAnalysis"), { args: [] }, parentScene, false);
2037
+ };
2038
+ that.addCIMTerrain = function(options) {
2039
+ if (scene == null)
2040
+ return;
2041
+ scene.fire((msgPrefix + ":addCIMTerrain"), { args: [options] }, parentScene, false);
2042
+ };
2043
+ that.flytoPosition = function(lon, lat, height) {
2044
+ if (scene == null)
2045
+ return;
2046
+ scene.fire((msgPrefix + ":flytoPosition"), { args: [lon, lat, height] }, parentScene, false);
2047
+ };
2048
+ //开启日照分析
2049
+ that.openSunshineAnalysis = function() {
2050
+ if (scene == null)
2051
+ return;
2052
+ scene.fire((msgPrefix + ":openSunshineAnalysis"), { args: [] }, parentScene, false);
2053
+ };
2054
+ that.sunshineAnalysis = function(date) {
2055
+ if (scene == null)
2056
+ return;
2057
+ scene.fire((msgPrefix + ":sunshineAnalysis"), { args: [date] }, parentScene, false);
2058
+ };
2059
+ that.closeSunshineAnalysis = function() {
2060
+ if (scene == null)
2061
+ return;
2062
+ scene.fire((msgPrefix + ":closeSunshineAnalysis"), { args: [] }, parentScene, false);
2063
+ };
2064
+ //设置天气
2065
+ that.setViewConfig = function(type, options) {
2066
+ if (scene == null)
2067
+ return;
2068
+ scene.fire((msgPrefix + ":setViewConfig"), { args: [type, options] }, parentScene, false);
2069
+ };
2070
+ //管网高亮显示
2071
+ that.searchAndShowPipe = function(url, options, color, clear) {
2072
+ if (scene == null)
2073
+ return;
2074
+ scene.fire((msgPrefix + ":searchAndShowPipe"), { args: [url, options, color, clear] }, parentScene, false);
2075
+ };
2076
+ that.splitView = function(options) {
2077
+ if (scene == null)
2078
+ return;
2079
+ scene.fire((msgPrefix + ":splitView"), { args: [options] }, parentScene, false);
2080
+ };
2081
+ //4.13
2082
+ //淹没分析
2083
+ that.drawRange = function(type) {
2084
+ if (scene == null)
2085
+ return;
2086
+ scene.fire((msgPrefix + ":drawRange"), { args: [type] }, parentScene, false);
2087
+ };
2088
+ that.floodAnalysis = function(options) {
2089
+ if (scene == null)
2090
+ return;
2091
+ scene.fire((msgPrefix + ":floodAnalysis"), { args: [options] }, parentScene, false);
2092
+ };
2093
+ that.clearFloodAnalysis = function() {
2094
+ if (scene == null)
2095
+ return;
2096
+ scene.fire((msgPrefix + ":clearFloodAnalysis"), { args: [] }, parentScene, false);
2097
+ };
2098
+ //空间分析
2099
+ that.currencyDraw = function(type) {
2100
+ if (scene == null)
2101
+ return;
2102
+ scene.fire((msgPrefix + ":currencyDraw"), { args: [type] }, parentScene, false);
2103
+ };
2104
+ that.intersect = function() {
2105
+ if (scene == null)
2106
+ return;
2107
+ scene.fire((msgPrefix + ":intersect"), { args: [] }, parentScene, false);
2108
+ };
2109
+ that.spatialAnalysisClear = function() {
2110
+ if (scene == null)
2111
+ return;
2112
+ scene.fire((msgPrefix + ":spatialAnalysisClear"), { args: [] }, parentScene, false);
2113
+ };
2114
+ //挖掘分析
2115
+ that.openDigSurface = function(options) {
2116
+ if (scene == null)
2117
+ return;
2118
+ scene.fire((msgPrefix + ":openDigSurface"), { args: [options] }, parentScene, false);
2119
+ };
2120
+ that.closeDigSurface = function() {
2121
+ if (scene == null)
2122
+ return;
2123
+ scene.fire((msgPrefix + ":closeDigSurface"), { args: [] }, parentScene, false);
2124
+ };
2125
+ //设置图层显隐
2126
+ that.setLayerAlpha = function(options) {
2127
+ if (scene == null)
2128
+ return;
2129
+ scene.fire((msgPrefix + ":setLayerAlpha"), { args: [options] }, parentScene, false);
2130
+ };
2131
+ //打开天气设置
2132
+ that.changeWeather = function(options) {
2133
+ if (scene == null)
2134
+ return;
2135
+ scene.fire((msgPrefix + ":changeWeather"), { args: [options] }, parentScene, false);
2136
+ };
2137
+ //关闭天气效果
2138
+ that.closeWeather = function() {
2139
+ if (scene == null)
2140
+ return;
2141
+ scene.fire((msgPrefix + ":closeWeather"), { args: [] }, parentScene, false);
2142
+ };
2143
+ //模型容差
2144
+ that.changeModelTolerance = function(options) {
2145
+ if (scene == null)
2146
+ return;
2147
+ scene.fire((msgPrefix + ":changeModelTolerance"), { args: [options] }, parentScene, false);
2148
+ };
2149
+ //获取模型容差
2150
+ that.getModelTolerance = function(options) {
2151
+ if (scene == null)
2152
+ return;
2153
+ scene.fire((msgPrefix + ":getModelTolerance"), { args: [options] }, parentScene, false);
2154
+ };
2155
+ //设置天空盒
2156
+ that.setSkyBox = function(name, imgType) {
2157
+ if (scene == null)
2158
+ return;
2159
+ scene.fire((msgPrefix + ":setSkyBox"), { args: [name, imgType] }, parentScene, false);
2160
+ };
2161
+ //打开pbr
2162
+ that.showPbrPanel = function(style) {
2163
+ if (scene == null)
2164
+ return;
2165
+ scene.fire((msgPrefix + ":showPbrPanel"), { args: [style] }, parentScene, false);
2166
+ };
2167
+ that.hidePbrPanel = function() {
2168
+ if (scene == null)
2169
+ return;
2170
+ scene.fire((msgPrefix + ":hidePbrPanel"), { args: [] }, parentScene, false);
2171
+ };
2172
+ that.showPop = function(property, keyPropety, position) {
2173
+ if (scene == null)
2174
+ return;
2175
+ scene.fire((msgPrefix + ":showPop"), { args: [property, keyPropety, position] }, parentScene, false);
2176
+ };
2177
+ that.union = function() {
2178
+ if (scene == null)
2179
+ return;
2180
+ scene.fire((msgPrefix + ":union"), { args: [] }, parentScene, false);
2181
+ };
2182
+ that.difference = function() {
2183
+ if (scene == null)
2184
+ return;
2185
+ scene.fire((msgPrefix + ":difference"), { args: [] }, parentScene, false);
2186
+ };
2187
+ that.splitComparison = function(bool) {
2188
+ if (scene == null)
2189
+ return;
2190
+ scene.fire((msgPrefix + ":splitComparison"), { args: [bool] }, parentScene, false);
2191
+ };
2192
+ that.addCIMVector = function(options) {
2193
+ if (scene == null)
2194
+ return;
2195
+ scene.fire((msgPrefix + ":addCIMVector"), { args: [options] }, parentScene, false);
2196
+ };
2197
+ that.init();
2198
+ };
2199
+
2200
+ //在外面也可以调用checkGlobeServerURL函数
2201
+ EGovaGlobeMap.checkGlobeServerURL = checkGlobeServerURL;
2202
+
2203
+ export default EGovaGlobeMap;