Class LineBucket
Implements
Index
Constructors
Properties
distance
e1
e2
gradients
hasDependencies
index
indexArray
indexBuffer
layerIds
layers
layoutVertexArray
layoutVertexArray2
layoutVertexBuffer
layoutVertexBuffer2
lineClips?
lineClipsArray
maxLineLength
overscaling
patternFeatures
programConfigurations
scaledDistance
segments
stateDependentLayerIds
stateDependentLayers
totalDistance
uploaded
zoom
Methods
Constructors
constructor
Parameters
- options: BucketParameters<LineStyleLayer>
Returns LineBucket
Properties
distance
distance: number
e1
e1: number
e2
e2: number
gradients
hasDependencies
hasDependencies: boolean
index
index: number
indexArray
indexBuffer
layerIds
layerIds: string[]
layers
layoutVertexArray
layoutVertexArray2
layoutVertexBuffer
layoutVertexBuffer2
OptionallineClips
lineClipsArray
maxLineLength
maxLineLength: number
overscaling
overscaling: number
patternFeatures
programConfigurations
scaledDistance
scaledDistance: number
segments
stateDependentLayerIds
stateDependentLayerIds: string[]
stateDependentLayers
stateDependentLayers: any[]
totalDistance
totalDistance: number
uploaded
uploaded: boolean
zoom
zoom: number
Methods
addCurrentVertex
- addCurrentVertex(
p: Point,
normal: Point,
endLeft: number,
endRight: number,
segment: Segment,
round?: boolean,
): voidAdd two vertices to the buffers.
Parameters
- p: Point
the line vertex to add buffer vertices for
- normal: Point
vertex normal
- endLeft: number
extrude to shift the left vertex along the line
- endRight: number
extrude to shift the left vertex along the line
- segment: Segment
the segment object to add the vertex to
Optionalround: booleanwhether this is a round cap
Returns void
- p: Point
addFeature
- addFeature(
feature: BucketFeature,
geometry: Point[][],
index: number,
canonical: CanonicalTileID,
imagePositions: { [_: string]: ImagePosition },
dashPositions: Record<string, DashEntry>,
subdivisionGranularity: SubdivisionGranularitySetting,
): voidParameters
- feature: BucketFeature
- geometry: Point[][]
- index: number
- canonical: CanonicalTileID
- imagePositions: { [_: string]: ImagePosition }
- dashPositions: Record<string, DashEntry>
- subdivisionGranularity: SubdivisionGranularitySetting
Returns void
addFeatures
- addFeatures(
options: PopulateParameters,
canonical: CanonicalTileID,
imagePositions: { [_: string]: ImagePosition },
dashPositions?: { [_: string]: DashEntry },
): voidParameters
- options: PopulateParameters
- canonical: CanonicalTileID
- imagePositions: { [_: string]: ImagePosition }
OptionaldashPositions: { [_: string]: DashEntry }
Returns void
addHalfVertex
addLine
- addLine(
vertices: Point[],
feature: BucketFeature,
join: string,
cap: string,
miterLimit: number,
roundLimit: number,
canonical: CanonicalTileID | undefined,
subdivisionGranularity: SubdivisionGranularitySetting,
): voidParameters
- vertices: Point[]
- feature: BucketFeature
- join: string
- cap: string
- miterLimit: number
- roundLimit: number
- canonical: CanonicalTileID | undefined
- subdivisionGranularity: SubdivisionGranularitySetting
Returns void
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
lineFeatureClips
Parameters
- feature: BucketFeature
Returns LineClips | undefined
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: { [_: string]: DashEntry },
): voidParameters
- states: FeatureStates
- vtLayer: VectorTileLayerLike
- imagePositions: { [_: string]: ImagePosition }
- dashPositions: { [_: string]: DashEntry }
Returns void
updateDistance
updateScaledDistance
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.