diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 545573f100..8534aef970 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -819,6 +819,8 @@ * a value is provided, the rule will apply at resolutions greater than or * equal to this value. * @property {Array.|undefined} symbolizers Symbolizers. + * @property {string|undefined} name Name. + * @property {string|undefined} title Title. * @todo stability experimental */ diff --git a/src/ol/parser/ogc/sldparser_v1.js b/src/ol/parser/ogc/sldparser_v1.js index 4803ae4db8..feecb404b1 100644 --- a/src/ol/parser/ogc/sldparser_v1.js +++ b/src/ol/parser/ogc/sldparser_v1.js @@ -544,15 +544,12 @@ ol.parser.ogc.SLD_v1 = function() { 'Rule': function(rule) { var node = this.createElementNS('sld:Rule'); var filter = rule.getFilter(); - if (rule.name) { - this.writeNode('Name', rule.name, null, node); + if (!goog.isNull(rule.getName())) { + this.writeNode('Name', rule.getName(), null, node); } - if (rule.title) { + if (!goog.isNull(rule.getTitle())) { this.writeNode('Title', rule.title, null, node); } - if (rule.description) { - this.writeNode('Abstract', rule.description, null, node); - } if (rule.elseFilter) { this.writeNode('ElseFilter', null, null, node); } else if (filter) { diff --git a/src/ol/style/rule.js b/src/ol/style/rule.js index 25d342aa5e..3495422459 100644 --- a/src/ol/style/rule.js +++ b/src/ol/style/rule.js @@ -54,6 +54,20 @@ ol.style.Rule = function(options) { this.maxResolution_ = goog.isDef(options.maxResolution) ? options.maxResolution : Infinity; + /** + * @type {?string} + * @private + */ + this.name_ = goog.isDef(options.name) ? + options.name : null; + + /** + * @type {?string} + * @private + */ + this.title_ = goog.isDef(options.title) ? + options.title : null; + }; @@ -102,3 +116,19 @@ ol.style.Rule.prototype.getMinResolution = function() { ol.style.Rule.prototype.getMaxResolution = function() { return this.maxResolution_; }; + + +/** + * @return {?string} + */ +ol.style.Rule.prototype.getName = function() { + return this.name_; +}; + + +/** + * @return {?string} + */ +ol.style.Rule.prototype.getTitle = function() { + return this.title_; +};