From 6f48cebf7c195a06035afa98938ddce5277c6107 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 13 Oct 2021 12:20:57 +0300 Subject: CALCULATION OF YELLOW FACTORS - correct calculation for down line Related Work Items: #5741 --- .../ViewModels/ColorParametersVewVM.cs | 30 +++++----------------- 1 file changed, 6 insertions(+), 24 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs index a89a2e33c..2aa5598be 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/ColorParametersVewVM.cs @@ -672,31 +672,10 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels var processData = SelectedColorProcessParameter.ColorProcessData.Where(x => x.FactorColor == color).ToList(); double target100 = FactorTarget.GetFactor100(color); double target200 = FactorTarget.GetFactor200(color); - //ColorProcessData closest100 = null; - //ColorProcessData closest200 = null; - - //var minDifference100 = double.MaxValue; - //var minDifference200 = double.MaxValue; - + if (processData.Count == 0) return; - - //foreach (var item in processData) - //{ - // var colorvalue = isLtype ? item.L : item.B; - // var difference100 = Math.Abs(colorvalue - target100); - // if (minDifference100 > difference100) - // { - // minDifference100 = (int)difference100; - // closest100 = item; - // } - // var difference200 = Math.Abs(colorvalue - target200); - // if (minDifference200 > difference200) - // { - // minDifference200 = (int)difference200; - // closest200 = item; - // } - //} + var point100 = GetTargetPoint(processData, target100, isLtype); UpdateFactor(Factor100ProcessData.FirstOrDefault(x => x.FactorColor == color), point100); var point200 = GetTargetPoint(processData, target200, isLtype); @@ -716,12 +695,15 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels for (int index = 1; index < distinctItems.Count; index++) { var item = distinctItems[index]; + if (prevItem.L > item.L && (factor > prevItem.L || (factor <= prevItem.L && factor >= item.L)) || (prevItem.L <= item.L && (factor > prevItem.L || (factor >= prevItem.L && factor <= item.L))) || ((index + 1) == distinctItems.Count && calculatedX == 0.0)) { calculatedX = CalculateXValue(factor, new DataPoint(prevItem.InkNlCm, prevItem.L), new DataPoint(item.InkNlCm, item.L)); - break; + //Yellow line is ascending line( up line), others - descending line(down) + if (isLtype) + break; } prevItem = item; -- cgit v1.3.1