MvtStyleRule

class MvtStyleRule(val sourceLayer: String, val filter: MvtFilter = MvtFilter.Always, val minZoom: Int = 0, val maxZoom: Int = Int.MAX_VALUE, val zOrder: Int = 0, val geometryType: MvtGeometryType? = null, val paint: MvtStyleRule.PaintSpec)

One declarative rule in an MvtRuleBasedStyle. Matches features by source layer name, optional filter over properties, and tile-zoom range, then resolves zoom-interpolated paint properties into a ShapeAttributes.

Rules paint in declaration order — earlier rules in the list paint under later rules. The zOrder field also feeds MvtStyle.zOrderFor so cross-tile compositing matches the within-tile order.

Parameters

sourceLayer

MVT layer name to match (e.g. "streets", "water_polygons"). Use MvtStyle.zOrderFor canonicals where they apply.

filter

predicate over the feature's property map; defaults to MvtFilter.Always.

minZoom

smallest tile zoom that activates this rule (inclusive); below = skipped.

maxZoom

largest tile zoom that activates this rule (inclusive); above = skipped. Int.MAX_VALUE = no upper bound.

zOrder

paint order against rules in other tiles. Use MvtStyle.Z_* constants.

geometryType

when non-null, only matches features of that geometry type. Useful for splitting a layer that carries both polygon and line variants (e.g. Shortbread's street_polygons vs streets).

paint

resolves zoom-interpolated paint properties into a ShapeAttributes.

Constructors

Link copied to clipboard
constructor(sourceLayer: String, filter: MvtFilter = MvtFilter.Always, minZoom: Int = 0, maxZoom: Int = Int.MAX_VALUE, zOrder: Int = 0, geometryType: MvtGeometryType? = null, paint: MvtStyleRule.PaintSpec)

Types

Link copied to clipboard
class IconSpec(val name: String, val size: Float, val offset: Float, val anchor: String)

Resolved icon payload. The name is the atlas entry to look up; size is a multiplier on the atlas entry's native pixel size; offset is a horizontal offset in icon-pixel units; anchor picks where on the icon the geographic point sits.

Link copied to clipboard

Where the label sits on the feature it labels.

Link copied to clipboard
class LabelSpec(val text: String, val attributes: TextAttributes, val pixelSize: Int, val width: Float = 0.0f)

Resolved label payload. pixelSize is read by MvtLabelGroup's collision pass to size its screen-space bbox — earth.worldwind.render.Font is an expect class and doesn't expose its size in commonMain, so we keep it separate.

Link copied to clipboard
class PaintSpec(val fillColor: MvtExpression<Color>? = null, val fillOpacity: MvtExpression<Float>? = null, val fillExtrusionHeight: MvtExpression<Float>? = null, val fillExtrusionBase: MvtExpression<Float>? = null, val lineColor: MvtExpression<Color>? = null, val lineWidth: MvtExpression<Float>? = null, val lineOpacity: MvtExpression<Float>? = null, val lineCasingColor: MvtExpression<Color>? = null, val lineCasingWidth: MvtExpression<Float>? = null, val lineGradient: MvtExpression<Color>? = null, val lineDashArray: FloatArray? = null, val shadowMode: ShadowMode = ShadowMode.DISABLED, val textField: String? = null, val textColor: MvtExpression<Color>? = null, val textSize: MvtExpression<Float>? = null, val textHaloColor: MvtExpression<Color>? = null, val textHaloWidth: MvtExpression<Float>? = null, val fontFamily: String? = null, val fontWeight: FontWeight = FontWeight.NORMAL, val textPlacement: MvtStyleRule.LabelPlacement = LabelPlacement.POINT, val textMaxWidth: MvtExpression<Float>? = null, val textUppercase: Boolean = false, val iconImage: MvtExpression<String>? = null, val iconSize: MvtExpression<Float>? = null, val iconOffset: MvtExpression<Float>? = null, val iconAnchor: MvtExpression<String>? = null)

Bundle of zoom-interpolated paint properties for one rule. Fields default to "draw nothing"; supply only what your rule needs and the rest stays inert.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val zOrder: Int

Functions

Link copied to clipboard
fun matches(layerName: String, geomType: MvtGeometryType, zoom: Int, properties: Map<String, Any?>): Boolean
Link copied to clipboard
fun resolve(zoom: Int, properties: Map<String, Any?> = emptyMap(), featureState: Map<String, Any?>? = null, geometryType: MvtGeometryType? = null): ShapeAttributes

Resolve paint for one feature into a concrete ShapeAttributes. Called once per matching feature during tile assembly. Results are NOT cached — short-lived attribute instances flow into the batched tile and are consumed by color packing.