Skip to content

Commit

Permalink
fix(layer-legend.component) Fix param legendOptions.display: false (#703
Browse files Browse the repository at this point in the history
)

* travis

* feat(libs): upgrade librairies (#696)

* chore(utils): bowser version

* fix(spatial-filter): fix spatial filter 1.4 (#697)

* fix bug legend param display:false

* fix exemple legend param

* rebase

Co-authored-by: Marc-André Barbeau <[email protected]>
Co-authored-by: Philippe Lafrenière <[email protected]>
Co-authored-by: Josée Martel <[email protected]>
  • Loading branch information
4 people authored and Marc-André Barbeau committed Sep 8, 2020
1 parent 7a79bc4 commit 8f4f372
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 19 deletions.
81 changes: 63 additions & 18 deletions demo/src/app/geo/legend/legend.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,66 @@ export class AppLegendComponent {
}
};

this.layerService
.createAsyncLayer({
title: 'legend with display:false',
visible: true,
legendOptions: {
display: false,
html: "test html"
},
sourceOptions: {
type: 'wms',
url: 'https://geoegl.msp.gouv.qc.ca/apis/ws/mffpecofor.fcgi',
optionsFromCapabilities: true,
params: {
LAYERS: 'sh_dis_eco',
VERSION: '1.3.0'
}
}
})
.subscribe(l => this.map.addLayer(l));

this.layerService
.createAsyncLayer({
title: 'legend in html',
visible: true,
legendOptions: {
display: true,
html: '<h2>HTML légende</h2>'
},
sourceOptions: {
type: 'wms',
url: 'https://geoegl.msp.gouv.qc.ca/apis/ws/mffpecofor.fcgi',
optionsFromCapabilities: true,
params: {
LAYERS: 'sh_sreg_eco',
VERSION: '1.3.0'
}
}
})
.subscribe(l => this.map.addLayer(l));

this.layerService
.createAsyncLayer({
title: 'legend with url param',
visible: true,
legendOptions: {
url: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxASEhUQEBISFRUVFRAQFRUQFRUVFRAPFRUWFhUVFRUYHSggGBolGxUVITEiJSkrLi4uFx8zODMsNygtLisBCgoKDg0OGhAQGy0dHyUtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS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q0ZVA3ETp0mnB1LVcaxilQXOAIk6HxSSjSAEra+8moiTppZuJnRy3vAeJklWXOQZ06R8KO+IesBlnTo7Q//2Q=='

},
sourceOptions: {
type: 'wms',
url: 'https://geoegl.msp.gouv.qc.ca/apis/ws/mffpecofor.fcgi',
optionsFromCapabilities: true,
params: {
LAYERS: 'sh_reg_eco',
VERSION: '1.3.0'
}
}
})
.subscribe(l => this.map.addLayer(l));

this.dataSourceService
.createAsyncDataSource(wfsDatasource)
.subscribe(dataSource => {
Expand Down Expand Up @@ -135,24 +195,8 @@ export class AppLegendComponent {

this.layerService
.createAsyncLayer({
title: 'sh_dis_eco',
visible: false,
sourceOptions: {
type: 'wms',
url: 'https://geoegl.msp.gouv.qc.ca/apis/ws/mffpecofor.fcgi',
optionsFromCapabilities: true,
params: {
LAYERS: 'sh_dis_eco',
VERSION: '1.3.0'
}
}
})
.subscribe(l => this.map.addLayer(l));

this.layerService
.createAsyncLayer({
title: 'nurc:Arc_Sample_Parent',
visible: false,
title: '2 styles nurc:Arc_Sample_Parent',
visible: true,
legendOptions: {
// collapsed: false,
display: true,
Expand Down Expand Up @@ -208,6 +252,7 @@ export class AppLegendComponent {
.subscribe(dataSource => {
const layer: LayerOptionsWithMetadata = {
title: 'Embâcle',
visible: true,
source: dataSource,
metadata: {
url:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ export class LayerLegendComponent implements OnInit, OnDestroy {
} else if (this.styles && this.styles.length > 1) {
this.currentStyle = lastlLegend[0].currentStyle;
}
if ( typeof this.layer.options.legendOptions !== 'undefined' && this.layer.options.legendOptions.display === false) {
lastlLegend = [];
} else {
lastlLegend = this.layer.dataSource.getLegend(this.currentStyle, this.scale);
}

lastlLegend = this.layer.dataSource.getLegend(this.currentStyle, this.scale);
if (this.updateLegendOnResolutionChange === true) {
const resolution$ = this.layer.map.viewController.resolution$;
this.resolution$$ = resolution$.subscribe((resolution: number) => this.onResolutionChange(resolution));
Expand Down

0 comments on commit 8f4f372

Please sign in to comment.