Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface BoxStyle

Interface for configuring the visual appearance of Boxes.

Hierarchy

  • BoxStyle

Index

Properties

Optional altitude

altitude: number | boolean | StyleValueFunction<number | boolean> | StyleZoomRange<number | boolean> | StyleExpression<number | boolean>

The altitude of the center of the Box in meters. The altitude defines the distance in the vertical direction between the ground plane at 0 meters and the geometry/style. If altitude is set to true, the altitude from the feature's geometry coordinates will be used automatically. If a number is set for altitude, the altitude of the feature's geometry is ignored and the value of "altitude" is used instead. The height must be defined in meters.

defaultvalue

false

experimental

Optional depth

depth: number | StyleValueFunction<number> | StyleZoomRange<number> | StyleExpression<number>

The depth of the Box. The depth defines the length of the edges of a "Box" parallel to the Z axis. If the depth is not explicitly defined, the value of the "width" is used as the height.

example
// define a Box that has a width, height and depth of 16px
{
    zIndex: 0,
    type: "Box",
    stroke: "blue",
    fill: "red",
    width: 16,
    height: 16,
    depth: 16
}

Optional emissive

Sets the emissive color of the "Box", giving it a glow effect.

see

Color for a detailed list of possible supported formats.

Optional fill

Sets the color to fill the Box.

see

Color for a detailed list of possible supported formats.

Optional fillIntensity

fillIntensity: number

Controls the intensity of the fill color under directional lighting.

fillIntensity determines how much the "Box"'s fill color is affected by the directional lighting in the scene. A higher value increases the intensity of the fill color, making it more vibrant under strong lighting, while a lower value reduces the effect, resulting in a more muted color.

The value should range from 0 to 1, where 0 means no color intensity and 1 represents full intensity.

defaultvalue

1

Optional height

height: number | StyleValueFunction<number> | StyleZoomRange<number> | StyleExpression<number>

The Height of the Box. The unit of height is defined in pixels. If the height is not explicitly defined, the value of the width is used as the height.

example
// define a Box that have a width of 32px and a height of 48px.
{
    zIndex: 0,
    type: "Box",
    fill: "blue",
    width: 32,
    height: 48
}

Optional light

light: string

Specifies the name of the light group to use for illuminating specific features on a layer. This property must reference a key corresponding to a light group defined in LayerStyle.lights. A light group consists of lighting sources such as ambient or directional lights that affect the appearance of features.

If light is not defined, the default light group "defaultLight" will be used to illuminate the layer's features.

see

LayerStyle.lights for defining and referencing available light groups.

defaultvalue

"defaultLight"

Optional offsetX

offsetX: number | string | StyleValueFunction<number | string> | StyleZoomRange<number | string> | StyleExpression<number | string>

Offset the Box in pixels on x-axis. A positive value offsets to the right, a negative value to the left. The default unit is pixels.

example
// offset Box by 8px to the right.
{ type: "Box", zIndex: 0, with: 32, fill: 'red', offsetX: 8}

Optional offsetY

offsetY: number | StyleValueFunction<number> | StyleZoomRange<number> | StyleExpression<number>

Offset the Box in pixels on y-axis. A positive value offsetY offsets downwards, a negative value upwards. The default unit is pixels.

example
// offset Box by 8px to the bottom
{ type: "Box", zIndex: 0, fill: 'red', width:32, offsetY: 8}

// offset Box by 1m to the top
{ type: "Box", zIndex: 0, fill: 'blue', width: 32, offsetY: "-1m"}

Optional offsetZ

offsetZ: number | string | StyleValueFunction<number | string> | StyleZoomRange<number | string> | StyleExpression<number | string>

Offset the Box in pixels on z-axis. A positive value offsets up, a negative value down. The default unit is pixels.

example
// offset Image by 8px to the top.
{ type: "Box", zIndex: 0, fill: 'red', width:32, offsetZ: 8}

