change simple type values to undefined instead of null

This commit is contained in:
Bart van den Eijnden
2013-11-25 10:48:30 +01:00
parent 01c9448c3c
commit 25ae9fe784
3 changed files with 19 additions and 18 deletions

View File

@@ -342,10 +342,10 @@ ol.parser.ogc.SLD_v1 = function() {
'UserStyle': function(style) {
var node = this.createElementNS('sld:UserStyle');
var name = style.getName(), title = style.getTitle();
if (!goog.isNull(name)) {
if (goog.isDef(name)) {
this.writeNode('Name', name, null, node);
}
if (!goog.isNull(title)) {
if (goog.isDef(title)) {
this.writeNode('Title', title, null, node);
}
// TODO sorting by zIndex
@@ -370,11 +370,12 @@ ol.parser.ogc.SLD_v1 = function() {
'Rule': function(rule) {
var node = this.createElementNS('sld:Rule');
var filter = rule.getFilter();
if (!goog.isNull(rule.getName())) {
this.writeNode('Name', rule.getName(), null, node);
var name = rule.getName(), title = rule.getTitle();
if (goog.isDef(name)) {
this.writeNode('Name', name, null, node);
}
if (!goog.isNull(rule.getTitle())) {
this.writeNode('Title', rule.title, null, node);
if (goog.isDef(title)) {
this.writeNode('Title', title, null, node);
}
if (rule.elseFilter === true) {
this.writeNode('ElseFilter', null, null, node);

View File

@@ -55,18 +55,18 @@ ol.style.Rule = function(options) {
options.maxResolution : Infinity;
/**
* @type {?string}
* @type {string|undefined}
* @private
*/
this.name_ = goog.isDef(options.name) ?
options.name : null;
options.name : undefined;
/**
* @type {?string}
* @type {string|undefined}
* @private
*/
this.title_ = goog.isDef(options.title) ?
options.title : null;
options.title : undefined;
};
@@ -119,7 +119,7 @@ ol.style.Rule.prototype.getMaxResolution = function() {
/**
* @return {?string}
* @return {string|undefined}
*/
ol.style.Rule.prototype.getName = function() {
return this.name_;
@@ -127,7 +127,7 @@ ol.style.Rule.prototype.getName = function() {
/**
* @return {?string}
* @return {string|undefined}
*/
ol.style.Rule.prototype.getTitle = function() {
return this.title_;

View File

@@ -41,18 +41,18 @@ ol.style.Style = function(options) {
options.symbolizers : [];
/**
* @type {?string}
* @type {string|undefined}
* @private
*/
this.name_ = goog.isDef(options.name) ?
options.name : null;
options.name : undefined;
/**
* @type {?string}
* @type {string|undefined}
* @private
*/
this.title_ = goog.isDef(options.title) ?
options.title : null;
options.title : undefined;
};
@@ -247,7 +247,7 @@ ol.style.Style.prototype.getSymbolizers = function() {
/**
* @return {?string}
* @return {string|undefined}
*/
ol.style.Style.prototype.getName = function() {
return this.name_;
@@ -255,7 +255,7 @@ ol.style.Style.prototype.getName = function() {
/**
* @return {?string}
* @return {string|undefined}
*/
ol.style.Style.prototype.getTitle = function() {
return this.title_;