Lint removal

This commit is contained in:
Tim Schaub
2018-07-16 17:57:57 -06:00
parent f78d0d4cfa
commit d0ab8dce38
63 changed files with 2945 additions and 2917 deletions

View File

@@ -38,215 +38,215 @@ import {assign} from '../obj.js';
* @api
*/
class BaseLayer {
constructor(options) {
constructor(options) {
BaseObject.call(this);
BaseObject.call(this);
/**
/**
* @type {Object.<string, *>}
*/
const properties = assign({}, options);
properties[LayerProperty.OPACITY] =
const properties = assign({}, options);
properties[LayerProperty.OPACITY] =
options.opacity !== undefined ? options.opacity : 1;
properties[LayerProperty.VISIBLE] =
properties[LayerProperty.VISIBLE] =
options.visible !== undefined ? options.visible : true;
properties[LayerProperty.Z_INDEX] =
properties[LayerProperty.Z_INDEX] =
options.zIndex !== undefined ? options.zIndex : 0;
properties[LayerProperty.MAX_RESOLUTION] =
properties[LayerProperty.MAX_RESOLUTION] =
options.maxResolution !== undefined ? options.maxResolution : Infinity;
properties[LayerProperty.MIN_RESOLUTION] =
properties[LayerProperty.MIN_RESOLUTION] =
options.minResolution !== undefined ? options.minResolution : 0;
this.setProperties(properties);
this.setProperties(properties);
/**
/**
* @type {module:ol/layer/Layer~State}
* @private
*/
this.state_ = /** @type {module:ol/layer/Layer~State} */ ({
layer: /** @type {module:ol/layer/Layer} */ (this),
managed: true
});
this.state_ = /** @type {module:ol/layer/Layer~State} */ ({
layer: /** @type {module:ol/layer/Layer} */ (this),
managed: true
});
/**
/**
* The layer type.
* @type {module:ol/LayerType}
* @protected;
*/
this.type;
this.type;
}
}
/**
/**
* Get the layer type (used when creating a layer renderer).
* @return {module:ol/LayerType} The layer type.
*/
getType() {
return this.type;
}
getType() {
return this.type;
}
/**
/**
* @return {module:ol/layer/Layer~State} Layer state.
*/
getLayerState() {
this.state_.opacity = clamp(this.getOpacity(), 0, 1);
this.state_.sourceState = this.getSourceState();
this.state_.visible = this.getVisible();
this.state_.extent = this.getExtent();
this.state_.zIndex = this.getZIndex();
this.state_.maxResolution = this.getMaxResolution();
this.state_.minResolution = Math.max(this.getMinResolution(), 0);
getLayerState() {
this.state_.opacity = clamp(this.getOpacity(), 0, 1);
this.state_.sourceState = this.getSourceState();
this.state_.visible = this.getVisible();
this.state_.extent = this.getExtent();
this.state_.zIndex = this.getZIndex();
this.state_.maxResolution = this.getMaxResolution();
this.state_.minResolution = Math.max(this.getMinResolution(), 0);
return this.state_;
}
return this.state_;
}
/**
/**
* @abstract
* @param {Array.<module:ol/layer/Layer>=} opt_array Array of layers (to be
* modified in place).
* @return {Array.<module:ol/layer/Layer>} Array of layers.
*/
getLayersArray(opt_array) {}
getLayersArray(opt_array) {}
/**
/**
* @abstract
* @param {Array.<module:ol/layer/Layer~State>=} opt_states Optional list of layer
* states (to be modified in place).
* @return {Array.<module:ol/layer/Layer~State>} List of layer states.
*/
getLayerStatesArray(opt_states) {}
getLayerStatesArray(opt_states) {}
/**
/**
* Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it
* will be visible regardless of extent.
* @return {module:ol/extent~Extent|undefined} The layer extent.
* @observable
* @api
*/
getExtent() {
return (
/** @type {module:ol/extent~Extent|undefined} */ (this.get(LayerProperty.EXTENT))
);
}
getExtent() {
return (
/** @type {module:ol/extent~Extent|undefined} */ (this.get(LayerProperty.EXTENT))
);
}
/**
/**
* Return the maximum resolution of the layer.
* @return {number} The maximum resolution of the layer.
* @observable
* @api
*/
getMaxResolution() {
return /** @type {number} */ (this.get(LayerProperty.MAX_RESOLUTION));
}
getMaxResolution() {
return /** @type {number} */ (this.get(LayerProperty.MAX_RESOLUTION));
}
/**
/**
* Return the minimum resolution of the layer.
* @return {number} The minimum resolution of the layer.
* @observable
* @api
*/
getMinResolution() {
return /** @type {number} */ (this.get(LayerProperty.MIN_RESOLUTION));
}
getMinResolution() {
return /** @type {number} */ (this.get(LayerProperty.MIN_RESOLUTION));
}
/**
/**
* Return the opacity of the layer (between 0 and 1).
* @return {number} The opacity of the layer.
* @observable
* @api
*/
getOpacity() {
return /** @type {number} */ (this.get(LayerProperty.OPACITY));
}
getOpacity() {
return /** @type {number} */ (this.get(LayerProperty.OPACITY));
}
/**
/**
* @abstract
* @return {module:ol/source/State} Source state.
*/
getSourceState() {}
getSourceState() {}
/**
/**
* Return the visibility of the layer (`true` or `false`).
* @return {boolean} The visibility of the layer.
* @observable
* @api
*/
getVisible() {
return /** @type {boolean} */ (this.get(LayerProperty.VISIBLE));
}
getVisible() {
return /** @type {boolean} */ (this.get(LayerProperty.VISIBLE));
}
/**
/**
* Return the Z-index of the layer, which is used to order layers before
* rendering. The default Z-index is 0.
* @return {number} The Z-index of the layer.
* @observable
* @api
*/
getZIndex() {
return /** @type {number} */ (this.get(LayerProperty.Z_INDEX));
}
getZIndex() {
return /** @type {number} */ (this.get(LayerProperty.Z_INDEX));
}
/**
/**
* Set the extent at which the layer is visible. If `undefined`, the layer
* will be visible at all extents.
* @param {module:ol/extent~Extent|undefined} extent The extent of the layer.
* @observable
* @api
*/
setExtent(extent) {
this.set(LayerProperty.EXTENT, extent);
}
setExtent(extent) {
this.set(LayerProperty.EXTENT, extent);
}
/**
/**
* Set the maximum resolution at which the layer is visible.
* @param {number} maxResolution The maximum resolution of the layer.
* @observable
* @api
*/
setMaxResolution(maxResolution) {
this.set(LayerProperty.MAX_RESOLUTION, maxResolution);
}
setMaxResolution(maxResolution) {
this.set(LayerProperty.MAX_RESOLUTION, maxResolution);
}
/**
/**
* Set the minimum resolution at which the layer is visible.
* @param {number} minResolution The minimum resolution of the layer.
* @observable
* @api
*/
setMinResolution(minResolution) {
this.set(LayerProperty.MIN_RESOLUTION, minResolution);
}
setMinResolution(minResolution) {
this.set(LayerProperty.MIN_RESOLUTION, minResolution);
}
/**
/**
* Set the opacity of the layer, allowed values range from 0 to 1.
* @param {number} opacity The opacity of the layer.
* @observable
* @api
*/
setOpacity(opacity) {
this.set(LayerProperty.OPACITY, opacity);
}
setOpacity(opacity) {
this.set(LayerProperty.OPACITY, opacity);
}
/**
/**
* Set the visibility of the layer (`true` or `false`).
* @param {boolean} visible The visibility of the layer.
* @observable
* @api
*/
setVisible(visible) {
this.set(LayerProperty.VISIBLE, visible);
}
setVisible(visible) {
this.set(LayerProperty.VISIBLE, visible);
}
/**
/**
* Set Z-index of the layer, which is used to order layers before rendering.
* The default Z-index is 0.
* @param {number} zindex The z-index of the layer.
* @observable
* @api
*/
setZIndex(zindex) {
this.set(LayerProperty.Z_INDEX, zindex);
}
setZIndex(zindex) {
this.set(LayerProperty.Z_INDEX, zindex);
}
}
inherits(BaseLayer, BaseObject);

