Remove opt_ prefix

This commit is contained in:
Tim Schaub
2022-08-11 17:46:31 -06:00
committed by Tim Schaub
parent dd1edc37ca
commit 99612e7f9a
183 changed files with 1918 additions and 2079 deletions
+3 -3
View File
@@ -142,12 +142,12 @@ class Cluster extends VectorSource {
/**
* Remove all features from the source.
* @param {boolean} [opt_fast] Skip dispatching of {@link module:ol/source/VectorEventType~VectorEventType#removefeature} events.
* @param {boolean} [fast] Skip dispatching of {@link module:ol/source/VectorEventType~VectorEventType#removefeature} events.
* @api
*/
clear(opt_fast) {
clear(fast) {
this.features.length = 0;
super.clear(opt_fast);
super.clear(fast);
}
/**
+26 -26
View File
@@ -59,25 +59,25 @@ function formatPercentage(percentage) {
*/
class IIIF extends TileImage {
/**
* @param {Options} [opt_options] Tile source options. Use {@link import("../format/IIIFInfo.js").IIIFInfo}
* @param {Options} [options] Tile source options. Use {@link import("../format/IIIFInfo.js").IIIFInfo}
* to parse Image API service information responses into constructor options.
* @api
*/
constructor(opt_options) {
constructor(options) {
/**
* @type {Partial<Options>}
*/
const options = opt_options || {};
const partialOptions = options || {};
let baseUrl = options.url || '';
let baseUrl = partialOptions.url || '';
baseUrl =
baseUrl +
(baseUrl.lastIndexOf('/') === baseUrl.length - 1 || baseUrl === ''
? ''
: '/');
const version = options.version || Versions.VERSION2;
const sizes = options.sizes || [];
const size = options.size;
const version = partialOptions.version || Versions.VERSION2;
const sizes = partialOptions.sizes || [];
const size = partialOptions.size;
assert(
size != undefined &&
Array.isArray(size) &&
@@ -90,15 +90,15 @@ class IIIF extends TileImage {
);
const width = size[0];
const height = size[1];
const tileSize = options.tileSize;
const tilePixelRatio = options.tilePixelRatio || 1;
const format = options.format || 'jpg';
const tileSize = partialOptions.tileSize;
const tilePixelRatio = partialOptions.tilePixelRatio || 1;
const format = partialOptions.format || 'jpg';
const quality =
options.quality ||
(options.version == Versions.VERSION1 ? 'native' : 'default');
let resolutions = options.resolutions || [];
const supports = options.supports || [];
const extent = options.extent || [0, -height, width, 0];
partialOptions.quality ||
(partialOptions.version == Versions.VERSION1 ? 'native' : 'default');
let resolutions = partialOptions.resolutions || [];
const supports = partialOptions.supports || [];
const extent = partialOptions.extent || [0, -height, width, 0];
const supportsListedSizes =
sizes != undefined && Array.isArray(sizes) && sizes.length > 0;
@@ -329,25 +329,25 @@ class IIIF extends TileImage {
);
super({
attributions: options.attributions,
attributionsCollapsible: options.attributionsCollapsible,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
interpolate: options.interpolate,
projection: options.projection,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
state: options.state,
attributions: partialOptions.attributions,
attributionsCollapsible: partialOptions.attributionsCollapsible,
cacheSize: partialOptions.cacheSize,
crossOrigin: partialOptions.crossOrigin,
interpolate: partialOptions.interpolate,
projection: partialOptions.projection,
reprojectionErrorThreshold: partialOptions.reprojectionErrorThreshold,
state: partialOptions.state,
tileClass: IiifTileClass,
tileGrid: tileGrid,
tilePixelRatio: options.tilePixelRatio,
tilePixelRatio: partialOptions.tilePixelRatio,
tileUrlFunction: tileUrlFunction,
transition: options.transition,
transition: partialOptions.transition,
});
/**
* @type {number|import("../array.js").NearestDirectionFunction}
*/
this.zDirection = options.zDirection;
this.zDirection = partialOptions.zDirection;
}
}
+3 -3
View File
@@ -52,10 +52,10 @@ import {containsExtent, getHeight, getWidth} from '../extent.js';
*/
class ImageArcGISRest extends ImageSource {
/**
* @param {Options} [opt_options] Image ArcGIS Rest Options.
* @param {Options} [options] Image ArcGIS Rest Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
super({
attributions: options.attributions,
+3 -3
View File
@@ -53,10 +53,10 @@ import {
*/
class ImageCanvasSource extends ImageSource {
/**
* @param {Options} [opt_options] ImageCanvas options.
* @param {Options} [options] ImageCanvas options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
super({
attributions: options.attributions,
+5 -5
View File
@@ -46,7 +46,7 @@ const GETFEATUREINFO_IMAGE_SIZE = [101, 101];
* @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
* @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
* linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
* @property {Object<string,*>} params WMS request parameters.
* @property {Object<string,*>} [params] WMS request parameters.
* At least a `LAYERS` param is required. `STYLES` is
* `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`
* and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.
@@ -56,7 +56,7 @@ const GETFEATUREINFO_IMAGE_SIZE = [101, 101];
* higher.
* @property {Array<number>} [resolutions] Resolutions.
* If specified, requests will be made for these resolutions only.
* @property {string} url WMS service URL.
* @property {string} [url] WMS service URL.
*/
/**
@@ -68,10 +68,10 @@ const GETFEATUREINFO_IMAGE_SIZE = [101, 101];
*/
class ImageWMS extends ImageSource {
/**
* @param {Options} [opt_options] ImageWMS options.
* @param {Options} [options] ImageWMS options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
super({
attributions: options.attributions,
+3 -3
View File
@@ -52,10 +52,10 @@ export const ATTRIBUTION =
*/
class OSM extends XYZ {
/**
* @param {Options} [opt_options] Open Street Map options.
* @param {Options} [options] Open Street Map options.
*/
constructor(opt_options) {
const options = opt_options || {};
constructor(options) {
options = options || {};
let attributions;
if (options.attributions !== undefined) {
+3 -3
View File
@@ -675,11 +675,11 @@ class RasterSource extends ImageSource {
/**
* Set the operation.
* @param {Operation} operation New operation.
* @param {Object} [opt_lib] Functions that will be available to operations run
* @param {Object} [lib] Functions that will be available to operations run
* in a worker.
* @api
*/
setOperation(operation, opt_lib) {
setOperation(operation, lib) {
if (this.processor_) {
this.processor_.dispose();
}
@@ -688,7 +688,7 @@ class RasterSource extends ImageSource {
operation: operation,
imageOps: this.operationType_ === 'image',
queue: 1,
lib: opt_lib,
lib: lib,
threads: this.threads_,
});
this.changed();
+3 -4
View File
@@ -322,13 +322,12 @@ class TileSource extends Source {
* is outside the resolution and extent range of the tile grid, `null` will be
* returned.
* @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
* @param {import("../proj/Projection.js").default} [opt_projection] Projection.
* @param {import("../proj/Projection.js").default} [projection] Projection.
* @return {import("../tilecoord.js").TileCoord} Tile coordinate to be passed to the tileUrlFunction or
* null if no tile URL should be created for the passed `tileCoord`.
*/
getTileCoordForTileUrlFunction(tileCoord, opt_projection) {
const projection =
opt_projection !== undefined ? opt_projection : this.getProjection();
getTileCoordForTileUrlFunction(tileCoord, projection) {
projection = projection !== undefined ? projection : this.getProjection();
const tileGrid = this.getTileGridForProjection(projection);
if (this.getWrapX() && projection.isGlobal()) {
tileCoord = wrapX(tileGrid, tileCoord, projection);
+3 -3
View File
@@ -67,10 +67,10 @@ import {hash as tileCoordHash} from '../tilecoord.js';
*/
class TileArcGISRest extends TileImage {
/**
* @param {Options} [opt_options] Tile ArcGIS Rest options.
* @param {Options} [options] Tile ArcGIS Rest options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
super({
attributions: options.attributions,
+3 -3
View File
@@ -28,13 +28,13 @@ import {toSize} from '../size.js';
*/
class TileDebug extends XYZ {
/**
* @param {Options} [opt_options] Debug tile options.
* @param {Options} [options] Debug tile options.
*/
constructor(opt_options) {
constructor(options) {
/**
* @type {Options}
*/
const options = opt_options || {};
options = options || {};
super({
opaque: false,
+3 -3
View File
@@ -79,10 +79,10 @@ import {hash as tileCoordHash} from '../tilecoord.js';
*/
class TileWMS extends TileImage {
/**
* @param {Options} [opt_options] Tile WMS options.
* @param {Options} [options] Tile WMS options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : /** @type {Options} */ ({});
constructor(options) {
options = options ? options : /** @type {Options} */ ({});
const params = options.params || {};
+9 -14
View File
@@ -131,11 +131,11 @@ export class CustomTile extends Tile {
* for given coordinate (or `null` if not yet loaded).
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
* @param {function(*): void} callback Callback.
* @param {boolean} [opt_request] If `true` the callback is always async.
* @param {boolean} [request] If `true` the callback is always async.
* The tile data is requested if not yet loaded.
*/
forDataAtCoordinate(coordinate, callback, opt_request) {
if (this.state == TileState.EMPTY && opt_request === true) {
forDataAtCoordinate(coordinate, callback, request) {
if (this.state == TileState.EMPTY && request === true) {
this.state = TileState.IDLE;
listenOnce(
this,
@@ -147,7 +147,7 @@ export class CustomTile extends Tile {
);
this.loadInternal_();
} else {
if (opt_request === true) {
if (request === true) {
setTimeout(
function () {
callback(this.getData(coordinate));
@@ -259,7 +259,7 @@ export class CustomTile extends Tile {
* If `true` the UTFGrid source loads the tiles based on their "visibility".
* This improves the speed of response, but increases traffic.
* Note that if set to `false` (lazy loading), you need to pass `true` as
* `opt_request` to the `forDataAtCoordinateAndResolution` method otherwise no
* `request` to the `forDataAtCoordinateAndResolution` method otherwise no
* data will ever be loaded.
* @property {boolean} [jsonp=false] Use JSONP with callback to load the TileJSON.
* Useful when the server does not support CORS..
@@ -381,16 +381,11 @@ class UTFGrid extends TileSource {
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
* @param {number} resolution Resolution.
* @param {function(*): void} callback Callback.
* @param {boolean} [opt_request] If `true` the callback is always async.
* @param {boolean} [request] If `true` the callback is always async.
* The tile data is requested if not yet loaded.
* @api
*/
forDataAtCoordinateAndResolution(
coordinate,
resolution,
callback,
opt_request
) {
forDataAtCoordinateAndResolution(coordinate, resolution, callback, request) {
if (this.tileGrid) {
const z = this.tileGrid.getZForResolution(resolution, this.zDirection);
const tileCoord = this.tileGrid.getTileCoordForCoordAndZ(coordinate, z);
@@ -403,9 +398,9 @@ class UTFGrid extends TileSource {
this.getProjection()
)
);
tile.forDataAtCoordinate(coordinate, callback, opt_request);
tile.forDataAtCoordinate(coordinate, callback, request);
} else {
if (opt_request === true) {
if (request === true) {
setTimeout(function () {
callback(null);
}, 0);
+21 -22
View File
@@ -38,10 +38,10 @@ import {xhr} from '../featureloader.js';
export class VectorSourceEvent extends Event {
/**
* @param {string} type Type.
* @param {import("../Feature.js").default<Geometry>} [opt_feature] Feature.
* @param {Array<import("../Feature.js").default<Geometry>>} [opt_features] Features.
* @param {import("../Feature.js").default<Geometry>} [feature] Feature.
* @param {Array<import("../Feature.js").default<Geometry>>} [features] Features.
*/
constructor(type, opt_feature, opt_features) {
constructor(type, feature, features) {
super(type);
/**
@@ -49,14 +49,14 @@ export class VectorSourceEvent extends Event {
* @type {import("../Feature.js").default<Geometry>|undefined}
* @api
*/
this.feature = opt_feature;
this.feature = feature;
/**
* The loaded features for the `FEATURESLOADED` event, `undefined` otherwise.
* @type {Array<import("../Feature.js").default<Geometry>>|undefined}
* @api
*/
this.features = opt_features;
this.features = features;
}
}
@@ -174,10 +174,10 @@ export class VectorSourceEvent extends Event {
*/
class VectorSource extends Source {
/**
* @param {Options<Geometry>} [opt_options] Vector source options.
* @param {Options<Geometry>} [options] Vector source options.
*/
constructor(opt_options) {
const options = opt_options || {};
constructor(options) {
options = options || {};
super({
attributions: options.attributions,
@@ -526,11 +526,11 @@ class VectorSource extends Source {
/**
* Remove all features from the source.
* @param {boolean} [opt_fast] Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#event:removefeature removefeature} events.
* @param {boolean} [fast] Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#event:removefeature removefeature} events.
* @api
*/
clear(opt_fast) {
if (opt_fast) {
clear(fast) {
if (fast) {
for (const featureId in this.featureChangeKeys_) {
const keys = this.featureChangeKeys_[featureId];
keys.forEach(unlistenByKey);
@@ -725,21 +725,20 @@ class VectorSource extends Source {
* features.
*
* @param {import("../extent.js").Extent} extent Extent.
* @param {import("../proj/Projection.js").default} [opt_projection] Include features
* @param {import("../proj/Projection.js").default} [projection] Include features
* where `extent` exceeds the x-axis bounds of `projection` and wraps around the world.
* @return {Array<import("../Feature.js").default<Geometry>>} Features.
* @api
*/
getFeaturesInExtent(extent, opt_projection) {
getFeaturesInExtent(extent, projection) {
if (this.featuresRtree_) {
const multiWorld =
opt_projection && opt_projection.canWrapX() && this.getWrapX();
const multiWorld = projection && projection.canWrapX() && this.getWrapX();
if (!multiWorld) {
return this.featuresRtree_.getInExtent(extent);
}
const extents = wrapAndSliceX(extent, opt_projection);
const extents = wrapAndSliceX(extent, projection);
return [].concat(
...extents.map((anExtent) => this.featuresRtree_.getInExtent(anExtent))
@@ -757,13 +756,13 @@ class VectorSource extends Source {
* This method is not available when the source is configured with
* `useSpatialIndex` set to `false`.
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
* @param {function(import("../Feature.js").default<Geometry>):boolean} [opt_filter] Feature filter function.
* @param {function(import("../Feature.js").default<Geometry>):boolean} [filter] Feature filter function.
* The filter function will receive one argument, the {@link module:ol/Feature~Feature feature}
* and it should return a boolean value. By default, no filtering is made.
* @return {import("../Feature.js").default<Geometry>} Closest feature.
* @api
*/
getClosestFeatureToCoordinate(coordinate, opt_filter) {
getClosestFeatureToCoordinate(coordinate, filter) {
// Find the closest feature using branch and bound. We start searching an
// infinite extent, and find the distance from the first feature found. This
// becomes the closest feature. We then compute a smaller extent which any
@@ -777,7 +776,7 @@ class VectorSource extends Source {
const closestPoint = [NaN, NaN];
let minSquaredDistance = Infinity;
const extent = [-Infinity, -Infinity, Infinity, Infinity];
const filter = opt_filter ? opt_filter : TRUE;
filter = filter ? filter : TRUE;
this.featuresRtree_.forEachInExtent(
extent,
/**
@@ -816,13 +815,13 @@ class VectorSource extends Source {
*
* This method is not available when the source is configured with
* `useSpatialIndex` set to `false`.
* @param {import("../extent.js").Extent} [opt_extent] Destination extent. If provided, no new extent
* @param {import("../extent.js").Extent} [extent] Destination extent. If provided, no new extent
* will be created. Instead, that extent's coordinates will be overwritten.
* @return {import("../extent.js").Extent} Extent.
* @api
*/
getExtent(opt_extent) {
return this.featuresRtree_.getExtent(opt_extent);
getExtent(extent) {
return this.featuresRtree_.getExtent(extent);
}
/**
+3 -3
View File
@@ -72,10 +72,10 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
*/
class XYZ extends TileImage {
/**
* @param {Options} [opt_options] XYZ options.
* @param {Options} [options] XYZ options.
*/
constructor(opt_options) {
const options = opt_options || {};
constructor(options) {
options = options || {};
const projection =
options.projection !== undefined ? options.projection : 'EPSG:3857';
+5 -7
View File
@@ -25,7 +25,7 @@ export class CustomTile extends ImageTile {
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
* @param {import("../Tile.js").Options} [opt_options] Tile options.
* @param {import("../Tile.js").Options} [options] Tile options.
*/
constructor(
tileSize,
@@ -34,9 +34,9 @@ export class CustomTile extends ImageTile {
src,
crossOrigin,
tileLoadFunction,
opt_options
options
) {
super(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options);
super(tileCoord, state, src, crossOrigin, tileLoadFunction, options);
/**
* @private
@@ -123,11 +123,9 @@ export class CustomTile extends ImageTile {
*/
class Zoomify extends TileImage {
/**
* @param {Options} opt_options Options.
* @param {Options} options Options.
*/
constructor(opt_options) {
const options = opt_options;
constructor(options) {
const size = options.size;
const tierSizeCalculation =
options.tierSizeCalculation !== undefined