add name and title to ol.style.Rule

This commit is contained in:
Bart van den Eijnden
2013-10-11 16:49:39 +02:00
committed by Bart van den Eijnden
parent 9a6c1feddc
commit c75082c75d
3 changed files with 35 additions and 6 deletions

View File

@@ -819,6 +819,8 @@
* a value is provided, the rule will apply at resolutions greater than or
* equal to this value.
* @property {Array.<ol.style.Symbolizer>|undefined} symbolizers Symbolizers.
* @property {string|undefined} name Name.
* @property {string|undefined} title Title.
* @todo stability experimental
*/

View File

@@ -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) {

View File

@@ -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_;
};