View File

@@ -289,9 +289,8 @@ inherits(Heatmap, VectorLayer);
/**
* @param {Array.<string>} colors A list of colored.
* @return {Uint8ClampedArray} An array.
* @private
*/
const createGradient = function(colors) {
function createGradient(colors) {
const width = 1;
const height = 256;
const context = createCanvasContext2D(width, height);
@@ -306,7 +305,7 @@ const createGradient = function(colors) {
context.fillRect(0, 0, width, height);
return context.getImageData(0, 0, width, height).data;
};
}
export default Heatmap;

View File

@@ -46,67 +46,67 @@ import {assign} from '../obj.js';
* @api
*/
class TileLayer {
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(opt_options) {
const options = opt_options ? opt_options : {};
const baseOptions = assign({}, options);
const baseOptions = assign({}, options);
delete baseOptions.preload;
delete baseOptions.useInterimTilesOnError;
Layer.call(this, /** @type {module:ol/layer/Layer~Options} */ (baseOptions));
delete baseOptions.preload;
delete baseOptions.useInterimTilesOnError;
Layer.call(this, /** @type {module:ol/layer/Layer~Options} */ (baseOptions));
this.setPreload(options.preload !== undefined ? options.preload : 0);
this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ?
options.useInterimTilesOnError : true);
this.setPreload(options.preload !== undefined ? options.preload : 0);
this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ?
options.useInterimTilesOnError : true);
/**
/**
* The layer type.
* @protected
* @type {module:ol/LayerType}
*/
this.type = LayerType.TILE;
this.type = LayerType.TILE;
}
}
/**
/**
* Return the level as number to which we will preload tiles up to.
* @return {number} The level to preload tiles up to.
* @observable
* @api
*/
getPreload() {
return /** @type {number} */ (this.get(TileProperty.PRELOAD));
}
getPreload() {
return /** @type {number} */ (this.get(TileProperty.PRELOAD));
}
/**
/**
* Set the level as number to which we will preload tiles up to.
* @param {number} preload The level to preload tiles up to.
* @observable
* @api
*/
setPreload(preload) {
this.set(TileProperty.PRELOAD, preload);
}
setPreload(preload) {
this.set(TileProperty.PRELOAD, preload);
}
/**
/**
* Whether we use interim tiles on error.
* @return {boolean} Use interim tiles on error.
* @observable
* @api
*/
getUseInterimTilesOnError() {
return /** @type {boolean} */ (this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR));
}
getUseInterimTilesOnError() {
return /** @type {boolean} */ (this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR));
}
/**
/**
* Set whether we use interim tiles on error.
* @param {boolean} useInterimTilesOnError Use interim tiles on error.
* @observable
* @api
*/
setUseInterimTilesOnError(useInterimTilesOnError) {
this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
}
setUseInterimTilesOnError(useInterimTilesOnError) {
this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
}
}
inherits(TileLayer, Layer);

