Skip to content

Commit

Permalink
Fix change signature olms
Browse files Browse the repository at this point in the history
  • Loading branch information
lowzonenose committed Nov 13, 2024
1 parent dc0f652 commit fc7ccce
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ <h2>Ajout du gestionnaire de catalogue avec options sur les categories</h2>
field : "service",
value : "TMS"
}
},
{
title : "WFS",
default : false,
filter : {
field : "service",
value : "WFS"
}
}
],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ <h2>Ajout du gestionnaire de catalogue avec options sur les categories</h2>
field : "service",
value : "TMS"
}
},
{
title : "WFS",
default : false,
filter : {
field : "service",
value : "WFS"
}
}
],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,25 @@ <h2>Ajout d'une couche MapBox</h2>
break;
}
}
return olms.applyStyle(layer, style, source);
return olms.applyStyle(layer, style, { source: source });
}

function updateLegendMapBoxLayer (layer, source, options) {
console.error(layer, source, options);

var layers = style.layers;
for (var i = 0; i < layers.length; i++) {
if (layers[i].id === options.data.id) {
var paint = layers[i].paint;
if (paint) {
paint[options.dataset] = options.value;
}
break;
}
}
return olms.applyStyle(layer, style, { source: source });
}

// edition des filtres
function displayEditor() {
waiting(true);
Expand Down Expand Up @@ -121,7 +137,20 @@ <h2>Ajout d'une couche MapBox</h2>
},
"editor:legend:onchangevalue" : function (e) {
// opacité, epaisseur et couleur
console.log(e);
var data = e.target.data.obj;
var target = e.target.srcElement;

updateLegendMapBoxLayer(layer, "plan_ign", {
data:data,
value:target.value,
dataset: target.dataset.id
})
.then(function () {
// some stuff...
})
.catch(function (error) {
console.error("[ERROR]", error);
});
},
"editor:style:scale:onchangemax" : function (e) {console.log(e);},
"editor:style:scale:onchangemin" : function (e) {console.log(e);}
Expand Down
10 changes: 5 additions & 5 deletions src/packages/Controls/LayerImport/LayerImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ var LayerImport = class LayerImport extends Control {
// TODO ajouter le style de type background !
// fonction de style de la couche
var setStyle = () => {
applyStyleOlms(p.layer, p.styles, p.id)
applyStyleOlms(p.layer, p.styles, { source : p.id })
.then(function () {
var visibility = true;
p.layer.setVisible(visibility);
Expand Down Expand Up @@ -1870,7 +1870,7 @@ var LayerImport = class LayerImport extends Control {
break;
}
}
applyStyleOlms(layer, styles, data.source)
applyStyleOlms(layer, styles, { source : data.source })
.then(function () {})
.catch(function (error) {
logger.error(error);
Expand Down Expand Up @@ -1901,7 +1901,7 @@ var LayerImport = class LayerImport extends Control {
break;
}
}
applyStyleOlms(layer, styles, data.source)
applyStyleOlms(layer, styles, { source : data.source })
.then(function () {})
.catch(function (error) {
logger.error(error);
Expand Down Expand Up @@ -1933,7 +1933,7 @@ var LayerImport = class LayerImport extends Control {
break;
}
}
applyStyleOlms(layer, styles, data.source)
applyStyleOlms(layer, styles, { source : data.source })
.then(function () {})
.catch(function (error) {
logger.error(error);
Expand Down Expand Up @@ -1967,7 +1967,7 @@ var LayerImport = class LayerImport extends Control {
break;
}
}
applyStyleOlms(layer, styles, data.source)
applyStyleOlms(layer, styles, { source : data.source, updateSource : true })
.then(function () {})
.catch(function (error) {
logger.error(error);
Expand Down

0 comments on commit fc7ccce

Please sign in to comment.