@deck.gl/carto 9.0.29 → 9.0.31
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/api/common.d.ts +1 -1
- package/dist/api/common.d.ts.map +1 -1
- package/dist/api/common.js +2 -1
- package/dist/api/fetch-map.d.ts +7 -1
- package/dist/api/fetch-map.d.ts.map +1 -1
- package/dist/api/fetch-map.js +17 -15
- package/dist/api/query.d.ts.map +1 -1
- package/dist/api/query.js +3 -2
- package/dist/api/request-with-parameters.d.ts +2 -1
- package/dist/api/request-with-parameters.d.ts.map +1 -1
- package/dist/api/request-with-parameters.js +3 -3
- 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 +57 -30
- package/dist/index.cjs +132 -180
- package/dist/index.cjs.map +2 -2
- package/dist/layers/cluster-tile-layer.d.ts.map +1 -1
- package/dist/layers/cluster-tile-layer.js +20 -9
- package/dist/layers/cluster-utils.d.ts +1 -1
- package/dist/layers/cluster-utils.d.ts.map +1 -1
- package/dist/layers/cluster-utils.js +5 -5
- package/dist/layers/h3-tile-layer.js +4 -3
- package/dist/layers/heatmap-tile-layer.js +3 -3
- package/dist/layers/point-label-layer.js +6 -5
- package/dist/layers/post-process-utils.js +89 -85
- package/dist/layers/quadbin-layer.js +4 -3
- package/dist/layers/quadbin-tile-layer.js +4 -3
- package/dist/layers/raster-layer.js +5 -4
- package/dist/layers/raster-tile-layer.js +4 -3
- 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/layers/spatial-index-tile-layer.js +4 -3
- package/dist/layers/vector-tile-layer.js +4 -3
- package/dist/sources/base-source.d.ts.map +1 -1
- package/dist/sources/base-source.js +10 -6
- package/dist/sources/types.d.ts +6 -0
- package/dist/sources/types.d.ts.map +1 -1
- package/dist.min.js +9 -9
- package/package.json +2 -2
- package/src/api/common.ts +3 -1
- package/src/api/fetch-map.ts +38 -18
- package/src/api/query.ts +3 -1
- package/src/api/request-with-parameters.ts +5 -3
- package/src/layers/cluster-tile-layer.ts +14 -1
- package/src/layers/cluster-utils.ts +5 -4
- package/src/sources/base-source.ts +10 -6
- package/src/sources/types.ts +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cluster-tile-layer.d.ts","sourceRoot":"","sources":["../../src/layers/cluster-tile-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAGL,cAAc,EACd,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE/C,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,cAAc,EAGd,KAAK,EACL,UAAU,EACV,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAEL,2BAA2B,EAI3B,iBAAiB,EACjB,iBAAiB,EAClB,2BAAwB;AAMzB,OAAO,KAAK,EAAC,cAAc,EAAC,4BAAyB;AAgBrD,MAAM,MAAM,2BAA2B,CAAC,kBAAkB,GAAG,EAAE,IAAI,oBAAoB,CACrF,iBAAiB,CAAC,kBAAkB,CAAC,EACrC,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CACnD,CAAC;AAEF,oDAAoD;AACpD,MAAM,MAAM,qBAAqB,CAAC,kBAAkB,GAAG,OAAO,IAC5D,sBAAsB,CAAC,kBAAkB,CAAC,GACxC,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAExE,4CAA4C;AAC5C,KAAK,sBAAsB,CAAC,kBAAkB,IAAI,IAAI,CACpD,iBAAiB,CAAC,2BAA2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,cAAc,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAExE,4CAA4C;AAC5C,KAAK,sBAAsB,CAAC,kBAAkB,IAAI,IAAI,CACpD,iBAAiB,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,CAAC,EAClE,MAAM,CACP,GAAG;IACF,IAAI,EAAE,IAAI,GAAG,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEtD;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEhF;;;;OAIG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC;CACrE,CAAC;AAiHF,MAAM,CAAC,OAAO,OAAO,gBAAgB,CACnC,kBAAkB,GAAG,GAAG,EACxB,UAAU,SAAS,EAAE,GAAG,EAAE,CAC1B,SAAQ,cAAc,CAAC,UAAU,GAAG,QAAQ,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACzF,MAAM,CAAC,SAAS,SAAsB;IACtC,MAAM,CAAC,YAAY,+CAAgB;IAEnC,cAAc,IAAI,GAAG;IAQrB,YAAY,IAAI,KAAK,GAAG,IAAI,GAAG,UAAU;CAiB1C"}
|
|
@@ -22,8 +22,10 @@ const defaultProps = {
|
|
|
22
22
|
tileSize: DEFAULT_TILE_SIZE
|
|
23
23
|
};
|
|
24
24
|
class ClusterGeoJsonLayer extends TileLayer {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
initializeState() {
|
|
26
|
+
super.initializeState();
|
|
27
|
+
this.state.aggregationCache = new WeakMap();
|
|
28
|
+
}
|
|
27
29
|
renderLayers() {
|
|
28
30
|
const visibleTiles = this.state.tileset?.tiles.filter((tile) => {
|
|
29
31
|
return tile.isLoaded && tile.content && this.state.tileset.isTileVisible(tile);
|
|
@@ -34,6 +36,7 @@ class ClusterGeoJsonLayer extends TileLayer {
|
|
|
34
36
|
visibleTiles.sort((a, b) => b.zoom - a.zoom);
|
|
35
37
|
const { zoom } = this.context.viewport;
|
|
36
38
|
const { clusterLevel, getPosition, getWeight } = this.props;
|
|
39
|
+
const { aggregationCache } = this.state;
|
|
37
40
|
const properties = extractAggregationProperties(visibleTiles[0]);
|
|
38
41
|
const data = [];
|
|
39
42
|
let needsUpdate = false;
|
|
@@ -41,13 +44,18 @@ class ClusterGeoJsonLayer extends TileLayer {
|
|
|
41
44
|
// Calculate aggregation based on viewport zoom
|
|
42
45
|
const overZoom = Math.round(zoom - tile.zoom);
|
|
43
46
|
const aggregationLevels = Math.round(clusterLevel) - overZoom;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
let tileAggregationCache = aggregationCache.get(tile.content);
|
|
48
|
+
if (!tileAggregationCache) {
|
|
49
|
+
tileAggregationCache = new Map();
|
|
50
|
+
aggregationCache.set(tile.content, tileAggregationCache);
|
|
51
|
+
}
|
|
52
|
+
const didAggregate = aggregateTile(tile, tileAggregationCache, aggregationLevels, properties, getPosition, getWeight);
|
|
53
|
+
needsUpdate || (needsUpdate = didAggregate);
|
|
54
|
+
data.push(...tileAggregationCache.get(aggregationLevels));
|
|
47
55
|
}
|
|
48
56
|
data.sort((a, b) => Number(b.count - a.count));
|
|
49
57
|
const clusterIds = data?.map((tile) => tile.id);
|
|
50
|
-
needsUpdate
|
|
58
|
+
needsUpdate || (needsUpdate = !deepEqual(clusterIds, this.state.clusterIds, 1));
|
|
51
59
|
this.setState({ clusterIds });
|
|
52
60
|
if (needsUpdate) {
|
|
53
61
|
const stats = computeAggregationStats(data, properties);
|
|
@@ -86,10 +94,10 @@ class ClusterGeoJsonLayer extends TileLayer {
|
|
|
86
94
|
return true;
|
|
87
95
|
}
|
|
88
96
|
}
|
|
97
|
+
ClusterGeoJsonLayer.layerName = 'ClusterGeoJsonLayer';
|
|
98
|
+
ClusterGeoJsonLayer.defaultProps = defaultProps;
|
|
89
99
|
// Adapter layer around ClusterLayer that converts tileJSON into TileLayer API
|
|
90
|
-
|
|
91
|
-
static { this.layerName = 'ClusterTileLayer'; }
|
|
92
|
-
static { this.defaultProps = defaultProps; }
|
|
100
|
+
class ClusterTileLayer extends CompositeLayer {
|
|
93
101
|
getLoadOptions() {
|
|
94
102
|
const loadOptions = super.getLoadOptions() || {};
|
|
95
103
|
const tileJSON = this.props.data;
|
|
@@ -115,3 +123,6 @@ export default class ClusterTileLayer extends CompositeLayer {
|
|
|
115
123
|
];
|
|
116
124
|
}
|
|
117
125
|
}
|
|
126
|
+
ClusterTileLayer.layerName = 'ClusterTileLayer';
|
|
127
|
+
ClusterTileLayer.defaultProps = defaultProps;
|
|
128
|
+
export default ClusterTileLayer;
|
|
@@ -21,7 +21,7 @@ export type ParsedQuadbinTile<FeaturePropertiesT> = ParsedQuadbinCell<FeaturePro
|
|
|
21
21
|
*
|
|
22
22
|
* @returns true if data was aggregated, false if cache used
|
|
23
23
|
*/
|
|
24
|
-
export declare function aggregateTile<FeaturePropertiesT>(tile: Tile2DHeader<ParsedQuadbinTile<FeaturePropertiesT>>, aggregationLevels: number, properties: AggregationProperties<FeaturePropertiesT> | undefined, getPosition: Accessor<ParsedQuadbinCell<FeaturePropertiesT>, [number, number]>, getWeight: Accessor<ParsedQuadbinCell<FeaturePropertiesT>, number>): boolean;
|
|
24
|
+
export declare function aggregateTile<FeaturePropertiesT>(tile: Tile2DHeader<ParsedQuadbinTile<FeaturePropertiesT>>, tileAggregationCache: Map<number, ClusteredFeaturePropertiesT<FeaturePropertiesT>[]>, aggregationLevels: number, properties: AggregationProperties<FeaturePropertiesT> | undefined, getPosition: Accessor<ParsedQuadbinCell<FeaturePropertiesT>, [number, number]>, getWeight: Accessor<ParsedQuadbinCell<FeaturePropertiesT>, number>): boolean;
|
|
25
25
|
export declare function extractAggregationProperties<FeaturePropertiesT extends {}>(tile: Tile2DHeader<ParsedQuadbinTile<FeaturePropertiesT>>): AggregationProperties<FeaturePropertiesT>;
|
|
26
26
|
export declare function computeAggregationStats<FeaturePropertiesT>(data: ClusteredFeaturePropertiesT<FeaturePropertiesT>[], properties: AggregationProperties<FeaturePropertiesT>): Record<keyof FeaturePropertiesT, {
|
|
27
27
|
min: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cluster-utils.d.ts","sourceRoot":"","sources":["../../src/layers/cluster-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,IAAI,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAC,QAAQ,EAAM,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAE3D,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAC9E,MAAM,MAAM,qBAAqB,CAAC,kBAAkB,IAAI;IACtD,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,MAAM,kBAAkB,CAAC;CAChC,EAAE,CAAC;AACJ,MAAM,MAAM,2BAA2B,CAAC,kBAAkB,IAAI,kBAAkB,GAAG;IACjF,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,iBAAiB,CAAC,kBAAkB,IAAI;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAC,CAAC;AACjG,MAAM,MAAM,iBAAiB,CAAC,kBAAkB,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,EAAE,CAAC;AAE5F;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,kBAAkB,EAC9C,IAA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AS,EAAE,EACxE,IAAI,EAAE,YAAY,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,GACxD,qBAAqB,CAAC,kBAAkB,CAAC,CAa3C;AAED,wBAAgB,uBAAuB,CAAC,kBAAkB,EACxD,IAAI,EAAE,2BAA2B,CAAC,kBAAkB,CAAC,EAAE,EACvD,UAAU,EAAE,qBAAqB,CAAC,kBAAkB,CAAC;SAEM,MAAM;SAAO,MAAM;GAY/E;AAWD,KAAK,gCAAgC,CAAC,kBAAkB,IAAI,IAAI,CAC9D,uBAAuB,EACvB,QAAQ,CACT,GAAG;IACF,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GAAG;QAC1C,UAAU,CAAC,EAAE;YACX,KAAK,EAAE,MAAM,CAAC,MAAM,kBAAkB,EAAE;gBAAC,GAAG,EAAE,MAAM,CAAC;gBAAC,GAAG,EAAE,MAAM,CAAA;aAAC,CAAC,CAAC;SACrE,CAAC;KACH,CAAC;CACH,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,kBAAkB,EACjD,IAAI,EAAE,2BAA2B,CAAC,kBAAkB,CAAC,EAAE,GACtD,gCAAgC,CAAC,kBAAkB,CAAC,CA8BtD"}
|
|
@@ -5,13 +5,13 @@ import { log } from '@deck.gl/core';
|
|
|
5
5
|
*
|
|
6
6
|
* @returns true if data was aggregated, false if cache used
|
|
7
7
|
*/
|
|
8
|
-
export function aggregateTile(tile, aggregationLevels, properties = [], getPosition, getWeight) {
|
|
8
|
+
export function aggregateTile(tile, tileAggregationCache, aggregationLevels, properties = [], getPosition, getWeight) {
|
|
9
9
|
if (!tile.content)
|
|
10
10
|
return false;
|
|
11
11
|
// Aggregate on demand and cache result
|
|
12
12
|
if (!tile.userData)
|
|
13
13
|
tile.userData = {};
|
|
14
|
-
const cell0 =
|
|
14
|
+
const cell0 = tileAggregationCache.get(aggregationLevels)?.[0];
|
|
15
15
|
if (cell0) {
|
|
16
16
|
// Have already aggregated this tile
|
|
17
17
|
if (properties.every(property => property.name in cell0)) {
|
|
@@ -19,13 +19,13 @@ export function aggregateTile(tile, aggregationLevels, properties = [], getPosit
|
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
// Aggregated properties have changed, re-aggregate
|
|
22
|
-
|
|
22
|
+
tileAggregationCache.clear();
|
|
23
23
|
}
|
|
24
24
|
const out = {};
|
|
25
25
|
for (const cell of tile.content) {
|
|
26
26
|
let id = cell.id;
|
|
27
27
|
const position = typeof getPosition === 'function' ? getPosition(cell, {}) : getPosition;
|
|
28
|
-
// Aggregate by parent
|
|
28
|
+
// Aggregate by parent rid
|
|
29
29
|
for (let i = 0; i < aggregationLevels - 1; i++) {
|
|
30
30
|
id = cellToParent(id);
|
|
31
31
|
}
|
|
@@ -69,7 +69,7 @@ export function aggregateTile(tile, aggregationLevels, properties = [], getPosit
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
tileAggregationCache.set(aggregationLevels, Object.values(out));
|
|
73
73
|
return true;
|
|
74
74
|
}
|
|
75
75
|
export function extractAggregationProperties(tile) {
|
|
@@ -19,9 +19,7 @@ const defaultProps = {
|
|
|
19
19
|
data: TilejsonPropType,
|
|
20
20
|
tileSize: DEFAULT_TILE_SIZE
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
static { this.layerName = 'H3TileLayer'; }
|
|
24
|
-
static { this.defaultProps = defaultProps; }
|
|
22
|
+
class H3TileLayer extends CompositeLayer {
|
|
25
23
|
initializeState() {
|
|
26
24
|
H3HexagonLayer._checkH3Lib();
|
|
27
25
|
}
|
|
@@ -64,3 +62,6 @@ export default class H3TileLayer extends CompositeLayer {
|
|
|
64
62
|
];
|
|
65
63
|
}
|
|
66
64
|
}
|
|
65
|
+
H3TileLayer.layerName = 'H3TileLayer';
|
|
66
|
+
H3TileLayer.defaultProps = defaultProps;
|
|
67
|
+
export default H3TileLayer;
|
|
@@ -14,7 +14,6 @@ function unitDensityForCell(cell) {
|
|
|
14
14
|
}
|
|
15
15
|
// Modified polygon layer to draw offscreen and output value expected by heatmap
|
|
16
16
|
class RTTSolidPolygonLayer extends RTTModifier(SolidPolygonLayer) {
|
|
17
|
-
static { this.layerName = 'RTTSolidPolygonLayer'; }
|
|
18
17
|
getShaders(type) {
|
|
19
18
|
const shaders = super.getShaders(type);
|
|
20
19
|
shaders.inject = {
|
|
@@ -52,6 +51,7 @@ uniform float densityFactor;
|
|
|
52
51
|
super.draw(opts);
|
|
53
52
|
}
|
|
54
53
|
}
|
|
54
|
+
RTTSolidPolygonLayer.layerName = 'RTTSolidPolygonLayer';
|
|
55
55
|
// Modify QuadbinTileLayer to apply heatmap post process effect
|
|
56
56
|
const PostProcessQuadbinTileLayer = PostProcessModifier(QuadbinTileLayer, heatmap);
|
|
57
57
|
const defaultProps = {
|
|
@@ -63,8 +63,6 @@ const defaultProps = {
|
|
|
63
63
|
radiusPixels: { type: 'number', min: 0, max: 100, value: 20 }
|
|
64
64
|
};
|
|
65
65
|
class HeatmapTileLayer extends CompositeLayer {
|
|
66
|
-
static { this.layerName = 'HeatmapTileLayer'; }
|
|
67
|
-
static { this.defaultProps = defaultProps; }
|
|
68
66
|
initializeState() {
|
|
69
67
|
this.state = {
|
|
70
68
|
isLoaded: false,
|
|
@@ -162,4 +160,6 @@ class HeatmapTileLayer extends CompositeLayer {
|
|
|
162
160
|
}));
|
|
163
161
|
}
|
|
164
162
|
}
|
|
163
|
+
HeatmapTileLayer.layerName = 'HeatmapTileLayer';
|
|
164
|
+
HeatmapTileLayer.defaultProps = defaultProps;
|
|
165
165
|
export default HeatmapTileLayer;
|
|
@@ -2,7 +2,6 @@ import { CompositeLayer } from '@deck.gl/core';
|
|
|
2
2
|
import { TextLayer, _TextBackgroundLayer as TextBackgroundLayer } from '@deck.gl/layers';
|
|
3
3
|
const [LEFT, TOP, RIGHT, BOTTOM] = [0, 1, 2, 3];
|
|
4
4
|
class EnhancedTextBackgroundLayer extends TextBackgroundLayer {
|
|
5
|
-
static { this.layerName = 'EnhancedTextBackgroundLayer'; }
|
|
6
5
|
getShaders() {
|
|
7
6
|
const shaders = super.getShaders();
|
|
8
7
|
let vs = shaders.vs;
|
|
@@ -13,10 +12,10 @@ class EnhancedTextBackgroundLayer extends TextBackgroundLayer {
|
|
|
13
12
|
return { ...shaders, vs };
|
|
14
13
|
}
|
|
15
14
|
}
|
|
15
|
+
EnhancedTextBackgroundLayer.layerName = 'EnhancedTextBackgroundLayer';
|
|
16
16
|
// TextLayer which includes modified text-background-layer-vertex shader and only renders the
|
|
17
17
|
// primary background layer in the collision pass
|
|
18
18
|
class EnhancedTextLayer extends TextLayer {
|
|
19
|
-
static { this.layerName = 'EnhancedTextLayer'; }
|
|
20
19
|
filterSubLayer({ layer, renderPass }) {
|
|
21
20
|
const background = layer.id.includes('primary-background');
|
|
22
21
|
if (renderPass === 'collision') {
|
|
@@ -25,14 +24,13 @@ class EnhancedTextLayer extends TextLayer {
|
|
|
25
24
|
return !background; // Do not draw background layer in other passes
|
|
26
25
|
}
|
|
27
26
|
}
|
|
27
|
+
EnhancedTextLayer.layerName = 'EnhancedTextLayer';
|
|
28
28
|
const defaultProps = {
|
|
29
29
|
...TextLayer.defaultProps,
|
|
30
30
|
getRadius: { type: 'accessor', value: 1 },
|
|
31
31
|
radiusScale: { type: 'number', min: 0, value: 1 }
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
static { this.layerName = 'PointLabelLayer'; }
|
|
35
|
-
static { this.defaultProps = defaultProps; }
|
|
33
|
+
class PointLabelLayer extends CompositeLayer {
|
|
36
34
|
calculatePixelOffset(secondary) {
|
|
37
35
|
const { getTextAnchor: anchor, getAlignmentBaseline: alignment, getRadius, getSecondaryText, radiusScale, secondarySizeScale, sizeScale } = this.props;
|
|
38
36
|
const xMult = anchor === 'middle' ? 0 : anchor === 'start' ? 1 : -1;
|
|
@@ -148,3 +146,6 @@ export default class PointLabelLayer extends CompositeLayer {
|
|
|
148
146
|
return out;
|
|
149
147
|
}
|
|
150
148
|
}
|
|
149
|
+
PointLabelLayer.layerName = 'PointLabelLayer';
|
|
150
|
+
PointLabelLayer.defaultProps = defaultProps;
|
|
151
|
+
export default PointLabelLayer;
|
|
@@ -19,7 +19,6 @@ function getPostProcessLayer(layer) {
|
|
|
19
19
|
* Dummy Layer that draws nothing, just calls back to root Layer
|
|
20
20
|
*/
|
|
21
21
|
class DrawCallbackLayer extends Layer {
|
|
22
|
-
static { this.layerName = 'DrawCallbackLayer'; }
|
|
23
22
|
initializeState() {
|
|
24
23
|
this.id = `draw-callback-${getPostProcessLayer(this).props.id}`;
|
|
25
24
|
}
|
|
@@ -27,104 +26,109 @@ class DrawCallbackLayer extends Layer {
|
|
|
27
26
|
getPostProcessLayer(this).applyPostProcess();
|
|
28
27
|
}
|
|
29
28
|
}
|
|
29
|
+
DrawCallbackLayer.layerName = 'DrawCallbackLayer';
|
|
30
30
|
/**
|
|
31
31
|
* Modifier that marks a layer for Render-to-Target rendering.
|
|
32
32
|
* Resulting layer must be used as a sublayer of a layer created
|
|
33
33
|
* with `PostProcessModifier`
|
|
34
34
|
*/
|
|
35
35
|
export function RTTModifier(BaseLayer) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
var _a;
|
|
37
|
+
return _a = class RTTLayer extends BaseLayer {
|
|
38
|
+
draw(opts) {
|
|
39
|
+
const { moduleParameters } = opts;
|
|
40
|
+
const { picking } = moduleParameters;
|
|
41
|
+
const postProcessLayer = getPostProcessLayer(this);
|
|
42
|
+
if (!picking.isActive) {
|
|
43
|
+
postProcessLayer.enableRTT(opts);
|
|
44
|
+
}
|
|
45
|
+
// Draw actual layer
|
|
46
|
+
super.draw(opts);
|
|
47
|
+
if (!picking.isActive) {
|
|
48
|
+
postProcessLayer.disableRTT();
|
|
49
|
+
}
|
|
44
50
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
postProcessLayer.disableRTT();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
51
|
+
},
|
|
52
|
+
_a.layerName = `RTT-${BaseLayer.layerName}`,
|
|
53
|
+
_a;
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* Modifier that returns the a modified Layer, which applies a
|
|
55
57
|
* postprocess effect to all subLayers created using `RTTModifier`
|
|
56
58
|
*/
|
|
57
59
|
export function PostProcessModifier(BaseLayer, effect) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
var _a;
|
|
61
|
+
return _a = class PostProcessLayer extends BaseLayer {
|
|
62
|
+
initializeState(context) {
|
|
63
|
+
super.initializeState(context);
|
|
64
|
+
this._createTextures();
|
|
65
|
+
this.internalState.postProcess = new PostProcessEffect(effect, this.props);
|
|
66
|
+
this.internalState.postProcess.setup(context);
|
|
67
|
+
}
|
|
68
|
+
updateState(params) {
|
|
69
|
+
super.updateState(params);
|
|
70
|
+
this.internalState.postProcess.setProps(this.props);
|
|
71
|
+
}
|
|
72
|
+
renderLayers() {
|
|
73
|
+
let subLayers = super.renderLayers();
|
|
74
|
+
if (!subLayers) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
subLayers = Array.isArray(subLayers) ? subLayers : [subLayers];
|
|
78
|
+
return [...subLayers, new DrawCallbackLayer()];
|
|
79
|
+
}
|
|
80
|
+
_createTextures() {
|
|
81
|
+
const { device } = this.context;
|
|
82
|
+
this.internalState.renderBuffers = [0, 1].map(i => {
|
|
83
|
+
return device.createFramebuffer({
|
|
84
|
+
id: `layer-fbo-${i}`,
|
|
85
|
+
colorAttachments: [device.createTexture(TEXTURE_PROPS)],
|
|
86
|
+
depthStencilAttachment: 'depth16unorm'
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
_resizeBuffers(opts) {
|
|
91
|
+
// TODO we could likely render to a smaller buffer for better perf
|
|
92
|
+
const { moduleParameters } = opts;
|
|
93
|
+
const { viewport } = this.context;
|
|
94
|
+
const width = moduleParameters.devicePixelRatio * viewport.width;
|
|
95
|
+
const height = moduleParameters.devicePixelRatio * viewport.height;
|
|
96
|
+
this.internalState.renderBuffers.forEach((fbo) => fbo.resize({ width, height }));
|
|
97
|
+
}
|
|
98
|
+
enableRTT(opts) {
|
|
99
|
+
this._resizeBuffers(opts);
|
|
100
|
+
this.internalState.originalRenderPass = this.context.renderPass;
|
|
101
|
+
const [framebuffer] = this.internalState.renderBuffers;
|
|
102
|
+
// Create new render pass for RTT
|
|
103
|
+
this.internalState.internalRenderPass = this.context.device.beginRenderPass({
|
|
104
|
+
framebuffer,
|
|
105
|
+
parameters: { viewport: [0, 0, framebuffer.width, framebuffer.height] },
|
|
106
|
+
// Only clear on first render
|
|
107
|
+
clearColor: this.internalState.renderInProgress ? false : [0, 0, 0, 0]
|
|
108
|
+
});
|
|
109
|
+
this.internalState.renderInProgress = true;
|
|
110
|
+
this.context.renderPass = this.internalState.internalRenderPass;
|
|
111
|
+
}
|
|
112
|
+
disableRTT() {
|
|
113
|
+
// End render pass, and reinstate original
|
|
114
|
+
this.internalState.internalRenderPass.end();
|
|
115
|
+
this.context.renderPass = this.internalState.originalRenderPass;
|
|
74
116
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
117
|
+
applyPostProcess() {
|
|
118
|
+
if (!this.internalState.renderInProgress) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
// Apply post process effect
|
|
122
|
+
const [inputBuffer, swapBuffer] = this.internalState.renderBuffers;
|
|
123
|
+
const { framebuffer: target } = this.context.renderPass.props;
|
|
124
|
+
this.internalState.postProcess.postRender({
|
|
125
|
+
inputBuffer,
|
|
126
|
+
swapBuffer,
|
|
127
|
+
target
|
|
85
128
|
});
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
_resizeBuffers(opts) {
|
|
89
|
-
// TODO we could likely render to a smaller buffer for better perf
|
|
90
|
-
const { moduleParameters } = opts;
|
|
91
|
-
const { viewport } = this.context;
|
|
92
|
-
const width = moduleParameters.devicePixelRatio * viewport.width;
|
|
93
|
-
const height = moduleParameters.devicePixelRatio * viewport.height;
|
|
94
|
-
this.internalState.renderBuffers.forEach((fbo) => fbo.resize({ width, height }));
|
|
95
|
-
}
|
|
96
|
-
enableRTT(opts) {
|
|
97
|
-
this._resizeBuffers(opts);
|
|
98
|
-
this.internalState.originalRenderPass = this.context.renderPass;
|
|
99
|
-
const [framebuffer] = this.internalState.renderBuffers;
|
|
100
|
-
// Create new render pass for RTT
|
|
101
|
-
this.internalState.internalRenderPass = this.context.device.beginRenderPass({
|
|
102
|
-
framebuffer,
|
|
103
|
-
parameters: { viewport: [0, 0, framebuffer.width, framebuffer.height] },
|
|
104
|
-
// Only clear on first render
|
|
105
|
-
clearColor: this.internalState.renderInProgress ? false : [0, 0, 0, 0]
|
|
106
|
-
});
|
|
107
|
-
this.internalState.renderInProgress = true;
|
|
108
|
-
this.context.renderPass = this.internalState.internalRenderPass;
|
|
109
|
-
}
|
|
110
|
-
disableRTT() {
|
|
111
|
-
// End render pass, and reinstate original
|
|
112
|
-
this.internalState.internalRenderPass.end();
|
|
113
|
-
this.context.renderPass = this.internalState.originalRenderPass;
|
|
114
|
-
}
|
|
115
|
-
applyPostProcess() {
|
|
116
|
-
if (!this.internalState.renderInProgress) {
|
|
117
|
-
return;
|
|
129
|
+
this.internalState.renderInProgress = false;
|
|
118
130
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this.internalState.postProcess.postRender({
|
|
123
|
-
inputBuffer,
|
|
124
|
-
swapBuffer,
|
|
125
|
-
target
|
|
126
|
-
});
|
|
127
|
-
this.internalState.renderInProgress = false;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
131
|
+
},
|
|
132
|
+
_a.layerName = `PostProcess${BaseLayer.layerName}`,
|
|
133
|
+
_a;
|
|
130
134
|
}
|
|
@@ -3,9 +3,7 @@ import { getQuadbinPolygon } from "./quadbin-utils.js";
|
|
|
3
3
|
const defaultProps = {
|
|
4
4
|
getQuadbin: { type: 'accessor', value: (d) => d.quadbin }
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
static { this.layerName = 'QuadbinLayer'; }
|
|
8
|
-
static { this.defaultProps = defaultProps; }
|
|
6
|
+
class QuadbinLayer extends GeoCellLayer {
|
|
9
7
|
indexToBounds() {
|
|
10
8
|
const { data, extruded, getQuadbin } = this.props;
|
|
11
9
|
// To avoid z-fighting reduce polygon footprint when extruding
|
|
@@ -19,3 +17,6 @@ export default class QuadbinLayer extends GeoCellLayer {
|
|
|
19
17
|
};
|
|
20
18
|
}
|
|
21
19
|
}
|
|
20
|
+
QuadbinLayer.layerName = 'QuadbinLayer';
|
|
21
|
+
QuadbinLayer.defaultProps = defaultProps;
|
|
22
|
+
export default QuadbinLayer;
|
|
@@ -18,9 +18,7 @@ const defaultProps = {
|
|
|
18
18
|
data: TilejsonPropType,
|
|
19
19
|
tileSize: DEFAULT_TILE_SIZE
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
static { this.layerName = 'QuadbinTileLayer'; }
|
|
23
|
-
static { this.defaultProps = defaultProps; }
|
|
21
|
+
class QuadbinTileLayer extends CompositeLayer {
|
|
24
22
|
getLoadOptions() {
|
|
25
23
|
const loadOptions = super.getLoadOptions() || {};
|
|
26
24
|
const tileJSON = this.props.data;
|
|
@@ -47,3 +45,6 @@ export default class QuadbinTileLayer extends CompositeLayer {
|
|
|
47
45
|
];
|
|
48
46
|
}
|
|
49
47
|
}
|
|
48
|
+
QuadbinTileLayer.layerName = 'QuadbinTileLayer';
|
|
49
|
+
QuadbinTileLayer.defaultProps = defaultProps;
|
|
50
|
+
export default QuadbinTileLayer;
|
|
@@ -16,7 +16,6 @@ const defaultProps = {
|
|
|
16
16
|
};
|
|
17
17
|
// Modified ColumnLayer with custom vertex shader
|
|
18
18
|
class RasterColumnLayer extends ColumnLayer {
|
|
19
|
-
static { this.layerName = 'RasterColumnLayer'; }
|
|
20
19
|
getShaders() {
|
|
21
20
|
const shaders = super.getShaders();
|
|
22
21
|
const data = this.props.data;
|
|
@@ -50,10 +49,9 @@ class RasterColumnLayer extends ColumnLayer {
|
|
|
50
49
|
});
|
|
51
50
|
}
|
|
52
51
|
}
|
|
52
|
+
RasterColumnLayer.layerName = 'RasterColumnLayer';
|
|
53
53
|
// Adapter layer around RasterColumnLayer that converts data & accessors into correct format
|
|
54
|
-
|
|
55
|
-
static { this.layerName = 'RasterLayer'; }
|
|
56
|
-
static { this.defaultProps = defaultProps; }
|
|
54
|
+
class RasterLayer extends CompositeLayer {
|
|
57
55
|
renderLayers() {
|
|
58
56
|
// Rendering props underlying layer
|
|
59
57
|
const { data, getElevation, getFillColor, getLineColor, getLineWidth, tileIndex, updateTriggers } = this.props;
|
|
@@ -123,3 +121,6 @@ export default class RasterLayer extends CompositeLayer {
|
|
|
123
121
|
}
|
|
124
122
|
}
|
|
125
123
|
}
|
|
124
|
+
RasterLayer.layerName = 'RasterLayer';
|
|
125
|
+
RasterLayer.defaultProps = defaultProps;
|
|
126
|
+
export default RasterLayer;
|
|
@@ -14,9 +14,7 @@ const defaultProps = {
|
|
|
14
14
|
data: TilejsonPropType,
|
|
15
15
|
tileSize: DEFAULT_TILE_SIZE
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
static { this.layerName = 'RasterTileLayer'; }
|
|
19
|
-
static { this.defaultProps = defaultProps; }
|
|
17
|
+
class RasterTileLayer extends CompositeLayer {
|
|
20
18
|
getLoadOptions() {
|
|
21
19
|
const loadOptions = super.getLoadOptions() || {};
|
|
22
20
|
const tileJSON = this.props.data;
|
|
@@ -43,3 +41,6 @@ export default class RasterTileLayer extends CompositeLayer {
|
|
|
43
41
|
];
|
|
44
42
|
}
|
|
45
43
|
}
|
|
44
|
+
RasterTileLayer.layerName = 'RasterTileLayer';
|
|
45
|
+
RasterTileLayer.defaultProps = defaultProps;
|
|
46
|
+
export default RasterTileLayer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TileReader } from "./carto-raster-tile.js";
|
|
2
2
|
import { parsePbf } from "./tile-loader-utils.js";
|
|
3
3
|
import { getWorkerUrl } from "../../utils.js";
|
|
4
|
-
const VERSION = typeof "9.0.
|
|
4
|
+
const VERSION = typeof "9.0.31" !== 'undefined' ? "9.0.31" : 'latest';
|
|
5
5
|
const id = 'cartoRasterTile';
|
|
6
6
|
const DEFAULT_OPTIONS = {
|
|
7
7
|
cartoRasterTile: {
|
|
@@ -2,7 +2,7 @@ import { TileReader } from "./carto-spatial-tile.js";
|
|
|
2
2
|
import { parsePbf } from "./tile-loader-utils.js";
|
|
3
3
|
import { getWorkerUrl } from "../../utils.js";
|
|
4
4
|
import { binaryToSpatialjson } from "./spatialjson-utils.js";
|
|
5
|
-
const VERSION = typeof "9.0.
|
|
5
|
+
const VERSION = typeof "9.0.31" !== 'undefined' ? "9.0.31" : 'latest';
|
|
6
6
|
const id = 'cartoSpatialTile';
|
|
7
7
|
const DEFAULT_OPTIONS = {
|
|
8
8
|
cartoSpatialTile: {
|
|
@@ -2,7 +2,7 @@ import earcut from 'earcut';
|
|
|
2
2
|
import { TileReader } from "./carto-tile.js";
|
|
3
3
|
import { parsePbf } from "./tile-loader-utils.js";
|
|
4
4
|
import { getWorkerUrl } from "../../utils.js";
|
|
5
|
-
const VERSION = typeof "9.0.
|
|
5
|
+
const VERSION = typeof "9.0.31" !== 'undefined' ? "9.0.31" : 'latest';
|
|
6
6
|
const id = 'cartoVectorTile';
|
|
7
7
|
const DEFAULT_OPTIONS = {
|
|
8
8
|
cartoVectorTile: {
|
|
@@ -10,9 +10,7 @@ function isFeatureIdDefined(value) {
|
|
|
10
10
|
const defaultProps = {
|
|
11
11
|
tileSize: DEFAULT_TILE_SIZE
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
static { this.layerName = 'SpatialIndexTileLayer'; }
|
|
15
|
-
static { this.defaultProps = defaultProps; }
|
|
13
|
+
class SpatialIndexTileLayer extends TileLayer {
|
|
16
14
|
_updateAutoHighlight(info) {
|
|
17
15
|
const { hoveredFeatureId } = this.state;
|
|
18
16
|
const hoveredFeature = info.object;
|
|
@@ -65,3 +63,6 @@ export default class SpatialIndexTileLayer extends TileLayer {
|
|
|
65
63
|
return featureIndex[KEY] === tile.index[KEY];
|
|
66
64
|
}
|
|
67
65
|
}
|
|
66
|
+
SpatialIndexTileLayer.layerName = 'SpatialIndexTileLayer';
|
|
67
|
+
SpatialIndexTileLayer.defaultProps = defaultProps;
|
|
68
|
+
export default SpatialIndexTileLayer;
|
|
@@ -14,9 +14,7 @@ const defaultProps = {
|
|
|
14
14
|
tileSize: DEFAULT_TILE_SIZE
|
|
15
15
|
};
|
|
16
16
|
// @ts-ignore
|
|
17
|
-
|
|
18
|
-
static { this.layerName = 'VectorTileLayer'; }
|
|
19
|
-
static { this.defaultProps = defaultProps; }
|
|
17
|
+
class VectorTileLayer extends MVTLayer {
|
|
20
18
|
constructor(...propObjects) {
|
|
21
19
|
// Force externally visible props type, as it is not possible modify via extension
|
|
22
20
|
// @ts-ignore
|
|
@@ -117,3 +115,6 @@ export default class VectorTileLayer extends MVTLayer {
|
|
|
117
115
|
return true;
|
|
118
116
|
}
|
|
119
117
|
}
|
|
118
|
+
VectorTileLayer.layerName = 'VectorTileLayer';
|
|
119
|
+
VectorTileLayer.defaultProps = defaultProps;
|
|
120
|
+
export default VectorTileLayer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-source.d.ts","sourceRoot":"","sources":["../../src/sources/base-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAkB,OAAO,EAAC,wBAAqB;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EAErB,cAAc,EACf,mBAAgB;AAEjB,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"base-source.d.ts","sourceRoot":"","sources":["../../src/sources/base-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAkB,OAAO,EAAC,wBAAqB;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EAErB,cAAc,EACf,mBAAgB;AAEjB,eAAO,MAAM,eAAe,EAAE,qBAM7B,CAAC;AAEF,wBAAsB,UAAU,CAAC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5E,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,EAC/D,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,cAAc,GAAG,aAAa,GAAG,UAAU,CAAC,CAoDtD"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
|
-
import { DEFAULT_API_BASE_URL, DEFAULT_CLIENT } from "../api/common.js";
|
|
2
|
+
import { DEFAULT_API_BASE_URL, DEFAULT_CLIENT, DEFAULT_MAX_LENGTH_URL } from "../api/common.js";
|
|
3
3
|
import { buildSourceUrl } from "../api/endpoints.js";
|
|
4
4
|
import { requestWithParameters } from "../api/request-with-parameters.js";
|
|
5
5
|
export const SOURCE_DEFAULTS = {
|
|
6
6
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
7
7
|
clientId: DEFAULT_CLIENT,
|
|
8
8
|
format: 'tilejson',
|
|
9
|
-
headers: {}
|
|
9
|
+
headers: {},
|
|
10
|
+
maxLengthURL: DEFAULT_MAX_LENGTH_URL
|
|
10
11
|
};
|
|
11
12
|
export async function baseSource(endpoint, options, urlParameters) {
|
|
12
13
|
const { accessToken, connectionName, cache, ...optionalOptions } = options;
|
|
@@ -17,7 +18,7 @@ export async function baseSource(endpoint, options, urlParameters) {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
const baseUrl = buildSourceUrl(mergedOptions);
|
|
20
|
-
const { clientId, format } = mergedOptions;
|
|
21
|
+
const { clientId, maxLengthURL, format } = mergedOptions;
|
|
21
22
|
const headers = { Authorization: `Bearer ${options.accessToken}`, ...options.headers };
|
|
22
23
|
const parameters = { client: clientId, ...urlParameters };
|
|
23
24
|
const errorContext = {
|
|
@@ -30,7 +31,8 @@ export async function baseSource(endpoint, options, urlParameters) {
|
|
|
30
31
|
baseUrl,
|
|
31
32
|
parameters,
|
|
32
33
|
headers,
|
|
33
|
-
errorContext
|
|
34
|
+
errorContext,
|
|
35
|
+
maxLengthURL
|
|
34
36
|
});
|
|
35
37
|
const dataUrl = mapInstantiation[format].url[0];
|
|
36
38
|
if (cache) {
|
|
@@ -41,7 +43,8 @@ export async function baseSource(endpoint, options, urlParameters) {
|
|
|
41
43
|
const json = await requestWithParameters({
|
|
42
44
|
baseUrl: dataUrl,
|
|
43
45
|
headers,
|
|
44
|
-
errorContext
|
|
46
|
+
errorContext,
|
|
47
|
+
maxLengthURL
|
|
45
48
|
});
|
|
46
49
|
if (accessToken) {
|
|
47
50
|
json.accessToken = accessToken;
|
|
@@ -51,6 +54,7 @@ export async function baseSource(endpoint, options, urlParameters) {
|
|
|
51
54
|
return await requestWithParameters({
|
|
52
55
|
baseUrl: dataUrl,
|
|
53
56
|
headers,
|
|
54
|
-
errorContext
|
|
57
|
+
errorContext,
|
|
58
|
+
maxLengthURL
|
|
55
59
|
});
|
|
56
60
|
}
|