TilesetStyleEvaluator

Pluggable evaluator for the 3D Tiles styling language. Apps register a concrete implementation via earth.worldwind.layer.ogc3d.Ogc3dDecoderRegistry.tilesetStyleEvaluator once at startup. When null (default), every styled tile renders with material defaults.

Implementations are expected to be stateless per feature (state across feature evaluations within one style document is fine — e.g. caching parsed expression ASTs).

The spec's expression syntax is non-trivial (literals, ${name} property lookups, math operators, function calls like color(), conditional (test) ? a : b, regex predicates). A realistic implementation parses each expression into an AST once when the style is bound to the layer, then evaluates the AST against feature properties on every draw — far cheaper than re-parsing per feature.

Functions

Link copied to clipboard
abstract fun bind(style: TilesetStyle): BoundStyle

Bind this evaluator to a parsed style. The implementation typically parses each expression in style into an AST + caches them keyed by expression text, so subsequent evaluateShow / evaluateColor calls are O(features × ast-eval).

Link copied to clipboard
abstract fun evaluateColor(bound: BoundStyle, featureProperties: Map<String, Any?>): Color?

Evaluate the bound style's color expression for one feature. Returns null when the expression is absent or evaluates to a value the engine can't apply (e.g. non-color string), letting the caller fall back to the material's base colour.

Link copied to clipboard
abstract fun evaluateMeta(bound: BoundStyle, key: String, featureProperties: Map<String, Any?>): JsonElement?

Evaluate one of the bound style's meta expressions by key. Returns null when the key is absent or the expression evaluates to JSON null.

Link copied to clipboard
abstract fun evaluateShow(bound: BoundStyle, featureProperties: Map<String, Any?>): Boolean

Evaluate the bound style's show expression for one feature. Returns true (visible) when the expression is absent or evaluates to truthy; false hides the feature.