@deck.gl/carto 9.0.34 → 9.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cartoRasterTile-worker.js +1 -1
- package/dist/cartoSpatialTile-worker.js +1 -1
- package/dist/cartoVectorTile-worker.js +1 -1
- package/dist/dist.dev.js +115 -112
- package/dist/index.cjs +110 -105
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/layers/h3-tile-layer.d.ts +3 -3
- package/dist/layers/h3-tile-layer.d.ts.map +1 -1
- package/dist/layers/h3-tile-layer.js +12 -14
- package/dist/layers/heatmap-tile-layer.d.ts +11 -1
- package/dist/layers/heatmap-tile-layer.d.ts.map +1 -1
- package/dist/layers/heatmap-tile-layer.js +62 -2
- package/dist/layers/heatmap.d.ts +69 -22
- package/dist/layers/heatmap.d.ts.map +1 -1
- package/dist/layers/heatmap.js +20 -69
- package/dist/layers/quadbin-tile-layer.d.ts +3 -3
- package/dist/layers/quadbin-tile-layer.d.ts.map +1 -1
- package/dist/layers/quadbin-tile-layer.js +10 -12
- package/dist/layers/raster-layer-vertex.glsl.d.ts +1 -1
- package/dist/layers/raster-layer-vertex.glsl.js +1 -1
- package/dist/layers/raster-tile-layer.d.ts.map +1 -1
- package/dist/layers/raster-tile-layer.js +11 -13
- package/dist/layers/schema/carto-raster-tile-loader.js +1 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js +1 -1
- package/dist/layers/schema/carto-vector-tile-loader.js +1 -1
- package/dist.min.js +13 -39
- package/package.json +2 -2
- package/src/index.ts +21 -0
- package/src/layers/h3-tile-layer.ts +13 -15
- package/src/layers/heatmap-tile-layer.ts +86 -3
- package/src/layers/heatmap.ts +33 -97
- package/src/layers/quadbin-tile-layer.ts +11 -13
- package/src/layers/raster-layer-vertex.glsl.ts +1 -1
- package/src/layers/raster-tile-layer.ts +11 -13
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "CARTO official integration with Deck.gl. Build geospatial applications using CARTO and Deck.gl.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.0.
|
|
6
|
+
"version": "9.0.36",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"@deck.gl/layers": "^9.0.0",
|
|
73
73
|
"@loaders.gl/core": "^4.2.0"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "9f1a85a66ced70ff35fd404a81f37aaf1c338c62"
|
|
76
76
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// CARTO Layers
|
|
1
2
|
import {default as ClusterTileLayer} from './layers/cluster-tile-layer';
|
|
2
3
|
import {default as H3TileLayer} from './layers/h3-tile-layer';
|
|
3
4
|
import {default as HeatmapTileLayer} from './layers/heatmap-tile-layer';
|
|
@@ -5,6 +6,8 @@ import {default as _PointLabelLayer} from './layers/point-label-layer';
|
|
|
5
6
|
import {default as QuadbinTileLayer} from './layers/quadbin-tile-layer';
|
|
6
7
|
import {default as RasterTileLayer} from './layers/raster-tile-layer';
|
|
7
8
|
import {default as VectorTileLayer} from './layers/vector-tile-layer';
|
|
9
|
+
|
|
10
|
+
// Exports for playground/bindings
|
|
8
11
|
const CARTO_LAYERS = {
|
|
9
12
|
ClusterTileLayer,
|
|
10
13
|
H3TileLayer,
|
|
@@ -25,6 +28,24 @@ export {
|
|
|
25
28
|
VectorTileLayer
|
|
26
29
|
};
|
|
27
30
|
|
|
31
|
+
// Internal Layers
|
|
32
|
+
export {default as _QuadbinLayer} from './layers/quadbin-layer';
|
|
33
|
+
export {default as _RasterLayer} from './layers/raster-layer';
|
|
34
|
+
export {default as _SpatialIndexTileLayer} from './layers/spatial-index-tile-layer';
|
|
35
|
+
|
|
36
|
+
// Types
|
|
37
|
+
export type {ClusterTileLayerProps} from './layers/cluster-tile-layer';
|
|
38
|
+
export type {H3TileLayerProps} from './layers/h3-tile-layer';
|
|
39
|
+
export type {HeatmapTileLayerProps} from './layers/heatmap-tile-layer';
|
|
40
|
+
export type {PointLabelLayerProps} from './layers/point-label-layer';
|
|
41
|
+
export type {QuadbinLayerProps} from './layers/quadbin-layer';
|
|
42
|
+
export type {QuadbinTileLayerProps} from './layers/quadbin-tile-layer';
|
|
43
|
+
export type {RasterLayerProps} from './layers/raster-layer';
|
|
44
|
+
export type {RasterTileLayerProps} from './layers/raster-tile-layer';
|
|
45
|
+
export type {SpatialIndexTileLayerProps} from './layers/spatial-index-tile-layer';
|
|
46
|
+
export type {VectorTileLayerProps} from './layers/vector-tile-layer';
|
|
47
|
+
|
|
48
|
+
// Helpers
|
|
28
49
|
export {
|
|
29
50
|
default as BASEMAP,
|
|
30
51
|
GOOGLE_BASEMAPS as _GOOGLE_BASEMAPS,
|
|
@@ -50,7 +50,7 @@ export default class H3TileLayer<DataT = any, ExtraPropsT extends {} = {}> exten
|
|
|
50
50
|
return loadOptions;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
renderLayers():
|
|
53
|
+
renderLayers(): SpatialIndexTileLayer | null {
|
|
54
54
|
const tileJSON = this.props.data as TilejsonResult;
|
|
55
55
|
if (!tileJSON) return null;
|
|
56
56
|
|
|
@@ -71,21 +71,19 @@ export default class H3TileLayer<DataT = any, ExtraPropsT extends {} = {}> exten
|
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
const SubLayerClass = this.getSubLayerClass('spatial-index-tile', SpatialIndexTileLayer);
|
|
74
75
|
// The naming is unfortunate, but minZoom & maxZoom in the context
|
|
75
76
|
// of a Tileset2D refer to the resolution levels, not the Mercator zooms
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
loadOptions: this.getLoadOptions()
|
|
88
|
-
})
|
|
89
|
-
];
|
|
77
|
+
return new SubLayerClass(this.props, {
|
|
78
|
+
id: `h3-tile-layer-${this.props.id}`,
|
|
79
|
+
data,
|
|
80
|
+
// TODO: Tileset2D should be generic over TileIndex type
|
|
81
|
+
TilesetClass: H3Tileset2D as any,
|
|
82
|
+
renderSubLayers,
|
|
83
|
+
// minZoom and maxZoom are H3 resolutions, however we must use this naming as that is what the Tileset2D class expects
|
|
84
|
+
minZoom: minresolution,
|
|
85
|
+
maxZoom: maxresolution,
|
|
86
|
+
loadOptions: this.getLoadOptions()
|
|
87
|
+
});
|
|
90
88
|
}
|
|
91
89
|
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import {getResolution} from 'quadbin';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Accessor,
|
|
5
|
+
Color,
|
|
6
|
+
CompositeLayer,
|
|
7
|
+
CompositeLayerProps,
|
|
8
|
+
DefaultProps,
|
|
9
|
+
Layer,
|
|
10
|
+
UpdateParameters
|
|
11
|
+
} from '@deck.gl/core';
|
|
4
12
|
import {SolidPolygonLayer} from '@deck.gl/layers';
|
|
5
13
|
|
|
6
14
|
import {HeatmapProps, heatmap} from './heatmap';
|
|
@@ -9,7 +17,27 @@ import QuadbinTileLayer, {QuadbinTileLayerProps} from './quadbin-tile-layer';
|
|
|
9
17
|
import {TilejsonPropType} from './utils';
|
|
10
18
|
import {TilejsonResult} from '../sources';
|
|
11
19
|
import {_Tile2DHeader as Tile2DHeader} from '@deck.gl/geo-layers';
|
|
20
|
+
import {Texture, TextureProps} from '@luma.gl/core';
|
|
12
21
|
|
|
22
|
+
const defaultColorRange: Color[] = [
|
|
23
|
+
[255, 255, 178],
|
|
24
|
+
[254, 217, 118],
|
|
25
|
+
[254, 178, 76],
|
|
26
|
+
[253, 141, 60],
|
|
27
|
+
[240, 59, 32],
|
|
28
|
+
[189, 0, 38]
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const TEXTURE_PROPS: TextureProps = {
|
|
32
|
+
format: 'rgba8unorm',
|
|
33
|
+
mipmaps: false,
|
|
34
|
+
sampler: {
|
|
35
|
+
minFilter: 'linear',
|
|
36
|
+
magFilter: 'linear',
|
|
37
|
+
addressModeU: 'clamp-to-edge',
|
|
38
|
+
addressModeV: 'clamp-to-edge'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
13
41
|
/**
|
|
14
42
|
* Computes the unit density (inverse of cell area)
|
|
15
43
|
*/
|
|
@@ -18,6 +46,24 @@ function unitDensityForCell(cell: bigint) {
|
|
|
18
46
|
return Math.pow(4.0, cellResolution);
|
|
19
47
|
}
|
|
20
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Converts a colorRange array to a flat array with 4 components per color
|
|
51
|
+
*/
|
|
52
|
+
function colorRangeToFlatArray(colorRange: Color[]): Uint8Array {
|
|
53
|
+
const flatArray = new Uint8Array(colorRange.length * 4);
|
|
54
|
+
let index = 0;
|
|
55
|
+
|
|
56
|
+
for (let i = 0; i < colorRange.length; i++) {
|
|
57
|
+
const color = colorRange[i];
|
|
58
|
+
flatArray[index++] = color[0];
|
|
59
|
+
flatArray[index++] = color[1];
|
|
60
|
+
flatArray[index++] = color[2];
|
|
61
|
+
flatArray[index++] = Number.isFinite(color[3]) ? (color[3] as number) : 255;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return flatArray;
|
|
65
|
+
}
|
|
66
|
+
|
|
21
67
|
// Modified polygon layer to draw offscreen and output value expected by heatmap
|
|
22
68
|
class RTTSolidPolygonLayer extends RTTModifier(SolidPolygonLayer) {
|
|
23
69
|
static layerName = 'RTTSolidPolygonLayer';
|
|
@@ -70,6 +116,7 @@ const defaultProps: DefaultProps<HeatmapTileLayerProps> = {
|
|
|
70
116
|
getWeight: {type: 'accessor', value: 1},
|
|
71
117
|
onMaxDensityChange: {type: 'function', optional: true, value: null},
|
|
72
118
|
colorDomain: {type: 'array', value: [0, 1]},
|
|
119
|
+
colorRange: defaultColorRange,
|
|
73
120
|
intensity: {type: 'number', value: 1},
|
|
74
121
|
radiusPixels: {type: 'number', min: 0, max: 100, value: 20}
|
|
75
122
|
};
|
|
@@ -83,6 +130,13 @@ export type HeatmapTileLayerProps<DataT = unknown> = _HeatmapTileLayerProps<Data
|
|
|
83
130
|
/** Properties added by HeatmapTileLayer. */
|
|
84
131
|
type _HeatmapTileLayerProps<DataT> = QuadbinTileLayerProps<DataT> &
|
|
85
132
|
HeatmapProps & {
|
|
133
|
+
/**
|
|
134
|
+
* Specified as an array of colors [color1, color2, ...].
|
|
135
|
+
*
|
|
136
|
+
* @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)
|
|
137
|
+
*/
|
|
138
|
+
colorRange: Color[];
|
|
139
|
+
|
|
86
140
|
/**
|
|
87
141
|
* The weight of each object.
|
|
88
142
|
*
|
|
@@ -101,6 +155,7 @@ class HeatmapTileLayer<DataT = any, ExtraProps extends {} = {}> extends Composit
|
|
|
101
155
|
static defaultProps = defaultProps;
|
|
102
156
|
|
|
103
157
|
state!: {
|
|
158
|
+
colorTexture?: Texture;
|
|
104
159
|
isLoaded: boolean;
|
|
105
160
|
tiles: Set<Tile2DHeader>;
|
|
106
161
|
viewportChanged?: boolean;
|
|
@@ -119,12 +174,19 @@ class HeatmapTileLayer<DataT = any, ExtraProps extends {} = {}> extends Composit
|
|
|
119
174
|
return changeFlags.somethingChanged;
|
|
120
175
|
}
|
|
121
176
|
|
|
177
|
+
updateState(opts: UpdateParameters<this>) {
|
|
178
|
+
const {props, oldProps} = opts;
|
|
179
|
+
super.updateState(opts);
|
|
180
|
+
if (props.colorRange !== oldProps.colorRange) {
|
|
181
|
+
this._updateColorTexture(opts);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
122
185
|
renderLayers(): Layer {
|
|
123
186
|
const {
|
|
124
187
|
data,
|
|
125
188
|
getWeight,
|
|
126
189
|
colorDomain,
|
|
127
|
-
colorRange,
|
|
128
190
|
intensity,
|
|
129
191
|
radiusPixels,
|
|
130
192
|
_subLayerProps,
|
|
@@ -183,12 +245,13 @@ class HeatmapTileLayer<DataT = any, ExtraProps extends {} = {}> extends Composit
|
|
|
183
245
|
|
|
184
246
|
colorDomain,
|
|
185
247
|
|
|
186
|
-
colorRange,
|
|
187
248
|
radiusPixels,
|
|
188
249
|
intensity,
|
|
189
250
|
_subLayerProps: subLayerProps,
|
|
190
251
|
refinementStrategy: 'no-overlap',
|
|
191
252
|
|
|
253
|
+
colorTexture: this.state.colorTexture,
|
|
254
|
+
|
|
192
255
|
// Disable line rendering
|
|
193
256
|
extruded: false,
|
|
194
257
|
stroked: false,
|
|
@@ -231,6 +294,26 @@ class HeatmapTileLayer<DataT = any, ExtraProps extends {} = {}> extends Composit
|
|
|
231
294
|
})
|
|
232
295
|
);
|
|
233
296
|
}
|
|
297
|
+
|
|
298
|
+
_updateColorTexture(opts) {
|
|
299
|
+
const {colorRange} = opts.props;
|
|
300
|
+
let {colorTexture} = this.state;
|
|
301
|
+
const colors = colorRangeToFlatArray(colorRange);
|
|
302
|
+
|
|
303
|
+
if (colorTexture && colorTexture?.width === colorRange.length) {
|
|
304
|
+
// TODO(v9): Unclear whether `setSubImageData` is a public API, or what to use if not.
|
|
305
|
+
(colorTexture as any).setSubImageData({data: colors});
|
|
306
|
+
} else {
|
|
307
|
+
colorTexture?.destroy();
|
|
308
|
+
colorTexture = this.context.device.createTexture({
|
|
309
|
+
...TEXTURE_PROPS,
|
|
310
|
+
data: colors,
|
|
311
|
+
width: colorRange.length,
|
|
312
|
+
height: 1
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
this.setState({colorTexture});
|
|
316
|
+
}
|
|
234
317
|
}
|
|
235
318
|
|
|
236
319
|
export default HeatmapTileLayer;
|
package/src/layers/heatmap.ts
CHANGED
|
@@ -1,54 +1,29 @@
|
|
|
1
1
|
import type {ShaderPass} from '@luma.gl/shadertools';
|
|
2
|
-
import {
|
|
2
|
+
import {Texture} from '@luma.gl/core';
|
|
3
3
|
const glsl = (s: TemplateStringsArray) => `${s}`;
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @filter Heatmap
|
|
7
7
|
* @param radiusPixels Blur radius in pixels, controls smoothness of heatmap
|
|
8
8
|
* @param colorDomain Domain to apply to values prior to applying color scale
|
|
9
|
-
* @param
|
|
9
|
+
* @param colorTexture 1D RGB lookup texture for color scale
|
|
10
|
+
* @param intensity Multiplier to apply to value
|
|
11
|
+
* @param opacity Output opacity
|
|
10
12
|
*/
|
|
11
13
|
|
|
12
14
|
const fs = glsl`\
|
|
13
15
|
uniform heatmapUniforms {
|
|
14
|
-
vec2 delta;
|
|
15
|
-
float radiusPixels;
|
|
16
16
|
vec2 colorDomain;
|
|
17
|
-
|
|
18
|
-
vec3 color2;
|
|
19
|
-
vec3 color3;
|
|
20
|
-
vec3 color4;
|
|
21
|
-
vec3 color5;
|
|
22
|
-
vec3 color6;
|
|
17
|
+
vec2 delta;
|
|
23
18
|
float intensity;
|
|
24
19
|
float opacity;
|
|
20
|
+
float radiusPixels;
|
|
25
21
|
} heatmap;
|
|
26
22
|
|
|
27
|
-
|
|
23
|
+
uniform sampler2D colorTexture;
|
|
28
24
|
|
|
29
25
|
vec3 colorGradient(float value) {
|
|
30
|
-
|
|
31
|
-
vec3 c2;
|
|
32
|
-
vec2 range;
|
|
33
|
-
if (value < STOPS.x) {
|
|
34
|
-
range = vec2(0.0, STOPS.x);
|
|
35
|
-
c1 = heatmap.color1; c2 = heatmap.color2;
|
|
36
|
-
} else if (value < STOPS.y) {
|
|
37
|
-
range = STOPS.xy;
|
|
38
|
-
c1 = heatmap.color2; c2 = heatmap.color3;
|
|
39
|
-
} else if (value < STOPS.z) {
|
|
40
|
-
range = STOPS.yz;
|
|
41
|
-
c1 = heatmap.color3; c2 = heatmap.color4;
|
|
42
|
-
} else if (value < STOPS.w) {
|
|
43
|
-
range = STOPS.zw;
|
|
44
|
-
c1 = heatmap.color4; c2 = heatmap.color5;
|
|
45
|
-
} else {
|
|
46
|
-
range = vec2(STOPS.w, 1.0);
|
|
47
|
-
c1 = heatmap.color5; c2 = heatmap.color6;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
float f = (clamp(value, 0.0, 1.0) - range.x) / (range.y - range.x);
|
|
51
|
-
return mix(c1, c2, f) / 255.0;
|
|
26
|
+
return texture(colorTexture, vec2(value, 0.5)).rgb;
|
|
52
27
|
}
|
|
53
28
|
|
|
54
29
|
const vec3 SHIFT = vec3(1.0, 256.0, 256.0 * 256.0);
|
|
@@ -115,15 +90,6 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
115
90
|
}
|
|
116
91
|
`;
|
|
117
92
|
|
|
118
|
-
const defaultColorRange: Color[] = [
|
|
119
|
-
[255, 255, 178],
|
|
120
|
-
[254, 217, 118],
|
|
121
|
-
[254, 178, 76],
|
|
122
|
-
[253, 141, 60],
|
|
123
|
-
[240, 59, 32],
|
|
124
|
-
[189, 0, 38]
|
|
125
|
-
];
|
|
126
|
-
|
|
127
93
|
export type HeatmapProps = {
|
|
128
94
|
/**
|
|
129
95
|
* Radius of the heatmap blur in pixels, to which the weight of a cell is distributed.
|
|
@@ -132,89 +98,59 @@ export type HeatmapProps = {
|
|
|
132
98
|
*/
|
|
133
99
|
radiusPixels?: number;
|
|
134
100
|
/**
|
|
135
|
-
* Controls how weight values are mapped to the `
|
|
101
|
+
* Controls how weight values are mapped to the colors in `colorTexture`, as an array of two numbers [`minValue`, `maxValue`].
|
|
136
102
|
*
|
|
137
103
|
* @default [0, 1]
|
|
138
104
|
*/
|
|
139
105
|
colorDomain?: [number, number];
|
|
140
|
-
/**
|
|
141
|
-
* Specified as an array of colors [color1, color2, ...].
|
|
142
|
-
*
|
|
143
|
-
* @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)
|
|
144
|
-
*/
|
|
145
|
-
colorRange: Color[];
|
|
146
106
|
/**
|
|
147
107
|
* Value that is multiplied with the total weight at a pixel to obtain the final weight. A value larger than 1 biases the output color towards the higher end of the spectrum, and a value less than 1 biases the output color towards the lower end of the spectrum.
|
|
148
108
|
*/
|
|
149
109
|
intensity?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Color LUT for color gradient
|
|
112
|
+
*/
|
|
113
|
+
colorTexture: Texture;
|
|
150
114
|
opacity: number;
|
|
151
115
|
};
|
|
152
116
|
|
|
153
|
-
|
|
154
|
-
delta
|
|
155
|
-
radiusPixels?: number;
|
|
156
|
-
colorDomain?: [number, number];
|
|
157
|
-
color1?: [number, number, number];
|
|
158
|
-
color2?: [number, number, number];
|
|
159
|
-
color3?: [number, number, number];
|
|
160
|
-
color4?: [number, number, number];
|
|
161
|
-
color5?: [number, number, number];
|
|
162
|
-
color6?: [number, number, number];
|
|
163
|
-
intensity: number;
|
|
164
|
-
opacity?: number;
|
|
117
|
+
type PassProps = {
|
|
118
|
+
delta: [number, number];
|
|
165
119
|
};
|
|
166
120
|
|
|
167
|
-
export const heatmap
|
|
121
|
+
export const heatmap = {
|
|
168
122
|
name: 'heatmap',
|
|
169
123
|
uniformPropTypes: {
|
|
170
|
-
delta: {value: [0, 1]},
|
|
171
|
-
radiusPixels: {value: 20, min: 0, softMax: 100},
|
|
172
124
|
colorDomain: {value: [0, 1]},
|
|
173
|
-
|
|
174
|
-
color2: {value: [0, 0, 0]},
|
|
175
|
-
color3: {value: [0, 0, 0]},
|
|
176
|
-
color4: {value: [0, 0, 0]},
|
|
177
|
-
color5: {value: [0, 0, 0]},
|
|
178
|
-
color6: {value: [0, 0, 0]},
|
|
125
|
+
delta: {value: [0, 1]},
|
|
179
126
|
intensity: {value: 1, min: 0.1, max: 10},
|
|
180
|
-
opacity: {value: 1, min: 0, max: 1}
|
|
127
|
+
opacity: {value: 1, min: 0, max: 1},
|
|
128
|
+
radiusPixels: {value: 20, min: 0, softMax: 100}
|
|
181
129
|
},
|
|
182
130
|
uniformTypes: {
|
|
183
|
-
delta: 'vec2<f32>',
|
|
184
|
-
radiusPixels: 'f32',
|
|
185
131
|
colorDomain: 'vec2<f32>',
|
|
186
|
-
|
|
187
|
-
color2: 'vec3<f32>',
|
|
188
|
-
color3: 'vec3<f32>',
|
|
189
|
-
color4: 'vec3<f32>',
|
|
190
|
-
color5: 'vec3<f32>',
|
|
191
|
-
color6: 'vec3<f32>',
|
|
132
|
+
delta: 'vec2<f32>',
|
|
192
133
|
intensity: 'f32',
|
|
193
|
-
opacity: 'f32'
|
|
134
|
+
opacity: 'f32',
|
|
135
|
+
radiusPixels: 'f32'
|
|
194
136
|
},
|
|
195
|
-
// @ts-expect-error stricter luma gl types
|
|
196
137
|
getUniforms: opts => {
|
|
138
|
+
if (!opts) return {};
|
|
197
139
|
const {
|
|
198
|
-
delta = [1, 0],
|
|
199
|
-
colorRange = defaultColorRange,
|
|
200
|
-
radiusPixels = 20,
|
|
201
140
|
colorDomain = [0, 1],
|
|
141
|
+
colorTexture,
|
|
142
|
+
delta = [1, 0],
|
|
202
143
|
intensity = 1,
|
|
203
|
-
opacity = 1
|
|
204
|
-
|
|
205
|
-
|
|
144
|
+
opacity = 1,
|
|
145
|
+
radiusPixels = 20
|
|
146
|
+
} = opts;
|
|
206
147
|
return {
|
|
207
|
-
delta,
|
|
208
|
-
color1,
|
|
209
|
-
color2,
|
|
210
|
-
color3,
|
|
211
|
-
color4,
|
|
212
|
-
color5,
|
|
213
|
-
color6,
|
|
214
|
-
radiusPixels,
|
|
215
148
|
colorDomain,
|
|
149
|
+
colorTexture,
|
|
150
|
+
delta,
|
|
216
151
|
intensity,
|
|
217
|
-
opacity
|
|
152
|
+
opacity,
|
|
153
|
+
radiusPixels
|
|
218
154
|
};
|
|
219
155
|
},
|
|
220
156
|
fs,
|
|
@@ -222,4 +158,4 @@ export const heatmap: ShaderPass<HeatmapProps, HeatmapUniforms> = {
|
|
|
222
158
|
{sampler: true, uniforms: {delta: [1, 0]}},
|
|
223
159
|
{sampler: true, uniforms: {delta: [0, 1]}}
|
|
224
160
|
]
|
|
225
|
-
}
|
|
161
|
+
} as const satisfies ShaderPass<HeatmapProps & PassProps>;
|
|
@@ -46,22 +46,20 @@ export default class QuadbinTileLayer<
|
|
|
46
46
|
return loadOptions;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
renderLayers():
|
|
49
|
+
renderLayers(): SpatialIndexTileLayer | null {
|
|
50
50
|
const tileJSON = this.props.data as TilejsonResult;
|
|
51
51
|
if (!tileJSON) return null;
|
|
52
52
|
|
|
53
53
|
const {tiles: data, maxresolution: maxZoom} = tileJSON;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
})
|
|
65
|
-
];
|
|
54
|
+
const SubLayerClass = this.getSubLayerClass('spatial-index-tile', SpatialIndexTileLayer);
|
|
55
|
+
return new SubLayerClass(this.props, {
|
|
56
|
+
id: `quadbin-tile-layer-${this.props.id}`,
|
|
57
|
+
data,
|
|
58
|
+
// TODO: Tileset2D should be generic over TileIndex type
|
|
59
|
+
TilesetClass: QuadbinTileset2D as any,
|
|
60
|
+
renderSubLayers,
|
|
61
|
+
maxZoom,
|
|
62
|
+
loadOptions: this.getLoadOptions()
|
|
63
|
+
});
|
|
66
64
|
}
|
|
67
65
|
}
|
|
@@ -34,7 +34,7 @@ void main(void) {
|
|
|
34
34
|
|
|
35
35
|
int yIndex = - (gl_InstanceID / BLOCK_WIDTH);
|
|
36
36
|
int xIndex = gl_InstanceID + (yIndex * BLOCK_WIDTH);
|
|
37
|
-
common_position += scale * vec2(float(xIndex), float(yIndex));
|
|
37
|
+
common_position += scale * vec2(float(xIndex), float(yIndex - 1));
|
|
38
38
|
|
|
39
39
|
vec4 color = isStroke ? instanceLineColors : instanceFillColors;
|
|
40
40
|
|
|
@@ -46,18 +46,16 @@ export default class RasterTileLayer<
|
|
|
46
46
|
if (!tileJSON) return null;
|
|
47
47
|
|
|
48
48
|
const {tiles: data, minzoom: minZoom, maxzoom: maxZoom} = tileJSON;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
];
|
|
49
|
+
const SubLayerClass = this.getSubLayerClass('tile', TileLayer);
|
|
50
|
+
return new SubLayerClass(this.props, {
|
|
51
|
+
id: `raster-tile-layer-${this.props.id}`,
|
|
52
|
+
data,
|
|
53
|
+
// TODO: Tileset2D should be generic over TileIndex type
|
|
54
|
+
TilesetClass: QuadbinTileset2D as any,
|
|
55
|
+
renderSubLayers,
|
|
56
|
+
minZoom,
|
|
57
|
+
maxZoom,
|
|
58
|
+
loadOptions: this.getLoadOptions()
|
|
59
|
+
});
|
|
62
60
|
}
|
|
63
61
|
}
|