Skip to content

Commit

Permalink
baselayers user defined
Browse files Browse the repository at this point in the history
  • Loading branch information
nboisteault committed Jul 18, 2023
1 parent 0055bd2 commit 814e94d
Show file tree
Hide file tree
Showing 5 changed files with 521 additions and 5 deletions.
6 changes: 3 additions & 3 deletions assets/src/components/BaseLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ export default class BaseLayers extends HTMLElement {

connectedCallback() {

if (mainLizmap.state.baseLayers.baseLayerNames.length === 0) {
if (mainLizmap.state.baseLayers.baseLayerConfigs.length === 0) {
document.getElementById('switcher-baselayer').classList.add('hide');
return;
}

this._template = () => html`
${mainLizmap.state.baseLayers.baseLayerNames.length > 1
${mainLizmap.state.baseLayers.baseLayerConfigs.length > 1
? html`
<select @change=${(event) => { mainLizmap.state.baseLayers.selectedBaseLayerName = event.target.value }}>
${mainLizmap.state.baseLayers.baseLayerConfigs.map((config) =>
html`<option .selected="${mainLizmap.state.baseLayers.selectedBaseLayerName === config.name}" value="${config.name}">${config.title === 'empty' ? lizDict['baselayer.empty.title'] : config.title}</option>`
)}
</select>`
:
html`${mainLizmap.state.baseLayers.baseLayerNames[0].title}`
html`${mainLizmap.state.baseLayers.baseLayerConfigs[0].title}`
}
`;

Expand Down
2 changes: 1 addition & 1 deletion assets/src/modules/config/BaseLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ export class BaseLayersConfig {
if ( !extendedCfg.hasOwnProperty(layerTreeItem.name) ) {
if ( defaultCompleteBaseLayersCfg.hasOwnProperty(layerTreeItem.name) ) {
extendedCfg[layerTreeItem.name] = structuredClone(defaultCompleteBaseLayersCfg[layerTreeItem.name]);
} else if ( layerTreeItem.layerCfg.externalWmsToggle ){
} else if ( layerTreeItem.layerConfig.externalWmsToggle ){
extendedCfg[layerTreeItem.name] = structuredClone(defaultCompleteBaseLayersCfg[layerTreeItem.layerCfg.externalAccess]);
} else {
extendedCfg[layerTreeItem.name] = {
Expand Down
2 changes: 1 addition & 1 deletion assets/src/modules/config/LayerTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export class LayerTreeLayerConfig extends LayerTreeItemConfig {
* @type {?AttributionConfig}
**/
get wmsAttribution() {
if(!this._wmsCapa.hasOwnProperty('Attribution')) {
if(!this._wmsCapa?.['Attribution']) {
return null;
}
const attribution = this._wmsCapa.Attribution;
Expand Down
Loading

0 comments on commit 814e94d

Please sign in to comment.