pub struct LayerSet { /* private fields */ }Expand description
Per-render override of OCG visibility.
An OCG with no entry here falls back to its display-list-baked
default_visible. Entries are explicit bools so a consumer can
override a layer in either direction.
Implementations§
Source§impl LayerSet
impl LayerSet
Sourcepub fn get(&self, ocg_id: u32) -> Option<bool>
pub fn get(&self, ocg_id: u32) -> Option<bool>
Get the explicit override for an OCG, if any. None means the
renderer should fall back to default_visible.
Sourcepub fn evaluate(&self, vis: &OcgVisibility) -> bool
pub fn evaluate(&self, vis: &OcgVisibility) -> bool
Evaluate an OcgVisibility predicate.
Each variant’s default_visible is the renderer’s fallback
for the whole group when this LayerSet has no opinion on
any of its leaves. Specifically:
Single→ consult the LayerSet forocg_id; fall back todefault_visible.Membership/Expression→ if none of the relevant leaves are overridden by this LayerSet, returndefault_visibledirectly. This is the “consumer has no opinion at all” path and preserves byte-identity for OCMD defaults baked at parse time.- With at least one leaf overridden, evaluate the policy or
expression: overridden leaves use their override value,
missing leaves fall back to the variant’s
default_visible.
Sourcepub fn enforce_rb_group(&mut self, group: &[u32], newly_on: u32)
pub fn enforce_rb_group(&mut self, group: &[u32], newly_on: u32)
Apply a radio-button-group constraint: when one layer in the
group is turned ON, all the others get explicitly turned OFF.
newly_on is left ON.
Layers in group other than newly_on are explicitly forced
OFF (they get an entry in this set, not just a missing entry).