using System.Collections.Generic; using System.Collections.ObjectModel; namespace MultiWheelC.TrajectoryPlanning.PathSmoothing.Visualization; /// 报告导出结果的稳定状态。 public enum SmoothingReportExportStatus { Success, InvalidInput, FontUnavailable, Failed, } /// 六张 SVG、六张 PNG 与一个 CSV 的发布结果;失败时不返回部分输出路径。 public sealed class SmoothingReportExportResult { internal SmoothingReportExportResult(SmoothingReportExportStatus status, string reason, IReadOnlyList svgPaths, IReadOnlyList pngPaths, string csvPath) { Status = status; Reason = reason ?? string.Empty; SvgPaths = Copy(svgPaths); PngPaths = Copy(pngPaths); CsvPath = csvPath ?? string.Empty; } public SmoothingReportExportStatus Status { get; } public string Reason { get; } public IReadOnlyList SvgPaths { get; } public IReadOnlyList PngPaths { get; } public string CsvPath { get; } internal static SmoothingReportExportResult Success(IReadOnlyList svgPaths, IReadOnlyList pngPaths, string csvPath) { return new SmoothingReportExportResult(SmoothingReportExportStatus.Success, string.Empty, svgPaths, pngPaths, csvPath); } internal static SmoothingReportExportResult Failure(SmoothingReportExportStatus status, string reason) { return new SmoothingReportExportResult(status, reason, new string[0], new string[0], string.Empty); } private static IReadOnlyList Copy(IReadOnlyList source) { var copy = new List(source == null ? 0 : source.Count); if (source != null) for (int index = 0; index < source.Count; index++) copy.Add(source[index] ?? string.Empty); return new ReadOnlyCollection(copy); } }