Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

Commit

Permalink
map fill-opacity in TextSymbolizer to fontOpacity
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van den Eijnden committed Feb 23, 2012
1 parent 330777d commit 2e69d68
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 11 additions & 5 deletions lib/OpenLayers/Format/SLD/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,14 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, {
"CssParameter": function(node, symbolizer) {
var cssProperty = node.getAttribute("name");
var symProperty = this.cssMap[cssProperty];
// for labels, fill should map to the fontColor
if (symbolizer.label && cssProperty === 'fill') {
symProperty = "fontColor";
// for labels, fill should map to fontColor and fill-opacity
// to fontOpacity
if (symbolizer.label) {
if (cssProperty === 'fill') {
symProperty = "fontColor";
} else if (cssProperty === 'fill-opacity') {
symProperty = "fontOpacity";
}
}
if(symProperty) {
// Limited support for parsing of OGC expressions
Expand Down Expand Up @@ -893,9 +898,10 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, {
}
// add in optional Fill
if(symbolizer.fontColor != null ||
symbolizer.fillOpacity != null) {
symbolizer.fontOpacity != null) {
this.writeNode("Fill", {
fillColor: symbolizer.fontColor
fillColor: symbolizer.fontColor,
fillOpacity: symbolizer.fontOpacity
}, node);
}
return node;
Expand Down
4 changes: 3 additions & 1 deletion tests/Format/SLD/v1_0_0_GeoServer.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@
</Font>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
<CssParameter name="fill-opacity">0.5</CssParameter>
</Fill>
<Graphic>
<Mark>
<WellKnownName>square</WellKnownName>
<Fill>
<CssParameter name="fill">#59BF34</CssParameter>
<CssParameter name="fill">#59BF34</CssParameter>
<CssParameter name="fill-opacity">0.8</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#2D6917</CssParameter>
Expand Down

0 comments on commit 2e69d68

Please sign in to comment.