[ol.Tile] add ol.Tile.createConstructor and set width and height to the img archetype

This commit is contained in:
Éric Lemoine
2012-06-22 10:38:14 +02:00
parent 67ce7afe67
commit f7a956f404
4 changed files with 68 additions and 8 deletions
+8 -1
View File
@@ -1,6 +1,7 @@
goog.provide('ol.layer.TileLayer');
goog.require('ol.layer.Layer');
goog.require('ol.Tile');
goog.require('ol.TileCache');
/**
@@ -33,6 +34,12 @@ ol.layer.TileLayer = function() {
*/
this.tileHeight_ = 256;
/**
* @protected
* @type {function(new:ol.Tile, string, ol.Bounds)}
*/
this.Tile = ol.Tile.createConstructor(this.tileWidth_, this.tileHeight_);
/**
* @protected
* @type {number|undefined}
@@ -231,7 +238,7 @@ ol.layer.TileLayer.prototype.setResolutions = function(resolutions) {
ol.layer.TileLayer.prototype.getTile = function(url, bounds) {
var tile = this.cache_.get(url);
if (!goog.isDef(tile)) {
tile = new ol.Tile(url, bounds);
tile = new this.Tile(url, bounds);
this.cache_.set(tile.getUrl(), tile);
}
return tile;