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

@@ -30,50 +30,50 @@ import RegularShape from '../style/RegularShape.js';
* @api
*/
class CircleStyle {
constructor(opt_options) {
constructor(opt_options) {
const options = opt_options || {};
const options = opt_options || {};
RegularShape.call(this, {
points: Infinity,
fill: options.fill,
radius: options.radius,
snapToPixel: options.snapToPixel,
stroke: options.stroke,
atlasManager: options.atlasManager
});
RegularShape.call(this, {
points: Infinity,
fill: options.fill,
radius: options.radius,
snapToPixel: options.snapToPixel,
stroke: options.stroke,
atlasManager: options.atlasManager
});
}
}
/**
/**
* Clones the style. If an atlasmanager was provided to the original style it will be used in the cloned style, too.
* @return {module:ol/style/Circle} The cloned style.
* @override
* @api
*/
clone() {
const style = new CircleStyle({
fill: this.getFill() ? this.getFill().clone() : undefined,
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
radius: this.getRadius(),
snapToPixel: this.getSnapToPixel(),
atlasManager: this.atlasManager_
});
style.setOpacity(this.getOpacity());
style.setScale(this.getScale());
return style;
}
clone() {
const style = new CircleStyle({
fill: this.getFill() ? this.getFill().clone() : undefined,
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
radius: this.getRadius(),
snapToPixel: this.getSnapToPixel(),
atlasManager: this.atlasManager_
});
style.setOpacity(this.getOpacity());
style.setScale(this.getScale());
return style;
}
/**
/**
* Set the circle radius.
*
* @param {number} radius Circle radius.
* @api
*/
setRadius(radius) {
this.radius_ = radius;
this.render_(this.atlasManager_);
}
setRadius(radius) {
this.radius_ = radius;
this.render_(this.atlasManager_);
}
}
inherits(CircleStyle, RegularShape);

View File

@@ -8,85 +8,85 @@ import {asString} from '../color.js';
* @constructor
*/
class IconImageCache {
constructor() {
constructor() {
/**
/**
* @type {!Object.<string, module:ol/style/IconImage>}
* @private
*/
this.cache_ = {};
this.cache_ = {};
/**
/**
* @type {number}
* @private
*/
this.cacheSize_ = 0;
this.cacheSize_ = 0;
/**
/**
* @type {number}
* @private
*/
this.maxCacheSize_ = 32;
}
this.maxCacheSize_ = 32;
}
/**
/**
* FIXME empty description for jsdoc
*/
clear() {
this.cache_ = {};
this.cacheSize_ = 0;
}
clear() {
this.cache_ = {};
this.cacheSize_ = 0;
}
/**
/**
* FIXME empty description for jsdoc
*/
expire() {
if (this.cacheSize_ > this.maxCacheSize_) {
let i = 0;
for (const key in this.cache_) {
const iconImage = this.cache_[key];
if ((i++ & 3) === 0 && !iconImage.hasListener()) {
delete this.cache_[key];
--this.cacheSize_;
}
}
}
}
expire() {
if (this.cacheSize_ > this.maxCacheSize_) {
let i = 0;
for (const key in this.cache_) {
const iconImage = this.cache_[key];
if ((i++ & 3) === 0 && !iconImage.hasListener()) {
delete this.cache_[key];
--this.cacheSize_;
}
}
}
}
/**
/**
* @param {string} src Src.
* @param {?string} crossOrigin Cross origin.
* @param {module:ol/color~Color} color Color.
* @return {module:ol/style/IconImage} Icon image.
*/
get(src, crossOrigin, color) {
const key = getKey(src, crossOrigin, color);
return key in this.cache_ ? this.cache_[key] : null;
}
get(src, crossOrigin, color) {
const key = getKey(src, crossOrigin, color);
return key in this.cache_ ? this.cache_[key] : null;
}
/**
/**
* @param {string} src Src.
* @param {?string} crossOrigin Cross origin.
* @param {module:ol/color~Color} color Color.
* @param {module:ol/style/IconImage} iconImage Icon image.
*/
set(src, crossOrigin, color, iconImage) {
const key = getKey(src, crossOrigin, color);
this.cache_[key] = iconImage;
++this.cacheSize_;
}
set(src, crossOrigin, color, iconImage) {
const key = getKey(src, crossOrigin, color);
this.cache_[key] = iconImage;
++this.cacheSize_;
}
/**
/**
* Set the cache size of the icon cache. Default is `32`. Change this value when
* your map uses more than 32 different icon images and you are not caching icon
* styles on the application level.
* @param {number} maxCacheSize Cache max size.
* @api
*/
setSize(maxCacheSize) {
this.maxCacheSize_ = maxCacheSize;
this.expire();
}
setSize(maxCacheSize) {
this.maxCacheSize_ = maxCacheSize;
this.expire();
}
}

