add Image source imageSmoothing option

Add Image smoothing checkbox to example

Test imageSmoothing option
This commit is contained in:
mike-000
2020-05-06 21:56:11 +01:00
parent 24c453c6b8
commit 9a8b9d8ade
16 changed files with 130 additions and 20 deletions
+18 -1
View File
@@ -6,6 +6,7 @@ import ImageState from '../ImageState.js';
import ReprojImage from '../reproj/Image.js';
import Source from './Source.js';
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
import {IMAGE_SMOOTHING_DISABLED} from './common.js';
import {abstract} from '../util.js';
import {equals} from '../extent.js';
import {equivalent} from '../proj.js';
@@ -62,6 +63,7 @@ export class ImageSourceEvent extends Event {
/**
* @typedef {Object} Options
* @property {import("./Source.js").AttributionLike} [attributions]
* @property {boolean} [imageSmoothing=true] Enable image smoothing.
* @property {import("../proj.js").ProjectionLike} [projection]
* @property {Array<number>} [resolutions]
* @property {import("./State.js").default} [state]
@@ -105,6 +107,13 @@ class ImageSource extends Source {
* @type {number}
*/
this.reprojectedRevision_ = 0;
/**
* @private
* @type {object|undefined}
*/
this.contextOptions_ =
options.imageSmoothing === false ? IMAGE_SMOOTHING_DISABLED : undefined;
}
/**
@@ -114,6 +123,13 @@ class ImageSource extends Source {
return this.resolutions_;
}
/**
* @return {Object|undefined} Context options.
*/
getContextOptions() {
return this.contextOptions_;
}
/**
* @protected
* @param {number} resolution Resolution.
@@ -173,7 +189,8 @@ class ImageSource extends Source {
pixelRatio,
sourceProjection
);
}.bind(this)
}.bind(this),
this.contextOptions_
);
this.reprojectedRevision_ = this.getRevision();