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