Remove usage of various goog.* functions

goog.isNull, goog.isDefAndNotNull and goog.array.*
This commit is contained in:
Petr Sloup
2015-10-14 11:06:19 +02:00
parent f3d5d16a82
commit 8fb1d1f244
7 changed files with 68 additions and 68 deletions
+4 -4
View File
@@ -110,15 +110,15 @@ ol.source.Image.prototype.getImage =
function(extent, resolution, pixelRatio, projection) {
var sourceProjection = this.getProjection();
if (!ol.ENABLE_RASTER_REPROJECTION ||
!goog.isDefAndNotNull(sourceProjection) ||
!goog.isDefAndNotNull(projection) ||
!sourceProjection ||
!projection ||
ol.proj.equivalent(sourceProjection, projection)) {
if (!goog.isNull(sourceProjection)) {
if (sourceProjection) {
projection = sourceProjection;
}
return this.getImageInternal(extent, resolution, pixelRatio, projection);
} else {
if (!goog.isNull(this.reprojectedImage_)) {
if (this.reprojectedImage_) {
if (this.reprojectedRevision_ == this.getRevision() &&
ol.proj.equivalent(
this.reprojectedImage_.getProjection(), projection) &&
+7 -7
View File
@@ -152,8 +152,8 @@ ol.source.TileImage.prototype.getTileGridForProjection = function(projection) {
return goog.base(this, 'getTileGridForProjection', projection);
}
var thisProj = this.getProjection();
if (!goog.isNull(this.tileGrid) &&
(goog.isNull(thisProj) || ol.proj.equivalent(thisProj, projection))) {
if (this.tileGrid &&
(!thisProj || ol.proj.equivalent(thisProj, projection))) {
return this.tileGrid;
} else {
var projKey = goog.getUid(projection).toString();
@@ -174,7 +174,7 @@ ol.source.TileImage.prototype.getTileCacheForProjection = function(projection) {
return goog.base(this, 'getTileCacheForProjection', projection);
}
var thisProj = this.getProjection();
if (goog.isNull(thisProj) || ol.proj.equivalent(thisProj, projection)) {
if (!thisProj || ol.proj.equivalent(thisProj, projection)) {
return this.tileCache;
} else {
var projKey = goog.getUid(projection).toString();
@@ -192,8 +192,8 @@ ol.source.TileImage.prototype.getTileCacheForProjection = function(projection) {
ol.source.TileImage.prototype.getTile =
function(z, x, y, pixelRatio, projection) {
if (!ol.ENABLE_RASTER_REPROJECTION ||
!goog.isDefAndNotNull(this.getProjection()) ||
!goog.isDefAndNotNull(projection) ||
!this.getProjection() ||
!projection ||
ol.proj.equivalent(this.getProjection(), projection)) {
return this.getTileInternal(z, x, y, pixelRatio, projection);
} else {
@@ -335,7 +335,7 @@ ol.source.TileImage.prototype.setTileGridForProjection =
function(projection, tilegrid) {
if (ol.ENABLE_RASTER_REPROJECTION) {
var proj = ol.proj.get(projection);
if (!goog.isNull(proj)) {
if (proj) {
var projKey = goog.getUid(proj).toString();
if (!(projKey in this.tileGridForProjection)) {
this.tileGridForProjection[projKey] = tilegrid;
@@ -380,7 +380,7 @@ ol.source.TileImage.prototype.setTileUrlFunction = function(tileUrlFunction) {
ol.source.TileImage.prototype.useTile = function(z, x, y, projection) {
var tileCache = this.getTileCacheForProjection(projection);
var tileCoordKey = this.getKeyZXY(z, x, y);
if (!goog.isNull(tileCache) && tileCache.containsKey(tileCoordKey)) {
if (tileCache && tileCache.containsKey(tileCoordKey)) {
tileCache.get(tileCoordKey);
}
};
+3 -3
View File
@@ -103,7 +103,7 @@ ol.source.Tile.prototype.canExpireCache = function() {
*/
ol.source.Tile.prototype.expireCache = function(projection, usedTiles) {
var tileCache = this.getTileCacheForProjection(projection);
if (!goog.isNull(tileCache)) {
if (tileCache) {
tileCache.expireCache(usedTiles);
}
};
@@ -121,7 +121,7 @@ ol.source.Tile.prototype.expireCache = function(projection, usedTiles) {
ol.source.Tile.prototype.forEachLoadedTile =
function(projection, z, tileRange, callback) {
var tileCache = this.getTileCacheForProjection(projection);
if (goog.isNull(tileCache)) {
if (!tileCache) {
return false;
}
@@ -222,7 +222,7 @@ ol.source.Tile.prototype.getTileGridForProjection = function(projection) {
*/
ol.source.Tile.prototype.getTileCacheForProjection = function(projection) {
var thisProj = this.getProjection();
if (!goog.isNull(thisProj) && !ol.proj.equivalent(thisProj, projection)) {
if (thisProj && !ol.proj.equivalent(thisProj, projection)) {
return null;
} else {
return this.tileCache;