Class ViewingGroupController
Controls visibility of features by viewing group assignment.
public sealed class ViewingGroupController
- Inheritance
-
ViewingGroupController
- Inherited Members
Remarks
Effective visibility is the layered combination of two inputs (S-100 Part 9 §11.7, "Display modes and viewing groups"):
-
A base mode membership set established by the active
DisplayModeController: when a non-null set is
active, only viewing groups in the set are considered base-on
and every other viewing group is base-off. When the membership
is
null(the default), every viewing group is base-on. - User overrides applied on top of the base via SetUserOverride(int, bool?). An explicit override always wins over the base membership, allowing the user to toggle individual groups regardless of the active mode.
Mode-independent groups (SetModeIndependentGroups(IReadOnlySet<int>?)) are base-on whatever the active mode: a portrayal catalogue's chart text is switched on and off by the mariner, not by the display mode.
Properties
ActiveModeMembership
The active mode membership, or null when no mode is
active (in which case every viewing group is visible by
default). The returned set is a non-downcastable read-only view.
public IReadOnlySet<int>? ActiveModeMembership { get; }
Property Value
DatasetFilter
The per-dataset filter applied after the mode membership and user
overrides, or null. See SetDatasetFilter(ViewingGroupFilter?).
public ViewingGroupFilter? DatasetFilter { get; }
Property Value
GroupVisibility
Backwards-compatible view: the effective visibility for every viewing group that has either an active-mode membership entry or an explicit user override. Groups that are visible solely by the "no mode active → everything visible" default are not enumerated.
public IReadOnlyDictionary<int, bool> GroupVisibility { get; }
Property Value
ModeIndependentGroups
The groups set by SetModeIndependentGroups(IReadOnlySet<int>?), or null.
public IReadOnlySet<int>? ModeIndependentGroups { get; }
Property Value
UserOverrides
Read-only view of the current per-group user overrides.
public IReadOnlyDictionary<int, bool> UserOverrides { get; }
Property Value
Methods
ClearUserOverrides()
Clears every user override.
public void ClearUserOverrides()
IsVisible(DrawingInstruction)
Returns whether instruction is visible: every viewing
group assigned to it — ViewingGroup and
each of AdditionalViewingGroups — must be
visible per IsVisible(int).
public bool IsVisible(DrawingInstruction instruction)
Parameters
instructionDrawingInstructionThe drawing instruction to test.
Returns
Remarks
S-100 Ed 5.2 Part 9 §9-11.1.3: "A drawing instruction which has multiple
Viewing Groups is disabled when any assigned Viewing Group is disabled"
(restated for the Lua ViewingGroup command in Part 9a
§9a-11.2.2.1). This is what lets a secondary group act as an
independent toggle — e.g. S-101's 90020/90021 switch off
the INFORM01 "additional information" marker without hiding the
feature's own symbology in its primary group.
IsVisible(int)
Returns the effective visibility for viewingGroup.
User overrides win over base mode membership; with no override and
no active mode, the group is visible. A DatasetFilter
then hides any group it doesn't allow.
public bool IsVisible(int viewingGroup)
Parameters
viewingGroupint
Returns
SetActiveModeMembership(IReadOnlySet<int>?)
Replaces the active-mode viewing-group membership. Pass
null to clear so that every viewing group is visible by
default again. User overrides are preserved.
public void SetActiveModeMembership(IReadOnlySet<int>? membership)
Parameters
membershipIReadOnlySet<int>
SetDatasetFilter(ViewingGroupFilter?)
Sets or clears the per-dataset filter. A group the filter doesn't allow is hidden whatever its mode membership or user override says; the filter never shows a group those hide.
public void SetDatasetFilter(ViewingGroupFilter? filter)
Parameters
filterViewingGroupFilterThe filter, or
nullto clear it.
SetModeIndependentGroups(IReadOnlySet<int>?)
Sets the viewing groups the display mode doesn't govern: they're
visible unless a user override hides them, whatever the active mode.
Pass null to clear.
public void SetModeIndependentGroups(IReadOnlySet<int>? groups)
Parameters
groupsIReadOnlySet<int>The mode-independent groups, or
null.
Remarks
The S-101 portrayal catalogue's Chart text layer is the case in
point: its text groups belong to no display mode (S-100 Part 9 §11.7)
and are toggled on their own, as S-52 text groups are.
SetUserOverride(int, bool?)
Sets, replaces, or clears the user override for
viewingGroup. Pass null to clear so
that the base mode membership wins again.
public void SetUserOverride(int viewingGroup, bool? visible)
Parameters
SetVisible(int, bool)
Sets the user's explicit visibility override for
viewingGroup. Equivalent to calling
SetUserOverride(int, bool?) with a non-null value.
public void SetVisible(int viewingGroup, bool visible)
Parameters
Events
Changed
Raised whenever effective visibility changes — either because the active mode membership was updated, or because a user override was set or cleared.
public event Action? Changed