// offset Circle by 1m to the top
{ type: "Box", zIndex: 0, fill: 'red', width:32, offsetZ: "1m"}

Optional opacity

opacity: number | StyleValueFunction<number> | StyleZoomRange<number> | StyleExpression<number>

Defines the opacity of the style. The value must be between 0.0 (fully transparent) and 1.0 (fully opaque).

defaultvalue

1

Optional scaleByAltitude

scaleByAltitude: boolean | StyleValueFunction<boolean> | StyleZoomRange<boolean> | StyleExpression<boolean>

Scales the size of a style based on the feature's altitude. If it's enabled (true), features closer to the camera will be drawn larger than those farther away. When off (false), the size of the style is always the same size, regardless of its actual altitude, as if it were placed on the ground (altitude 0). This attribute applies to styles of type "Rect", "Image", "Text", "Circle", "Line", "Box", or "Sphere" whose size (width, {@link radius}, strokeWidth) that are using "map" alignment only. If the size attribute is defined in meters, scaleByAltitude is enabled by default, for pixels it is disabled.

defaultvalue

false (pixels), true (meters)

experimental

Optional shininess

shininess: number

Sets the shininess of the "Box", determining how glossy its surface appears. A higher value makes the "Box" surface more reflective.

Relationship with Specular

  • Effect: The shininess value controls the size and intensity of the specular highlight, which is colored by the specular property.
  • Specular Dependency: The shininess property enhances the effect of the specular color. If specular is not set, shininess has no visible effect.

Shininess Value Range and Effect

  • Range: The shininess value typically ranges from 0 to 128.
  • Low Values (0-10): Produce a wide, diffused highlight, resulting in a matte or dull appearance.
  • High Values (50-128): Produce a small, intense highlight, resulting in a glossy or shiny appearance.
defaultvalue

32

Optional specular

Sets the specular color of the "Box", affecting how it reflects light.

Relationship with Shininess

  • Effect: The specular property determines the color of the light reflection, while the shininess value controls the intensity and size of the reflection.
  • Shininess Dependency: If specular is set and shininess is not explicitly set, the default shininess value will be used to control the reflection's appearance.
see

Color for a detailed list of possible supported formats.

Optional stroke

Sets the stroke color of the Box.

see

Color for a detailed list of possible supported formats.

Optional strokeWidth

strokeWidth: number | string | StyleValueFunction<number | number> | StyleZoomRange<string | number> | StyleExpression<number | string>

Sets the width of the stroke. The unit of strokeWidth is defined in pixels.

example
// define a red filled Box that with a blue stroke of 2px width.
{
    zIndex: 0,
    type: "Box",
    fill: "red",
    stroke: "blue",
    strokeWidth: "2
}

type

type: "Box"

Specifies the type of style to render.

width

width: number | StyleValueFunction<number> | StyleZoomRange<number> | StyleExpression<number>

The Width of the Box. The unit of width is defined in pixels.

example
// define a Box that has a width, height and depth of 32 pixels.
{
    zIndex: 0,
    type: "Box",
    fill: "blue",
    width: 32
}

zIndex

zIndex: number | StyleValueFunction<number> | StyleZoomRange<number> | StyleExpression<number>

Indicates the drawing order within a layer. Styles with larger zIndex value are rendered above those with smaller values. The zIndex is defined relative to the "zLayer" property. If "zLayer" is defined all zIndex values are relative to the "zLayer" value.

Optional zLayer

zLayer: number | StyleValueFunction<number> | StyleExpression<number>

Indicates drawing order across multiple layers. Styles using zLayer with a high value are rendered on top of zLayers with a low value. If no zLayer is defined, it will fall back to the LayerStyle.zLayer or depend on the display layer order. The first (lowest) layer has a zLayer value of 1.

example

{...zLayer: 2, zIndex: 5} will be rendered on top of {...zLayer: 1, zIndex: 10}

Generated using TypeDoc