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

@@ -11,6 +11,18 @@ import TileImage from '../source/TileImage.js';
import {createOrUpdate, quadKey} from '../tilecoord.js';
import {createXYZ, extentFromProjection} from '../tilegrid.js';
/**
* The attribution containing a link to the Microsoft® Bing™ Maps Platform APIs
* Terms Of Use.
* @const
* @type {string}
*/
const TOS_ATTRIBUTION = '<a class="ol-attribution-bing-tos" ' +
'href="https://www.microsoft.com/maps/product/terms.html">' +
'Terms of Use</a>';
/**
* @typedef {Object} Options
* @property {number} [cacheSize=2048] Cache size.
@@ -213,16 +225,4 @@ class BingMaps {
inherits(BingMaps, TileImage);
/**
* The attribution containing a link to the Microsoft® Bing™ Maps Platform APIs
* Terms Of Use.
* @const
* @type {string}
*/
const TOS_ATTRIBUTION = '<a class="ol-attribution-bing-tos" ' +
'href="https://www.microsoft.com/maps/product/terms.html">' +
'Terms of Use</a>';
export default BingMaps;

View File

@@ -52,73 +52,73 @@ import ImageSource from '../source/Image.js';
* @api
*/
class ImageCanvasSource {
constructor(options) {
constructor(options) {
ImageSource.call(this, {
attributions: options.attributions,
projection: options.projection,
resolutions: options.resolutions,
state: options.state
});
ImageSource.call(this, {
attributions: options.attributions,
projection: options.projection,
resolutions: options.resolutions,
state: options.state
});
/**
/**
* @private
* @type {module:ol/source/ImageCanvas~FunctionType}
*/
this.canvasFunction_ = options.canvasFunction;
this.canvasFunction_ = options.canvasFunction;
/**
/**
* @private
* @type {module:ol/ImageCanvas}
*/
this.canvas_ = null;
this.canvas_ = null;
/**
/**
* @private
* @type {number}
*/
this.renderedRevision_ = 0;
this.renderedRevision_ = 0;
/**
/**
* @private
* @type {number}
*/
this.ratio_ = options.ratio !== undefined ?
options.ratio : 1.5;
this.ratio_ = options.ratio !== undefined ?
options.ratio : 1.5;
}
}
/**
/**
* @inheritDoc
*/
getImageInternal(extent, resolution, pixelRatio, projection) {
resolution = this.findNearestResolution(resolution);
getImageInternal(extent, resolution, pixelRatio, projection) {
resolution = this.findNearestResolution(resolution);
let canvas = this.canvas_;
if (canvas &&
let canvas = this.canvas_;
if (canvas &&
this.renderedRevision_ == this.getRevision() &&
canvas.getResolution() == resolution &&
canvas.getPixelRatio() == pixelRatio &&
containsExtent(canvas.getExtent(), extent)) {
return canvas;
}
return canvas;
}
extent = extent.slice();
scaleFromCenter(extent, this.ratio_);
const width = getWidth(extent) / resolution;
const height = getHeight(extent) / resolution;
const size = [width * pixelRatio, height * pixelRatio];
extent = extent.slice();
scaleFromCenter(extent, this.ratio_);
const width = getWidth(extent) / resolution;
const height = getHeight(extent) / resolution;
const size = [width * pixelRatio, height * pixelRatio];
const canvasElement = this.canvasFunction_(
extent, resolution, pixelRatio, size, projection);
if (canvasElement) {
canvas = new ImageCanvas(extent, resolution, pixelRatio, canvasElement);
}
this.canvas_ = canvas;
this.renderedRevision_ = this.getRevision();
const canvasElement = this.canvasFunction_(
extent, resolution, pixelRatio, size, projection);
if (canvasElement) {
canvas = new ImageCanvas(extent, resolution, pixelRatio, canvasElement);
}
this.canvas_ = canvas;
this.renderedRevision_ = this.getRevision();
return canvas;
}
return canvas;
}
}
inherits(ImageCanvasSource, ImageSource);

View File

