Merge pull request #5120 from ahocevar/utfgrid-config
Add tileJSON option to ol.source.TileUTFGrid
This commit is contained in:
+14
-2
@@ -4123,7 +4123,8 @@ olx.source.ClusterOptions.prototype.wrapX;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{preemptive: (boolean|undefined),
|
* @typedef {{preemptive: (boolean|undefined),
|
||||||
* url: string}}
|
* tileJSON: (TileJSON|undefined),
|
||||||
|
* url: (string|undefined)}}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.source.TileUTFGridOptions;
|
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
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.source.TileUTFGridOptions.prototype.url;
|
olx.source.TileUTFGridOptions.prototype.url;
|
||||||
|
|||||||
@@ -49,7 +49,13 @@ ol.source.TileUTFGrid = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.template_ = undefined;
|
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);
|
goog.inherits(ol.source.TileUTFGrid, ol.source.Tile);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user