Remove goog.isNull in tilegrid class

This commit is contained in:
Marc Jansen
2015-09-29 15:26:16 +02:00
parent 369f5a6171
commit 7d110c829f

View File

@@ -73,13 +73,13 @@ ol.tilegrid.TileGrid = function(options) {
var extent = options.extent;
if (extent !== undefined &&
goog.isNull(this.origin_) && goog.isNull(this.origins_)) {
!this.origin_ && !this.origins_) {
this.origin_ = ol.extent.getTopLeft(extent);
}
goog.asserts.assert(
(goog.isNull(this.origin_) && !goog.isNull(this.origins_)) ||
(!goog.isNull(this.origin_) && goog.isNull(this.origins_)),
(!this.origin_ && this.origins_) ||
(this.origin_ && !this.origins_),
'either origin or origins must be configured, never both');
/**
@@ -99,10 +99,10 @@ ol.tilegrid.TileGrid = function(options) {
*/
this.tileSize_ = options.tileSize !== undefined ?
options.tileSize :
goog.isNull(this.tileSizes_) ? ol.DEFAULT_TILE_SIZE : null;
!this.tileSizes_ ? ol.DEFAULT_TILE_SIZE : null;
goog.asserts.assert(
(goog.isNull(this.tileSize_) && !goog.isNull(this.tileSizes_)) ||
(!goog.isNull(this.tileSize_) && goog.isNull(this.tileSizes_)),
(!this.tileSize_ && this.tileSizes_) ||
(this.tileSize_ && !this.tileSizes_),
'either tileSize or tileSizes must be configured, never both');
/**
@@ -214,10 +214,10 @@ ol.tilegrid.TileGrid.prototype.getMinZoom = function() {
* @api stable
*/
ol.tilegrid.TileGrid.prototype.getOrigin = function(z) {
if (!goog.isNull(this.origin_)) {
if (this.origin_) {
return this.origin_;
} else {
goog.asserts.assert(!goog.isNull(this.origins_),
goog.asserts.assert(this.origins_,
'origins cannot be null if origin is null');
goog.asserts.assert(this.minZoom <= z && z <= this.maxZoom,
'given z is not in allowed range (%s <= %s <= %s)',
@@ -448,10 +448,10 @@ ol.tilegrid.TileGrid.prototype.getTileCoordResolution = function(tileCoord) {
* @api stable
*/
ol.tilegrid.TileGrid.prototype.getTileSize = function(z) {
if (!goog.isNull(this.tileSize_)) {
if (this.tileSize_) {
return this.tileSize_;
} else {
goog.asserts.assert(!goog.isNull(this.tileSizes_),
goog.asserts.assert(this.tileSizes_,
'tileSizes cannot be null if tileSize is null');
goog.asserts.assert(this.minZoom <= z && z <= this.maxZoom,
'z is not in allowed range (%s <= %s <= %s',
@@ -466,7 +466,7 @@ ol.tilegrid.TileGrid.prototype.getTileSize = function(z) {
* @return {ol.TileRange} Extent tile range for the specified zoom level.
*/
ol.tilegrid.TileGrid.prototype.getFullTileRange = function(z) {
if (goog.isNull(this.fullTileRanges_)) {
if (!this.fullTileRanges_) {
return null;
} else {
goog.asserts.assert(this.minZoom <= z && z <= this.maxZoom,
@@ -507,7 +507,7 @@ ol.tilegrid.TileGrid.prototype.calculateTileRanges_ = function(extent) {
*/
ol.tilegrid.getForProjection = function(projection) {
var tileGrid = projection.getDefaultTileGrid();
if (goog.isNull(tileGrid)) {
if (!tileGrid) {
tileGrid = ol.tilegrid.createForProjection(projection);
projection.setDefaultTileGrid(tileGrid);
}
@@ -620,7 +620,7 @@ ol.tilegrid.createForProjection =
ol.tilegrid.extentFromProjection = function(projection) {
projection = ol.proj.get(projection);
var extent = projection.getExtent();
if (goog.isNull(extent)) {
if (!extent) {
var half = 180 * ol.proj.METERS_PER_UNIT[ol.proj.Units.DEGREES] /
projection.getMetersPerUnit();
extent = ol.extent.createOrUpdate(-half, -half, half, half);