Give method a better name and add docs
This commit is contained in:
@@ -6684,6 +6684,37 @@ olx.source.VectorOptions.prototype.format;
|
|||||||
* The loader function used to load features, from a remote source for example.
|
* The loader function used to load features, from a remote source for example.
|
||||||
* If this is not set and `url` is set, the source will create and use an XHR
|
* If this is not set and `url` is set, the source will create and use an XHR
|
||||||
* feature loader.
|
* feature loader.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* var vectorSource = new ol.source.Vector({
|
||||||
|
* format: new ol.format.GeoJSON(),
|
||||||
|
* loader: function(extent, resolution, projection) {
|
||||||
|
* var proj = projection.getCode();
|
||||||
|
* var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +
|
||||||
|
* 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
|
||||||
|
* 'outputFormat=application/json&srsname=' + proj + '&' +
|
||||||
|
* 'bbox=' + extent.join(',') + ',' + proj;
|
||||||
|
* var xhr = new XMLHttpRequest();
|
||||||
|
* xhr.open('GET', url);
|
||||||
|
* var onError = function() {
|
||||||
|
* vectorSource.removeLoadedExtent(extent);
|
||||||
|
* }
|
||||||
|
* xhr.onerror = onError;
|
||||||
|
* xhr.onload = function() {
|
||||||
|
* if (xhr.status == 200) {
|
||||||
|
* vectorSource.addFeatures(
|
||||||
|
* vectorSource.getFormat().readFeatures(xhr.responseText));
|
||||||
|
* } else {
|
||||||
|
* onError();
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* xhr.send();
|
||||||
|
* },
|
||||||
|
* strategy: ol.loadingstrategy.bbox
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
* @type {ol.FeatureLoader|undefined}
|
* @type {ol.FeatureLoader|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -763,12 +763,11 @@ ol.source.Vector.prototype.loadFeatures = function(
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the current extent from the list of loaded extent.
|
* Remove an extent from the list of loaded extents.
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.source.Vector.prototype.removeFromLoadedExtent = function(
|
ol.source.Vector.prototype.removeLoadedExtent = function(extent) {
|
||||||
extent) {
|
|
||||||
var loadedExtentsRtree = this.loadedExtentsRtree_;
|
var loadedExtentsRtree = this.loadedExtentsRtree_;
|
||||||
var obj;
|
var obj;
|
||||||
loadedExtentsRtree.forEachInExtent(extent, function(object) {
|
loadedExtentsRtree.forEachInExtent(extent, function(object) {
|
||||||
|
|||||||
Reference in New Issue
Block a user