set Paint Property
Sets a paint style property on a layer at runtime, addressed by key path.
Array entries use bracket notation, matching MapsGL JS. text[0] is the first text paint on a symbol layer, such as a place-name layer:
mapController.setPaintProperty("admin.place_city.text", "text[0].size", 20.0)
mapController.setPaintProperty(layerId, "sample.colorscale", colorScale)value may be a ready com.xweather.mapsgl.style.StyleValue -- including an com.xweather.mapsgl.style.StyleValue.Expression, so text can scale with zoom -- or a plain Number, Color or hex String, which is wrapped as a constant.
One call covers everything applying a paint change needs, which is what MapsGL JS's setPaintProperty does: it writes the value, lets the paint emit its own PAINT_CHANGE where it has one (so a bar legend follows a sample.colorscale change), asks the renderer to rebuild any GL state that is built once rather than per frame, and invalidates the layer. The equivalent by hand is three steps and easy to get half right.
Supported paths:
Symbol layers:
text[n].size,text[n].opacity,text[n].color,text[n].outlineColor. The index is required.Sample and particle layers:
sample.colorscale(com.xweather.mapsgl.style.ColorScaleOptions).Particle layers only:
sample.drawRange(aClosedRange<Double>, including a com.xweather.mapsgl.types.math_type.BoundedRange with an open end)sample.drawRange.min/sample.drawRange.max(aNumberin data units; the other end is kept)particle.density(com.xweather.mapsgl.style.ParticleDensity or its name),particle.count,particle.size,particle.speed,particle.trailsFade,particle.trails
sample.drawRange is not supported on sample layers; set it before adding the layer. For the sample and particle paths, names after the first segment are matched case-insensitively, so both sample.colorscale and sample.colorScale resolve.
An unknown layer, malformed path, unsupported property or uncoercible value is logged and ignored rather than throwing.
Parameters
Target layer id, as returned by addLayer / addWeatherLayer.
Key path of the paint field, e.g. "text[0].size".
New value to apply. text[n].size / .opacity take a Number or StyleValue<Double>; text[n].color / .outlineColor a Color, hex String or StyleValue<Color>; sample.colorscale a ColorScaleOptions; particle.count an Int; particle.size a Size or Number; particle.speed / .trailsFade a Number; particle.trails a Boolean.