Skip to content

Commit f760540

Browse files
webmapv2 增加 layerorsourcenameduplicated 事件 review by luox
1 parent 644f4fb commit f760540

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

src/common/mapping/WebMapBase.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const WORLD_WIDTH = 360;
4343
* @fires WebMapBase#addlayerssucceeded
4444
* @fires WebMapBase#layercreatefailed
4545
* @fires WebMapBase#baidumapnotsupport
46+
* @fires WebMapBase#layerorsourcenameduplicated
4647
* @fires WebMapBase#dataflowfeatureupdated
4748
* @fires WebMapBase#projectionnotmatch
4849
* @fires WebMapBase#mapbeforeremove
@@ -144,6 +145,11 @@ export function createWebMapBaseExtending(SuperClass, { mapRepo }) {
144145
* @description 不支持百度地图。
145146
*/
146147
'baidumapnotsupport',
148+
/**
149+
* @event WebMapBase#layerorsourcenameduplicated
150+
* @description 图层名或数据源名重复。
151+
*/
152+
'layerorsourcenameduplicated',
147153
/**
148154
* @event WebMapBase#dataflowfeatureupdated
149155
* @description 数据流图层要素更新。

src/common/mapping/WebMapV2.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) {
350350
(style) => {
351351
const sourceIds = Object.keys(style.sources);
352352
if (sourceIds.some((id) => this.map.getSource(id))) {
353+
this.fire('layerorsourcenameduplicated', {});
353354
addedCallback && addedCallback();
354355
return;
355356
}

src/mapboxgl/mapping/WebMap.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import MapManager from './webmap/MapManager';
6161
* @fires WebMap#addlayerssucceeded
6262
* @fires WebMap#layercreatefailed
6363
* @fires WebMap#baidumapnotsupport
64+
* @fires WebMap#layerorsourcenameduplicated
6465
* @fires WebMap#dataflowfeatureupdated
6566
* @fires WebMap#projectionnotmatch
6667
* @fires WebMap#mapbeforeremove

src/maplibregl/mapping/WebMap.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import MapManager from './webmap/MapManager';
6161
* @fires WebMap#addlayerssucceeded
6262
* @fires WebMap#layercreatefailed
6363
* @fires WebMap#baidumapnotsupport
64+
* @fires WebMap#layerorsourcenameduplicated
6465
* @fires WebMap#dataflowfeatureupdated
6566
* @fires WebMap#projectionnotmatch
6667
* @fires WebMap#mapbeforeremove

0 commit comments

Comments
 (0)