Inline simple goog.isDef() checks

This commit is contained in:
Tim Schaub
2015-09-27 10:18:44 -06:00
parent cf5eadebaa
commit 7659e47e07
22 changed files with 59 additions and 59 deletions

View File

@@ -149,7 +149,7 @@ ol.source.ImageMapGuide.prototype.getImage =
var size = [width * pixelRatio, height * pixelRatio];
var imageUrl = this.imageUrlFunction_(extent, size, projection);
if (goog.isDef(imageUrl)) {
if (imageUrl !== undefined) {
image = new ol.Image(extent, resolution, pixelRatio,
this.getAttributions(), imageUrl, this.crossOrigin_,
this.imageLoadFunction_);

View File

@@ -129,7 +129,7 @@ ol.source.TileVector.prototype.forEachFeatureAtCoordinateAndResolution =
var tileKey = this.getTileKeyZXY_(tileCoord[0], tileCoord[1], tileCoord[2]);
var features = tiles[tileKey];
if (goog.isDef(features)) {
if (features !== undefined) {
var i, ii;
for (i = 0, ii = features.length; i < ii; ++i) {
var feature = features[i];
@@ -168,7 +168,7 @@ ol.source.TileVector.prototype.forEachFeatureInExtentAtResolution =
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
var tileKey = this.getTileKeyZXY_(z, x, y);
var features = tiles[tileKey];
if (goog.isDef(features)) {
if (features !== undefined) {
var i, ii;
for (i = 0, ii = features.length; i < ii; ++i) {
var result = f.call(opt_this, features[i]);
@@ -305,7 +305,7 @@ ol.source.TileVector.prototype.loadFeatures =
tileCoord, projection);
var url = goog.isNull(urlTileCoord) ? undefined :
tileUrlFunction(urlTileCoord, 1, projection);
if (goog.isDef(url)) {
if (url !== undefined) {
tiles[tileKey] = [];
var tileSuccess = goog.partial(success, tileKey);
if (!goog.isNull(this.tileLoadFunction_)) {

View File

@@ -164,10 +164,10 @@ ol.source.Vector = function(opt_options) {
if (!useSpatialIndex && !goog.isDef(collection)) {
collection = new ol.Collection(features);
}
if (goog.isDef(features)) {
if (features !== undefined) {
this.addFeaturesInternal(features);
}
if (goog.isDef(collection)) {
if (collection !== undefined) {
this.bindFeaturesCollection_(collection);
}
@@ -246,7 +246,7 @@ ol.source.Vector.prototype.setupChangeEvents_ = function(featureKey, feature) {
ol.source.Vector.prototype.addToIndex_ = function(featureKey, feature) {
var valid = true;
var id = feature.getId();
if (goog.isDef(id)) {
if (id !== undefined) {
if (!(id.toString() in this.idIndex_)) {
this.idIndex_[id.toString()] = feature;
} else {
@@ -726,7 +726,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
}
var id = feature.getId();
var removed;
if (goog.isDef(id)) {
if (id !== undefined) {
var sid = id.toString();
if (featureKey in this.undefIdIndex_) {
delete this.undefIdIndex_[featureKey];
@@ -827,7 +827,7 @@ ol.source.Vector.prototype.removeFeatureInternal = function(feature) {
goog.events.unlistenByKey);
delete this.featureChangeKeys_[featureKey];
var id = feature.getId();
if (goog.isDef(id)) {
if (id !== undefined) {
delete this.idIndex_[id.toString()];
} else {
delete this.undefIdIndex_[featureKey];

View File

@@ -404,7 +404,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
goog.array.forEach(l['Dimension'], function(elt, index, array) {
var key = elt['Identifier'];
var value = elt['default'];
if (goog.isDef(value)) {
if (value !== undefined) {
goog.asserts.assert(goog.array.contains(elt['values'], value),
'default value contained in values');
} else {
@@ -432,7 +432,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var wgs84BoundingBox = l['WGS84BoundingBox'];
var extent, wrapX;
if (goog.isDef(wgs84BoundingBox)) {
if (wgs84BoundingBox !== undefined) {
var wgs84ProjectionExtent = ol.proj.get('EPSG:4326').getExtent();
wrapX = (wgs84BoundingBox[0] == wgs84ProjectionExtent[0] &&
wgs84BoundingBox[2] == wgs84ProjectionExtent[2]);