getTemplate method to get the Mustache template from the TileJSON
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user