From b1cc06f8c6c119809818172c63d7c1f44a3154b3 Mon Sep 17 00:00:00 2001 From: Pierre-Etienne Lord Date: Thu, 14 Oct 2021 10:32:30 -0400 Subject: [PATCH] fix(layer-legend): WMS datasource with multiple style were not updated after style selection --- .../layer/layer-legend/layer-legend.component.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts b/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts index 43453cee6c..8b4c4bddda 100644 --- a/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts +++ b/packages/geo/src/lib/layer/layer-legend/layer-legend.component.ts @@ -10,7 +10,7 @@ import { LegendMapViewOptions } from '../shared/layers/layer.interface'; import { CapabilitiesService } from '../../datasource/shared/capabilities.service'; import { catchError, map } from 'rxjs/operators'; import { LanguageService } from '@igo2/core'; -import { WMSDataSourceOptions } from '../../datasource'; +import { WMSDataSource, WMSDataSourceOptions } from '../../datasource'; import { SecureImagePipe } from '@igo2/common'; @Component({ @@ -231,12 +231,13 @@ export class LayerLegendComponent implements OnInit, OnDestroy { onChangeStyle() { this.updateLegend(); let STYLES = ''; - console.log(this.layer.dataSource.ol); - // this.layer.dataSource.ol.getParams().LAYERS.split(',').map(layer => - // STYLES += this.currentStyle + ',' - // ); - STYLES = STYLES.slice(0, -1); - // this.layer.dataSource.ol.updateParams({STYLES}); + if (this.layer.dataSource instanceof WMSDataSource) { + this.layer.dataSource.ol.getParams().LAYERS.split(',').map(layer => + STYLES += this.currentStyle + ',' + ); + STYLES = STYLES.slice(0, -1); + this.layer.dataSource.ol.updateParams({ STYLES }); + } } onLoadImage(id: string) {