csharpdeeb25a2 | 1 | #nullable enable |
| 2 | using CascadeIDE.Cockpit.Graph; |
| 3 | using CascadeIDE.Models; |
| 4 | |
| 5 | namespace CascadeIDE.Cockpit.Graph.Layout; |
| 6 | |
| 7 | /// <summary>Связывает <see cref="GraphKind"/> и уровень карты с <see cref="GraphLayoutPresentation"/>.</summary> |
| 8 | public static class GraphLayoutPresentationResolver |
| 9 | { |
| 10 | public static GraphLayoutPresentation Resolve(GraphDocument doc, string semanticMapLevel) |
| 11 | { |
| 12 | if (doc.Kind != GraphKind.Unspecified) |
| 13 | return ToPresentation(doc.Kind); |
| 14 | |
| 15 | var level = CodeNavigationMapLevelKind.Normalize(semanticMapLevel); |
| 16 | return string.Equals(level, CodeNavigationMapLevelKind.ControlFlow, StringComparison.Ordinal) |
| 17 | ? GraphLayoutPresentation.CodeControlFlow |
| 18 | : GraphLayoutPresentation.WorkspaceRelatedFiles; |
| 19 | } |
| 20 | |
| 21 | private static GraphLayoutPresentation ToPresentation(GraphKind kind) => |
| 22 | kind switch |
| 23 | { |
| 24 | GraphKind.CodeIntent => GraphLayoutPresentation.CodeControlFlow, |
| 25 | GraphKind.RelatedFiles => GraphLayoutPresentation.WorkspaceRelatedFiles, |
| 26 | GraphKind.RepositoryModuleTree => GraphLayoutPresentation.WorkspaceRelatedFiles, |
| 27 | _ => GraphLayoutPresentation.WorkspaceRelatedFiles |
| 28 | }; |
| 29 | } |
| 30 | |
View only · write via MCP/CIDE