1
- import {
2
- CompositeLayer ,
3
- Layer ,
4
- LayersList ,
5
- LayerContext ,
6
- GetPickingInfoParams ,
7
- } from "deck.gl" ;
1
+ import { CompositeLayer , Layer , LayersList } from "deck.gl" ;
8
2
import type { CompositeLayerProps , UpdateParameters } from "deck.gl" ;
9
- import type { BitmapLayerPickingInfo } from "@deck.gl/layers" ;
10
3
import type { Texture } from "@luma.gl/core" ;
11
4
12
5
import { NumericDataAnimationPaintLayer } from "../NumericDataAnimationPaintLayer" ;
@@ -27,53 +20,19 @@ const textureSamplerDefaultOption = {
27
20
28
21
export default class NumericDataAnimationLayer extends CompositeLayer < NumericDataAnimationLayerProps > {
29
22
static layerName : string = "numeric-data-animation-layer" ;
30
-
31
- // initializeState(context: LayerContext): void {
32
- // const { tileSize, textureParameters } = this.props;
33
- // const dataTextureStart = context.device.createTexture({
34
- // data: this.props.imageDataStart,
35
- // width: tileSize,
36
- // height: tileSize,
37
- // ...textureDefaultOption,
38
- // sampler: {
39
- // ...textureSamplerDefaultOption,
40
- // ...textureParameters,
41
- // },
42
- // });
43
- // const dataTextureEnd = context.device.createTexture({
44
- // data: this.props.imageDataEnd,
45
- // width: tileSize,
46
- // height: tileSize,
47
- // ...textureDefaultOption,
48
- // sampler: {
49
- // ...textureSamplerDefaultOption,
50
- // ...textureParameters,
51
- // },
52
- // });
53
- // this.setState({
54
- // dataTextureStart,
55
- // dataTextureEnd,
56
- // });
57
- // }
58
23
updateState (
59
24
params : UpdateParameters <
60
- Layer < NumericDataLayerProps & Required < CompositeLayerProps > >
25
+ Layer < NumericDataAnimationLayerProps & Required < CompositeLayerProps > >
61
26
>
62
27
) : void {
63
28
const { props, oldProps, context } = params ;
64
- const { imageDataStart, imageDataEnd, timestamp } = props ;
65
- const {
66
- imageDataStart : oldImageDataStart ,
67
- imageDataEnd : oldImageDataEnd ,
68
- timestamp : oldTimestamp ,
69
- } = oldProps ;
70
- if (
71
- imageDataStart !== oldImageDataStart &&
72
- imageDataEnd !== oldImageDataEnd
73
- ) {
29
+ const { imageDataFrom, imageDataTo } = props ;
30
+ const { imageDataFrom : oldImageDataFrom , imageDataTo : oldImageDataTo } =
31
+ oldProps ;
32
+ if ( imageDataFrom !== oldImageDataFrom && imageDataTo !== oldImageDataTo ) {
74
33
const { tileSize, textureParameters } = props ;
75
- const dataTextureStart = context . device . createTexture ( {
76
- data : this . props . imageDataStart ,
34
+ const dataTextureFrom = context . device . createTexture ( {
35
+ data : this . props . imageDataFrom ,
77
36
width : tileSize ,
78
37
height : tileSize ,
79
38
...textureDefaultOption ,
@@ -82,8 +41,8 @@ export default class NumericDataAnimationLayer extends CompositeLayer<NumericDat
82
41
...textureParameters ,
83
42
} ,
84
43
} ) ;
85
- const dataTextureEnd = context . device . createTexture ( {
86
- data : this . props . imageDataEnd ,
44
+ const dataTextureTo = context . device . createTexture ( {
45
+ data : this . props . imageDataTo ,
87
46
width : tileSize ,
88
47
height : tileSize ,
89
48
...textureDefaultOption ,
@@ -93,17 +52,17 @@ export default class NumericDataAnimationLayer extends CompositeLayer<NumericDat
93
52
} ,
94
53
} ) ;
95
54
this . setState ( {
96
- dataTextureStart ,
97
- dataTextureEnd ,
55
+ dataTextureFrom ,
56
+ dataTextureTo ,
98
57
} ) ;
99
58
}
100
59
}
101
60
102
61
renderLayers ( ) : Layer | null | LayersList {
103
62
return new NumericDataAnimationPaintLayer ( this . props , {
104
63
id : `${ this . props . id } -data` ,
105
- image : this . state . dataTextureStart as Texture ,
106
- imageEnd : this . state . dataTextureEnd as Texture ,
64
+ image : this . state . dataTextureFrom as Texture ,
65
+ imageTo : this . state . dataTextureTo as Texture ,
107
66
} ) ;
108
67
}
109
68
}
0 commit comments