Remove goog.isNull in source classes

This commit is contained in:
Marc Jansen
2015-09-29 15:20:51 +02:00
parent 30e2f44825
commit e1f477ad8c
18 changed files with 51 additions and 55 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
goog.asserts.assert(ol.proj.equivalent( goog.asserts.assert(ol.proj.equivalent(
projection, sourceProjection), projection, sourceProjection),
'projections are equivalent'); 'projections are equivalent');
if (goog.isNull(tileCoord)) { if (!tileCoord) {
return undefined; return undefined;
} else { } else {
ol.tilecoord.createOrUpdate(tileCoord[0], tileCoord[1], ol.tilecoord.createOrUpdate(tileCoord[0], tileCoord[1],
+2 -2
View File
@@ -64,7 +64,7 @@ ol.source.ImageCanvas.prototype.getImage =
resolution = this.findNearestResolution(resolution); resolution = this.findNearestResolution(resolution);
var canvas = this.canvas_; var canvas = this.canvas_;
if (!goog.isNull(canvas) && if (canvas &&
this.renderedRevision_ == this.getRevision() && this.renderedRevision_ == this.getRevision() &&
canvas.getResolution() == resolution && canvas.getResolution() == resolution &&
canvas.getPixelRatio() == pixelRatio && canvas.getPixelRatio() == pixelRatio &&
@@ -80,7 +80,7 @@ ol.source.ImageCanvas.prototype.getImage =
var canvasElement = this.canvasFunction_( var canvasElement = this.canvasFunction_(
extent, resolution, pixelRatio, size, projection); extent, resolution, pixelRatio, size, projection);
if (!goog.isNull(canvasElement)) { if (canvasElement) {
canvas = new ol.ImageCanvas(extent, resolution, pixelRatio, canvas = new ol.ImageCanvas(extent, resolution, pixelRatio,
this.getAttributions(), canvasElement); this.getAttributions(), canvasElement);
} }
+1 -1
View File
@@ -132,7 +132,7 @@ ol.source.ImageMapGuide.prototype.getImage =
pixelRatio = this.hidpi_ ? pixelRatio : 1; pixelRatio = this.hidpi_ ? pixelRatio : 1;
var image = this.image_; var image = this.image_;
if (!goog.isNull(image) && if (image &&
this.renderedRevision_ == this.getRevision() && this.renderedRevision_ == this.getRevision() &&
image.getResolution() == resolution && image.getResolution() == resolution &&
image.getPixelRatio() == pixelRatio && image.getPixelRatio() == pixelRatio &&
+2 -2
View File
@@ -50,7 +50,7 @@ ol.source.Image = function(options) {
*/ */
this.resolutions_ = options.resolutions !== undefined ? this.resolutions_ = options.resolutions !== undefined ?
options.resolutions : null; options.resolutions : null;
goog.asserts.assert(goog.isNull(this.resolutions_) || goog.asserts.assert(!this.resolutions_ ||
goog.array.isSorted(this.resolutions_, goog.array.isSorted(this.resolutions_,
function(a, b) { function(a, b) {
return b - a; return b - a;
@@ -75,7 +75,7 @@ ol.source.Image.prototype.getResolutions = function() {
*/ */
ol.source.Image.prototype.findNearestResolution = ol.source.Image.prototype.findNearestResolution =
function(resolution) { function(resolution) {
if (!goog.isNull(this.resolutions_)) { if (this.resolutions_) {
var idx = ol.array.linearFindNearest(this.resolutions_, resolution, 0); var idx = ol.array.linearFindNearest(this.resolutions_, resolution, 0);
resolution = this.resolutions_[idx]; resolution = this.resolutions_[idx];
} }
+2 -2
View File
@@ -154,7 +154,7 @@ ol.source.ImageVector.prototype.canvasFunctionInternal_ =
*/ */
ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function( ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function(
coordinate, resolution, rotation, skippedFeatureUids, callback) { coordinate, resolution, rotation, skippedFeatureUids, callback) {
if (goog.isNull(this.replayGroup_)) { if (!this.replayGroup_) {
return undefined; return undefined;
} else { } else {
/** @type {Object.<string, boolean>} */ /** @type {Object.<string, boolean>} */
@@ -292,7 +292,7 @@ ol.source.ImageVector.prototype.renderFeature_ =
*/ */
ol.source.ImageVector.prototype.setStyle = function(style) { ol.source.ImageVector.prototype.setStyle = function(style) {
this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction; this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction;
this.styleFunction_ = goog.isNull(style) ? this.styleFunction_ = !style ?
undefined : ol.style.createStyleFunction(this.style_); undefined : ol.style.createStyleFunction(this.style_);
this.changed(); this.changed();
}; };
+1 -1
View File
@@ -223,7 +223,7 @@ ol.source.ImageWMS.prototype.getImage =
extent[3] = centerY + imageResolution * height / 2; extent[3] = centerY + imageResolution * height / 2;
var image = this.image_; var image = this.image_;
if (!goog.isNull(image) && if (image &&
this.renderedRevision_ == this.getRevision() && this.renderedRevision_ == this.getRevision() &&
image.getResolution() == resolution && image.getResolution() == resolution &&
image.getPixelRatio() == pixelRatio && image.getPixelRatio() == pixelRatio &&
+1 -1
View File
@@ -319,7 +319,7 @@ ol.source.Raster.prototype.onWorkerComplete_ =
callback(err); callback(err);
return; return;
} }
if (goog.isNull(output)) { if (!output) {
// job aborted // job aborted
return; return;
} }
+1 -1
View File
@@ -200,7 +200,7 @@ ol.source.TileArcGISRest.prototype.tileUrlFunction_ =
function(tileCoord, pixelRatio, projection) { function(tileCoord, pixelRatio, projection) {
var tileGrid = this.getTileGrid(); var tileGrid = this.getTileGrid();
if (goog.isNull(tileGrid)) { if (!tileGrid) {
tileGrid = this.getTileGridForProjection(projection); tileGrid = this.getTileGridForProjection(projection);
} }
+1 -1
View File
@@ -110,7 +110,7 @@ ol.source.TileDebug.prototype.getTile = function(z, x, y) {
var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z)); var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z));
var tileCoord = [z, x, y]; var tileCoord = [z, x, y];
var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord); var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord);
var text = goog.isNull(textTileCoord) ? '' : ol.tilecoord.toString( var text = !textTileCoord ? '' : ol.tilecoord.toString(
this.getTileCoordForTileUrlFunction(textTileCoord)); this.getTileCoordForTileUrlFunction(textTileCoord));
var tile = new ol.DebugTile_(tileCoord, tileSize, text); var tile = new ol.DebugTile_(tileCoord, tileSize, text);
this.tileCache.set(tileCoordKey, tile); this.tileCache.set(tileCoordKey, tile);
+1 -1
View File
@@ -95,7 +95,7 @@ ol.source.TileImage.prototype.getTile =
var tileCoord = [z, x, y]; var tileCoord = [z, x, y];
var urlTileCoord = this.getTileCoordForTileUrlFunction( var urlTileCoord = this.getTileCoordForTileUrlFunction(
tileCoord, projection); tileCoord, projection);
var tileUrl = goog.isNull(urlTileCoord) ? undefined : var tileUrl = !urlTileCoord ? undefined :
this.tileUrlFunction(urlTileCoord, pixelRatio, projection); this.tileUrlFunction(urlTileCoord, pixelRatio, projection);
var tile = new this.tileClass( var tile = new this.tileClass(
tileCoord, tileCoord,
+1 -2
View File
@@ -78,8 +78,7 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
this.tileUrlFunction = this.tileUrlFunction =
ol.TileUrlFunction.createFromTemplates(tileJSON.tiles, tileGrid); ol.TileUrlFunction.createFromTemplates(tileJSON.tiles, tileGrid);
if (tileJSON.attribution !== undefined && if (tileJSON.attribution !== undefined && !this.getAttributions()) {
goog.isNull(this.getAttributions())) {
var attributionExtent = extent !== undefined ? var attributionExtent = extent !== undefined ?
extent : epsg4326Projection.getExtent(); extent : epsg4326Projection.getExtent();
/** @type {Object.<string, Array.<ol.TileRange>>} */ /** @type {Object.<string, Array.<ol.TileRange>>} */
+2 -2
View File
@@ -195,7 +195,7 @@ ol.source.Tile.prototype.getTileGrid = function() {
* @return {ol.tilegrid.TileGrid} Tile grid. * @return {ol.tilegrid.TileGrid} Tile grid.
*/ */
ol.source.Tile.prototype.getTileGridForProjection = function(projection) { ol.source.Tile.prototype.getTileGridForProjection = function(projection) {
if (goog.isNull(this.tileGrid)) { if (!this.tileGrid) {
return ol.tilegrid.getForProjection(projection); return ol.tilegrid.getForProjection(projection);
} else { } else {
return this.tileGrid; return this.tileGrid;
@@ -231,7 +231,7 @@ ol.source.Tile.prototype.getTileCoordForTileUrlFunction =
var projection = opt_projection !== undefined ? var projection = opt_projection !== undefined ?
opt_projection : this.getProjection(); opt_projection : this.getProjection();
var tileGrid = this.getTileGridForProjection(projection); var tileGrid = this.getTileGridForProjection(projection);
goog.asserts.assert(!goog.isNull(tileGrid), 'tile grid needed'); goog.asserts.assert(tileGrid, 'tile grid needed');
if (this.getWrapX() && projection.isGlobal()) { if (this.getWrapX() && projection.isGlobal()) {
tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection); tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection);
} }
+2 -2
View File
@@ -81,7 +81,7 @@ ol.source.TileUTFGrid.prototype.getTemplate = function() {
*/ */
ol.source.TileUTFGrid.prototype.forDataAtCoordinateAndResolution = function( ol.source.TileUTFGrid.prototype.forDataAtCoordinateAndResolution = function(
coordinate, resolution, callback, opt_this, opt_request) { coordinate, resolution, callback, opt_this, opt_request) {
if (!goog.isNull(this.tileGrid)) { if (this.tileGrid) {
var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution( var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution(
coordinate, resolution); coordinate, resolution);
var tile = /** @type {!ol.source.TileUTFGridTile_} */(this.getTile( var tile = /** @type {!ol.source.TileUTFGridTile_} */(this.getTile(
@@ -269,7 +269,7 @@ ol.source.TileUTFGridTile_.prototype.getImage = function(opt_context) {
* @return {Object} * @return {Object}
*/ */
ol.source.TileUTFGridTile_.prototype.getData = function(coordinate) { ol.source.TileUTFGridTile_.prototype.getData = function(coordinate) {
if (goog.isNull(this.grid_) || goog.isNull(this.keys_) || !this.data_) { if (!this.grid_ || !this.keys_ || !this.data_) {
return null; return null;
} }
var xRelative = (coordinate[0] - this.extent_[0]) / var xRelative = (coordinate[0] - this.extent_[0]) /
+4 -5
View File
@@ -57,8 +57,7 @@ ol.source.TileVector = function(options) {
this.tileLoadFunction_ = options.tileLoadFunction !== undefined ? this.tileLoadFunction_ = options.tileLoadFunction !== undefined ?
options.tileLoadFunction : null; options.tileLoadFunction : null;
goog.asserts.assert(!goog.isNull(this.format_) || goog.asserts.assert(this.format_ || this.tileLoadFunction_,
!goog.isNull(this.tileLoadFunction_),
'Either format or tileLoadFunction are required'); 'Either format or tileLoadFunction are required');
/** /**
@@ -252,7 +251,7 @@ ol.source.TileVector.prototype.getFeaturesInExtent = goog.abstractMethod;
ol.source.TileVector.prototype.getTileCoordForTileUrlFunction = ol.source.TileVector.prototype.getTileCoordForTileUrlFunction =
function(tileCoord, projection) { function(tileCoord, projection) {
var tileGrid = this.tileGrid_; var tileGrid = this.tileGrid_;
goog.asserts.assert(!goog.isNull(tileGrid), 'tile grid needed'); goog.asserts.assert(tileGrid, 'tile grid needed');
if (this.getWrapX() && projection.isGlobal()) { if (this.getWrapX() && projection.isGlobal()) {
tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection); tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection);
} }
@@ -302,12 +301,12 @@ ol.source.TileVector.prototype.loadFeatures =
tileCoord[2] = y; tileCoord[2] = y;
var urlTileCoord = this.getTileCoordForTileUrlFunction( var urlTileCoord = this.getTileCoordForTileUrlFunction(
tileCoord, projection); tileCoord, projection);
var url = goog.isNull(urlTileCoord) ? undefined : var url = !urlTileCoord ? undefined :
tileUrlFunction(urlTileCoord, 1, projection); tileUrlFunction(urlTileCoord, 1, projection);
if (url !== undefined) { if (url !== undefined) {
tiles[tileKey] = []; tiles[tileKey] = [];
var tileSuccess = goog.partial(success, tileKey); var tileSuccess = goog.partial(success, tileKey);
if (!goog.isNull(this.tileLoadFunction_)) { if (this.tileLoadFunction_) {
this.tileLoadFunction_(url, goog.bind(tileSuccess, this)); this.tileLoadFunction_(url, goog.bind(tileSuccess, this));
} else { } else {
var loader = ol.featureloader.loadFeaturesXhr(url, var loader = ol.featureloader.loadFeaturesXhr(url,
+2 -2
View File
@@ -135,7 +135,7 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl =
var projectionObj = ol.proj.get(projection); var projectionObj = ol.proj.get(projection);
var tileGrid = this.getTileGrid(); var tileGrid = this.getTileGrid();
if (goog.isNull(tileGrid)) { if (!tileGrid) {
tileGrid = this.getTileGridForProjection(projectionObj); tileGrid = this.getTileGridForProjection(projectionObj);
} }
@@ -365,7 +365,7 @@ ol.source.TileWMS.prototype.tileUrlFunction_ =
function(tileCoord, pixelRatio, projection) { function(tileCoord, pixelRatio, projection) {
var tileGrid = this.getTileGrid(); var tileGrid = this.getTileGrid();
if (goog.isNull(tileGrid)) { if (!tileGrid) {
tileGrid = this.getTileGridForProjection(projection); tileGrid = this.getTileGridForProjection(projection);
} }
+20 -20
View File
@@ -206,7 +206,7 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
var extent = geometry.getExtent(); var extent = geometry.getExtent();
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
this.featuresRtree_.insert(extent, feature); this.featuresRtree_.insert(extent, feature);
} }
} else { } else {
@@ -307,7 +307,7 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) {
this.nullGeometryFeatures_[featureKey] = feature; this.nullGeometryFeatures_[featureKey] = feature;
} }
} }
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
this.featuresRtree_.load(extents, geometryFeatures); this.featuresRtree_.load(extents, geometryFeatures);
} }
@@ -323,7 +323,7 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) {
* @private * @private
*/ */
ol.source.Vector.prototype.bindFeaturesCollection_ = function(collection) { ol.source.Vector.prototype.bindFeaturesCollection_ = function(collection) {
goog.asserts.assert(goog.isNull(this.featuresCollection_), goog.asserts.assert(!this.featuresCollection_,
'bindFeaturesCollection can only be called once'); 'bindFeaturesCollection can only be called once');
var modifyingCollection = false; var modifyingCollection = false;
goog.events.listen(this, ol.source.VectorEventType.ADDFEATURE, goog.events.listen(this, ol.source.VectorEventType.ADDFEATURE,
@@ -377,19 +377,19 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
var keys = this.featureChangeKeys_[featureId]; var keys = this.featureChangeKeys_[featureId];
keys.forEach(goog.events.unlistenByKey); keys.forEach(goog.events.unlistenByKey);
} }
if (goog.isNull(this.featuresCollection_)) { if (!this.featuresCollection_) {
this.featureChangeKeys_ = {}; this.featureChangeKeys_ = {};
this.idIndex_ = {}; this.idIndex_ = {};
this.undefIdIndex_ = {}; this.undefIdIndex_ = {};
} }
} else { } else {
var rmFeatureInternal = this.removeFeatureInternal; var rmFeatureInternal = this.removeFeatureInternal;
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
this.featuresRtree_.forEach(rmFeatureInternal, this); this.featuresRtree_.forEach(rmFeatureInternal, this);
goog.object.forEach(this.nullGeometryFeatures_, rmFeatureInternal, this); goog.object.forEach(this.nullGeometryFeatures_, rmFeatureInternal, this);
} }
} }
if (!goog.isNull(this.featuresCollection_)) { if (this.featuresCollection_) {
this.featuresCollection_.clear(); this.featuresCollection_.clear();
} }
goog.asserts.assert(goog.object.isEmpty(this.featureChangeKeys_), goog.asserts.assert(goog.object.isEmpty(this.featureChangeKeys_),
@@ -399,7 +399,7 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
goog.asserts.assert(goog.object.isEmpty(this.undefIdIndex_), goog.asserts.assert(goog.object.isEmpty(this.undefIdIndex_),
'undefIdIndex is an empty object now'); 'undefIdIndex is an empty object now');
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
this.featuresRtree_.clear(); this.featuresRtree_.clear();
} }
this.loadedExtentsRtree_.clear(); this.loadedExtentsRtree_.clear();
@@ -424,9 +424,9 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
* @api stable * @api stable
*/ */
ol.source.Vector.prototype.forEachFeature = function(callback, opt_this) { ol.source.Vector.prototype.forEachFeature = function(callback, opt_this) {
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
return this.featuresRtree_.forEach(callback, opt_this); return this.featuresRtree_.forEach(callback, opt_this);
} else if (!goog.isNull(this.featuresCollection_)) { } else if (this.featuresCollection_) {
return this.featuresCollection_.forEach(callback, opt_this); return this.featuresCollection_.forEach(callback, opt_this);
} }
}; };
@@ -483,9 +483,9 @@ ol.source.Vector.prototype.forEachFeatureAtCoordinateDirect =
*/ */
ol.source.Vector.prototype.forEachFeatureInExtent = ol.source.Vector.prototype.forEachFeatureInExtent =
function(extent, callback, opt_this) { function(extent, callback, opt_this) {
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
return this.featuresRtree_.forEachInExtent(extent, callback, opt_this); return this.featuresRtree_.forEachInExtent(extent, callback, opt_this);
} else if (!goog.isNull(this.featuresCollection_)) { } else if (this.featuresCollection_) {
return this.featuresCollection_.forEach(callback, opt_this); return this.featuresCollection_.forEach(callback, opt_this);
} }
}; };
@@ -563,9 +563,9 @@ ol.source.Vector.prototype.getFeaturesCollection = function() {
*/ */
ol.source.Vector.prototype.getFeatures = function() { ol.source.Vector.prototype.getFeatures = function() {
var features; var features;
if (!goog.isNull(this.featuresCollection_)) { if (this.featuresCollection_) {
features = this.featuresCollection_.getArray(); features = this.featuresCollection_.getArray();
} else if (!goog.isNull(this.featuresRtree_)) { } else if (this.featuresRtree_) {
features = this.featuresRtree_.getAll(); features = this.featuresRtree_.getAll();
if (!goog.object.isEmpty(this.nullGeometryFeatures_)) { if (!goog.object.isEmpty(this.nullGeometryFeatures_)) {
goog.array.extend( goog.array.extend(
@@ -605,7 +605,7 @@ ol.source.Vector.prototype.getFeaturesAtCoordinate = function(coordinate) {
* @api * @api
*/ */
ol.source.Vector.prototype.getFeaturesInExtent = function(extent) { ol.source.Vector.prototype.getFeaturesInExtent = function(extent) {
goog.asserts.assert(!goog.isNull(this.featuresRtree_), goog.asserts.assert(this.featuresRtree_,
'getFeaturesInExtent does not work when useSpatialIndex is set to false'); 'getFeaturesInExtent does not work when useSpatialIndex is set to false');
return this.featuresRtree_.getInExtent(extent); return this.featuresRtree_.getInExtent(extent);
}; };
@@ -635,7 +635,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate =
var closestPoint = [NaN, NaN]; var closestPoint = [NaN, NaN];
var minSquaredDistance = Infinity; var minSquaredDistance = Infinity;
var extent = [-Infinity, -Infinity, Infinity, Infinity]; var extent = [-Infinity, -Infinity, Infinity, Infinity];
goog.asserts.assert(!goog.isNull(this.featuresRtree_), goog.asserts.assert(this.featuresRtree_,
'getClosestFeatureToCoordinate does not work with useSpatialIndex set ' + 'getClosestFeatureToCoordinate does not work with useSpatialIndex set ' +
'to false'); 'to false');
this.featuresRtree_.forEachInExtent(extent, this.featuresRtree_.forEachInExtent(extent,
@@ -675,7 +675,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate =
* @api stable * @api stable
*/ */
ol.source.Vector.prototype.getExtent = function() { ol.source.Vector.prototype.getExtent = function() {
goog.asserts.assert(!goog.isNull(this.featuresRtree_), goog.asserts.assert(this.featuresRtree_,
'getExtent does not work when useSpatialIndex is set to false'); 'getExtent does not work when useSpatialIndex is set to false');
return this.featuresRtree_.getExtent(); return this.featuresRtree_.getExtent();
}; };
@@ -706,7 +706,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (!geometry) { if (!geometry) {
if (!(featureKey in this.nullGeometryFeatures_)) { if (!(featureKey in this.nullGeometryFeatures_)) {
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
this.featuresRtree_.remove(feature); this.featuresRtree_.remove(feature);
} }
this.nullGeometryFeatures_[featureKey] = feature; this.nullGeometryFeatures_[featureKey] = feature;
@@ -715,11 +715,11 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
var extent = geometry.getExtent(); var extent = geometry.getExtent();
if (featureKey in this.nullGeometryFeatures_) { if (featureKey in this.nullGeometryFeatures_) {
delete this.nullGeometryFeatures_[featureKey]; delete this.nullGeometryFeatures_[featureKey];
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
this.featuresRtree_.insert(extent, feature); this.featuresRtree_.insert(extent, feature);
} }
} else { } else {
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
this.featuresRtree_.update(extent, feature); this.featuresRtree_.update(extent, feature);
} }
} }
@@ -805,7 +805,7 @@ ol.source.Vector.prototype.removeFeature = function(feature) {
if (featureKey in this.nullGeometryFeatures_) { if (featureKey in this.nullGeometryFeatures_) {
delete this.nullGeometryFeatures_[featureKey]; delete this.nullGeometryFeatures_[featureKey];
} else { } else {
if (!goog.isNull(this.featuresRtree_)) { if (this.featuresRtree_) {
this.featuresRtree_.remove(feature); this.featuresRtree_.remove(feature);
} }
} }
+6 -8
View File
@@ -154,7 +154,7 @@ ol.source.WMTS = function(options) {
* @return {string|undefined} Tile URL. * @return {string|undefined} Tile URL.
*/ */
function(tileCoord, pixelRatio, projection) { function(tileCoord, pixelRatio, projection) {
if (goog.isNull(tileCoord)) { if (!tileCoord) {
return undefined; return undefined;
} else { } else {
var localContext = { var localContext = {
@@ -341,15 +341,14 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
/* jshint -W069 */ /* jshint -W069 */
// TODO: add support for TileMatrixLimits // TODO: add support for TileMatrixLimits
goog.asserts.assert(!goog.isNull(config['layer']), goog.asserts.assert(config['layer'],
'config "layer" must not be null'); 'config "layer" must not be null');
var layers = wmtsCap['Contents']['Layer']; var layers = wmtsCap['Contents']['Layer'];
var l = goog.array.find(layers, function(elt, index, array) { var l = goog.array.find(layers, function(elt, index, array) {
return elt['Identifier'] == config['layer']; return elt['Identifier'] == config['layer'];
}); });
goog.asserts.assert(!goog.isNull(l), goog.asserts.assert(l, 'found a matching layer in Contents/Layer');
'found a matching layer in Contents/Layer');
goog.asserts.assert(l['TileMatrixSetLink'].length > 0, goog.asserts.assert(l['TileMatrixSetLink'].length > 0,
'layer has TileMatrixSetLink'); 'layer has TileMatrixSetLink');
@@ -381,8 +380,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
matrixSet = /** @type {string} */ matrixSet = /** @type {string} */
(l['TileMatrixSetLink'][idx]['TileMatrixSet']); (l['TileMatrixSetLink'][idx]['TileMatrixSet']);
goog.asserts.assert(!goog.isNull(matrixSet), goog.asserts.assert(matrixSet, 'TileMatrixSet must not be null');
'TileMatrixSet must not be null');
var format = /** @type {string} */ (l['Format'][0]); var format = /** @type {string} */ (l['Format'][0]);
if ('format' in config) { if ('format' in config) {
@@ -420,7 +418,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var matrixSetObj = goog.array.find(matrixSets, function(elt, index, array) { var matrixSetObj = goog.array.find(matrixSets, function(elt, index, array) {
return elt['Identifier'] == matrixSet; return elt['Identifier'] == matrixSet;
}); });
goog.asserts.assert(!goog.isNull(matrixSetObj), goog.asserts.assert(matrixSetObj,
'found matrixSet in Contents/TileMatrixSet'); 'found matrixSet in Contents/TileMatrixSet');
var projection; var projection;
@@ -440,7 +438,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
extent = ol.proj.transformExtent( extent = ol.proj.transformExtent(
wgs84BoundingBox, 'EPSG:4326', projection); wgs84BoundingBox, 'EPSG:4326', projection);
var projectionExtent = projection.getExtent(); var projectionExtent = projection.getExtent();
if (!goog.isNull(projectionExtent)) { if (projectionExtent) {
// If possible, do a sanity check on the extent - it should never be // If possible, do a sanity check on the extent - it should never be
// bigger than the validity extent of the projection of a matrix set. // bigger than the validity extent of the projection of a matrix set.
if (!ol.extent.containsExtent(projectionExtent, extent)) { if (!ol.extent.containsExtent(projectionExtent, extent)) {
+1 -1
View File
@@ -104,7 +104,7 @@ ol.source.Zoomify = function(opt_options) {
* @return {string|undefined} Tile URL. * @return {string|undefined} Tile URL.
*/ */
function tileUrlFunction(tileCoord, pixelRatio, projection) { function tileUrlFunction(tileCoord, pixelRatio, projection) {
if (goog.isNull(tileCoord)) { if (!tileCoord) {
return undefined; return undefined;
} else { } else {
var tileCoordZ = tileCoord[0]; var tileCoordZ = tileCoord[0];