Add setUrl function and don't reset loaded extents in setLoader

This commit is contained in:
ahocevar
2019-02-20 21:48:08 +01:00
parent 1416a3d162
commit 94cd126189
4 changed files with 87 additions and 61 deletions

View File

@@ -985,16 +985,25 @@ class VectorSource extends Source {
/**
* Set the new loader of the source. The next loadFeatures call will use the
* Set the new loader of the source. The next render cycle will use the
* new loader.
* @param {import("../featureloader.js").FeatureLoader} loader The loader to set.
* @api
*/
setLoader(loader) {
this.loadedExtentsRtree_.clear();
this.loader_ = loader;
}
/**
* Points the source to a new url. The next render cycle will use the new url.
* @param {string|import("../featureloader.js").FeatureUrlFunction} url Url.
* @api
*/
setUrl(url) {
assert(this.format_, 7); // `format` must be set when `url` is set
this.setLoader(xhr(url, this.format_));
}
}