IconPaint

class IconPaint(allowOverlap: StyleValue<Boolean> = StyleValue.Constant(true), image: StyleValue<String>? = null, size: StyleValue<Double>? = null, iconSize: IconSize? = null, atlas: IconAtlas? = null, anchor: StyleValue<Anchor> = StyleValue.Constant(Anchor.CENTER), offset: StyleValue<AnchorOffset> = StyleValue.Constant(AnchorOffset()), padding: StyleValue<Double> = StyleValue.Constant(0.0), rotation: Double = 0.0, rotationUsesDataDirection: Boolean = false, scale: StyleValue<Double>? = null, type: String? = null, spin: Boolean = false, spinDegreesPerSecond: Float = 180.0f, shader: String? = null, factor: StyleValue<Double>? = null, placement: SymbolPlacementPaint? = null, source: IconSourcePaint? = null) : Paint

Icon style options (Apple IconPaint). Prefer placement / source for new code; named constructor parameters (image, atlas, allowOverlap, …) remain supported for existing call sites.

Constructors

Link copied to clipboard
constructor(allowOverlap: StyleValue<Boolean> = StyleValue.Constant(true), image: StyleValue<String>? = null, size: StyleValue<Double>? = null, iconSize: IconSize? = null, atlas: IconAtlas? = null, anchor: StyleValue<Anchor> = StyleValue.Constant(Anchor.CENTER), offset: StyleValue<AnchorOffset> = StyleValue.Constant(AnchorOffset()), padding: StyleValue<Double> = StyleValue.Constant(0.0), rotation: Double = 0.0, rotationUsesDataDirection: Boolean = false, scale: StyleValue<Double>? = null, type: String? = null, spin: Boolean = false, spinDegreesPerSecond: Float = 180.0f, shader: String? = null, factor: StyleValue<Double>? = null, placement: SymbolPlacementPaint? = null, source: IconSourcePaint? = null)

Properties

Link copied to clipboard

Whether icons can overlap other icons.

Link copied to clipboard

Positioning anchor of the icon.

Link copied to clipboard

Declarative atlas (JS / Apple icon.atlas).

Link copied to clipboard

Per-feature data value for custom shader as v_factor (JS paint.icon.factor).

Link copied to clipboard

Per-feature icon height in JS icon pixels. See iconWidth; both must be set for the per-axis path to apply.

Link copied to clipboard

Optional width/height in JS icon pixels. Takes precedence over size/scale for instanced wind / GLES layout when non-null.

Link copied to clipboard

Per-feature icon width in JS icon pixels (JS parity paint.icon.size.width as an expression). Takes precedence over iconSize and size when set.

Link copied to clipboard

The name of the image to display.

Link copied to clipboard

Offset of the icon from its anchor position.

Link copied to clipboard

Padding around the icon.

Link copied to clipboard

Whether the icon pitches with the map (Apple placement.pitchWithMap).

Link copied to clipboard

Placement shared with other symbol types (Apple IconPaint.placement). Default allowOverlap = true preserves prior Android icon defaults.

Link copied to clipboard

Whether the icon rotates with map bearing (Apple placement.rotateWithMap).

Link copied to clipboard

Constant rotation offset in degrees (e.g. -90 for wind barb/arrow base tilt). When rotationUsesDataDirection is true, Mapbox icon rotation is dir + rotation from encoded features.

Link copied to clipboard

When true, rotationExpression uses dir + rotation via Expression.get("dir"); when false, rotation is constant.

Link copied to clipboard

Multiplier applied to the source sprite's native size (Apple/Mapbox icon-size / scale). Ignored when iconSize is set. Takes precedence over size for Style JSON when both are set.

Link copied to clipboard

Custom GLSL fragment shader source (JS paint.icon.shader). Layer-level constant.

Link copied to clipboard

Absolute icon size in screen points as a Mapbox-style scalar multiplier when iconSize is unset (legacy). Prefer iconSize for pixel dimensions or scale for Mapbox icon-size.

Link copied to clipboard

Source used to resolve the icon image (Apple IconPaint.source).

Link copied to clipboard

When true, the icon rotates continuously (adds elapsedSeconds * spinDegreesPerSecond to rotation every frame) instead of holding a static rotation.

Link copied to clipboard

Rotation speed in degrees/second when spin is true. Positive spins counter-clockwise on screen, which is the cyclonic direction in the northern hemisphere; factor flips it per feature for southern-hemisphere storms.

Link copied to clipboard
var type: String?

Optional grid-only built-in symbol type (Apple icon.type).

Functions

Link copied to clipboard
fun copy(allowOverlap: StyleValue<Boolean> = this.allowOverlap, image: StyleValue<String>? = this.image, size: StyleValue<Double>? = this.size, scale: StyleValue<Double>? = this.scale, iconSize: IconSize? = this.iconSize, atlas: IconAtlas? = this.atlas, type: String? = this.type, anchor: StyleValue<Anchor> = this.anchor, offset: StyleValue<AnchorOffset> = this.offset, padding: StyleValue<Double> = this.padding, rotation: Double = this.rotation, rotationUsesDataDirection: Boolean = this.rotationUsesDataDirection, spin: Boolean = this.spin, spinDegreesPerSecond: Float = this.spinDegreesPerSecond, shader: String? = this.shader, factor: StyleValue<Double>? = this.factor, rotateWithMap: Boolean = this.placement.rotateWithMap, pitchWithMap: Boolean = this.placement.pitchWithMap, source: IconSourcePaint = this.source): IconPaint

Shallow copy for tests / paint mutation helpers (IconPaint is no longer a data class).

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Value equality, kept by hand because IconPaint stopped being a data class when its constructor parameters became body properties backed by placement and source.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Mapbox icon-size value for Style JSON: scale, else derived from iconSize, else size.

Link copied to clipboard
open override fun toString(): String