On this page

Class LineBucket

The Bucket interface is the single point of knowledge about turning vector tiles into WebGL buffers.

Bucket is an abstract interface. An implementation exists for each style layer type. Create a bucket via the StyleLayer.createBucket method.

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 (using new Bucket(serializedBucketData), with the array data now stored in bucket.buffers: BufferGroup. BufferGroups hold the same data as ArrayGroups, but are tuned for consumption by WebGL.

Implements

Index

Constructors

Properties

distance: number
e1: number
e2: number
gradients: { [x: string]: GradientTexture }
hasDependencies: boolean
index: number
indexArray: TriangleIndexArray
indexBuffer: IndexBuffer
layerIds: string[]
layers: LineStyleLayer[]
layoutVertexArray: LineLayoutArray
layoutVertexArray2: LineExtLayoutArray
layoutVertexBuffer: VertexBuffer
layoutVertexBuffer2: VertexBuffer
lineClips?: LineClips
lineClipsArray: LineClips[]
maxLineLength: number
overscaling: number
patternFeatures: BucketFeature[]
programConfigurations: ProgramConfigurationSet<LineStyleLayer>
scaledDistance: number
segments: SegmentVector
stateDependentLayerIds: string[]
stateDependentLayers: any[]
totalDistance: number
uploaded: boolean
zoom: number

Methods

  • Add 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: boolean

      whether this is a round cap

    Returns void

  • Parameters

    • __namedParameters: Point
    • extrudeX: number
    • extrudeY: number
    • round: boolean
    • up: boolean
    • dir: number
    • segment: Segment

    Returns void

  • 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

  • Returns boolean

  • Returns void

Was this helpful?
SDK JS
Reference
LineBucket