Shorter module paths for default exports
This commit is contained in:
@@ -37,10 +37,10 @@ import RBush from '../structs/RBush.js';
|
||||
* type.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {module:ol/events/Event~Event}
|
||||
* @extends {module:ol/events/Event}
|
||||
* @implements {oli.source.Vector.Event}
|
||||
* @param {string} type Type.
|
||||
* @param {module:ol/Feature~Feature=} opt_feature Feature.
|
||||
* @param {module:ol/Feature=} opt_feature Feature.
|
||||
*/
|
||||
export const VectorSourceEvent = function(type, opt_feature) {
|
||||
|
||||
@@ -48,7 +48,7 @@ export const VectorSourceEvent = function(type, opt_feature) {
|
||||
|
||||
/**
|
||||
* The feature being added or removed.
|
||||
* @type {module:ol/Feature~Feature|undefined}
|
||||
* @type {module:ol/Feature|undefined}
|
||||
* @api
|
||||
*/
|
||||
this.feature = opt_feature;
|
||||
@@ -60,10 +60,10 @@ inherits(VectorSourceEvent, Event);
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {Array.<module:ol/Feature~Feature>|module:ol/Collection~Collection.<module:ol/Feature~Feature>} [features]
|
||||
* Features. If provided as {@link module:ol/Collection~Collection}, the features in the source
|
||||
* @property {Array.<module:ol/Feature>|module:ol/Collection.<module:ol/Feature>} [features]
|
||||
* Features. If provided as {@link module:ol/Collection}, the features in the source
|
||||
* and the collection will stay in sync.
|
||||
* @property {module:ol/format/Feature~FeatureFormat} [format] The feature format used by the XHR
|
||||
* @property {module:ol/format/Feature} [format] The feature format used by the XHR
|
||||
* feature loader when `url` is set. Required if `url` is set, otherwise ignored.
|
||||
* @property {module:ol/Feature~FeatureLoader} [loader]
|
||||
* The loader function used to load features, from a remote source for example.
|
||||
@@ -135,7 +135,7 @@ inherits(VectorSourceEvent, Event);
|
||||
* through all features.
|
||||
*
|
||||
* When set to `false`, the features will be maintained in an
|
||||
* {@link module:ol/Collection~Collection}, which can be retrieved through
|
||||
* {@link module:ol/Collection}, which can be retrieved through
|
||||
* {@link module:ol/source/Vector~VectorSource#getFeaturesCollection}.
|
||||
* @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the
|
||||
* -180° and 180° meridians to work properly, this should be set to `false`. The
|
||||
@@ -150,7 +150,7 @@ inherits(VectorSourceEvent, Event);
|
||||
* vector data that is optimized for rendering.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {module:ol/source/Source~Source}
|
||||
* @extends {module:ol/source/Source}
|
||||
* @fires ol.source.Vector.Event
|
||||
* @param {module:ol/source/Vector~Options=} opt_options Vector source options.
|
||||
* @api
|
||||
@@ -174,7 +174,7 @@ const VectorSource = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/format/Feature~FeatureFormat|undefined}
|
||||
* @type {module:ol/format/Feature|undefined}
|
||||
*/
|
||||
this.format_ = options.format;
|
||||
|
||||
@@ -195,7 +195,7 @@ const VectorSource = function(opt_options) {
|
||||
} else if (this.url_ !== undefined) {
|
||||
assert(this.format_, 7); // `format` must be set when `url` is set
|
||||
// create a XHR feature loader for "url" and "format"
|
||||
this.loader_ = xhr(this.url_, /** @type {module:ol/format/Feature~FeatureFormat} */ (this.format_));
|
||||
this.loader_ = xhr(this.url_, /** @type {module:ol/format/Feature} */ (this.format_));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,7 +209,7 @@ const VectorSource = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.structs.RBush.<module:ol/Feature~Feature>}
|
||||
* @type {ol.structs.RBush.<module:ol/Feature>}
|
||||
*/
|
||||
this.featuresRtree_ = useSpatialIndex ? new RBush() : null;
|
||||
|
||||
@@ -221,21 +221,21 @@ const VectorSource = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object.<string, module:ol/Feature~Feature>}
|
||||
* @type {!Object.<string, module:ol/Feature>}
|
||||
*/
|
||||
this.nullGeometryFeatures_ = {};
|
||||
|
||||
/**
|
||||
* A lookup of features by id (the return from feature.getId()).
|
||||
* @private
|
||||
* @type {!Object.<string, module:ol/Feature~Feature>}
|
||||
* @type {!Object.<string, module:ol/Feature>}
|
||||
*/
|
||||
this.idIndex_ = {};
|
||||
|
||||
/**
|
||||
* A lookup of features without id (keyed by ol.getUid(feature)).
|
||||
* @private
|
||||
* @type {!Object.<string, module:ol/Feature~Feature>}
|
||||
* @type {!Object.<string, module:ol/Feature>}
|
||||
*/
|
||||
this.undefIdIndex_ = {};
|
||||
|
||||
@@ -247,7 +247,7 @@ const VectorSource = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/Collection~Collection.<module:ol/Feature~Feature>}
|
||||
* @type {module:ol/Collection.<module:ol/Feature>}
|
||||
*/
|
||||
this.featuresCollection_ = null;
|
||||
|
||||
@@ -279,7 +279,7 @@ inherits(VectorSource, Source);
|
||||
* instead. A feature will not be added to the source if feature with
|
||||
* the same id is already there. The reason for this behavior is to avoid
|
||||
* feature duplication when using bbox or tile loading strategies.
|
||||
* @param {module:ol/Feature~Feature} feature Feature to add.
|
||||
* @param {module:ol/Feature} feature Feature to add.
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.addFeature = function(feature) {
|
||||
@@ -290,7 +290,7 @@ VectorSource.prototype.addFeature = function(feature) {
|
||||
|
||||
/**
|
||||
* Add a feature without firing a `change` event.
|
||||
* @param {module:ol/Feature~Feature} feature Feature.
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @protected
|
||||
*/
|
||||
VectorSource.prototype.addFeatureInternal = function(feature) {
|
||||
@@ -319,7 +319,7 @@ VectorSource.prototype.addFeatureInternal = function(feature) {
|
||||
|
||||
/**
|
||||
* @param {string} featureKey Unique identifier for the feature.
|
||||
* @param {module:ol/Feature~Feature} feature The feature.
|
||||
* @param {module:ol/Feature} feature The feature.
|
||||
* @private
|
||||
*/
|
||||
VectorSource.prototype.setupChangeEvents_ = function(featureKey, feature) {
|
||||
@@ -334,7 +334,7 @@ VectorSource.prototype.setupChangeEvents_ = function(featureKey, feature) {
|
||||
|
||||
/**
|
||||
* @param {string} featureKey Unique identifier for the feature.
|
||||
* @param {module:ol/Feature~Feature} feature The feature.
|
||||
* @param {module:ol/Feature} feature The feature.
|
||||
* @return {boolean} The feature is "valid", in the sense that it is also a
|
||||
* candidate for insertion into the Rtree.
|
||||
* @private
|
||||
@@ -359,7 +359,7 @@ VectorSource.prototype.addToIndex_ = function(featureKey, feature) {
|
||||
|
||||
/**
|
||||
* Add a batch of features to the source.
|
||||
* @param {Array.<module:ol/Feature~Feature>} features Features to add.
|
||||
* @param {Array.<module:ol/Feature>} features Features to add.
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.addFeatures = function(features) {
|
||||
@@ -370,7 +370,7 @@ VectorSource.prototype.addFeatures = function(features) {
|
||||
|
||||
/**
|
||||
* Add features without firing a `change` event.
|
||||
* @param {Array.<module:ol/Feature~Feature>} features Features.
|
||||
* @param {Array.<module:ol/Feature>} features Features.
|
||||
* @protected
|
||||
*/
|
||||
VectorSource.prototype.addFeaturesInternal = function(features) {
|
||||
@@ -411,7 +411,7 @@ VectorSource.prototype.addFeaturesInternal = function(features) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {!module:ol/Collection~Collection.<module:ol/Feature~Feature>} collection Collection.
|
||||
* @param {!module:ol/Collection.<module:ol/Feature>} collection Collection.
|
||||
* @private
|
||||
*/
|
||||
VectorSource.prototype.bindFeaturesCollection_ = function(collection) {
|
||||
@@ -436,7 +436,7 @@ VectorSource.prototype.bindFeaturesCollection_ = function(collection) {
|
||||
function(evt) {
|
||||
if (!modifyingCollection) {
|
||||
modifyingCollection = true;
|
||||
this.addFeature(/** @type {module:ol/Feature~Feature} */ (evt.element));
|
||||
this.addFeature(/** @type {module:ol/Feature} */ (evt.element));
|
||||
modifyingCollection = false;
|
||||
}
|
||||
}, this);
|
||||
@@ -444,7 +444,7 @@ VectorSource.prototype.bindFeaturesCollection_ = function(collection) {
|
||||
function(evt) {
|
||||
if (!modifyingCollection) {
|
||||
modifyingCollection = true;
|
||||
this.removeFeature(/** @type {module:ol/Feature~Feature} */ (evt.element));
|
||||
this.removeFeature(/** @type {module:ol/Feature} */ (evt.element));
|
||||
modifyingCollection = false;
|
||||
}
|
||||
}, this);
|
||||
@@ -498,7 +498,7 @@ VectorSource.prototype.clear = function(opt_fast) {
|
||||
* stop and the function will return the same value.
|
||||
* Note: this function only iterate through the feature that have a defined geometry.
|
||||
*
|
||||
* @param {function(module:ol/Feature~Feature): T} callback Called with each feature
|
||||
* @param {function(module:ol/Feature): T} callback Called with each feature
|
||||
* on the source. Return a truthy value to stop iteration.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
@@ -520,7 +520,7 @@ VectorSource.prototype.forEachFeature = function(callback) {
|
||||
* value.
|
||||
*
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {function(module:ol/Feature~Feature): T} callback Called with each feature
|
||||
* @param {function(module:ol/Feature): T} callback Called with each feature
|
||||
* whose goemetry contains the provided coordinate.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
@@ -552,7 +552,7 @@ VectorSource.prototype.forEachFeatureAtCoordinateDirect = function(coordinate, c
|
||||
* features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature}.
|
||||
*
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {function(module:ol/Feature~Feature): T} callback Called with each feature
|
||||
* @param {function(module:ol/Feature): T} callback Called with each feature
|
||||
* whose bounding box intersects the provided extent.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
@@ -577,7 +577,7 @@ VectorSource.prototype.forEachFeatureInExtent = function(extent, callback) {
|
||||
* source.forEachFeatureInExtent()} method instead.
|
||||
*
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {function(module:ol/Feature~Feature): T} callback Called with each feature
|
||||
* @param {function(module:ol/Feature): T} callback Called with each feature
|
||||
* whose geometry intersects the provided extent.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
@@ -586,7 +586,7 @@ VectorSource.prototype.forEachFeatureInExtent = function(extent, callback) {
|
||||
VectorSource.prototype.forEachFeatureIntersectingExtent = function(extent, callback) {
|
||||
return this.forEachFeatureInExtent(extent,
|
||||
/**
|
||||
* @param {module:ol/Feature~Feature} feature Feature.
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @return {T|undefined} The return value from the last call to the callback.
|
||||
* @template T
|
||||
*/
|
||||
@@ -605,8 +605,8 @@ VectorSource.prototype.forEachFeatureIntersectingExtent = function(extent, callb
|
||||
/**
|
||||
* Get the features collection associated with this source. Will be `null`
|
||||
* unless the source was configured with `useSpatialIndex` set to `false`, or
|
||||
* with an {@link module:ol/Collection~Collection} as `features`.
|
||||
* @return {module:ol/Collection~Collection.<module:ol/Feature~Feature>} The collection of features.
|
||||
* with an {@link module:ol/Collection} as `features`.
|
||||
* @return {module:ol/Collection.<module:ol/Feature>} The collection of features.
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.getFeaturesCollection = function() {
|
||||
@@ -616,7 +616,7 @@ VectorSource.prototype.getFeaturesCollection = function() {
|
||||
|
||||
/**
|
||||
* Get all features on the source in random order.
|
||||
* @return {Array.<module:ol/Feature~Feature>} Features.
|
||||
* @return {Array.<module:ol/Feature>} Features.
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.getFeatures = function() {
|
||||
@@ -629,14 +629,16 @@ VectorSource.prototype.getFeatures = function() {
|
||||
extend(features, getValues(this.nullGeometryFeatures_));
|
||||
}
|
||||
}
|
||||
return /** @type {Array.<module:ol/Feature~Feature>} */ (features);
|
||||
return (
|
||||
/** @type {Array.<module:ol/Feature>} */ (features)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get all features whose geometry intersects the provided coordinate.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @return {Array.<module:ol/Feature~Feature>} Features.
|
||||
* @return {Array.<module:ol/Feature>} Features.
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.getFeaturesAtCoordinate = function(coordinate) {
|
||||
@@ -656,7 +658,7 @@ VectorSource.prototype.getFeaturesAtCoordinate = function(coordinate) {
|
||||
* This method is not available when the source is configured with
|
||||
* `useSpatialIndex` set to `false`.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @return {Array.<module:ol/Feature~Feature>} Features.
|
||||
* @return {Array.<module:ol/Feature>} Features.
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.getFeaturesInExtent = function(extent) {
|
||||
@@ -670,10 +672,10 @@ VectorSource.prototype.getFeaturesInExtent = function(extent) {
|
||||
* This method is not available when the source is configured with
|
||||
* `useSpatialIndex` set to `false`.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {function(module:ol/Feature~Feature):boolean=} opt_filter Feature filter function.
|
||||
* The filter function will receive one argument, the {@link module:ol/Feature~Feature feature}
|
||||
* @param {function(module:ol/Feature):boolean=} opt_filter Feature filter function.
|
||||
* The filter function will receive one argument, the {@link module:ol/Feature feature}
|
||||
* and it should return a boolean value. By default, no filtering is made.
|
||||
* @return {module:ol/Feature~Feature} Closest feature.
|
||||
* @return {module:ol/Feature} Closest feature.
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.getClosestFeatureToCoordinate = function(coordinate, opt_filter) {
|
||||
@@ -693,8 +695,8 @@ VectorSource.prototype.getClosestFeatureToCoordinate = function(coordinate, opt_
|
||||
const filter = opt_filter ? opt_filter : TRUE;
|
||||
this.featuresRtree_.forEachInExtent(extent,
|
||||
/**
|
||||
* @param {module:ol/Feature~Feature} feature Feature.
|
||||
*/
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
*/
|
||||
function(feature) {
|
||||
if (filter(feature)) {
|
||||
const geometry = feature.getGeometry();
|
||||
@@ -740,7 +742,7 @@ VectorSource.prototype.getExtent = function(opt_extent) {
|
||||
* `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.
|
||||
*
|
||||
* @param {string|number} id Feature identifier.
|
||||
* @return {module:ol/Feature~Feature} The feature (or `null` if not found).
|
||||
* @return {module:ol/Feature} The feature (or `null` if not found).
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.getFeatureById = function(id) {
|
||||
@@ -752,7 +754,7 @@ VectorSource.prototype.getFeatureById = function(id) {
|
||||
/**
|
||||
* Get the format associated with this source.
|
||||
*
|
||||
* @return {module:ol/format/Feature~FeatureFormat|undefined} The feature format.
|
||||
* @return {module:ol/format/Feature|undefined} The feature format.
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.getFormat = function() {
|
||||
@@ -786,11 +788,11 @@ VectorSource.prototype.getUrl = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/events/Event~Event} event Event.
|
||||
* @param {module:ol/events/Event} event Event.
|
||||
* @private
|
||||
*/
|
||||
VectorSource.prototype.handleFeatureChange_ = function(event) {
|
||||
const feature = /** @type {module:ol/Feature~Feature} */ (event.target);
|
||||
const feature = /** @type {module:ol/Feature} */ (event.target);
|
||||
const featureKey = getUid(feature).toString();
|
||||
const geometry = feature.getGeometry();
|
||||
if (!geometry) {
|
||||
@@ -863,7 +865,7 @@ VectorSource.prototype.isEmpty = function() {
|
||||
/**
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {module:ol/proj/Projection~Projection} projection Projection.
|
||||
* @param {module:ol/proj/Projection} projection Projection.
|
||||
*/
|
||||
VectorSource.prototype.loadFeatures = function(extent, resolution, projection) {
|
||||
const loadedExtentsRtree = this.loadedExtentsRtree_;
|
||||
@@ -910,7 +912,7 @@ VectorSource.prototype.removeLoadedExtent = function(extent) {
|
||||
* Remove a single feature from the source. If you want to remove all features
|
||||
* at once, use the {@link module:ol/source/Vector~VectorSource#clear source.clear()} method
|
||||
* instead.
|
||||
* @param {module:ol/Feature~Feature} feature Feature to remove.
|
||||
* @param {module:ol/Feature} feature Feature to remove.
|
||||
* @api
|
||||
*/
|
||||
VectorSource.prototype.removeFeature = function(feature) {
|
||||
@@ -929,7 +931,7 @@ VectorSource.prototype.removeFeature = function(feature) {
|
||||
|
||||
/**
|
||||
* Remove feature without firing a `change` event.
|
||||
* @param {module:ol/Feature~Feature} feature Feature.
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @protected
|
||||
*/
|
||||
VectorSource.prototype.removeFeatureInternal = function(feature) {
|
||||
@@ -950,7 +952,7 @@ VectorSource.prototype.removeFeatureInternal = function(feature) {
|
||||
/**
|
||||
* Remove a feature from the id index. Called internally when the feature id
|
||||
* may have changed.
|
||||
* @param {module:ol/Feature~Feature} feature The feature.
|
||||
* @param {module:ol/Feature} feature The feature.
|
||||
* @return {boolean} Removed the feature from the index.
|
||||
* @private
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user