Merge pull request #258 from bartvde/textplacement

PointPlacement and LinePlacement are choices, so don't output both (r=@ahocevar)
This commit is contained in:
Bart van den Eijnden
2012-02-29 05:54:00 -08:00
2 changed files with 7 additions and 3 deletions

View File

@@ -990,12 +990,14 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, {
},
"LabelPlacement": function(symbolizer) {
var node = this.createElementNSPlus("sld:LabelPlacement");
if (symbolizer.labelAnchorPointX != null ||
// PointPlacement and LinePlacement are choices, so don't output both
if ((symbolizer.labelAnchorPointX != null ||
symbolizer.labelAnchorPointY != null ||
symbolizer.labelAlign != null ||
symbolizer.labelXOffset != null ||
symbolizer.labelYOffset != null ||
symbolizer.labelRotation != null) {
symbolizer.labelRotation != null) &&
symbolizer.labelPerpendicularOffset == null) {
this.writeNode("PointPlacement", symbolizer, node);
}
if (symbolizer.labelPerpendicularOffset != null) {

View File

@@ -528,6 +528,7 @@
var format = new OpenLayers.Format.SLD.v1_0_0({
multipleSymbolizers: true
});
// labelPerpendicularOffset takes precedence over labelAlign
var style = new OpenLayers.Style2({
rules: [
new OpenLayers.Rule({
@@ -538,7 +539,8 @@
}),
new OpenLayers.Symbolizer.Text({
label: "${FOO}",
labelPerpendicularOffset: 10
labelPerpendicularOffset: 10,
labelAlign: "rb"
})
]
})