View File

@@ -25,212 +25,212 @@
* @api
*/
class ImageStyle {
constructor(options) {
constructor(options) {
/**
/**
* @private
* @type {number}
*/
this.opacity_ = options.opacity;
this.opacity_ = options.opacity;
/**
/**
* @private
* @type {boolean}
*/
this.rotateWithView_ = options.rotateWithView;
this.rotateWithView_ = options.rotateWithView;
/**
/**
* @private
* @type {number}
*/
this.rotation_ = options.rotation;
this.rotation_ = options.rotation;
/**
/**
* @private
* @type {number}
*/
this.scale_ = options.scale;
this.scale_ = options.scale;
/**
/**
* @private
* @type {boolean}
*/
this.snapToPixel_ = options.snapToPixel;
this.snapToPixel_ = options.snapToPixel;
}
}
/**
/**
* Get the symbolizer opacity.
* @return {number} Opacity.
* @api
*/
getOpacity() {
return this.opacity_;
}
getOpacity() {
return this.opacity_;
}
/**
/**
* Determine whether the symbolizer rotates with the map.
* @return {boolean} Rotate with map.
* @api
*/
getRotateWithView() {
return this.rotateWithView_;
}
getRotateWithView() {
return this.rotateWithView_;
}
/**
/**
* Get the symoblizer rotation.
* @return {number} Rotation.
* @api
*/
getRotation() {
return this.rotation_;
}
getRotation() {
return this.rotation_;
}
/**
/**
* Get the symbolizer scale.
* @return {number} Scale.
* @api
*/
getScale() {
return this.scale_;
}
getScale() {
return this.scale_;
}
/**
/**
* Determine whether the symbolizer should be snapped to a pixel.
* @return {boolean} The symbolizer should snap to a pixel.
* @api
*/
getSnapToPixel() {
return this.snapToPixel_;
}
getSnapToPixel() {
return this.snapToPixel_;
}
/**
/**
* Get the anchor point in pixels. The anchor determines the center point for the
* symbolizer.
* @abstract
* @return {Array.<number>} Anchor.
*/
getAnchor() {}
getAnchor() {}
/**
/**
* Get the image element for the symbolizer.
* @abstract
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
*/
getImage(pixelRatio) {}
getImage(pixelRatio) {}
/**
/**
* @abstract
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
*/
getHitDetectionImage(pixelRatio) {}
getHitDetectionImage(pixelRatio) {}
/**
/**
* @abstract
* @return {module:ol/ImageState} Image state.
*/
getImageState() {}
getImageState() {}
/**
/**
* @abstract
* @return {module:ol/size~Size} Image size.
*/
getImageSize() {}
getImageSize() {}
/**
/**
* @abstract
* @return {module:ol/size~Size} Size of the hit-detection image.
*/
getHitDetectionImageSize() {}
getHitDetectionImageSize() {}
/**
/**
* Get the origin of the symbolizer.
* @abstract
* @return {Array.<number>} Origin.
*/
getOrigin() {}
getOrigin() {}
/**
/**
* Get the size of the symbolizer (in pixels).
* @abstract
* @return {module:ol/size~Size} Size.
*/
getSize() {}
getSize() {}
/**
/**
* Set the opacity.
*
* @param {number} opacity Opacity.
* @api
*/
setOpacity(opacity) {
this.opacity_ = opacity;
}
setOpacity(opacity) {
this.opacity_ = opacity;
}
/**
/**
* Set whether to rotate the style with the view.
*
* @param {boolean} rotateWithView Rotate with map.
* @api
*/
setRotateWithView(rotateWithView) {
this.rotateWithView_ = rotateWithView;
}
setRotateWithView(rotateWithView) {
this.rotateWithView_ = rotateWithView;
}
/**
/**
* Set the rotation.
*
* @param {number} rotation Rotation.
* @api
*/
setRotation(rotation) {
this.rotation_ = rotation;
}
setRotation(rotation) {
this.rotation_ = rotation;
}
/**
/**
* Set the scale.
*
* @param {number} scale Scale.
* @api
*/
setScale(scale) {
this.scale_ = scale;
}
setScale(scale) {
this.scale_ = scale;
}
/**
/**
* Set whether to snap the image to the closest pixel.
*
* @param {boolean} snapToPixel Snap to pixel?
* @api
*/
setSnapToPixel(snapToPixel) {
this.snapToPixel_ = snapToPixel;
}
setSnapToPixel(snapToPixel) {
this.snapToPixel_ = snapToPixel;
}
/**
/**
* @abstract
* @param {function(this: T, module:ol/events/Event)} listener Listener function.
* @param {T} thisArg Value to use as `this` when executing `listener`.
* @return {module:ol/events~EventsKey|undefined} Listener key.
* @template T
*/
listenImageChange(listener, thisArg) {}
listenImageChange(listener, thisArg) {}
/**
/**
* Load not yet loaded URI.
* @abstract
*/
load() {}
load() {}
/**
/**
* @abstract
* @param {function(this: T, module:ol/events/Event)} listener Listener function.
* @param {T} thisArg Value to use as `this` when executing `listener`.
* @template T
*/
unlistenImageChange(listener, thisArg) {}
unlistenImageChange(listener, thisArg) {}
}
export default ImageStyle;

