Files
hoodFieldOfView/头罩视野slove/头罩视野/TestDataStore.cs

62 lines
2.2 KiB
C#
Raw Normal View History

2026-04-21 10:19:14 +08:00
using System;
using System.Collections.Generic;
using System.Text;
namespace
{
public static class TestDataStore
{
// 单条测试数据
public class TestRecord
{
public int Id { get; set; }
2026-04-22 14:45:50 +08:00
public string Time { get; set; } = string.Empty;
public string Date { get; set; } = string.Empty;
2026-04-21 10:19:14 +08:00
public double LeftEyeArea { get; set; }
public double RightEyeArea { get; set; }
public double BinocularArea { get; set; }
//public double BlankArea { get; set; }
public double LowerVision { get; set; }
public double VisionRetentionRate { get; set; }
}
// 所有记录
public static List<TestRecord> Records { get; } = new List<TestRecord>();
private static int _nextId = 1;
public static void AddNewRecord(TestRecord record)
{
2026-04-23 13:41:26 +08:00
foreach (var r in Records)
{
// 5个字段都一样就认为是重复
if (Math.Abs(r.LeftEyeArea - record.LeftEyeArea) < 0.01 &&
Math.Abs(r.RightEyeArea - record.RightEyeArea) < 0.01 &&
Math.Abs(r.BinocularArea - record.BinocularArea) < 0.01 &&
Math.Abs(r.LowerVision - record.LowerVision) < 0.01 &&
Math.Abs(r.VisionRetentionRate - record.VisionRetentionRate) < 0.01)
{
// 找到重复直接return不添加
return;
}
}
2026-04-21 10:19:14 +08:00
record.Id = _nextId++;
Records.Add(record);
}
2026-04-24 14:55:20 +08:00
public static class GlobalData
{
// 要传的所有数据放这里
public static double LeftEyeArea { get; set; }
public static double RightEyeArea { get; set; }
public static double TotalEyeArea { get; set; }
public static double BinocularArea { get; set; }
public static double BlankArea { get; set; }
public static double LowerVision { get; set; }//下方视野角度
public static double VisionRetentionRate { get; set; }
}
2026-04-21 10:19:14 +08:00
}
}