加日志

This commit is contained in:
zqm
2026-01-21 15:24:21 +08:00
parent b8d86924a2
commit 5fc4b0d01d
2 changed files with 35 additions and 1 deletions

View File

@@ -209,6 +209,9 @@ namespace JoyD.Windows.CS
// 映射到原始数据点坐标
Point dataPoint = MapToDataPoint(imagePoint);
// 添加鼠标移动日志
Console.WriteLine($"鼠标移动 - 控件坐标: ({e.Location.X},{e.Location.Y}), 图像坐标: ({imagePoint.X},{imagePoint.Y}), 数据点: ({dataPoint.X},{dataPoint.Y})");
// 使用锁保护_currentDataPoint的访问
lock (_dataPointLock)
{
@@ -294,7 +297,29 @@ namespace JoyD.Windows.CS
if (x >= 0 && x < _temperatureData.TemperatureMatrix.GetLength(1) && // 列索引有效
y >= 0 && y < _temperatureData.TemperatureMatrix.GetLength(0)) // 行索引有效
{
return _temperatureData.TemperatureMatrix[y, x]; // [行][列]访问
float temperature = _temperatureData.TemperatureMatrix[y, x]; // [行][列]访问
// 添加鼠标位置温度日志
Console.WriteLine($"鼠标位置温度 - 数据点: ({x},{y}), 温度: {temperature:F2} °C, 使用矩阵: TemperatureMatrix");
// 同时记录RealTemperatureMatrix中的对应温度如果可用
if (_temperatureData.RealTemperatureMatrix != null)
{
int realX = x * 2;
int realY = y * 2;
if (realX >= 0 && realX < _temperatureData.RealTemperatureMatrix.GetLength(1) &&
realY >= 0 && realY < _temperatureData.RealTemperatureMatrix.GetLength(0))
{
float realTemp = _temperatureData.RealTemperatureMatrix[realY, realX];
Console.WriteLine($"对应RealTemperatureMatrix温度 - 坐标: ({realX},{realY}), 温度: {realTemp:F2} °C");
if (Math.Abs(temperature - realTemp) > 0.1f)
{
Console.WriteLine($"温度差异: {Math.Abs(temperature - realTemp):F2} °C");
}
}
}
return temperature;
}
return float.NaN;