Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5cd5620

Browse files
author
chenguanglin
committed
【update】webmap增加reRender重绘方法
review by zhaoq
1 parent c74a972 commit 5cd5620

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,21 @@ export class WebMap extends Observable {
111111
this.createMap(options.mapSetting);
112112
this.createWebmap();
113113
}
114+
115+
/**
116+
* @function ol.supermap.WebMap.prototype.createMap
117+
* @description 重新渲染地图
118+
*/
119+
reRender() {
120+
// 移除所有图层 没找到清空地图的方法
121+
this.layerAdded = 0;
122+
const layers = this.map.getLayers().getArray();
123+
for (let i = 0, length = layers.length; i < length; i++) {
124+
this.map.removeLayer(layers[0]);
125+
}
126+
this.createWebmap();
127+
}
128+
114129
/**
115130
* @private
116131
* @function ol.supermap.WebMap.prototype.createMap

0 commit comments

Comments
 (0)