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
+10 -10
View File
@@ -149,16 +149,16 @@ class BaseLayer extends BaseObject {
* This method is not meant to be called by layers or layer renderers because the state
* is incorrect if the layer is included in a layer group.
*
* @param {boolean} [opt_managed] Layer is managed.
* @param {boolean} [managed] Layer is managed.
* @return {import("./Layer.js").State} Layer state.
*/
getLayerState(opt_managed) {
getLayerState(managed) {
/** @type {import("./Layer.js").State} */
const state =
this.state_ ||
/** @type {?} */ ({
layer: this,
managed: opt_managed === undefined ? true : opt_managed,
managed: managed === undefined ? true : managed,
});
const zIndex = this.getZIndex();
state.opacity = clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);
@@ -176,21 +176,21 @@ class BaseLayer extends BaseObject {
/**
* @abstract
* @param {Array<import("./Layer.js").default>} [opt_array] Array of layers (to be
* @param {Array<import("./Layer.js").default>} [array] Array of layers (to be
* modified in place).
* @return {Array<import("./Layer.js").default>} Array of layers.
*/
getLayersArray(opt_array) {
getLayersArray(array) {
return abstract();
}
/**
* @abstract
* @param {Array<import("./Layer.js").State>} [opt_states] Optional list of layer
* @param {Array<import("./Layer.js").State>} [states] Optional list of layer
* states (to be modified in place).
* @return {Array<import("./Layer.js").State>} List of layer states.
*/
getLayerStatesArray(opt_states) {
getLayerStatesArray(states) {
return abstract();
}
@@ -288,10 +288,10 @@ class BaseLayer extends BaseObject {
/**
* Sets the background color.
* @param {BackgroundColor} [opt_background] Background color.
* @param {BackgroundColor} [background] Background color.
*/
setBackground(opt_background) {
this.background_ = opt_background;
setBackground(background) {
this.background_ = background;
this.changed();
}
+3 -3
View File
@@ -46,10 +46,10 @@ import Layer from './Layer.js';
*/
class BaseImageLayer extends Layer {
/**
* @param {Options<ImageSourceType>} [opt_options] Layer options.
* @param {Options<ImageSourceType>} [options] Layer options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
super(options);
}
}
+3 -3
View File
@@ -60,10 +60,10 @@ import TileProperty from './TileProperty.js';
*/
class BaseTileLayer extends Layer {
/**
* @param {Options<TileSourceType>} [opt_options] Tile layer options.
* @param {Options<TileSourceType>} [options] Tile layer options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
const baseOptions = Object.assign({}, options);
+21 -21
View File
@@ -86,10 +86,10 @@ const Property = {
*/
class BaseVectorLayer extends Layer {
/**
* @param {Options<VectorSourceType>} [opt_options] Options.
* @param {Options<VectorSourceType>} [options] Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
const baseOptions = Object.assign({}, options);
@@ -256,25 +256,25 @@ class BaseVectorLayer extends Layer {
* using the `Style` and symbolizer constructors (`Fill`, `Stroke`, etc.). See the documentation
* for the [flat style types]{@link module:ol/style/flat~FlatStyle} to see what properties are supported.
*
* @param {import("../style/Style.js").StyleLike|import("../style/flat.js").FlatStyleLike|null} [opt_style] Layer style.
* @param {import("../style/Style.js").StyleLike|import("../style/flat.js").FlatStyleLike|null} [style] Layer style.
* @api
*/
setStyle(opt_style) {
setStyle(style) {
/**
* @type {import("../style/Style.js").StyleLike|null}
*/
let style;
let styleLike;
if (opt_style === undefined) {
style = createDefaultStyle;
} else if (opt_style === null) {
style = null;
} else if (typeof opt_style === 'function') {
style = opt_style;
} else if (opt_style instanceof Style) {
style = opt_style;
} else if (Array.isArray(opt_style)) {
const len = opt_style.length;
if (style === undefined) {
styleLike = createDefaultStyle;
} else if (style === null) {
styleLike = null;
} else if (typeof style === 'function') {
styleLike = style;
} else if (style instanceof Style) {
styleLike = style;
} else if (Array.isArray(style)) {
const len = style.length;
/**
* @type {Array<Style>}
@@ -282,21 +282,21 @@ class BaseVectorLayer extends Layer {
const styles = new Array(len);
for (let i = 0; i < len; ++i) {
const s = opt_style[i];
const s = style[i];
if (s instanceof Style) {
styles[i] = s;
} else {
styles[i] = toStyle(s);
}
}
style = styles;
styleLike = styles;
} else {
style = toStyle(opt_style);
styleLike = toStyle(style);
}
this.style_ = style;
this.style_ = styleLike;
this.styleFunction_ =
opt_style === null ? undefined : toStyleFunction(this.style_);
style === null ? undefined : toStyleFunction(this.style_);
this.changed();
}
}
+6 -10
View File
@@ -183,10 +183,10 @@ const INTERVALS = [
*/
class Graticule extends VectorLayer {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
const baseOptions = Object.assign(
{
@@ -1197,15 +1197,11 @@ class Graticule extends VectorLayer {
} else {
const split = this.minLon_ + this.maxLon_ / 2;
this.maxLon_ += 360;
this.toLonLatTransform_ = function (
coordinates,
opt_output,
opt_dimension
) {
const dimension = opt_dimension || 2;
this.toLonLatTransform_ = function (coordinates, output, dimension) {
dimension = dimension || 2;
const lonLatCoordinates = toLonLatTransform(
coordinates,
opt_output,
output,
dimension
);
for (let i = 0, l = lonLatCoordinates.length; i < l; i += dimension) {
+11 -11
View File
@@ -88,10 +88,10 @@ const Property = {
*/
class LayerGroup extends BaseLayer {
/**
* @param {Options} [opt_options] Layer options.
* @param {Options} [options] Layer options.
*/
constructor(opt_options) {
const options = opt_options || {};
constructor(options) {
options = options || {};
const baseOptions = /** @type {Options} */ (Object.assign({}, options));
delete baseOptions.layers;
@@ -272,11 +272,11 @@ class LayerGroup extends BaseLayer {
}
/**
* @param {Array<import("./Layer.js").default>} [opt_array] Array of layers (to be modified in place).
* @param {Array<import("./Layer.js").default>} [array] Array of layers (to be modified in place).
* @return {Array<import("./Layer.js").default>} Array of layers.
*/
getLayersArray(opt_array) {
const array = opt_array !== undefined ? opt_array : [];
getLayersArray(array) {
array = array !== undefined ? array : [];
this.getLayers().forEach(function (layer) {
layer.getLayersArray(array);
});
@@ -286,14 +286,14 @@ class LayerGroup extends BaseLayer {
/**
* Get the layer states list and use this groups z-index as the default
* for all layers in this and nested groups, if it is unset at this point.
* If opt_states is not provided and this group's z-index is undefined
* If dest is not provided and this group's z-index is undefined
* 0 is used a the default z-index.
* @param {Array<import("./Layer.js").State>} [opt_states] Optional list
* @param {Array<import("./Layer.js").State>} [dest] Optional list
* of layer states (to be modified in place).
* @return {Array<import("./Layer.js").State>} List of layer states.
*/
getLayerStatesArray(opt_states) {
const states = opt_states !== undefined ? opt_states : [];
getLayerStatesArray(dest) {
const states = dest !== undefined ? dest : [];
const pos = states.length;
this.getLayers().forEach(function (layer) {
@@ -302,7 +302,7 @@ class LayerGroup extends BaseLayer {
const ownLayerState = this.getLayerState();
let defaultZIndex = ownLayerState.zIndex;
if (!opt_states && ownLayerState.zIndex === undefined) {
if (!dest && ownLayerState.zIndex === undefined) {
defaultZIndex = 0;
}
for (let i = pos, ii = states.length; i < ii; i++) {
+3 -3
View File
@@ -65,10 +65,10 @@ const DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
*/
class Heatmap extends BaseVector {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
const baseOptions = Object.assign({}, options);
+3 -3
View File
@@ -18,10 +18,10 @@ import CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js';
*/
class ImageLayer extends BaseImageLayer {
/**
* @param {import("./BaseImage.js").Options<ImageSourceType>} [opt_options] Layer options.
* @param {import("./BaseImage.js").Options<ImageSourceType>} [options] Layer options.
*/
constructor(opt_options) {
super(opt_options);
constructor(options) {
super(options);
}
createRenderer() {
+6 -6
View File
@@ -165,21 +165,21 @@ class Layer extends BaseLayer {
}
/**
* @param {Array<import("./Layer.js").default>} [opt_array] Array of layers (to be modified in place).
* @param {Array<import("./Layer.js").default>} [array] Array of layers (to be modified in place).
* @return {Array<import("./Layer.js").default>} Array of layers.
*/
getLayersArray(opt_array) {
const array = opt_array ? opt_array : [];
getLayersArray(array) {
array = array ? array : [];
array.push(this);
return array;
}
/**
* @param {Array<import("./Layer.js").State>} [opt_states] Optional list of layer states (to be modified in place).
* @param {Array<import("./Layer.js").State>} [states] Optional list of layer states (to be modified in place).
* @return {Array<import("./Layer.js").State>} List of layer states.
*/
getLayerStatesArray(opt_states) {
const states = opt_states ? opt_states : [];
getLayerStatesArray(states) {
states = states ? states : [];
states.push(this.getLayerState());
return states;
}
+3 -3
View File
@@ -18,10 +18,10 @@ import CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js';
*/
class TileLayer extends BaseTileLayer {
/**
* @param {import("./BaseTile.js").Options<TileSourceType>} [opt_options] Tile layer options.
* @param {import("./BaseTile.js").Options<TileSourceType>} [options] Tile layer options.
*/
constructor(opt_options) {
super(opt_options);
constructor(options) {
super(options);
}
createRenderer() {
+3 -3
View File
@@ -21,10 +21,10 @@ import CanvasVectorLayerRenderer from '../renderer/canvas/VectorLayer.js';
*/
class VectorLayer extends BaseVectorLayer {
/**
* @param {import("./BaseVector.js").Options<VectorSourceType>} [opt_options] Options.
* @param {import("./BaseVector.js").Options<VectorSourceType>} [options] Options.
*/
constructor(opt_options) {
super(opt_options);
constructor(options) {
super(options);
}
createRenderer() {
+3 -3
View File
@@ -63,10 +63,10 @@ import CanvasVectorImageLayerRenderer from '../renderer/canvas/VectorImageLayer.
*/
class VectorImageLayer extends BaseVectorLayer {
/**
* @param {Options<VectorSourceType>} [opt_options] Options.
* @param {Options<VectorSourceType>} [options] Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
const baseOptions = Object.assign({}, options);
delete baseOptions.imageRatio;
+4 -4
View File
@@ -93,16 +93,16 @@ import {assert} from '../asserts.js';
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
* @extends {BaseVectorLayer<import("../source/VectorTile.js").default, CanvasVectorTileLayerRenderer>}
* @api
*/
class VectorTileLayer extends BaseVectorLayer {
/**
* @param {Options} [opt_options] Options.
* @param {Options} [options] Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(options) {
options = options ? options : {};
const baseOptions = /** @type {Object} */ (Object.assign({}, options));
delete baseOptions.preload;
+3 -3
View File
@@ -304,10 +304,10 @@ function parseStyle(style, bandCount) {
*/
class WebGLTileLayer extends BaseTileLayer {
/**
* @param {Options} opt_options Tile layer options.
* @param {Options} options Tile layer options.
*/
constructor(opt_options) {
const options = opt_options ? Object.assign({}, opt_options) : {};
constructor(options) {
options = options ? Object.assign({}, options) : {};
const style = options.style || {};
delete options.style;