carto/lib/mess/tree/style.js
2011-01-21 13:07:50 -05:00

22 lines
501 B
JavaScript

(function(tree) {
tree.Style = function(id, symbolizer, definitions) {
this.id = id;
this.symbolizer = symbolizer;
this.definitions = definitions;
};
tree.Style.prototype.name = function() {
return this.id + '-' + this.symbolizer;
}
tree.Style.prototype.toXML = function(env) {
return '<Style name="' + this.name() + '">\n' +
this.definitions.map(function(d) {
return d.toXML(env);
}).join('\n')
+ '\n</Style>';
};
})(require('mess/tree'));