Skip to content

Commit

Permalink
fix(catalog-browser): fixed add/remove function for baselayers catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeLafreniere18 authored and mbarbeau committed Sep 19, 2019
1 parent 1158806 commit 241d111
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class CatalogBrowserComponent implements OnInit, OnDestroy {
ngOnInit() {
const currentItems = this.map.layers.map((layer: Layer) => {
return {
id: layer.id,
id: layer.options.source.id,
title: layer.title,
type: CatalogItemType.Layer
};
Expand Down Expand Up @@ -161,9 +161,16 @@ export class CatalogBrowserComponent implements OnInit, OnDestroy {
private removeLayersFromMap(layers: CatalogItemLayer[]) {
layers.forEach((layer: CatalogItemLayer) => {
this.store.state.update(layer, { added: false });
const oLayer = this.map.getLayerById(layer.id);
if (oLayer !== undefined) {
this.map.removeLayer(oLayer);
if (layer.options.baseLayer === true) {
const oLayer = this.map.getLayerById(layer.options.id);
if (oLayer !== undefined) {
this.map.removeLayer(oLayer);
}
} else {
const oLayer = this.map.getLayerById(layer.id);
if (oLayer !== undefined) {
this.map.removeLayer(oLayer);
}
}
});
}
Expand Down

0 comments on commit 241d111

Please sign in to comment.