Skip to content

Commit bc3b02d

Browse files
ibesoragithub-actions[bot]
authored andcommitted
Add new property: model-allow-density-reduction (h/t
@JoshuaJMoore) (#13595) GitOrigin-RevId: 64bb4e75904e023db952a4054f4a575a9628c196
1 parent 033e7bf commit bc3b02d

File tree

7 files changed

+1531
-2
lines changed

7 files changed

+1531
-2
lines changed

3d-style/data/bucket/model_bucket.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ class ModelBucket implements Bucket {
445445
): string {
446446
const layer = this.layers[0];
447447
const modelIdProperty = layer.layout.get('model-id');
448+
const modelAllowDensityReductionProperty = layer.layout.get('model-allow-density-reduction');
448449
assert(modelIdProperty);
449450

450451
const modelId = modelIdProperty.evaluate(evaluationFeature, {}, this.canonical);
@@ -479,7 +480,7 @@ class ModelBucket implements Bucket {
479480
continue; // Clip on tile borders to prevent duplicates
480481
}
481482
// reduce density
482-
if (this.lookupDim !== 0) {
483+
if (this.lookupDim !== 0 && modelAllowDensityReductionProperty) {
483484
const tileToLookup = (this.lookupDim - 1.0) / EXTENT;
484485
const lookupIndex = this.lookupDim * ((point.y * tileToLookup) | 0) + (point.x * tileToLookup) | 0;
485486
if (this.lookup) {

3d-style/style/style_layer/model_style_layer_properties.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ import type {StylePropertySpecification} from '../../../src/style-spec/style-spe
1919
export type LayoutProps = {
2020
"visibility": DataConstantProperty<"visible" | "none">;
2121
"model-id": DataDrivenProperty<string>;
22+
"model-allow-density-reduction": DataConstantProperty<boolean>;
2223
};
2324
let layout: Properties<LayoutProps>;
2425
export const getLayoutProperties = (): Properties<LayoutProps> => layout || (layout = new Properties({
2526
"visibility": new DataConstantProperty(styleSpec["layout_model"]["visibility"]),
2627
"model-id": new DataDrivenProperty(styleSpec["layout_model"]["model-id"]),
28+
"model-allow-density-reduction": new DataConstantProperty(styleSpec["layout_model"]["model-allow-density-reduction"]),
2729
}));
2830

2931
export type PaintProps = {

src/style-spec/reference/v8.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,6 +1828,21 @@
18281828
"vector"
18291829
]
18301830
}]
1831+
},
1832+
"model-allow-density-reduction": {
1833+
"type": "boolean",
1834+
"default": true,
1835+
"transition": false,
1836+
"experimental": true,
1837+
"doc": "If true, the models will be reduced in density based on the zoom level. This is useful for large datasets that may be slow to render.",
1838+
"sdk-support": {
1839+
"basic functionality": {
1840+
"js": "0.10.0",
1841+
"android": "2.0.1",
1842+
"ios": "2.0.0"
1843+
}
1844+
},
1845+
"property-type": "data-constant"
18311846
}
18321847
},
18331848
"layout_clip": {

src/style-spec/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,11 @@ export type ModelLayerSpecification = {
13601360
"filter"?: FilterSpecification,
13611361
"layout"?: {
13621362
"visibility"?: "visible" | "none" | ExpressionSpecification,
1363-
"model-id"?: DataDrivenPropertyValueSpecification<string>
1363+
"model-id"?: DataDrivenPropertyValueSpecification<string>,
1364+
/**
1365+
* @experimental This property is experimental and subject to change in future versions.
1366+
*/
1367+
"model-allow-density-reduction"?: boolean
13641368
},
13651369
"paint"?: {
13661370
"model-opacity"?: DataDrivenPropertyValueSpecification<number>,

0 commit comments

Comments
 (0)