Default circle style options
Default fill style options
Default icon style options
Default stroke style options
Default text style options
Transform a native style to feature properties
A l'écriture du format.
feature style --> feature properties --> tag styling
Le style natif est récupéré pour chaque feature :
// Ex.
var style = feature.getStyle();
Ensuite, le style natif est transformé en properties pour chaque feature :
// Ex.
var stroke = style.getStroke();
var oColorStroke = Color.rgbaToHex(stroke.getColor());
feature.set("stroke", oColorStroke.hex); // #000000
feature.set("stroke-opacity", oColorStroke.opacity); // 0.8
Et, chaque properties des features sont ecrites dans le format du fichier (opération native sous OpenLayers) :
Ex. avec le format GeoJSON :
"properties": {
"stroke": "#000000",
"stroke-opacity": 0.8
}
Transform a native style to feature properties by type of geometry
Transform feature properties to a native style
A la lecture du format :
tag styling ---> feature properties ---> feature style
Les balises de 'styling' du fichier sont ajoutées dans les properties de chaque features (opération native sous OpenLayers):
Ex. avec le format GeoJSON :
"properties": {
"stroke": "#000000", -> feature.get("stroke");
"stroke-width": 13, -> feature.get("stroke-width");
"stroke-opacity": 0.8, -> feature.get("stroke-opacity");
"fill": "#a03737", -> feature.get("fill");
"fill-opacity": 0.5 -> feature.get("fill-opacity");
}
Ensuite, les properties des features sont transformées dans le style natif :
// Ex.
feature.setStyle(new Style({
fill : new FillStyle({
color : Color.hexToRgba(feature.get("fill"), feature.get("fill-opacity") || 1)
}),
stroke : new StrokeStyle({
color : Color.hexToRgba(feature.get("stroke"), feature.get("stroke-opacity"))
width : feature.get("stroke-width")
})
}));
Define a default style function to apply to a feature
Transform a native style to tags 'styling' into the format
All styling tags
Options to convert geometry