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
+7 -6
View File
@@ -342,10 +342,10 @@ ol.parser.ogc.SLD_v1 = function() {
'UserStyle': function(style) { 'UserStyle': function(style) {
var node = this.createElementNS('sld:UserStyle'); var node = this.createElementNS('sld:UserStyle');
var name = style.getName(), title = style.getTitle(); var name = style.getName(), title = style.getTitle();
if (!goog.isNull(name)) { if (goog.isDef(name)) {
this.writeNode('Name', name, null, node); this.writeNode('Name', name, null, node);
} }
if (!goog.isNull(title)) { if (goog.isDef(title)) {
this.writeNode('Title', title, null, node); this.writeNode('Title', title, null, node);
} }
// TODO sorting by zIndex // TODO sorting by zIndex
@@ -370,11 +370,12 @@ ol.parser.ogc.SLD_v1 = function() {
'Rule': function(rule) { 'Rule': function(rule) {
var node = this.createElementNS('sld:Rule'); var node = this.createElementNS('sld:Rule');
var filter = rule.getFilter(); var filter = rule.getFilter();
if (!goog.isNull(rule.getName())) { var name = rule.getName(), title = rule.getTitle();
this.writeNode('Name', rule.getName(), null, node); if (goog.isDef(name)) {
this.writeNode('Name', name, null, node);
} }
if (!goog.isNull(rule.getTitle())) { if (goog.isDef(title)) {
this.writeNode('Title', rule.title, null, node); this.writeNode('Title', title, null, node);
} }
if (rule.elseFilter === true) { if (rule.elseFilter === true) {
this.writeNode('ElseFilter', null, null, node); this.writeNode('ElseFilter', null, null, node);
+6 -6
View File
@@ -55,18 +55,18 @@ ol.style.Rule = function(options) {
options.maxResolution : Infinity; options.maxResolution : Infinity;
/** /**
* @type {?string} * @type {string|undefined}
* @private * @private
*/ */
this.name_ = goog.isDef(options.name) ? this.name_ = goog.isDef(options.name) ?
options.name : null; options.name : undefined;
/** /**
* @type {?string} * @type {string|undefined}
* @private * @private
*/ */
this.title_ = goog.isDef(options.title) ? 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() { ol.style.Rule.prototype.getName = function() {
return this.name_; return this.name_;
@@ -127,7 +127,7 @@ ol.style.Rule.prototype.getName = function() {
/** /**
* @return {?string} * @return {string|undefined}
*/ */
ol.style.Rule.prototype.getTitle = function() { ol.style.Rule.prototype.getTitle = function() {
return this.title_; return this.title_;
+6 -6
View File
@@ -41,18 +41,18 @@ ol.style.Style = function(options) {
options.symbolizers : []; options.symbolizers : [];
/** /**
* @type {?string} * @type {string|undefined}
* @private * @private
*/ */
this.name_ = goog.isDef(options.name) ? this.name_ = goog.isDef(options.name) ?
options.name : null; options.name : undefined;
/** /**
* @type {?string} * @type {string|undefined}
* @private * @private
*/ */
this.title_ = goog.isDef(options.title) ? 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() { ol.style.Style.prototype.getName = function() {
return this.name_; return this.name_;
@@ -255,7 +255,7 @@ ol.style.Style.prototype.getName = function() {
/** /**
* @return {?string} * @return {string|undefined}
*/ */
ol.style.Style.prototype.getTitle = function() { ol.style.Style.prototype.getTitle = function() {
return this.title_; return this.title_;