@@ -17,6 +17,14 @@ import WMSServerType from '../source/WMSServerType.js';
import {compareVersions} from '../string.js';
import {appendParams} from '../uri.js';
/**
* @const
* @type {module:ol/size~Size}
*/
const GETFEATUREINFO_IMAGE_SIZE = [101, 101];
/**
* @typedef {Object} Options
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
@@ -380,11 +388,4 @@ class ImageWMS {
inherits(ImageWMS, ImageSource);
/**
* @const
* @type {module:ol/size~Size}
*/
const GETFEATUREINFO_IMAGE_SIZE = [101, 101];
export default ImageWMS;

View File

@@ -52,129 +52,129 @@ import SourceState from '../source/State.js';
* @api
*/
class Source {
constructor(options) {
constructor(options) {
BaseObject.call(this);
BaseObject.call(this);
/**
/**
* @private
* @type {module:ol/proj/Projection}
*/
this.projection_ = getProjection(options.projection);
this.projection_ = getProjection(options.projection);
/**
/**
* @private
* @type {?module:ol/source/Source~Attribution}
*/
this.attributions_ = this.adaptAttributions_(options.attributions);
this.attributions_ = this.adaptAttributions_(options.attributions);
/**
/**
* @private
* @type {module:ol/source/State}
*/
this.state_ = options.state !== undefined ?
options.state : SourceState.READY;
this.state_ = options.state !== undefined ?
options.state : SourceState.READY;
/**
/**
* @private
* @type {boolean}
*/
this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;
this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;
}
}
/**
/**
* Turns the attributions option into an attributions function.
* @param {module:ol/source/Source~AttributionLike|undefined} attributionLike The attribution option.
* @return {?module:ol/source/Source~Attribution} An attribution function (or null).
*/
adaptAttributions_(attributionLike) {
if (!attributionLike) {
return null;
}
if (Array.isArray(attributionLike)) {
return function(frameState) {
return attributionLike;
};
}
adaptAttributions_(attributionLike) {
if (!attributionLike) {
return null;
}
if (Array.isArray(attributionLike)) {
return function(frameState) {
return attributionLike;
};
}
if (typeof attributionLike === 'function') {
return attributionLike;
}
if (typeof attributionLike === 'function') {
return attributionLike;
}
return function(frameState) {
return [attributionLike];
};
}
return function(frameState) {
return [attributionLike];
};
}
/**
/**
* Get the attribution function for the source.
* @return {?module:ol/source/Source~Attribution} Attribution function.
*/
getAttributions() {
return this.attributions_;
}
getAttributions() {
return this.attributions_;
}
/**
/**
* Get the projection of the source.
* @return {module:ol/proj/Projection} Projection.
* @api
*/
getProjection() {
return this.projection_;
}
getProjection() {
return this.projection_;
}
/**
/**
* @abstract
* @return {Array.<number>|undefined} Resolutions.
*/
getResolutions() {}
getResolutions() {}
/**
/**
* Get the state of the source, see {@link module:ol/source/State~State} for possible states.
* @return {module:ol/source/State} State.
* @api
*/
getState() {
return this.state_;
}
getState() {
return this.state_;
}
/**
/**
* @return {boolean|undefined} Wrap X.
*/
getWrapX() {
return this.wrapX_;
}
getWrapX() {
return this.wrapX_;
}
/**
/**
* Refreshes the source and finally dispatches a 'change' event.
* @api
*/
refresh() {
this.changed();
}
refresh() {
this.changed();
}
/**
/**
* Set the attributions of the source.
* @param {module:ol/source/Source~AttributionLike|undefined} attributions Attributions.
* Can be passed as `string`, `Array<string>`, `{@link module:ol/source/Source~Attribution}`,
* or `undefined`.
* @api
*/
setAttributions(attributions) {
this.attributions_ = this.adaptAttributions_(attributions);
this.changed();
}
setAttributions(attributions) {
this.attributions_ = this.adaptAttributions_(attributions);
this.changed();
}
/**
/**
* Set the state of the source.
* @param {module:ol/source/State} state State.
* @protected
*/
setState(state) {
this.state_ = state;
this.changed();
}
setState(state) {
this.state_ = state;
this.changed();
}
}
inherits(Source, BaseObject);

View File

