make vendorOptions an object instead of an array, which makes it more convenient to prevent duplicate vendorOptions
This commit is contained in:
@@ -58,12 +58,9 @@ OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class(
|
||||
},
|
||||
"VendorOption": function(node, obj) {
|
||||
if (!obj.vendorOptions) {
|
||||
obj.vendorOptions = [];
|
||||
obj.vendorOptions = {};
|
||||
}
|
||||
obj.vendorOptions.push({
|
||||
name: node.getAttribute("name"),
|
||||
value: this.getChildValue(node)
|
||||
});
|
||||
obj.vendorOptions[node.getAttribute("name")] = this.getChildValue(node);
|
||||
}
|
||||
}, OpenLayers.Format.SLD.v1_0_0.prototype.readers["sld"])
|
||||
}, OpenLayers.Format.SLD.v1_0_0.prototype.readers),
|
||||
@@ -130,8 +127,11 @@ OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class(
|
||||
addVendorOptions: function(node, symbolizer) {
|
||||
var options = symbolizer.vendorOptions;
|
||||
if (options) {
|
||||
for (var i=0, ii=options.length; i<ii; ++i) {
|
||||
this.writeNode("VendorOption", options[i], node);
|
||||
for (var key in symbolizer.vendorOptions) {
|
||||
this.writeNode("VendorOption", {
|
||||
name: key,
|
||||
value: symbolizer.vendorOptions[key]
|
||||
}, node);
|
||||
}
|
||||
}
|
||||
return node;
|
||||
|
||||
Reference in New Issue
Block a user