pub struct VectorStyle {Show 54 fields
pub render_mode: VectorRenderMode,
pub fill_color: [f32; 4],
pub stroke_color: [f32; 4],
pub stroke_width: f32,
pub point_radius: f32,
pub line_cap: LineCap,
pub line_join: LineJoin,
pub miter_limit: f32,
pub dash_array: Option<Vec<f32>>,
pub heatmap_radius: f32,
pub heatmap_intensity: f32,
pub extrusion_base: f32,
pub extrusion_height: f32,
pub symbol_size: f32,
pub symbol_halo_color: [f32; 4],
pub symbol_text_field: Option<String>,
pub symbol_icon_image: Option<String>,
pub symbol_font_stack: String,
pub symbol_padding: f32,
pub symbol_allow_overlap: bool,
pub symbol_text_allow_overlap: bool,
pub symbol_icon_allow_overlap: bool,
pub symbol_text_optional: bool,
pub symbol_icon_optional: bool,
pub symbol_text_ignore_placement: bool,
pub symbol_icon_ignore_placement: bool,
pub symbol_text_anchor: SymbolAnchor,
pub symbol_text_justify: SymbolTextJustify,
pub symbol_text_transform: SymbolTextTransform,
pub symbol_text_max_width: Option<f32>,
pub symbol_text_line_height: Option<f32>,
pub symbol_text_letter_spacing: Option<f32>,
pub symbol_icon_text_fit: SymbolIconTextFit,
pub symbol_icon_text_fit_padding: [f32; 4],
pub symbol_sort_key: Option<f32>,
pub symbol_anchors: Vec<SymbolAnchor>,
pub symbol_placement: SymbolPlacement,
pub symbol_spacing: f32,
pub symbol_max_angle: f32,
pub symbol_keep_upright: bool,
pub symbol_text_radial_offset: Option<f32>,
pub symbol_variable_anchor_offsets: Option<Vec<(SymbolAnchor, [f32; 2])>>,
pub symbol_writing_mode: SymbolWritingMode,
pub symbol_offset: [f32; 2],
pub fill_translate: [f32; 2],
pub fill_opacity: f32,
pub fill_antialias: bool,
pub fill_outline_color: Option<[f32; 4]>,
pub fill_pattern: Option<Arc<PatternImage>>,
pub line_pattern: Option<Arc<PatternImage>>,
pub width_expr: Option<Expression<f32>>,
pub stroke_color_expr: Option<Expression<[f32; 4]>>,
pub eval_zoom: f32,
pub line_gradient: Option<ColorRamp>,
}Expand description
Style parameters for rendering a vector layer.
Fields§
§render_mode: VectorRenderModeActive render family.
fill_color: [f32; 4]Fill colour (RGBA, 0–1 range).
stroke_color: [f32; 4]Stroke (outline) colour (RGBA, 0–1 range).
stroke_width: f32Stroke width in pixels.
point_radius: f32Point/circle radius in pixels.
line_cap: LineCapLine cap style.
line_join: LineJoinLine join style.
miter_limit: f32Miter limit ratio — when the miter length exceeds miter_limit * stroke_width, a miter join falls back to bevel. Default 2.0
(matching MapLibre / Mapbox).
dash_array: Option<Vec<f32>>Optional dash pattern [dash_length, gap_length, …] in pixels.
heatmap_radius: f32Heatmap radius in pixels.
heatmap_intensity: f32Heatmap intensity multiplier.
extrusion_base: f32Extrusion base height in meters.
extrusion_height: f32Extrusion height in meters.
symbol_size: f32Symbol size in pixels.
symbol_halo_color: [f32; 4]Symbol halo colour.
symbol_text_field: Option<String>Feature property used for text labels.
symbol_icon_image: Option<String>Optional icon image id for point symbols.
symbol_font_stack: StringFont stack used for glyph dependency requests.
symbol_padding: f32Collision padding in pixels.
symbol_allow_overlap: boolShared overlap fallback for simplified callers.
Mapbox and MapLibre distinguish text and icon overlap flags. The engine keeps this field as a shared default for existing call sites, while the more specific text/icon flags below let symbol candidates apply closer spec behavior.
symbol_text_allow_overlap: boolWhether text is allowed to overlap other placed symbols.
symbol_icon_allow_overlap: boolWhether icons are allowed to overlap other placed symbols.
symbol_text_optional: boolWhether text may be dropped while keeping the icon.
symbol_icon_optional: boolWhether the icon may be dropped while keeping the text.
symbol_text_ignore_placement: boolWhether text may be placed without blocking later symbols.
symbol_icon_ignore_placement: boolWhether icons may be placed without blocking later symbols.
symbol_text_anchor: SymbolAnchorDefault anchor when variable anchors are not in use.
symbol_text_justify: SymbolTextJustifyEffective horizontal justification for the current label.
symbol_text_transform: SymbolTextTransformText transformation applied before measurement and placement.
symbol_text_max_width: Option<f32>Maximum point-label width in symbol-size units before wrapping.
This is the engine’s simplified text-max-width representation. It is
currently used to estimate wrapped placeholder text boxes for point
labels, which improves collision and sizing behavior before full glyph
shaping is in place.
symbol_text_line_height: Option<f32>Preferred line height for wrapped text in text-size units.
The engine uses this in its simplified wrapped text-box estimate so placeholder label height follows the style more closely even before full glyph shaping is implemented.
symbol_text_letter_spacing: Option<f32>Extra spacing between adjacent glyphs in text-size units.
The engine applies this to its placeholder text width estimate so label
collisions and wrapping react to text-letter-spacing before full glyph
shaping exists.
symbol_icon_text_fit: SymbolIconTextFitIcon sizing mode relative to label text.
symbol_icon_text_fit_padding: [f32; 4]Padding applied when fitting the icon around text.
symbol_sort_key: Option<f32>Placement priority for symbol ordering.
Lower sort keys are placed first, matching Mapbox and MapLibre’s
symbol-sort-key semantics. None preserves source order when the
style does not request explicit symbol ordering.
symbol_anchors: Vec<SymbolAnchor>Preferred variable anchors in priority order.
symbol_placement: SymbolPlacementWhether symbols are anchored on points or along lines.
symbol_spacing: f32Preferred spacing between repeated line-placed symbols in pixels.
Mapbox and MapLibre interpret this during tile-space symbol layout. The engine currently uses it as an approximate world-space spacing for repeated line anchors until full line-shaped symbol layout is in place.
symbol_max_angle: f32Maximum cumulative turn angle tolerated for a line-placed label.
The current implementation applies this as a simplified readability check over the retained line window around each anchor. It is not yet a full reproduction of Mapbox or MapLibre’s sliding-window angle logic, but it prevents labels from being emitted on the sharpest bends.
symbol_keep_upright: boolWhether line-placed text should be flipped to remain upright.
Mapbox and MapLibre use this to avoid upside-down line labels. The engine currently applies it by normalizing line-anchor rotation into an upright range before placement.
symbol_text_radial_offset: Option<f32>Radial text offset measured in symbol-size units.
The full style spec defines this in EM-like text units. The engine uses the current symbol size as the scale factor so anchored labels can move outward in the requested direction without waiting for full glyph shaping metrics.
symbol_variable_anchor_offsets: Option<Vec<(SymbolAnchor, [f32; 2])>>Explicit per-anchor offsets for variable anchor placement.
This is the engine’s simplified representation of
text-variable-anchor-offset. Values are stored in symbol-size units and
resolved for the selected anchor during placement.
symbol_writing_mode: SymbolWritingModeWriting mode for symbol text.
symbol_offset: [f32; 2]Pixel-space symbol offset.
fill_translate: [f32; 2]Fill-layer pixel translate offset [tx, ty].
fill_opacity: f32Fill-layer opacity (separate from vertex alpha).
fill_antialias: boolWhether fill edges should be antialiased.
fill_outline_color: Option<[f32; 4]>Optional distinct outline color. When None, outline uses stroke_color.
fill_pattern: Option<Arc<PatternImage>>Optional fill pattern image.
When set, the fill is rendered with a repeating pattern texture
instead of a solid colour. The pattern repeats in world space
with one pattern pixel mapping to approximately one meter,
matching MapLibre / Mapbox fill-pattern semantics.
line_pattern: Option<Arc<PatternImage>>Optional line pattern image.
When set, the line is rendered with a repeating pattern texture
instead of a solid colour. The pattern maps along the line
centreline (U axis, distance / pattern width) and across the line
width (V axis, 0 at left edge → 1 at right edge), matching
MapLibre / Mapbox line-pattern semantics.
width_expr: Option<Expression<f32>>Optional data-driven width expression.
When present and Expression::is_data_driven returns true,
VectorLayer::tessellate evaluates the expression per feature
instead of using the single stroke_width value for every feature.
stroke_color_expr: Option<Expression<[f32; 4]>>Optional data-driven stroke-color expression.
Same semantics as width_expr: when data-driven, colour is resolved
per feature during tessellation.
eval_zoom: f32Zoom level captured at style-evaluation time.
Needed to build a per-feature ExprEvalContext during tessellation
so that zoom-dependent stops still resolve correctly.
line_gradient: Option<ColorRamp>Optional colour ramp evaluated along the polyline centreline.
When set, the tessellator overrides per-vertex colours with the
gradient evaluated at each vertex’s normalized distance [0, 1]
along the feature. This replicates MapLibre / Mapbox’s
line-gradient property.
Implementations§
Source§impl VectorStyle
impl VectorStyle
Sourcepub fn fill(
fill_color: [f32; 4],
outline_color: [f32; 4],
outline_width: f32,
) -> Self
pub fn fill( fill_color: [f32; 4], outline_color: [f32; 4], outline_width: f32, ) -> Self
Convenience constructor for fill rendering.
Sourcepub fn fill_pattern(pattern: Arc<PatternImage>) -> Self
pub fn fill_pattern(pattern: Arc<PatternImage>) -> Self
Fill rendering with a repeating pattern texture.
The pattern overrides fill_color — the fragment shader samples
the pattern image instead of using a solid colour.
Sourcepub fn line_pattern(width: f32, pattern: Arc<PatternImage>) -> Self
pub fn line_pattern(width: f32, pattern: Arc<PatternImage>) -> Self
Line rendering with a repeating pattern texture.
The pattern maps along the line centreline and across its width.
The fragment shader samples the pattern image instead of using a
solid colour, matching MapLibre / Mapbox line-pattern semantics.
Sourcepub fn line_styled(
color: [f32; 4],
width: f32,
cap: LineCap,
join: LineJoin,
miter_limit: f32,
dash_array: Option<Vec<f32>>,
) -> Self
pub fn line_styled( color: [f32; 4], width: f32, cap: LineCap, join: LineJoin, miter_limit: f32, dash_array: Option<Vec<f32>>, ) -> Self
Line rendering with explicit cap, join, and miter limit.
Sourcepub fn line_gradient(width: f32, ramp: ColorRamp) -> Self
pub fn line_gradient(width: f32, ramp: ColorRamp) -> Self
Line rendering with a colour gradient along the polyline.
The gradient overrides color — per-vertex colours are computed
from the ColorRamp at each vertex’s normalised distance along
the line.
Sourcepub fn circle(
color: [f32; 4],
radius: f32,
stroke_color: [f32; 4],
stroke_width: f32,
) -> Self
pub fn circle( color: [f32; 4], radius: f32, stroke_color: [f32; 4], stroke_width: f32, ) -> Self
Convenience constructor for point circles.
Sourcepub fn heatmap(color: [f32; 4], radius: f32, intensity: f32) -> Self
pub fn heatmap(color: [f32; 4], radius: f32, intensity: f32) -> Self
Convenience constructor for heatmap blobs.
Sourcepub fn fill_extrusion(color: [f32; 4], base: f32, height: f32) -> Self
pub fn fill_extrusion(color: [f32; 4], base: f32, height: f32) -> Self
Convenience constructor for polygon extrusion.
Sourcepub fn symbol(color: [f32; 4], halo_color: [f32; 4], size: f32) -> Self
pub fn symbol(color: [f32; 4], halo_color: [f32; 4], size: f32) -> Self
Convenience constructor for basic symbol markers.
Sourcepub fn tessellation_fingerprint(&self) -> u64
pub fn tessellation_fingerprint(&self) -> u64
Compute a lightweight u64 fingerprint of the fields that affect
VectorLayer::tessellate output.
Two styles that produce identical tessellation results will have the
same fingerprint. The hash is cheap (a few dozen field reads through
the default hasher) and is used by the sync-path vector bucket cache
to detect style changes without requiring PartialEq on
VectorStyle.
Sourcepub fn is_width_data_driven(&self) -> bool
pub fn is_width_data_driven(&self) -> bool
Whether line width is data-driven (varies per feature).
Sourcepub fn is_stroke_color_data_driven(&self) -> bool
pub fn is_stroke_color_data_driven(&self) -> bool
Whether stroke color is data-driven (varies per feature).
Sourcepub fn evaluate_width(&self, feature: &Feature) -> f32
pub fn evaluate_width(&self, feature: &Feature) -> f32
Evaluate stroke width for a specific feature’s properties.
Returns self.stroke_width when no data-driven expression is set.
Sourcepub fn evaluate_stroke_color(&self, feature: &Feature) -> [f32; 4]
pub fn evaluate_stroke_color(&self, feature: &Feature) -> [f32; 4]
Evaluate stroke color for a specific feature’s properties.
Returns self.stroke_color when no data-driven expression is set.
Trait Implementations§
Source§impl Clone for VectorStyle
impl Clone for VectorStyle
Source§fn clone(&self) -> VectorStyle
fn clone(&self) -> VectorStyle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more