View File

@@ -54,452 +54,452 @@ const DEFAULT_FILL_COLOR = '#333';
* @api
*/
class Text {
constructor(opt_options) {
constructor(opt_options) {
const options = opt_options || {};
const options = opt_options || {};
/**
/**
* @private
* @type {string|undefined}
*/
this.font_ = options.font;
this.font_ = options.font;
/**
/**
* @private
* @type {number|undefined}
*/
this.rotation_ = options.rotation;
this.rotation_ = options.rotation;
/**
/**
* @private
* @type {boolean|undefined}
*/
this.rotateWithView_ = options.rotateWithView;
this.rotateWithView_ = options.rotateWithView;
/**
/**
* @private
* @type {number|undefined}
*/
this.scale_ = options.scale;
this.scale_ = options.scale;
/**
/**
* @private
* @type {string|undefined}
*/
this.text_ = options.text;
this.text_ = options.text;
/**
/**
* @private
* @type {string|undefined}
*/
this.textAlign_ = options.textAlign;
this.textAlign_ = options.textAlign;
/**
/**
* @private
* @type {string|undefined}
*/
this.textBaseline_ = options.textBaseline;
this.textBaseline_ = options.textBaseline;
/**
/**
* @private
* @type {module:ol/style/Fill}
*/
this.fill_ = options.fill !== undefined ? options.fill :
new Fill({color: DEFAULT_FILL_COLOR});
this.fill_ = options.fill !== undefined ? options.fill :
new Fill({color: DEFAULT_FILL_COLOR});
/**
/**
* @private
* @type {number}
*/
this.maxAngle_ = options.maxAngle !== undefined ? options.maxAngle : Math.PI / 4;
this.maxAngle_ = options.maxAngle !== undefined ? options.maxAngle : Math.PI / 4;
/**
/**
* @private
* @type {module:ol/style/TextPlacement|string}
*/
this.placement_ = options.placement !== undefined ? options.placement : TextPlacement.POINT;
this.placement_ = options.placement !== undefined ? options.placement : TextPlacement.POINT;
/**
/**
* @private
* @type {boolean}
*/
this.overflow_ = !!options.overflow;
this.overflow_ = !!options.overflow;
/**
/**
* @private
* @type {module:ol/style/Stroke}
*/
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
/**
/**
* @private
* @type {number}
*/
this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0;
this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0;
/**
/**
* @private
* @type {number}
*/
this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0;
this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0;
/**
/**
* @private
* @type {module:ol/style/Fill}
*/
this.backgroundFill_ = options.backgroundFill ? options.backgroundFill : null;
this.backgroundFill_ = options.backgroundFill ? options.backgroundFill : null;
/**
/**
* @private
* @type {module:ol/style/Stroke}
*/
this.backgroundStroke_ = options.backgroundStroke ? options.backgroundStroke : null;
this.backgroundStroke_ = options.backgroundStroke ? options.backgroundStroke : null;
/**
/**
* @private
* @type {Array.<number>}
*/
this.padding_ = options.padding === undefined ? null : options.padding;
}
this.padding_ = options.padding === undefined ? null : options.padding;
}
/**
/**
* Clones the style.
* @return {module:ol/style/Text} The cloned style.
* @api
*/
clone() {
return new Text({
font: this.getFont(),
placement: this.getPlacement(),
maxAngle: this.getMaxAngle(),
overflow: this.getOverflow(),
rotation: this.getRotation(),
rotateWithView: this.getRotateWithView(),
scale: this.getScale(),
text: this.getText(),
textAlign: this.getTextAlign(),
textBaseline: this.getTextBaseline(),
fill: this.getFill() ? this.getFill().clone() : undefined,
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
offsetX: this.getOffsetX(),
offsetY: this.getOffsetY(),
backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : undefined,
backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : undefined
});
}
clone() {
return new Text({
font: this.getFont(),
placement: this.getPlacement(),
maxAngle: this.getMaxAngle(),
overflow: this.getOverflow(),
rotation: this.getRotation(),
rotateWithView: this.getRotateWithView(),
scale: this.getScale(),
text: this.getText(),
textAlign: this.getTextAlign(),
textBaseline: this.getTextBaseline(),
fill: this.getFill() ? this.getFill().clone() : undefined,
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
offsetX: this.getOffsetX(),
offsetY: this.getOffsetY(),
backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : undefined,
backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : undefined
});
}
/**
/**
* Get the `overflow` configuration.
* @return {boolean} Let text overflow the length of the path they follow.
* @api
*/
getOverflow() {
return this.overflow_;
}
getOverflow() {
return this.overflow_;
}
/**
/**
* Get the font name.
* @return {string|undefined} Font.
* @api
*/
getFont() {
return this.font_;
}
getFont() {
return this.font_;
}
/**
/**
* Get the maximum angle between adjacent characters.
* @return {number} Angle in radians.
* @api
*/
getMaxAngle() {
return this.maxAngle_;
}
getMaxAngle() {
return this.maxAngle_;
}
/**
/**
* Get the label placement.
* @return {module:ol/style/TextPlacement|string} Text placement.
* @api
*/
getPlacement() {
return this.placement_;
}
getPlacement() {
return this.placement_;
}
/**
/**
* Get the x-offset for the text.
* @return {number} Horizontal text offset.
* @api
*/
getOffsetX() {
return this.offsetX_;
}
getOffsetX() {
return this.offsetX_;
}
/**
/**
* Get the y-offset for the text.
* @return {number} Vertical text offset.
* @api
*/
getOffsetY() {
return this.offsetY_;
}
getOffsetY() {
return this.offsetY_;
}
/**
/**
* Get the fill style for the text.
* @return {module:ol/style/Fill} Fill style.
* @api
*/
getFill() {
return this.fill_;
}
getFill() {
return this.fill_;
}
/**
/**
* Determine whether the text rotates with the map.
* @return {boolean|undefined} Rotate with map.
* @api
*/
getRotateWithView() {
return this.rotateWithView_;
}
getRotateWithView() {
return this.rotateWithView_;
}
/**
/**
* Get the text rotation.
* @return {number|undefined} Rotation.
* @api
*/
getRotation() {
return this.rotation_;
}
getRotation() {
return this.rotation_;
}
/**
/**
* Get the text scale.
* @return {number|undefined} Scale.
* @api
*/
getScale() {
return this.scale_;
}
getScale() {
return this.scale_;
}
/**
/**
* Get the stroke style for the text.
* @return {module:ol/style/Stroke} Stroke style.
* @api
*/
getStroke() {
return this.stroke_;
}
getStroke() {
return this.stroke_;
}
/**
/**
* Get the text to be rendered.
* @return {string|undefined} Text.
* @api
*/
getText() {
return this.text_;
}
getText() {
return this.text_;
}
/**
/**
* Get the text alignment.
* @return {string|undefined} Text align.
* @api
*/
getTextAlign() {
return this.textAlign_;
}
getTextAlign() {
return this.textAlign_;
}
/**
/**
* Get the text baseline.
* @return {string|undefined} Text baseline.
* @api
*/
getTextBaseline() {
return this.textBaseline_;
}
getTextBaseline() {
return this.textBaseline_;
}
/**
/**
* Get the background fill style for the text.
* @return {module:ol/style/Fill} Fill style.
* @api
*/
getBackgroundFill() {
return this.backgroundFill_;
}
getBackgroundFill() {
return this.backgroundFill_;
}
/**
/**
* Get the background stroke style for the text.
* @return {module:ol/style/Stroke} Stroke style.
* @api
*/
getBackgroundStroke() {
return this.backgroundStroke_;
}
getBackgroundStroke() {
return this.backgroundStroke_;
}
/**
/**
* Get the padding for the text.
* @return {Array.<number>} Padding.
* @api
*/
getPadding() {
return this.padding_;
}
getPadding() {
return this.padding_;
}
/**
/**
* Set the `overflow` property.
*
* @param {boolean} overflow Let text overflow the path that it follows.
* @api
*/
setOverflow(overflow) {
this.overflow_ = overflow;
}
setOverflow(overflow) {
this.overflow_ = overflow;
}
/**
/**
* Set the font.
*
* @param {string|undefined} font Font.
* @api
*/
setFont(font) {
this.font_ = font;
}
setFont(font) {
this.font_ = font;
}
/**
/**
* Set the maximum angle between adjacent characters.
*
* @param {number} maxAngle Angle in radians.
* @api
*/
setMaxAngle(maxAngle) {
this.maxAngle_ = maxAngle;
}
setMaxAngle(maxAngle) {
this.maxAngle_ = maxAngle;
}
/**
/**
* Set the x offset.
*
* @param {number} offsetX Horizontal text offset.
* @api
*/
setOffsetX(offsetX) {
this.offsetX_ = offsetX;
}
setOffsetX(offsetX) {
this.offsetX_ = offsetX;
}
/**
/**
* Set the y offset.
*
* @param {number} offsetY Vertical text offset.
* @api
*/
setOffsetY(offsetY) {
this.offsetY_ = offsetY;
}
setOffsetY(offsetY) {
this.offsetY_ = offsetY;
}
/**
/**
* Set the text placement.
*
* @param {module:ol/style/TextPlacement|string} placement Placement.
* @api
*/
setPlacement(placement) {
this.placement_ = placement;
}
setPlacement(placement) {
this.placement_ = placement;
}
/**
/**
* Set the fill.
*
* @param {module:ol/style/Fill} fill Fill style.
* @api
*/
setFill(fill) {
this.fill_ = fill;
}
setFill(fill) {
this.fill_ = fill;
}
/**
/**
* Set the rotation.
*
* @param {number|undefined} rotation Rotation.
* @api
*/
setRotation(rotation) {
this.rotation_ = rotation;
}
setRotation(rotation) {
this.rotation_ = rotation;
}
/**
/**
* Set the scale.
*
* @param {number|undefined} scale Scale.
* @api
*/
setScale(scale) {
this.scale_ = scale;
}
setScale(scale) {
this.scale_ = scale;
}
/**
/**
* Set the stroke.
*
* @param {module:ol/style/Stroke} stroke Stroke style.
* @api
*/
setStroke(stroke) {
this.stroke_ = stroke;
}
setStroke(stroke) {
this.stroke_ = stroke;
}
/**
/**
* Set the text.
*
* @param {string|undefined} text Text.
* @api
*/
setText(text) {
this.text_ = text;
}
setText(text) {
this.text_ = text;
}
/**
/**
* Set the text alignment.
*
* @param {string|undefined} textAlign Text align.
* @api
*/
setTextAlign(textAlign) {
this.textAlign_ = textAlign;
}
setTextAlign(textAlign) {
this.textAlign_ = textAlign;
}
/**
/**
* Set the text baseline.
*
* @param {string|undefined} textBaseline Text baseline.
* @api
*/
setTextBaseline(textBaseline) {
this.textBaseline_ = textBaseline;
}
setTextBaseline(textBaseline) {
this.textBaseline_ = textBaseline;
}
/**
/**
* Set the background fill.
*
* @param {module:ol/style/Fill} fill Fill style.
* @api
*/
setBackgroundFill(fill) {
this.backgroundFill_ = fill;
}
setBackgroundFill(fill) {
this.backgroundFill_ = fill;
}
/**
/**
* Set the background stroke.
*
* @param {module:ol/style/Stroke} stroke Stroke style.
* @api
*/
setBackgroundStroke(stroke) {
this.backgroundStroke_ = stroke;
}
setBackgroundStroke(stroke) {
this.backgroundStroke_ = stroke;
}
/**
/**
* Set the padding (`[top, right, bottom, left]`).
*
* @param {!Array.<number>} padding Padding.
* @api
*/
setPadding(padding) {
this.padding_ = padding;
}
setPadding(padding) {
this.padding_ = padding;
}
}
export default Text;