Automated class transform

npx lebab --replace src --transform class
This commit is contained in:
Tim Schaub
2018-07-16 16:18:16 -06:00
parent 60e85e7d89
commit 7b4a73f3b9
145 changed files with 32887 additions and 33714 deletions
+63 -60
View File
@@ -51,74 +51,77 @@ import ImageSource from '../source/Image.js';
* @param {module:ol/source/ImageCanvas~Options=} options ImageCanvas options.
* @api
*/
const ImageCanvasSource = function(options) {
class ImageCanvasSource {
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;
/**
* @private
* @type {module:ol/source/ImageCanvas~FunctionType}
*/
this.canvasFunction_ = options.canvasFunction;
/**
* @private
* @type {module:ol/ImageCanvas}
*/
this.canvas_ = null;
/**
* @private
* @type {module:ol/ImageCanvas}
*/
this.canvas_ = null;
/**
* @private
* @type {number}
*/
this.renderedRevision_ = 0;
/**
* @private
* @type {number}
*/
this.renderedRevision_ = 0;
/**
* @private
* @type {number}
*/
this.ratio_ = options.ratio !== undefined ?
options.ratio : 1.5;
/**
* @private
* @type {number}
*/
this.ratio_ = options.ratio !== undefined ?
options.ratio : 1.5;
};
}
/**
* @inheritDoc
*/
getImageInternal(extent, resolution, pixelRatio, projection) {
resolution = this.findNearestResolution(resolution);
let canvas = this.canvas_;
if (canvas &&
this.renderedRevision_ == this.getRevision() &&
canvas.getResolution() == resolution &&
canvas.getPixelRatio() == pixelRatio &&
containsExtent(canvas.getExtent(), extent)) {
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];
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;
}
}
inherits(ImageCanvasSource, ImageSource);
/**
* @inheritDoc
*/
ImageCanvasSource.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) {
resolution = this.findNearestResolution(resolution);
let canvas = this.canvas_;
if (canvas &&
this.renderedRevision_ == this.getRevision() &&
canvas.getResolution() == resolution &&
canvas.getPixelRatio() == pixelRatio &&
containsExtent(canvas.getExtent(), extent)) {
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];
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;
};
export default ImageCanvasSource;