View File

@@ -92,152 +92,152 @@ const Property = {
* @api
*/
class VectorLayer {
constructor(opt_options) {
const options = opt_options ?
opt_options : /** @type {module:ol/layer/Vector~Options} */ ({});
constructor(opt_options) {
const options = opt_options ?
opt_options : /** @type {module:ol/layer/Vector~Options} */ ({});
const baseOptions = assign({}, options);
const baseOptions = assign({}, options);
delete baseOptions.style;
delete baseOptions.renderBuffer;
delete baseOptions.updateWhileAnimating;
delete baseOptions.updateWhileInteracting;
Layer.call(this, /** @type {module:ol/layer/Layer~Options} */ (baseOptions));
delete baseOptions.style;
delete baseOptions.renderBuffer;
delete baseOptions.updateWhileAnimating;
delete baseOptions.updateWhileInteracting;
Layer.call(this, /** @type {module:ol/layer/Layer~Options} */ (baseOptions));
/**
/**
* @private
* @type {boolean}
*/
this.declutter_ = options.declutter !== undefined ? options.declutter : false;
this.declutter_ = options.declutter !== undefined ? options.declutter : false;
/**
/**
* @type {number}
* @private
*/
this.renderBuffer_ = options.renderBuffer !== undefined ?
options.renderBuffer : 100;
this.renderBuffer_ = options.renderBuffer !== undefined ?
options.renderBuffer : 100;
/**
/**
* User provided style.
* @type {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style/Style~StyleFunction}
* @private
*/
this.style_ = null;
this.style_ = null;
/**
/**
* Style function for use within the library.
* @type {module:ol/style/Style~StyleFunction|undefined}
* @private
*/
this.styleFunction_ = undefined;
this.styleFunction_ = undefined;
this.setStyle(options.style);
this.setStyle(options.style);
/**
/**
* @type {boolean}
* @private
*/
this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ?
options.updateWhileAnimating : false;
this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ?
options.updateWhileAnimating : false;
/**
/**
* @type {boolean}
* @private
*/
this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ?
options.updateWhileInteracting : false;
this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ?
options.updateWhileInteracting : false;
/**
/**
* @private
* @type {module:ol/layer/VectorTileRenderType|string}
*/
this.renderMode_ = options.renderMode || VectorRenderType.VECTOR;
this.renderMode_ = options.renderMode || VectorRenderType.VECTOR;
/**
/**
* The layer type.
* @protected
* @type {module:ol/LayerType}
*/
this.type = LayerType.VECTOR;
this.type = LayerType.VECTOR;
}
}
/**
/**
* @return {boolean} Declutter.
*/
getDeclutter() {
return this.declutter_;
}
getDeclutter() {
return this.declutter_;
}
/**
/**
* @param {boolean} declutter Declutter.
*/
setDeclutter(declutter) {
this.declutter_ = declutter;
}
setDeclutter(declutter) {
this.declutter_ = declutter;
}
/**
/**
* @return {number|undefined} Render buffer.
*/
getRenderBuffer() {
return this.renderBuffer_;
}
getRenderBuffer() {
return this.renderBuffer_;
}
/**
/**
* @return {function(module:ol/Feature, module:ol/Feature): number|null|undefined} Render
* order.
*/
getRenderOrder() {
return (
/** @type {module:ol/render~OrderFunction|null|undefined} */ (this.get(Property.RENDER_ORDER))
);
}
getRenderOrder() {
return (
/** @type {module:ol/render~OrderFunction|null|undefined} */ (this.get(Property.RENDER_ORDER))
);
}
/**
/**
* Get the style for features. This returns whatever was passed to the `style`
* option at construction or to the `setStyle` method.
* @return {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style/Style~StyleFunction}
* Layer style.
* @api
*/
getStyle() {
return this.style_;
}
getStyle() {
return this.style_;
}
/**
/**
* Get the style function.
* @return {module:ol/style/Style~StyleFunction|undefined} Layer style function.
* @api
*/
getStyleFunction() {
return this.styleFunction_;
}
getStyleFunction() {
return this.styleFunction_;
}
/**
/**
* @return {boolean} Whether the rendered layer should be updated while
* animating.
*/
getUpdateWhileAnimating() {
return this.updateWhileAnimating_;
}
getUpdateWhileAnimating() {
return this.updateWhileAnimating_;
}
/**
/**
* @return {boolean} Whether the rendered layer should be updated while
* interacting.
*/
getUpdateWhileInteracting() {
return this.updateWhileInteracting_;
}
getUpdateWhileInteracting() {
return this.updateWhileInteracting_;
}
/**
/**
* @param {module:ol/render~OrderFunction|null|undefined} renderOrder
* Render order.
*/
setRenderOrder(renderOrder) {
this.set(Property.RENDER_ORDER, renderOrder);
}
setRenderOrder(renderOrder) {
this.set(Property.RENDER_ORDER, renderOrder);
}
/**
/**
* Set the style for features. This can be a single style object, an array
* of styles, or a function that takes a feature and resolution and returns
* an array of styles. If it is `undefined` the default style is used. If
@@ -248,19 +248,19 @@ class VectorLayer {
* style Layer style.
* @api
*/
setStyle(style) {
this.style_ = style !== undefined ? style : createDefaultStyle;
this.styleFunction_ = style === null ?
undefined : toStyleFunction(this.style_);
this.changed();
}
setStyle(style) {
this.style_ = style !== undefined ? style : createDefaultStyle;
this.styleFunction_ = style === null ?
undefined : toStyleFunction(this.style_);
this.changed();
}
/**
/**
* @return {module:ol/layer/VectorRenderType|string} The render mode.
*/
getRenderMode() {
return this.renderMode_;
}
getRenderMode() {
return this.renderMode_;
}
}
inherits(VectorLayer, Layer);

View File

@@ -100,78 +100,78 @@ export const RenderType = {
* @api
*/
class VectorTileLayer {
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(opt_options) {
const options = opt_options ? opt_options : {};
let renderMode = options.renderMode || VectorTileRenderType.HYBRID;
assert(renderMode == undefined ||
let renderMode = options.renderMode || VectorTileRenderType.HYBRID;
assert(renderMode == undefined ||
renderMode == VectorTileRenderType.IMAGE ||
renderMode == VectorTileRenderType.HYBRID ||
renderMode == VectorTileRenderType.VECTOR,
28); // `renderMode` must be `'image'`, `'hybrid'` or `'vector'`
if (options.declutter && renderMode == VectorTileRenderType.IMAGE) {
renderMode = VectorTileRenderType.HYBRID;
}
options.renderMode = renderMode;
28); // `renderMode` must be `'image'`, `'hybrid'` or `'vector'`
if (options.declutter && renderMode == VectorTileRenderType.IMAGE) {
renderMode = VectorTileRenderType.HYBRID;
}
options.renderMode = renderMode;
const baseOptions = assign({}, options);
const baseOptions = assign({}, options);
delete baseOptions.preload;
delete baseOptions.useInterimTilesOnError;
VectorLayer.call(this, /** @type {module:ol/layer/Vector~Options} */ (baseOptions));
delete baseOptions.preload;
delete baseOptions.useInterimTilesOnError;
VectorLayer.call(this, /** @type {module:ol/layer/Vector~Options} */ (baseOptions));
this.setPreload(options.preload ? options.preload : 0);
this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ?
options.useInterimTilesOnError : true);
this.setPreload(options.preload ? options.preload : 0);
this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ?
options.useInterimTilesOnError : true);
/**
/**
* The layer type.
* @protected
* @type {module:ol/LayerType}
*/
this.type = LayerType.VECTOR_TILE;
this.type = LayerType.VECTOR_TILE;
}
}
/**
/**
* Return the level as number to which we will preload tiles up to.
* @return {number} The level to preload tiles up to.
* @observable
* @api
*/
getPreload() {
return /** @type {number} */ (this.get(TileProperty.PRELOAD));
}
getPreload() {
return /** @type {number} */ (this.get(TileProperty.PRELOAD));
}
/**
/**
* Whether we use interim tiles on error.
* @return {boolean} Use interim tiles on error.
* @observable
* @api
*/
getUseInterimTilesOnError() {
return /** @type {boolean} */ (this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR));
}
getUseInterimTilesOnError() {
return /** @type {boolean} */ (this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR));
}
/**
/**
* Set the level as number to which we will preload tiles up to.
* @param {number} preload The level to preload tiles up to.
* @observable
* @api
*/
setPreload(preload) {
this.set(TileProperty.PRELOAD, preload);
}
setPreload(preload) {
this.set(TileProperty.PRELOAD, preload);
}
/**
/**
* Set whether we use interim tiles on error.
* @param {boolean} useInterimTilesOnError Use interim tiles on error.
* @observable
* @api
*/
setUseInterimTilesOnError(useInterimTilesOnError) {
this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
}
setUseInterimTilesOnError(useInterimTilesOnError) {
this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
}
}
inherits(VectorTileLayer, VectorLayer);