5.9 KiB
5.9 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T03:04:42.623188+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 02546da4f9d34015 |
RegionOfInterestChannels
1. Purpose
This module defines the core interfaces for the Region of Interest (ROI) Channels feature, which manages the mapping and filtering of physical channels (e.g., sensor or signal paths) to user-defined regions of interest within the test setup UI. It serves as the MVVM (Model-View-ViewModel) contract layer between the UI (IRegionOfInterestChannelsView) and the business logic/data (IRegionOfInterestChannelsViewModel), enabling dynamic display, filtering, sorting, and validation of channel-group associations for ROI configuration.
2. Public Interface
IRegionOfInterestChannelsView
- Inherits:
IBaseView - Purpose: Marker interface for the view layer (e.g., WPF UserControl or page) implementing the ROI channels UI. No additional members defined—relies on
IBaseViewcontract.
IRegionOfInterestChannelsViewModel
-
Inherits:
IBaseViewModel -
Properties:
IRegionOfInterestChannelsView View { get; set; }- Binds to the associated view instance (MVVM pattern).
BindingList<IRegionOfInterest> RegionsOfInterest { get; set; }- Mutable list of ROI definitions; implements change notification via
BindingList<T>.
- Mutable list of ROI definitions; implements change notification via
string[] AllChannelSSNs { get; }- Read-only array of serial numbers (SSNs) for all channels available in the current context.
List<DTS.Common.Classes.Groups.GroupChannel> AllChannelsUnfiltered { get; set; }- Mutable list of all physical channels (as
GroupChannelobjects), before filtering.
- Mutable list of all physical channels (as
-
Methods:
void SetParent(object o)- Sets the parent context (e.g., main view model or window) for navigation/coordination.
void SetGroups(ITestSetup testSetup, Dictionary<string, IDASHardware> serialNumberToHardware, IsoViewMode viewMode)- Initializes the ROI channel list based on a test setup, hardware lookup (by serial number), and view mode.
void SetTest(string path, IsoViewMode viewMode)- Loads ROI channel data from a test definition at
path, applying the specifiedviewMode.
- Loads ROI channel data from a test definition at
void Filter(object tag, string term)- Filters channels using a
tag(e.g., column/group identifier) and searchterm.
- Filters channels using a
void Filter(string term)- Filters channels across all channels (unqualified filter) by
term(e.g., SSN, name, description).
- Filters channels across all channels (unqualified filter) by
void Sort(object o, bool columnClick)- Sorts the ROI list;
olikely identifies the sort key (e.g., column header),columnClickindicates UI-initiated sort.
- Sorts the ROI list;
void SelectAll(int roiIndex, bool selection)- Sets selection state (
true/false) for all channels in the ROI atroiIndex.
- Sets selection state (
bool Validate(ref List<string> errors)- Validates ROI configuration; returns
falseand populateserrorsif invalid.
- Validates ROI configuration; returns
3. Invariants
RegionsOfInterestmust be a non-nullBindingList<IRegionOfInterest>(enforced by property setter).AllChannelSSNsis read-only and derived fromAllChannelsUnfiltered(implementation detail not visible, but implied by naming and usage).AllChannelsUnfilteredmust be populated before filtering/sorting operations (Filter,Sort,SelectAll) are called.SetGroupsorSetTestmust be called beforeValidate,Filter, orSortto initialize state.ISOViewMode(inherited viaIBaseViewModelor implied) must be consistent with theIsoViewModeparameter inSetGroups/SetTest.
4. Dependencies
- Depends on:
DTS.Common.Base(forIBaseView,IBaseViewModel)System.Collections.Generic,System.Collections.ObjectModel,System.ComponentModel(forBindingList<T>)DTS.Common.Interface.DataRecorders(IDASHardware)DTS.Common.Interface.Groups(GroupChannel)DTS.Common.Interface.GroupTemplate(likelyITestObjectTemplate, though commented out inSetGroups)DTS.Common.Interface.TestSetups.TestSetupsList(ITestSetup)DTS.Common.Enums(IsoViewMode)
- Implied dependents:
- View layer (e.g., WPF/XAML) implementing
IRegionOfInterestChannelsView. - Main application view model or test setup controller instantiating
IRegionOfInterestChannelsViewModel. - Unit tests for ROI channel logic.
- View layer (e.g., WPF/XAML) implementing
5. Gotchas
- The
SetGroupsmethod signature includes commented-out parameters (ITestObject[] groups,Dictionary<string, IDASHardware> hardwareLookup,ITestObjectTemplate[] groupTemplates), suggesting an older or refactored API. The current active signature usesITestSetupandserialNumberToHardware—developers must avoid mixing old/new usage. AllChannelsUnfilteredis mutable (setaccessor present), but its contents likely must not be modified directly (only viaSetGroups/SetTest); direct mutation may cause inconsistencies withAllChannelSSNsorRegionsOfInterest.Filter(string term)performs a global filter, whileFilter(object tag, string term)is scoped (e.g., per column/group). Confusing these may lead to unexpected filtering behavior.SelectAll(int roiIndex, bool selection)operates on channels within a specific ROI, not all ROIs—index out-of-bounds may cause runtime errors (no validation in interface).Validate(ref List<string> errors)returnsfalseon failure but does not specify when it succeeds (trueimplies no errors, but edge cases like empty ROIs may require explicit handling).IsoViewModeis used inSetGroups/SetTestbut not exposed as a property in the interface—its value must be tracked externally or inferred fromISOViewMode(case-sensitive naming mismatch noted:ISOViewModevs.IsoViewMode).