diff --git a/src/all.js b/src/all.js index 8885885b62..f28582c646 100644 --- a/src/all.js +++ b/src/all.js @@ -11,6 +11,7 @@ goog.require('ol.Projection'); goog.require('ol.TileBounds'); goog.require('ol.TileCoord'); goog.require('ol.TileGrid'); +goog.require('ol.TileLayer'); goog.require('ol.TileUrlFunction'); goog.require('ol.TileUrlFunctionType'); goog.require('ol.TransformFunction'); diff --git a/src/ol/tilelayer.js b/src/ol/tilelayer.js new file mode 100644 index 0000000000..56ce521939 --- /dev/null +++ b/src/ol/tilelayer.js @@ -0,0 +1,51 @@ +goog.provide('ol.TileLayer'); + +goog.require('ol.Layer'); +goog.require('ol.TileCoord'); +goog.require('ol.TileGrid'); +goog.require('ol.TileUrlFunctionType'); + + + +/** + * @constructor + * @extends {ol.Layer} + * @param {ol.TileGrid} tileGrid Tile grid. + * @param {ol.TileUrlFunctionType} tileUrlFunction Tile URL. + */ +ol.TileLayer = function(tileGrid, tileUrlFunction) { + + goog.base(this); + + /** + * @private + * @type {ol.TileGrid} + */ + this.tileGrid_ = tileGrid; + + /** + * @private + * @type {ol.TileUrlFunctionType} + */ + this.tileUrlFunction_ = tileUrlFunction; + +}; +goog.inherits(ol.TileLayer, ol.Layer); + + +/** + * @param {ol.TileCoord} tileCoord Tile coordinate. + * @return {string} Tile coord URL. + */ +ol.TileLayer.prototype.getTileCoordUrl = function(tileCoord) { + // FIXME maybe wrap x and y + return this.tileUrlFunction_(tileCoord); +}; + + +/** + * @return {ol.TileGrid} Tile grid. + */ +ol.TileLayer.prototype.getTileGrid = function() { + return this.tileGrid_; +};