diff --git a/src/ol.js b/src/ol.js index baa39356e7..29f3e4a655 100644 --- a/src/ol.js +++ b/src/ol.js @@ -3,3 +3,5 @@ goog.require('ol.bounds'); goog.require("ol.map"); goog.require("ol.loc"); goog.require("ol.projection"); + +goog.require("ol.Tile"); diff --git a/src/ol/Tile.js b/src/ol/Tile.js new file mode 100644 index 0000000000..ab192b74ba --- /dev/null +++ b/src/ol/Tile.js @@ -0,0 +1,50 @@ +goog.provide('ol.Tile'); + +/** + * @constructor + */ +ol.Tile = function() { + + /** + * @private + */ + this.img_ = ol.Tile.createImage(); +}; + +/** + * Load the tile for a given URL. + * @param {string} src The src URL. + */ +ol.Tile.prototype.load = function(src) { + this.setImgSrc(src); +}; + +/** + * Set the image src. + * @param {string|undefined} src The src URL. + * @return {ol.Tile} + */ +ol.Tile.prototype.setImgSrc = function(src) { + this.img_.src = src; + return this; +}; + +/** + * Get the image node. + * @return {Element} + */ +ol.Tile.prototype.getImg = function() { + return this.img_; +}; + +/** + * Create an image node. This is done by cloning + * an image template. + * @return {Element} + */ +ol.Tile.createImage = (function() { + var img = document.createElement("img"); + return function() { + return img.cloneNode(false); + }; +})(); diff --git a/test/index.html b/test/index.html index 20763998a8..d331119af3 100644 --- a/test/index.html +++ b/test/index.html @@ -16,6 +16,7 @@ +