the Tile constructor now takes a url as the first arg

This commit is contained in:
Éric Lemoine
2012-06-20 08:47:17 +02:00
parent 84d594cacb
commit 8d74113897

View File

@@ -3,8 +3,15 @@ goog.provide('ol.Tile');
/** /**
* The Tile class. * The Tile class.
* @constructor * @constructor
* @param {string} url
*/ */
ol.Tile = function() { ol.Tile = function(url) {
/**
* @private
* @type {string}
*/
this.url_ = url;
/** /**
* @private * @private
@@ -14,25 +21,22 @@ ol.Tile = function() {
}; };
/** /**
* Load the tile for a given URL. * Load the tile.
* @param {string} src The src URL.
*/ */
ol.Tile.prototype.load = function(src) { ol.Tile.prototype.load = function() {
this.setImgSrc(src); this.img_.src = this.url_;
}; };
/** /**
* Set the image src. * Get the tile url.
* @param {string|undefined} src The src URL. * @return {string}
* @return {ol.Tile}
*/ */
ol.Tile.prototype.setImgSrc = function(src) { ol.Tile.prototype.getUrl = function() {
this.img_.src = src; return this.url_;
return this;
}; };
/** /**
* Get the image node. * Get the tile image.
* @return {Element} * @return {Element}
*/ */
ol.Tile.prototype.getImg = function() { ol.Tile.prototype.getImg = function() {
@@ -41,7 +45,7 @@ ol.Tile.prototype.getImg = function() {
/** /**
* Create an image node. This is done by cloning * Create an image node. This is done by cloning
* an image template. * the same image element.
* @return {Element} * @return {Element}
*/ */
ol.Tile.createImage = (function() { ol.Tile.createImage = (function() {