@@ -10733,9 +10733,6 @@ SuperMap.Util.RequestJSONPPromise = {
1073310733 if (keysCount == 0) {
1073410734 return false;
1073510735 }
10736- if (splitQuestUrl == null) {
10737- splitQuestUrl = new Array();
10738- }
1073910736 splitQuestUrl.push(sectionURL);
1074010737 sectionURL = url;
1074110738 keysCount = 0;
@@ -10763,9 +10760,6 @@ SuperMap.Util.RequestJSONPPromise = {
1076310760 sectionURL += me.queryKeys[i] + "=" + tempLeftValue;
1076410761 leftValue = leftValue.substring(leftLength);
1076510762 if (tempLeftValue.length > 0) {
10766- if (splitQuestUrl == null) {
10767- splitQuestUrl = new Array();
10768- }
1076910763 splitQuestUrl.push(sectionURL);
1077010764 sectionURL = url;
1077110765 keysCount = 0;
@@ -10782,9 +10776,6 @@ SuperMap.Util.RequestJSONPPromise = {
1078210776 }
1078310777 }
1078410778 }
10785- if (splitQuestUrl == null) {
10786- splitQuestUrl = new Array();
10787- }
1078810779 splitQuestUrl.push(sectionURL);
1078910780 me.send(splitQuestUrl, "SuperMap.Util.RequestJSONPPromise.supermap_callbacks[" + uid + "]", config && config.proxy);
1079010781 return p;
@@ -60393,33 +60384,33 @@ external_mapboxgl_default.a.supermap.ThemeFeature = ThemeFeature_ThemeFeature;
6039360384/**
6039460385 * @class mapboxgl.supermap.ThemeLayer
6039560386 * @classdesc 专题图基类。
60396- * @param {string} name - 专题图图层名。</br>
60397- * @param {Object} options -可选参数。</br>
60398- * @param {string} options.id - 专题图层ID。</br>
60399- * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。</br>
60400- * @param {mapboxgl.Map} options.map - 当前mapboxgl map对象。</br>
60387+ * @param {string} name - 专题图图层名。
60388+ * @param {Object} options -可选参数。
60389+ * @param {string} options.id - 专题图层ID。
60390+ * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。
60391+ * @param {mapboxgl.Map} options.map - 当前mapboxgl map对象,将在下个版本弃用,请用map.addLayer()方法添加图层。
6040160392 * @param {number} options.opacity - 图层透明度。
6040260393 */
6040360394class ThemeLayer_Theme {
6040460395
6040560396 constructor(name, opt_options) {
6040660397 var options = opt_options ? opt_options : {};
6040760398 /**
60408- * @member {string} mapboxgl.supermap.ThemeLayer.prototype.name
60399+ * @member {string} mapboxgl.supermap.ThemeLayer.prototype.name
6040960400 * @description 专题图图层名称
6041060401 */
6041160402 this.name = name;
6041260403
6041360404 /**
60414- * @member {string} mapboxgl.supermap.ThemeLayer.prototype.name
60405+ * @member {string} mapboxgl.supermap.ThemeLayer.prototype.id
6041560406 * @description 专题图图层id
6041660407 */
6041760408 this.id = options.id ? options.id : Util_Util.createUniqueID("themeLayer_");
6041860409 /**
60419- * @member {float} mapboxgl.supermap.ThemeLayer.prototype.opacity
60410+ * @member {float} mapboxgl.supermap.ThemeLayer.prototype.opacity
6042060411 * @description 图层透明度
6042160412 */
60422- this.opacity = 1;
60413+ this.opacity = options.opacity ? options.opacity : 1;
6042360414
6042460415 /**
6042560416 * @member {boolean} [mapboxgl.supermap.ThemeLayer.prototype.visibility=true]
@@ -60428,19 +60419,66 @@ class ThemeLayer_Theme {
6042860419 this.visibility = true;
6042960420
6043060421 /**
60431- * @member {boolean} [mapboxgl.supermap.ThemeLayer.prototype.loadWhileAnimating=true]
60422+ * @member {boolean} [mapboxgl.supermap.ThemeLayer.prototype.loadWhileAnimating=true]
6043260423 * @description 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)
6043360424 */
6043460425 this.loadWhileAnimating = options.loadWhileAnimating === undefined ? true : options.loadWhileAnimating;
6043560426
6043660427 /**
60437- * @member {mapboxgl.Map} mapboxgl.supermap.ThemeLayer.prototype.map
60428+ * @member {mapboxgl.Map} mapboxgl.supermap.ThemeLayer.prototype.map
6043860429 * @description map对象
6043960430 */
60440- this.map = options.map;
60431+ this.map = options.map ? options.map : null ;
6044160432
6044260433 this.features = [];
6044360434 this.TFEvents = [];
60435+
60436+ //todo 保留之前创建图层同时添加到图层的用法,在下个版本遗弃
60437+ if (this.map) {
60438+ this.map.addLayer(this);
60439+ }
60440+
60441+ }
60442+
60443+ /**
60444+ * @function mapboxgl.supermap.ThemeLayer.prototype.onAdd
60445+ * @description 向底图添加该图层
60446+ */
60447+ onAdd(map) {
60448+ this.map = map;
60449+ this._createCanvasContainer();
60450+
60451+ //处理用户预先(在图层添加到 map 前)监听的事件
60452+ this.addTFEvents();
60453+ this.map.on('resize', this.resizeEvent.bind(this));
60454+ this.map.on('zoomstart', this.zoomStartEvent.bind(this));
60455+ this.map.on('zoomend', this.zoomEndEvent.bind(this));
60456+ this.map.on('rotatestart', this.rotateStartEvent.bind(this));
60457+ this.map.on('rotate', this.rotateEvent.bind(this));
60458+ this.map.on('rotateend', this.rotateEndEvent.bind(this));
60459+ this.map.on('dragend', this.dragEndEvent.bind(this));
60460+ this.map.on('movestart', this.moveStartEvent.bind(this));
60461+ this.map.on('move', this.moveEvent.bind(this));
60462+ this.map.on('moveend', this.moveEndEvent.bind(this));
60463+ this.map.on('remove', this.removeFromMap.bind(this));
60464+
60465+ this.refresh();
60466+ }
60467+
60468+ /**
60469+ * @function mapboxgl.supermap.HeatMapLayer.prototype.refresh
60470+ * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
60471+ */
60472+ refresh() {
60473+ if (this.features.length === 0) {
60474+ return;
60475+ }
60476+ if (this.map) {
60477+ this.redrawThematicFeatures(this.map.getBounds());
60478+ }
60479+ }
60480+
60481+ _createCanvasContainer() {
6044460482 this.movingOffset = [0, 0];
6044560483 this.mapContainer = this.map.getCanvasContainer();
6044660484 this.div = document.createElement('div');
@@ -60455,25 +60493,10 @@ class ThemeLayer_Theme {
6045560493 this.div.width = parseInt(canvas.width);
6045660494 this.div.height = parseInt(canvas.height);
6045760495 container.appendChild(this.div);
60458- if (opt_options.opacity) {
60459- this.setOpacity(options.opacity);
60460- }
60496+ this.setOpacity(this.opacity);
6046160497 this.levelRenderer = new LevelRenderer_LevelRenderer();
6046260498 this.renderer = this.levelRenderer.init(this.div);
6046360499 this.renderer.clear();
60464- //处理用户预先(在图层添加到 map 前)监听的事件
60465- this.addTFEvents();
60466- this.map.on('resize', this.resizeEvent.bind(this));
60467- this.map.on('zoomstart', this.zoomStartEvent.bind(this));
60468- this.map.on('zoomend', this.zoomEndEvent.bind(this));
60469- this.map.on('rotatestart', this.rotateStartEvent.bind(this));
60470- this.map.on('rotate', this.rotateEvent.bind(this));
60471- this.map.on('rotateend', this.rotateEndEvent.bind(this));
60472- this.map.on('dragend', this.dragEndEvent.bind(this));
60473- this.map.on('movestart', this.moveStartEvent.bind(this));
60474- this.map.on('move', this.moveEvent.bind(this));
60475- this.map.on('moveend', this.moveEndEvent.bind(this));
60476- this.map.on('remove', this.removeFromMap.bind(this));
6047760500 }
6047860501
6047960502 /**
@@ -60889,10 +60912,10 @@ class ThemeLayer_Theme {
6088960912
6089060913 /**
6089160914 * @function mapboxgl.supermap.ThemeLayer.prototype.removeFromMap
60892- * @description 移除事件
60915+ * @description 移除图层
6089360916 */
6089460917 removeFromMap() {
60895- this.map.getCanvasContainer() .removeChild(this.div);
60918+ this.mapContainer .removeChild(this.div);
6089660919 this.removeAllFeatures();
6089760920 }
6089860921
@@ -60903,16 +60926,16 @@ class ThemeLayer_Theme {
6090360926 * @param {boolean} [before=true] - 是否将本图层插入到图层id为layerID的图层之前(如果为false则将本图层插入到图层id为layerID的图层之后)。
6090460927 */
6090560928 moveTo(layerID, before) {
60906- var layer = document.getElementById(this.div.id);
60929+ const layer = document.getElementById(this.div.id);
6090760930 before = before !== undefined ? before : true;
6090860931 if (before) {
60909- var beforeLayer = document.getElementById(layerID);
60932+ const beforeLayer = document.getElementById(layerID);
6091060933 if (layer && beforeLayer) {
6091160934 beforeLayer.parentNode.insertBefore(layer, beforeLayer);
6091260935 }
6091360936 return;
6091460937 }
60915- var nextLayer = document.getElementById(layerID);
60938+ const nextLayer = document.getElementById(layerID);
6091660939 if (layer) {
6091760940 if (nextLayer.nextSibling) {
6091860941 nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
@@ -62944,30 +62967,96 @@ class MapvRenderer_MapvRenderer extends BaseLayer {
6294462967
6294562968
6294662969
62970+
6294762971/**
6294862972 * @class mapboxgl.supermap.MapvLayer
6294962973 * @category Visualization MapV
6295062974 * @classdesc Mapv图层
62951- * @param {Object } map - 地图 </br>
62952- * @param {Object} dataSet - 数据集 </br>
62953- * @param {Object} mapVOptions - Mapv参数。</br>
62975+ * @param {mapboxgl.Map } map - mapboxgl地图对象,将在下个版本弃用,请用map.addLayer()方法添加图层。
62976+ * @param {Object} dataSet - 数据集
62977+ * @param {Object} mapVOptions - Mapv参数。
6295462978 * @param {string} mapVOptions.layerID - 图层ID。
6295562979 */
6295662980class MapvLayer_MapvLayer {
6295762981
6295862982 constructor(map, dataSet, mapVOptions) {
6295962983 this.map = map;
62960- this.layerID = mapVOptions.layerID;
62984+ this.id = mapVOptions.layerID ? mapVOptions.layerID : Util_Util.createUniqueID("mapvLayer_") ;
6296162985 delete mapVOptions["layerID"];
62962- this.renderer = new MapvRenderer_MapvRenderer(map, this, dataSet, mapVOptions);
62986+
6296362987 this.mapVOptions = mapVOptions;
62988+ this.dataSet = dataSet;
62989+ this.visibility = true;
62990+
62991+ //保留之前的用法
62992+ if (this.map) {
62993+ this.map.addLayer(this);
62994+ }
62995+
62996+ }
62997+
62998+ onAdd(map) {
62999+ this.map = map;
63000+ this.renderer = new MapvRenderer_MapvRenderer(this.map, this, this.dataSet, this.mapVOptions);
6296463001 this.canvas = this._createCanvas();
6296563002 this.renderer._canvasUpdate();
6296663003 this.mapContainer = map.getCanvasContainer();
6296763004 this.mapContainer.appendChild(this.canvas);
6296863005 this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
6296963006 }
6297063007
63008+ /**
63009+ * @function mapboxgl.supermap.MapvLayer.prototype.removeFromMap
63010+ * @description 移除图层
63011+ */
63012+ removeFromMap() {
63013+ this.mapContainer.removeChild(this.canvas);
63014+ this.clearData();
63015+ }
63016+
63017+ /**
63018+ * @function mapboxgl.supermap.MapvLayer.prototype.setVisibility
63019+ * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
63020+ * @param {boolean} visibility - 是否显示图层(当前地图的resolution在最大最小resolution之间)。
63021+ */
63022+ setVisibility(visibility) {
63023+ if (visibility !== this.visibility) {
63024+ this.visibility = visibility;
63025+ if (visibility) {
63026+ this.show();
63027+ } else {
63028+ this.hide();
63029+ }
63030+ }
63031+ }
63032+
63033+ /**
63034+ * @function mapboxgl.supermap.MapvLayer.prototype.moveTo
63035+ * @description 将图层移动到某个图层之前。
63036+ * @param {string} layerID - 待插入的图层ID。</br>
63037+ * @param {boolean} [before=true] - 是否将本图层插入到图层id为layerID的图层之前(如果为false则将本图层插入到图层id为layerID的图层之后)。
63038+ */
63039+ moveTo(layerID, before) {
63040+ const layer = document.getElementById(this.canvas.id);
63041+ before = before !== undefined ? before : true;
63042+ if (before) {
63043+ const beforeLayer = document.getElementById(layerID);
63044+ if (layer && beforeLayer) {
63045+ beforeLayer.parentNode.insertBefore(layer, beforeLayer);
63046+ }
63047+ return;
63048+ }
63049+ const nextLayer = document.getElementById(layerID);
63050+ if (layer) {
63051+ if (nextLayer.nextSibling) {
63052+ nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
63053+ return;
63054+ }
63055+ nextLayer.parentNode.appendChild(layer);
63056+ }
63057+ }
63058+
63059+
6297163060 /**
6297263061 * @function mapboxgl.supermap.MapvLayer.prototype.getTopLeft
6297363062 * @description 获取左上的距离
@@ -62995,7 +63084,7 @@ class MapvLayer_MapvLayer {
6299563084 /**
6299663085 * @function mapboxgl.supermap.MapvLayer.prototype.update
6299763086 * @description 更新图层
62998- * @param {Object} opt - 待更新的数据</br>
63087+ * @param {Object} opt - 待更新的数据</br>
6299963088 * @param {Object} opt.data - mapv数据集</br>
6300063089 * @param {Object} opt.options - mapv绘制参数
6300163090 */
@@ -63055,7 +63144,7 @@ class MapvLayer_MapvLayer {
6305563144
6305663145 _createCanvas() {
6305763146 var canvas = document.createElement('canvas');
63058- canvas.id = this.layerID ;
63147+ canvas.id = this.id ;
6305963148 canvas.style.position = 'absolute';
6306063149 canvas.style.top = 0 + "px";
6306163150 canvas.style.left = 0 + "px";
@@ -63071,31 +63160,6 @@ class MapvLayer_MapvLayer {
6307163160 return canvas;
6307263161 }
6307363162
63074- /**
63075- * @function mapboxgl.supermap.MapvLayer.prototype.moveTo
63076- * @description 将图层移动到某个图层之前。
63077- * @param {string} layerID - 待插入的图层ID。</br>
63078- * @param {boolean} [before=true] - 是否将本图层插入到图层id为layerID的图层之前(如果为false则将本图层插入到图层id为layerID的图层之后)。
63079- */
63080- moveTo(layerID, before) {
63081- var layer = document.getElementById(this.layerID);
63082- before = before !== undefined ? before : true;
63083- if (before) {
63084- var beforeLayer = document.getElementById(layerID);
63085- if (layer && beforeLayer) {
63086- beforeLayer.parentNode.insertBefore(layer, beforeLayer);
63087- }
63088- return;
63089- }
63090- var nextLayer = document.getElementById(layerID);
63091- if (layer) {
63092- if (nextLayer.nextSibling) {
63093- nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
63094- return;
63095- }
63096- nextLayer.parentNode.appendChild(layer);
63097- }
63098- }
6309963163 /**
6310063164 * @function mapboxgl.supermap.MapvLayer.prototype.setZIndex
6310163165 * @description 设置canvas层级
@@ -64497,6 +64561,7 @@ class GraphicLayer_GraphicLayer {
6449764561 */
6449864562 clear() {
6449964563 this.removeGraphics();
64564+ this.deckGL.finalize();
6450064565 }
6450164566
6450264567 /**
@@ -64529,6 +64594,7 @@ class GraphicLayer_GraphicLayer {
6452964594 */
6453064595 removeFromMap() {
6453164596 this.remove();
64597+ this.clear();
6453264598 }
6453364599
6453464600 /**
@@ -66387,6 +66453,7 @@ class DeckglLayer_DeckglLayer {
6638766453 */
6638866454 removeFromMap() {
6638966455 this.remove();
66456+ this.clear();
6639066457 }
6639166458
6639266459 /**
@@ -66521,6 +66588,7 @@ class DeckglLayer_DeckglLayer {
6652166588 // todo 还有哪些资源应该被释放?
6652266589 clear() {
6652366590 this.removeData();
66591+ this.deckGL.finalize();
6652466592 }
6652566593
6652666594 /**
0 commit comments