@@ -18,59 +18,59 @@ import {getKeyZXY} from '../tilecoord.js';
* @param {string} text Text.
*/
class LabeledTile {
constructor(tileCoord, tileSize, text) {
constructor(tileCoord, tileSize, text) {
Tile.call(this, tileCoord, TileState.LOADED);
Tile.call(this, tileCoord, TileState.LOADED);
/**
/**
* @private
* @type {module:ol/size~Size}
*/
this.tileSize_ = tileSize;
this.tileSize_ = tileSize;
/**
/**
* @private
* @type {string}
*/
this.text_ = text;
this.text_ = text;
/**
/**
* @private
* @type {HTMLCanvasElement}
*/
this.canvas_ = null;
this.canvas_ = null;
}
}
/**
/**
* Get the image element for this tile.
* @return {HTMLCanvasElement} Image.
*/
getImage() {
if (this.canvas_) {
return this.canvas_;
} else {
const tileSize = this.tileSize_;
const context = createCanvasContext2D(tileSize[0], tileSize[1]);
getImage() {
if (this.canvas_) {
return this.canvas_;
} else {
const tileSize = this.tileSize_;
const context = createCanvasContext2D(tileSize[0], tileSize[1]);
context.strokeStyle = 'black';
context.strokeRect(0.5, 0.5, tileSize[0] + 0.5, tileSize[1] + 0.5);
context.strokeStyle = 'black';
context.strokeRect(0.5, 0.5, tileSize[0] + 0.5, tileSize[1] + 0.5);
context.fillStyle = 'black';
context.textAlign = 'center';
context.textBaseline = 'middle';
context.font = '24px sans-serif';
context.fillText(this.text_, tileSize[0] / 2, tileSize[1] / 2);
context.fillStyle = 'black';
context.textAlign = 'center';
context.textBaseline = 'middle';
context.font = '24px sans-serif';
context.fillText(this.text_, tileSize[0] / 2, tileSize[1] / 2);
this.canvas_ = context.canvas;
return context.canvas;
}
}
this.canvas_ = context.canvas;
return context.canvas;
}
}
/**
/**
* @override
*/
load() {}
load() {}
}
inherits(LabeledTile, Tile);
@@ -98,35 +98,35 @@ inherits(LabeledTile, Tile);
* @api
*/
class TileDebug {
constructor(options) {
constructor(options) {
TileSource.call(this, {
opaque: false,
projection: options.projection,
tileGrid: options.tileGrid,
wrapX: options.wrapX !== undefined ? options.wrapX : true
});
TileSource.call(this, {
opaque: false,
projection: options.projection,
tileGrid: options.tileGrid,
wrapX: options.wrapX !== undefined ? options.wrapX : true
});
}
}
/**
/**
* @inheritDoc
*/
getTile(z, x, y) {
const tileCoordKey = getKeyZXY(z, x, y);
if (this.tileCache.containsKey(tileCoordKey)) {
return /** @type {!module:ol/source/TileDebug~LabeledTile} */ (this.tileCache.get(tileCoordKey));
} else {
const tileSize = toSize(this.tileGrid.getTileSize(z));
const tileCoord = [z, x, y];
const textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord);
const text = !textTileCoord ? '' :
this.getTileCoordForTileUrlFunction(textTileCoord).toString();
const tile = new LabeledTile(tileCoord, tileSize, text);
this.tileCache.set(tileCoordKey, tile);
return tile;
}
}
getTile(z, x, y) {
const tileCoordKey = getKeyZXY(z, x, y);
if (this.tileCache.containsKey(tileCoordKey)) {
return /** @type {!module:ol/source/TileDebug~LabeledTile} */ (this.tileCache.get(tileCoordKey));
} else {
const tileSize = toSize(this.tileGrid.getTileSize(z));
const tileCoord = [z, x, y];
const textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord);
const text = !textTileCoord ? '' :
this.getTileCoordForTileUrlFunction(textTileCoord).toString();
const tile = new LabeledTile(tileCoord, tileSize, text);
this.tileCache.set(tileCoordKey, tile);
return tile;
}
}
}
inherits(TileDebug, TileSource);