Label

external class Label(source)
Create labels by calling [LabelCollection.add]. Do not call the constructor directly.

Parameters

labelCollection

Instance of LabelCollection

See also

Types

Link copied to clipboard
object Companion
Link copied to clipboard
sealed interface ConstructorOptions

Initialization options for the Label constructor

Properties

Link copied to clipboard

Gets or sets the background color of this label.

Link copied to clipboard

Gets or sets the background padding, in pixels, of this label. The x value controls horizontal padding, and the y value controls vertical padding.

Link copied to clipboard

Gets or sets the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain. When set to zero, the depth test is always applied. When set to Number.POSITIVE_INFINITY, the depth test is never applied.

Link copied to clipboard

Gets or sets the condition specifying at what distance from the camera that this label will be displayed.

Link copied to clipboard

Gets and sets the 3D Cartesian offset applied to this label in eye coordinates. Eye coordinates is a left-handed coordinate system, where x points towards the viewer's right, y points up, and z points into the screen. Eye coordinates use the same scale as world and model coordinates, which is typically meters.

Link copied to clipboard

Gets or sets the fill color of this label.

Link copied to clipboard

Gets or sets the font used to draw this label. Fonts are specified using the same syntax as the CSS 'font' property.

Link copied to clipboard

Gets or sets the height reference of this billboard.

Link copied to clipboard

Gets or sets the horizontal origin of this label, which determines if the label is drawn to the left, center, or right of its anchor position.

Link copied to clipboard
var id: Any

Gets or sets the user-defined value returned when the label is picked.

Link copied to clipboard

Gets or sets the outline color of this label.

Link copied to clipboard

Gets or sets the outline width of this label.

Link copied to clipboard

Gets or sets the pixel offset in screen space from the origin of this label. This is commonly used to align multiple labels and billboards at the same position, e.g., an image and text. The screen space origin is the top, left corner of the canvas; x increases from left to right, and y increases from top to bottom.

Link copied to clipboard

Gets or sets near and far pixel offset scaling properties of a Label based on the Label's distance from the camera. A label's pixel offset will be scaled between the NearFarScalar.nearValue and NearFarScalar.farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar.near and NearFarScalar.far. Outside of these ranges the label's pixel offset scaling remains clamped to the nearest bound. If undefined, pixelOffsetScaleByDistance will be disabled.

Link copied to clipboard

Gets or sets the Cartesian position of this label.

Link copied to clipboard

Gets or sets the uniform scale that is multiplied with the label's size in pixels. A scale of 1.0 does not change the size of the label; a scale greater than 1.0 enlarges the label; a positive scale less than 1.0 shrinks the label.

Link copied to clipboard

Gets or sets near and far scaling properties of a Label based on the label's distance from the camera. A label's scale will interpolate between the NearFarScalar.nearValue and NearFarScalar.farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar.near and NearFarScalar.far. Outside of these ranges the label's scale remains clamped to the nearest bound. If undefined, scaleByDistance will be disabled.

Link copied to clipboard

Determines if this label will be shown. Use this to hide or show a label, instead of removing it and re-adding it to the collection.

Link copied to clipboard

Determines if a background behind this label will be shown.

Link copied to clipboard

Gets or sets the style of this label.

Link copied to clipboard

Gets or sets the text of this label.

Link copied to clipboard

Gets the total scale of the label, which is the label's scale multiplied by the computed relative size of the desired font compared to the generated glyph size.

Link copied to clipboard

Gets or sets near and far translucency properties of a Label based on the Label's distance from the camera. A label's translucency will interpolate between the NearFarScalar.nearValue and NearFarScalar.farValue while the camera distance falls within the lower and upper bounds of the specified NearFarScalar.near and NearFarScalar.far. Outside of these ranges the label's translucency remains clamped to the nearest bound. If undefined, translucencyByDistance will be disabled.

Link copied to clipboard

Gets or sets the vertical origin of this label, which determines if the label is to the above, below, or at the center of its anchor position.

Functions

Link copied to clipboard
fun computeScreenSpacePosition(scene: Scene, result: Cartesian2? = definedExternally): Cartesian2

Computes the screen-space position of the label's origin, taking into account eye and pixel offsets. The screen space origin is the top, left corner of the canvas; x increases from left to right, and y increases from top to bottom.

Link copied to clipboard

Returns true if this object was destroyed; otherwise, false.