-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Image.js
51 lines (47 loc) · 1.55 KB
/
Image.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* @module ol/layer/Image
*/
import BaseImageLayer from './BaseImage.js';
import CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js';
/**
* @classdesc
* Server-rendered images that are available for arbitrary extents and
* resolutions.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @template {import("../source/Image.js").default} ImageSourceType
* @extends {BaseImageLayer<ImageSourceType, CanvasImageLayerRenderer>}
* @api
*/
class ImageLayer extends BaseImageLayer {
/**
* @param {import("./BaseImage.js").Options<ImageSourceType>} [options] Layer options.
*/
constructor(options) {
super(options);
}
createRenderer() {
return new CanvasImageLayerRenderer(this);
}
/**
* Get data for a pixel location. A four element RGBA array will be returned. For requests outside the
* layer extent, `null` will be returned. Data for an image can only be retrieved if the
* source's `crossOrigin` property is set.
*
* ```js
* // display layer data on every pointer move
* map.on('pointermove', (event) => {
* console.log(layer.getData(event.pixel));
* });
* ```
* @param {import("../pixel").Pixel} pixel Pixel.
* @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
* @api
*/
getData(pixel) {
return super.getData(pixel);
}
}
export default ImageLayer;