Interface Bucket
interface Bucket {
hasDependencies: boolean;
layerIds: string[];
layers: any[];
stateDependentLayerIds: string[];
stateDependentLayers: any[];
destroy(): void;
isEmpty(): boolean;
populate(
features: IndexedFeature[],
options: PopulateParameters,
canonical: CanonicalTileID,
): void;
update(
states: FeatureStates,
vtLayer: VectorTileLayerLike,
imagePositions: { [_: string]: ImagePosition },
dashPositions: Record<string, DashEntry>,
): void;
upload(context: Context): void;
uploadPending(): boolean;
}
hasDependencies: boolean;
layerIds: string[];
layers: any[];
stateDependentLayerIds: string[];
stateDependentLayers: any[];
destroy(): void;
isEmpty(): boolean;
populate(
features: IndexedFeature[],
options: PopulateParameters,
canonical: CanonicalTileID,
): void;
update(
states: FeatureStates,
vtLayer: VectorTileLayerLike,
imagePositions: { [_: string]: ImagePosition },
dashPositions: Record<string, DashEntry>,
): void;
upload(context: Context): void;
uploadPending(): boolean;
}
Implemented by
Index
Properties
hasDependencies
hasDependencies: boolean
layerIds
layerIds: string[]
Readonlylayers
layers: any[]
ReadonlystateDependentLayerIds
stateDependentLayerIds: string[]
ReadonlystateDependentLayers
stateDependentLayers: any[]
Methods
destroy
Release the WebGL resources associated with the buffers. Note that because buckets are shared between layers having the same layout properties, they must be destroyed in groups (all buckets for a tile, or all symbol buckets).
Returns void
isEmpty
Returns boolean
populate
- populate(
features: IndexedFeature[],
options: PopulateParameters,
canonical: CanonicalTileID,
): voidParameters
- features: IndexedFeature[]
- options: PopulateParameters
- canonical: CanonicalTileID
Returns void
update
- update(
states: FeatureStates,
vtLayer: VectorTileLayerLike,
imagePositions: { [_: string]: ImagePosition },
dashPositions: Record<string, DashEntry>,
): voidParameters
- states: FeatureStates
- vtLayer: VectorTileLayerLike
- imagePositions: { [_: string]: ImagePosition }
- dashPositions: Record<string, DashEntry>
Returns void
upload
Parameters
- context: Context
Returns void
uploadPending
Returns boolean
Was this helpful?
Hidden
The
Bucketinterface is the single point of knowledge about turning vector tiles into WebGL buffers.Bucketis an abstract interface. An implementation exists for each style layer type. Create a bucket via theStyleLayer.createBucketmethod.The concrete bucket types, using layout options from the style layer, transform feature geometries into vertex and index data for use by the vertex shader. They also (via
ProgramConfiguration) use feature properties and the zoom level to populate the attributes needed for data-driven styling.Buckets are designed to be built on a worker thread and then serialized and transferred back to the main thread for rendering. On the worker side, a bucket's vertex, index, and attribute data is stored in
bucket.arrays: ArrayGroup. When a bucket's data is serialized and sent back to the main thread, is gets deserialized (usingnew Bucket(serializedBucketData), with the array data now stored inbucket.buffers: BufferGroup. BufferGroups hold the same data as ArrayGroups, but are tuned for consumption by WebGL.