egovamap 0.35.68 → 0.35.70
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.
- package/egovamap/egovagisviewer.js +98 -1
- package/egovamap/egovamap.js +47 -12
- package/package.json +1 -1
|
@@ -91,6 +91,10 @@ var EGovaGISMap = function (
|
|
|
91
91
|
that.gisVisible = false;
|
|
92
92
|
that.gisLoaded = false;
|
|
93
93
|
that.isLoading = false;
|
|
94
|
+
that._boundGlobalCallback = null;
|
|
95
|
+
that._viewerScript = null;
|
|
96
|
+
that._viewerLink = null;
|
|
97
|
+
that._handleViewerScriptLoad = null;
|
|
94
98
|
|
|
95
99
|
//that.$gisMapFrame = null;
|
|
96
100
|
that.gisMapContainer = null;
|
|
@@ -389,6 +393,7 @@ var EGovaGISMap = function (
|
|
|
389
393
|
mainLink.setAttribute("href", cssUrl);
|
|
390
394
|
mainLink.setAttribute("rel", "stylesheet");
|
|
391
395
|
document.getElementsByTagName("head").item(0).appendChild(mainLink);
|
|
396
|
+
that._viewerLink = mainLink;
|
|
392
397
|
|
|
393
398
|
var url =
|
|
394
399
|
gisServerURL +
|
|
@@ -406,7 +411,11 @@ var EGovaGISMap = function (
|
|
|
406
411
|
if(context.initJSAsync) { // 初始化JS是否同步加载
|
|
407
412
|
mainScript.setAttribute("async", false);
|
|
408
413
|
}
|
|
409
|
-
|
|
414
|
+
that._handleViewerScriptLoad = function () {
|
|
415
|
+
return that.createMap();
|
|
416
|
+
};
|
|
417
|
+
mainScript.onload = that._handleViewerScriptLoad;
|
|
418
|
+
that._viewerScript = mainScript;
|
|
410
419
|
document.getElementsByTagName("head").item(0).appendChild(mainScript);
|
|
411
420
|
};
|
|
412
421
|
|
|
@@ -2608,7 +2617,47 @@ var EGovaGISMap = function (
|
|
|
2608
2617
|
};
|
|
2609
2618
|
|
|
2610
2619
|
that.destroyMap = function () {
|
|
2620
|
+
var currentMap = window.eMapList && window.eMapList[that.id];
|
|
2611
2621
|
that.callMap("destroyMap");
|
|
2622
|
+
if (that._viewerScript) {
|
|
2623
|
+
that._viewerScript.onload = null;
|
|
2624
|
+
that._viewerScript.onerror = null;
|
|
2625
|
+
that._viewerScript.remove();
|
|
2626
|
+
that._viewerScript = null;
|
|
2627
|
+
}
|
|
2628
|
+
if (that._viewerLink) {
|
|
2629
|
+
that._viewerLink.remove();
|
|
2630
|
+
that._viewerLink = null;
|
|
2631
|
+
}
|
|
2632
|
+
if (window.eMapList && window.eMapList[that.id]) {
|
|
2633
|
+
window.eMapList[that.id] = null;
|
|
2634
|
+
delete window.eMapList[that.id];
|
|
2635
|
+
}
|
|
2636
|
+
if (currentMap && currentMap.egovagis) {
|
|
2637
|
+
currentMap.egovagis.fireCallback = null;
|
|
2638
|
+
currentMap.egovagis.fireErrorCallback = null;
|
|
2639
|
+
currentMap.egovagis.reconfigMap = null;
|
|
2640
|
+
currentMap.egovagis.eMap = null;
|
|
2641
|
+
currentMap.egovagis.global = null;
|
|
2642
|
+
currentMap.egovagis.sysConfig = null;
|
|
2643
|
+
}
|
|
2644
|
+
if (that.callbackList) {
|
|
2645
|
+
Object.keys(that.callbackList).forEach(function (key) {
|
|
2646
|
+
that.callbackList[key] = null;
|
|
2647
|
+
delete that.callbackList[key];
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
if (that.onMapLoadedHandlers) {
|
|
2651
|
+
that.onMapLoadedHandlers.length = 0;
|
|
2652
|
+
}
|
|
2653
|
+
that._handleViewerScriptLoad = null;
|
|
2654
|
+
that._boundGlobalCallback = null;
|
|
2655
|
+
that.globalCallback = function () {};
|
|
2656
|
+
that.fireCallback = function () {};
|
|
2657
|
+
that.gisMapContainer = null;
|
|
2658
|
+
that.globeMapContainer = null;
|
|
2659
|
+
that.gisLoaded = false;
|
|
2660
|
+
that.isLoading = false;
|
|
2612
2661
|
};
|
|
2613
2662
|
|
|
2614
2663
|
that.switchGisMapType = function (type, callback) {
|
|
@@ -2851,9 +2900,57 @@ var EGovaGISMap = function (
|
|
|
2851
2900
|
that.addMaskLayerV22 = function (params) {
|
|
2852
2901
|
that.callMap("addMaskLayerV22",params);
|
|
2853
2902
|
}
|
|
2903
|
+
|
|
2904
|
+
that.playRouteIcon = function (params) {
|
|
2905
|
+
that.callMap("playRouteIcon", params);
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
that.addDiffusionPoint = function (params) {
|
|
2909
|
+
that.callMap("addDiffusionPoint", params);
|
|
2910
|
+
}
|
|
2854
2911
|
|
|
2855
2912
|
that.destroyMap = function () {
|
|
2913
|
+
var currentMap = window.eMapList && window.eMapList[that.id];
|
|
2856
2914
|
that.callMap("destroyMap");
|
|
2915
|
+
if (that._viewerScript) {
|
|
2916
|
+
that._viewerScript.onload = null;
|
|
2917
|
+
that._viewerScript.onerror = null;
|
|
2918
|
+
that._viewerScript.remove();
|
|
2919
|
+
that._viewerScript = null;
|
|
2920
|
+
}
|
|
2921
|
+
if (that._viewerLink) {
|
|
2922
|
+
that._viewerLink.remove();
|
|
2923
|
+
that._viewerLink = null;
|
|
2924
|
+
}
|
|
2925
|
+
if (window.eMapList && window.eMapList[that.id]) {
|
|
2926
|
+
window.eMapList[that.id] = null;
|
|
2927
|
+
delete window.eMapList[that.id];
|
|
2928
|
+
}
|
|
2929
|
+
if (currentMap && currentMap.egovagis) {
|
|
2930
|
+
currentMap.egovagis.fireCallback = null;
|
|
2931
|
+
currentMap.egovagis.fireErrorCallback = null;
|
|
2932
|
+
currentMap.egovagis.reconfigMap = null;
|
|
2933
|
+
currentMap.egovagis.eMap = null;
|
|
2934
|
+
currentMap.egovagis.global = null;
|
|
2935
|
+
currentMap.egovagis.sysConfig = null;
|
|
2936
|
+
}
|
|
2937
|
+
if (that.callbackList) {
|
|
2938
|
+
Object.keys(that.callbackList).forEach(function (key) {
|
|
2939
|
+
that.callbackList[key] = null;
|
|
2940
|
+
delete that.callbackList[key];
|
|
2941
|
+
});
|
|
2942
|
+
}
|
|
2943
|
+
if (that.onMapLoadedHandlers) {
|
|
2944
|
+
that.onMapLoadedHandlers.length = 0;
|
|
2945
|
+
}
|
|
2946
|
+
that._handleViewerScriptLoad = null;
|
|
2947
|
+
that._boundGlobalCallback = null;
|
|
2948
|
+
that.globalCallback = function () {};
|
|
2949
|
+
that.fireCallback = function () {};
|
|
2950
|
+
that.gisMapContainer = null;
|
|
2951
|
+
that.globeMapContainer = null;
|
|
2952
|
+
that.gisLoaded = false;
|
|
2953
|
+
that.isLoading = false;
|
|
2857
2954
|
}
|
|
2858
2955
|
|
|
2859
2956
|
that.pointInPolygon = function (point, polygon, callback) {
|
package/egovamap/egovamap.js
CHANGED
|
@@ -47,6 +47,31 @@ function getMapContainer(container) {
|
|
|
47
47
|
}
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
function ensureCanvasGetContextPatched() {
|
|
52
|
+
if (typeof HTMLCanvasElement === 'undefined') {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var canvasProto = HTMLCanvasElement.prototype;
|
|
57
|
+
if (canvasProto.__egovamapGetContextPatched) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var originalGetContext =
|
|
62
|
+
canvasProto.__egovamapOriginalGetContext || canvasProto.getContext;
|
|
63
|
+
canvasProto.__egovamapOriginalGetContext = originalGetContext;
|
|
64
|
+
canvasProto.getContext = function (type, attributes) {
|
|
65
|
+
if (type === 'webgl') {
|
|
66
|
+
attributes = Object.assign({}, attributes, {
|
|
67
|
+
preserveDrawingBuffer: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return originalGetContext.call(this, type, attributes);
|
|
71
|
+
};
|
|
72
|
+
canvasProto.__egovamapGetContextPatched = true;
|
|
73
|
+
}
|
|
74
|
+
|
|
50
75
|
var EGovaMap = function (
|
|
51
76
|
containerID,
|
|
52
77
|
callback,
|
|
@@ -55,6 +80,7 @@ var EGovaMap = function (
|
|
|
55
80
|
mapParam,
|
|
56
81
|
context
|
|
57
82
|
) {
|
|
83
|
+
ensureCanvasGetContextPatched();
|
|
58
84
|
context &&
|
|
59
85
|
!context.assetsPath &&
|
|
60
86
|
(context.assetsPath = '/library/urban/egovamap');
|
|
@@ -5577,6 +5603,7 @@ var EGovaMap = function (
|
|
|
5577
5603
|
if (scene == null) return;
|
|
5578
5604
|
if (gisMap && gisMap.destroyMap) {
|
|
5579
5605
|
gisMap.destroyMap();
|
|
5606
|
+
gisMap = null;
|
|
5580
5607
|
}
|
|
5581
5608
|
};
|
|
5582
5609
|
|
|
@@ -5736,23 +5763,26 @@ var EGovaMap = function (
|
|
|
5736
5763
|
}
|
|
5737
5764
|
};
|
|
5738
5765
|
|
|
5766
|
+
that.playRouteIcon = function (options) {
|
|
5767
|
+
if (scene == null) return;
|
|
5768
|
+
if (gisMap != null) {
|
|
5769
|
+
gisMap.playRouteIcon.apply(this, arguments);
|
|
5770
|
+
}
|
|
5771
|
+
};
|
|
5772
|
+
|
|
5773
|
+
that.addDiffusionPoint = function (options) {
|
|
5774
|
+
if (scene == null) return;
|
|
5775
|
+
if (gisMap != null) {
|
|
5776
|
+
gisMap.addDiffusionPoint.apply(this, arguments);
|
|
5777
|
+
}
|
|
5778
|
+
};
|
|
5779
|
+
|
|
5739
5780
|
that.initMap(containerID, callback, mapType, mapConfig, mapParam);
|
|
5740
5781
|
|
|
5741
5782
|
// EGovaBI(globeMap).bind(this)();
|
|
5742
5783
|
EGovaBI.call(this, globeMap, gisMap, mapType);
|
|
5743
5784
|
gisMobileMap && EgovamapMEx.call(this, gisMobileMap);
|
|
5744
5785
|
|
|
5745
|
-
//解决html2canvas截图空白问题
|
|
5746
|
-
HTMLCanvasElement.prototype.getContext = (function (origFn) {
|
|
5747
|
-
return function (type, attributes) {
|
|
5748
|
-
if (type === 'webgl') {
|
|
5749
|
-
attributes = Object.assign({}, attributes, {
|
|
5750
|
-
preserveDrawingBuffer: true,
|
|
5751
|
-
});
|
|
5752
|
-
}
|
|
5753
|
-
return origFn.call(this, type, attributes);
|
|
5754
|
-
};
|
|
5755
|
-
})(HTMLCanvasElement.prototype.getContext);
|
|
5756
5786
|
};
|
|
5757
5787
|
|
|
5758
5788
|
var EGovaMapUtils = {
|
|
@@ -5805,6 +5835,7 @@ var EGovaMapUtils = {
|
|
|
5805
5835
|
for (var i = mapArray.length - 1; i >= 0; i--) {
|
|
5806
5836
|
if (mapArray[i] === mapList[uniqueID]) {
|
|
5807
5837
|
mapArray[i].destroyMap();
|
|
5838
|
+
mapArray[i] = null;
|
|
5808
5839
|
delete mapArray[i];
|
|
5809
5840
|
break;
|
|
5810
5841
|
}
|
|
@@ -5825,12 +5856,16 @@ var EGovaMapUtils = {
|
|
|
5825
5856
|
}
|
|
5826
5857
|
}
|
|
5827
5858
|
}
|
|
5828
|
-
|
|
5829
5859
|
if(window && window.eMapList){
|
|
5830
5860
|
const mapId = uniqueID+ '_gis_emap';
|
|
5831
5861
|
if(window.eMapList[mapId]){
|
|
5862
|
+
window.eMapList[mapId] = null;
|
|
5832
5863
|
delete window.eMapList[mapId];
|
|
5833
5864
|
}
|
|
5865
|
+
if(window[mapId]){
|
|
5866
|
+
window[mapId] = null;
|
|
5867
|
+
delete window[mapId];
|
|
5868
|
+
}
|
|
5834
5869
|
}
|
|
5835
5870
|
},
|
|
5836
5871
|
};
|