| 1 | #nullable enable |
| 2 | using CascadeIDE.Cockpit.Cds; |
| 3 | using CascadeIDE.Cockpit.Channels.TraceFlow; |
| 4 | using CascadeIDE.Cockpit.Composition; |
| 5 | using CascadeIDE.ViewModels; |
| 6 | |
| 7 | namespace CascadeIDE.Cockpit.Composition.TraceFlow; |
| 8 | |
| 9 | /// <summary> |
| 10 | /// Surface compositor for trace-flow channel (ADR 0036 p.3): maps channel payload into view scene highlights. |
| 11 | /// </summary> |
| 12 | public interface ITraceFlowSurfaceCompositor : ISurfaceCompositor<CodeNavigationMapGraphSceneVm, TraceFlowChannelSnapshot, TraceFlowCdsDecision, CodeNavigationMapGraphSceneVm> |
| 13 | { |
| 14 | } |
| 15 | |
| 16 | public sealed class TraceFlowSurfaceCompositor : ITraceFlowSurfaceCompositor |
| 17 | { |
| 18 | public CodeNavigationMapGraphSceneVm Compose( |
| 19 | CodeNavigationMapGraphSceneVm scene, |
| 20 | TraceFlowChannelSnapshot snapshot, |
| 21 | in TraceFlowCdsDecision cdsDecision) |
| 22 | { |
| 23 | if (!cdsDecision.Enabled || scene.IsEmpty) |
| 24 | return scene; |
| 25 | |
| 26 | return new CodeNavigationMapGraphSceneVm |
| 27 | { |
| 28 | Nodes = scene.Nodes, |
| 29 | Edges = scene.Edges, |
| 30 | Legend = scene.Legend, |
| 31 | UseLegendColumn = scene.UseLegendColumn, |
| 32 | ShowLegendConditionKey = scene.ShowLegendConditionKey, |
| 33 | ShowLegendReturnKey = scene.ShowLegendReturnKey, |
| 34 | ShowLegendExceptionFlowKey = scene.ShowLegendExceptionFlowKey, |
| 35 | ShowLegendEdgeStyleKey = scene.ShowLegendEdgeStyleKey, |
| 36 | LegendColumnLeft = scene.LegendColumnLeft, |
| 37 | LegendPlacement = scene.LegendPlacement, |
| 38 | LegendBlockTopY = scene.LegendBlockTopY, |
| 39 | Presentation = scene.Presentation, |
| 40 | HighlightedNodeIds = snapshot.HighlightedNodeIds, |
| 41 | HighlightedEdgeKeys = snapshot.HighlightedEdgeKeys, |
| 42 | SideLabelFontSizePx = scene.SideLabelFontSizePx, |
| 43 | ShowNodeLegendGlyphs = scene.ShowNodeLegendGlyphs, |
| 44 | RelatedFilesLayout = scene.RelatedFilesLayout, |
| 45 | ControlFlowMainAxis = scene.ControlFlowMainAxis, |
| 46 | LayoutViewportWidth = scene.LayoutViewportWidth, |
| 47 | LayoutViewportHeight = scene.LayoutViewportHeight |
| 48 | }; |
| 49 | } |
| 50 | } |
| 51 | |