Files

200 lines
18 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IGraphMainView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IGraphChannelView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IGraphPropertyView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IExportGraphMainView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/ITestDataView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IGraphPropertyViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/ITestDataSeriesView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IGraphView.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IGraphViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/ITestDataViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/ITestDataSeriesViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IGraphChannelViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IGraphMainViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/IExportGraphMainViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/Graphs/ITestDataSeries.cs
generated_at: "2026-04-16T03:08:42.365849+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "807b06583f497496"
---
# Graphs
## Documentation: Graph View Layer Interfaces
---
### 1. Purpose
This module defines the core interfaces for the graphing and data visualization subsystem within the DTS Viewer. It establishes a clean separation between view and view model layers (following MVVM), enabling modular UI composition for graph display, channel selection, property inspection, test data series management, and export functionality. The interfaces collectively support interactive graph rendering, channel grouping/locking, metadata display, and report generation (PDF/CSV), serving as the contract between UI components and their underlying data and logic.
---
### 2. Public Interface
#### View Interfaces
- **`IGraphMainView : IBaseView`**
Represents the main tab view for graph display. No additional members beyond base view contract.
- **`IGraphChannelView : IBaseView`**
Represents the tab view for channel configuration/selection. No additional members beyond base view contract.
- **`IGraphPropertyView : IBaseView`**
Represents the tab view for displaying properties of selected graph items. No additional members beyond base view contract.
- **`IExportGraphMainView : IBaseView`**
Represents the main tab view for graph export functionality. No additional members beyond base view contract.
- **`ITestDataView : IBaseView`**
Represents the tab view for test data series. No additional members beyond base view contract.
- **`ITestDataSeriesView : IBaseView`**
Represents the view for a single test data series. Provides report export capabilities:
- `bool SaveReportToPDF(string directory)`
- `bool SaveReportToCSV(string directory)`
Returns `true` on successful save, `false` otherwise.
- **`IGraphView : IBaseView`**
Represents the main graph display view. Contains a commented-out method signature (`SetGraphs`) indicating potential future or deprecated functionality.
#### View Model Interfaces
- **`IGraphPropertyViewModel : IBaseViewModel`**
View model for graph properties view.
- `IGraphPropertyView View { get }` — Gets the associated view.
- **`IGraphViewModel : IBaseViewModel`**
View model for the main graph view.
- `IGraphView View { get }` — Gets the associated view.
- `ITestDataSeriesView DataSeriesView { get; set; }` — Gets or sets the view for data series.
- **`ITestDataViewModel : IBaseViewModel`**
View model for test data series root.
- `ITestDataView View { get; set; }` — Gets or sets the associated view.
- `ITestDataSeries Model { get; set; }` — Gets or sets the underlying data model.
- **`ITestDataSeriesViewModel : IBaseViewModel`**
View model for an individual test data series.
- `ITestDataSeriesView View { get; set; }` — Gets or sets the associated view.
- `ITestDataSeries Model { get; set; }` — Gets or sets the underlying data model.
- `void MoveCursor(object sender, KeyEventArgs e)` — Handles cursor movement (e.g., keyboard interaction).
- `string CurrentCursorValues { get; set; }` — Gets or sets the current cursor position values (e.g., X/Y coordinates).
- **`IGraphChannelViewModel : IBaseViewModel`**
View model for channel selection/grouping.
- `IGraphChannelView View { get }` — Gets the associated view.
- `ObservableCollection<ITestChannel> GraphChannelList { get; set; }` — Full list of available channels.
- `ObservableCollection<ITestChannel> SelectedGraphChannelList { get; set; }` — Currently selected channels.
- `TestChannel SelectedGraphChannel { get; set; }` — Single currently selected channel.
- **`IGraphMainViewModel : IBaseViewModel`**
View model for the main graph view (channel management).
- `IGraphMainView View { get; set; }` — Gets or sets the associated view.
- `IBaseViewModel Parent { get; set; }` — Parent view model.
- `List<ITestChannel> LockedChannelList { get; set; }` — List of locked channels.
- `List<ITestChannel> SelectedChannelList { get; set; }` — List of selected channels.
- `string LockedGroupName { get; set; }` — Name of the group for locked channels.
- `void PublishSelectedChannels()` — Commits selected channels for display.
- `void AddSelectedChannel(ITestChannel channel)` — Adds a single channel to selection.
- `void AddSelectedGroupChannels(string groupName, List<ITestChannel> channels)` — Adds a group of channels to selection.
- `void AddLockedChannel(ITestChannel channel, bool isLocked)` — Adds a channel to locked list (or removes if `isLocked=false`).
- `void AddLockedGroupChannels(string testName, string groupName, List<ITestChannel> channels, bool isLocked)` — Adds a group of channels to locked list.
- `void GraphList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)` — Handles collection change events on graph lists.
- **`IExportGraphMainViewModel : IBaseViewModel`**
View model for graph export functionality. Extends `IGraphMainViewModel`s responsibilities with event and export-specific logic.
- `IExportGraphMainView View { get; set; }` — Gets or sets the associated view.
- `IBaseViewModel Parent { get; set; }` — Parent view model.
- `List<ITestChannel> LockedChannelList { get; set; }` — Locked channels.
- `List<ITestChannel> SelectedChannelList { get; set; }` — Selected channels.
- `List<ITestEvent> SelectedEventList { get; set; }` — Selected events for export.
- `string LockedGroupName { get; set; }` — Group name for locked channels.
- `void PublishSelectedChannels()` — Commits selected channels for export.
- `void AddSelectedChannel(ITestChannel channel)` — Adds a channel to selection.
- `void AddSelectedGroupChannels(string groupName, List<ITestChannel> channels)` — Adds a group to selection.
- `void AddToSelectedEvents(string groupName, List<ITestEvent> events)` — Adds events to selection.
- `void RemoveFromSelectedEvents(string groupName, List<ITestEvent> events)` — Removes events from selection.
- `void SetItemsBetween(int startTreeIndex, int endTreeIndex)` — Selects items between two tree indices (e.g., shift-click).
- `void ResetAllItems()` — Clears all selections.
- `void AddLockedChannel(ITestChannel channel, bool isLocked)` — Adds/removes channel from locked list.
- `void AddLockedEvents(string testName, string groupName, List<ITestEvent> events, bool isLocked)` — Adds/removes events from locked list.
- `void AddLockedGroupChannels(string testName, string groupName, List<ITestChannel> channels, bool isLocked)` — Adds/removes channel group from locked list.
- `void GraphList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)` — Handles collection changes.
- `bool SettingChildNodesToTrue { get; set; }` — Flag indicating recursive child node selection.
- `bool SettingOrResettingChildNodes { get; set; }` — Flag for child node modification.
- `bool SettingPeerNodeToTrue { get; set; }` — Flag for peer node selection.
- `bool SettingItemsBetween { get; set; }` — Flag for range selection.
- `bool ResettingAllItems { get; set; }` — Flag for full reset operation.
- `int LastIndexChecked { get; }` — Index of last item checked/selected.
- `void SetLastIndexChecked(int index)` — Sets `LastIndexChecked`.
#### Data Model Interface
- **`ITestDataSeries : IBaseModel`**
Represents a single data series to be plotted. Contains metadata, raw data, and computed statistics.
- `string TestGroup`, `TestSetupName`, `TestId`, `ChannelId`, `HardwareChannel`, `Bridge`, `GroupName`, `SWAAF`, `HWAAF`, `SampleRate`, `ISOCode`, `ISOChannelName`, `UserCode`, `UserChannelName`, `ChannelName`, `Description`, `SensorSN`, `SensorSNDisplay`, `EngineeringUnits`, `Excitation`, `Polarity`, `RecordingMode` — Metadata properties.
- `double[] Xvalue`, `double[] Yvalue` — Raw data arrays.
- `Brush GraphColor` — Color used for rendering the series.
- `string Description { get; }` — Read-only description.
- `string SensorSNDisplay { get; }` — Read-only display version of sensor serial number.
- `string MinY`, `MaxY`, `AvgY`, `StdDevY`, `T0EUValue`, `HICValue`, `T1Time`, `T2Time` — Read-only computed statistics.
- `double PeakFrequency`, `PeakMagnitude` — Peak frequency and magnitude (populated only when `FFT=true`).
- `bool FFT { get; }` — Indicates if series is an FFT transform.
- `double GRMS { get; set; }` — RMS acceleration (populated only for PSD results).
- `bool HIC { get; }` — Indicates if HIC (Head Injury Criterion) is computed for this series.
---
### 3. Invariants
- All view interfaces (`IGraphMainView`, `IGraphChannelView`, etc.) derive from `IBaseView`, implying a consistent base contract (e.g., `DataContext` binding, lifecycle methods) inherited from `DTS.Common.Base`.
- All view model interfaces derive from `IBaseViewModel`, enforcing a consistent base contract for data binding and lifecycle.
- View models always expose a strongly-typed `View` property (e.g., `IGraphPropertyView View { get }`), ensuring a one-to-one view/view model pairing.
- `ITestDataSeries` is the canonical data model for graphed data; all view models that render graphs must bind to instances of this interface.
- `ITestDataSeriesView.SaveReportToPDF` and `SaveReportToCSV` are the only guaranteed export methods; no other export formats are defined.
- `ITestDataSeriesViewModel.MoveCursor` accepts `KeyEventArgs`, implying keyboard-based cursor interaction is supported.
- `ITestDataSeries.FFT` and `ITestDataSeries.HIC` are read-only flags indicating derived data types; their values must be set at construction and not modified afterward.
---
### 4. Dependencies
**Dependencies *of* this module (imports):**
- `DTS.Common.Base` — Provides `IBaseView`, `IBaseViewModel`, and `IBaseModel`.
- `System.Collections.Generic`, `System.Collections.ObjectModel`, `System.Collections.Specialized` — For list/collection interfaces.
- `System.Windows.Media` — For `Brush` type (used in `GraphColor`).
- `System.Windows.Input` — For `KeyEventArgs` (used in `MoveCursor`).
- `DTS.Common.Events` — Referenced only in `ITestDataSeriesView`, but no types used (possibly unused or legacy).
- `DTS.Common.Classes.Viewer.TestMetadata` — Referenced for `ITestChannel` and `TestChannel` (used in `IGraphChannelViewModel` and `IGraphMainViewModel`).
**Dependencies *on* this module (consumers):**
- UI rendering layers (e.g., WPF views) must implement these interfaces.
- View model implementations (e.g., `GraphMainViewModel`, `TestDataSeriesViewModel`) must implement these interfaces.
- Export services likely depend on `ITestDataSeriesView` to generate PDF/CSV reports.
---
### 5. Gotchas
- **No active method in `IGraphView`**: The `SetGraphs` method is commented out, suggesting incomplete or deprecated functionality. Do not assume this method exists or is implemented.
- **`ITestDataSeries` properties are mixed read/write and read-only**: While most properties have setters, several (e.g., `Description`, `SensorSNDisplay`, `MinY`, `MaxY`, `AvgY`, `StdDevY`, `T0EUValue`, `PeakFrequency`, `PeakMagnitude`, `HIC`, `HICValue`, `T1Time`, `T2Time`, `FFT`, `GRMS`) are documented as read-only or conditionally populated. Implementations must respect these semantics.
- **`ITestDataSeriesViewModel.MoveCursor` signature is non-standard**: Uses `KeyEventArgs` directly instead of a custom event args type, implying tight coupling to WPF input events.
- **`ITestDataSeriesViewModel.CurrentCursorValues` is a `string`**: No parsing or formatting contract is defined; consumers must agree on format (e.g., `"X: 1.23, Y: 4.56"`).
- **`ITestDataSeriesViewModel.Model` and `ITestDataViewModel.Model` both use `ITestDataSeries`**: This implies a shared data model across multiple view models, requiring careful synchronization to avoid stale bindings.
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both expose `ITestDataSeries` models**: The distinction between them is unclear from interfaces alone (likely `ITestDataSeriesViewModel` handles a single series, while `ITestDataViewModel` handles a collection or root node).
- **`ITestDataSeriesViewModel.MoveCursor` and `CurrentCursorValues` are present, but no corresponding view method is defined**: The view must expose a way to update cursor value display (e.g., via data binding to `CurrentCursorValues`).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITestDataSeriesViewModel` for individual series).
- **`ITestDataSeriesViewModel` and `ITestDataViewModel` both use `ITestDataSeries` as model**: This suggests potential redundancy or layered abstraction (e.g., `ITestDataViewModel` for root, `ITest