Remove goog.isDef from layer

This commit is contained in:
Marc Jansen
2015-09-23 21:00:14 +02:00
committed by Tim Schaub
parent 66ad8364e0
commit cbb72c1ce4
+6 -5
View File
@@ -3,6 +3,7 @@ goog.provide('ol.layer.Layer');
goog.require('goog.events'); goog.require('goog.events');
goog.require('goog.events.EventType'); goog.require('goog.events.EventType');
goog.require('goog.object'); goog.require('goog.object');
goog.require('ol');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.layer.Base'); goog.require('ol.layer.Base');
goog.require('ol.layer.LayerProperty'); goog.require('ol.layer.LayerProperty');
@@ -52,7 +53,7 @@ ol.layer.Layer = function(options) {
*/ */
this.sourceChangeKey_ = null; this.sourceChangeKey_ = null;
if (goog.isDef(options.map)) { if (options.map) {
this.setMap(options.map); this.setMap(options.map);
} }
@@ -60,7 +61,7 @@ ol.layer.Layer = function(options) {
ol.Object.getChangeEventType(ol.layer.LayerProperty.SOURCE), ol.Object.getChangeEventType(ol.layer.LayerProperty.SOURCE),
this.handleSourcePropertyChange_, false, this); this.handleSourcePropertyChange_, false, this);
var source = goog.isDef(options.source) ? options.source : null; var source = options.source ? options.source : null;
this.setSource(source); this.setSource(source);
}; };
goog.inherits(ol.layer.Layer, ol.layer.Base); goog.inherits(ol.layer.Layer, ol.layer.Base);
@@ -84,7 +85,7 @@ ol.layer.Layer.visibleAtResolution = function(layerState, resolution) {
* @inheritDoc * @inheritDoc
*/ */
ol.layer.Layer.prototype.getLayersArray = function(opt_array) { ol.layer.Layer.prototype.getLayersArray = function(opt_array) {
var array = goog.isDef(opt_array) ? opt_array : []; var array = opt_array ? opt_array : [];
array.push(this); array.push(this);
return array; return array;
}; };
@@ -94,7 +95,7 @@ ol.layer.Layer.prototype.getLayersArray = function(opt_array) {
* @inheritDoc * @inheritDoc
*/ */
ol.layer.Layer.prototype.getLayerStatesArray = function(opt_states) { ol.layer.Layer.prototype.getLayerStatesArray = function(opt_states) {
var states = goog.isDef(opt_states) ? opt_states : []; var states = opt_states ? opt_states : [];
states.push(this.getLayerState()); states.push(this.getLayerState());
return states; return states;
}; };
@@ -108,7 +109,7 @@ ol.layer.Layer.prototype.getLayerStatesArray = function(opt_states) {
*/ */
ol.layer.Layer.prototype.getSource = function() { ol.layer.Layer.prototype.getSource = function() {
var source = this.get(ol.layer.LayerProperty.SOURCE); var source = this.get(ol.layer.LayerProperty.SOURCE);
return goog.isDef(source) ? return ol.isDef(source) ?
/** @type {ol.source.Source} */ (source) : null; /** @type {ol.source.Source} */ (source) : null;
}; };