Merge pull request #5120 from ahocevar/utfgrid-config

Add tileJSON option to ol.source.TileUTFGrid
This commit is contained in:
Andreas Hocevar
2016-03-24 23:13:19 +01:00
2 changed files with 21 additions and 3 deletions

View File

@@ -4123,7 +4123,8 @@ olx.source.ClusterOptions.prototype.wrapX;
/**
* @typedef {{preemptive: (boolean|undefined),
* url: string}}
* tileJSON: (TileJSON|undefined),
* url: (string|undefined)}}
* @api
*/
olx.source.TileUTFGridOptions;
@@ -4143,7 +4144,18 @@ olx.source.TileUTFGridOptions.prototype.preemptive;
/**
* @type {string}
* TileJSON configuration for this source. If not provided, `url` must be
* configured.
* @type {TileJSON|undefined}
* @api
*/
olx.source.TileUTFGridOptions.prototype.tileJSON;
/**
* TileJSON endpoint that provides the configuration for this source. Request
* will be made through JSONP. If not provided, `tileJSON` must be configured.
* @type {string|undefined}
* @api
*/
olx.source.TileUTFGridOptions.prototype.url;

View File

@@ -49,7 +49,13 @@ ol.source.TileUTFGrid = function(options) {
*/
this.template_ = undefined;
ol.net.jsonp(options.url, this.handleTileJSONResponse.bind(this));
if (options.url) {
ol.net.jsonp(options.url, this.handleTileJSONResponse.bind(this));
} else if (options.tileJSON) {
this.handleTileJSONResponse(options.tileJSON);
} else {
goog.asserts.fail('Either url or tileJSON options must be provided');
}
};
goog.inherits(ol.source.TileUTFGrid, ol.source.Tile);