Add ol.TileBounds.getSize
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
goog.provide('ol.TileBounds');
|
goog.provide('ol.TileBounds');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
|
goog.require('goog.math.Size');
|
||||||
goog.require('ol.Rectangle');
|
goog.require('ol.Rectangle');
|
||||||
goog.require('ol.TileCoord');
|
goog.require('ol.TileCoord');
|
||||||
|
|
||||||
@@ -71,3 +72,12 @@ ol.TileBounds.prototype.forEachTileCoord = function(z, f, opt_obj) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {goog.math.Size} Size.
|
||||||
|
*/
|
||||||
|
ol.TileBounds.prototype.getSize = function() {
|
||||||
|
return new goog.math.Size(
|
||||||
|
this.maxX - this.minX + 1, this.maxY - this.minY + 1);
|
||||||
|
};
|
||||||
|
|||||||
@@ -76,3 +76,11 @@ function testForEachTileCoord() {
|
|||||||
assertEquals(3, tileCoords[3].y);
|
assertEquals(3, tileCoords[3].y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function testSize() {
|
||||||
|
var tileBounds = new ol.TileBounds(0, 1, 2, 4);
|
||||||
|
var size = tileBounds.getSize();
|
||||||
|
assertEquals(3, size.width);
|
||||||
|
assertEquals(4, size.height);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user