From 4b605d40d9ed01abf0810c7ce4abbd4f40ddc598 Mon Sep 17 00:00:00 2001 From: Petr Sloup Date: Tue, 30 Sep 2014 11:43:24 +0200 Subject: [PATCH] getTemplate method to get the Mustache template from the TileJSON --- src/ol/source/tileutfgridsource.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ol/source/tileutfgridsource.js b/src/ol/source/tileutfgridsource.js index 058c8963cf..16d3caa068 100644 --- a/src/ol/source/tileutfgridsource.js +++ b/src/ol/source/tileutfgridsource.js @@ -51,6 +51,12 @@ ol.source.TileUTFGrid = function(options) { */ this.tileCache = new ol.TileCache(); + /** + * @private + * @type {string|undefined} + */ + this.template_ = undefined; + var request = new goog.net.Jsonp(options.url); request.send(undefined, goog.bind(this.handleTileJSONResponse, this)); }; @@ -73,6 +79,15 @@ ol.source.TileUTFGrid.prototype.expireCache = function(usedTiles) { }; +/** + * @return {string|undefined} The template from TileJSON. + * @api + */ +ol.source.TileUTFGrid.prototype.getTemplate = function() { + return this.template_; +}; + + /** * @param {ol.Coordinate} coordinate Coordinate. * @param {number} resolution Resolution. @@ -123,6 +138,8 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) { }); this.tileGrid = tileGrid; + this.template_ = tileJSON.template; + var grids = tileJSON.grids; if (!goog.isDefAndNotNull(grids)) { this.setState(ol.source.State.ERROR);