From 66f00e5729e48811cc7d5d6f728988cd64f225e7 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 31 Aug 2020 09:10:47 +0300 Subject: Calibration Color. LAB graph is added to Linearization tab. --- .../ViewModels/ColorCalibrationViewVM.cs | 68 ++++++++++++++++++++-- 1 file changed, 63 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs index f7e93a4e6..31d89005e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs @@ -41,7 +41,7 @@ namespace Tango.MachineStudio.RML.ViewModels public BL.Entities.LiquidType LiquidType { get { return _liquidType; } - set { _liquidType = value; RaisePropertyChangedAuto(); } + set { _liquidType = value; RaisePropertyChangedAuto(); RaisePropertyChanged("LiquidTypeName"); } } private List _liquidTypes; @@ -99,7 +99,7 @@ namespace Tango.MachineStudio.RML.ViewModels public string LiquidTypeName { - get { return LiquidType == null ?"" : LiquidType.Name; } + get { return LiquidType == null ?"" : LiquidType.Name; } } public Plot PlotControl { get; set; } @@ -162,7 +162,23 @@ namespace Tango.MachineStudio.RML.ViewModels } } - + private double _LabMinVal; + + public double LabMinVal + { + get { return _LabMinVal; } + set { _LabMinVal = value; RaisePropertyChangedAuto(); } + } + + private double _LabMaxVal; + + public double LabMaxVal + { + get { return _LabMaxVal; } + set { _LabMaxVal = value; RaisePropertyChangedAuto(); } + } + + public Plot LABLinearizationPlotControl { get; set; } public Plot LinearizationPlotControl { get; set; } private IList _linearizationPoints; /// @@ -178,6 +194,31 @@ namespace Tango.MachineStudio.RML.ViewModels } } + private IList _LPoints; + + public IList LPoints + { + get { return _LPoints; } + set { _LPoints = value; } + } + + private IList _APoints; + + public IList APoints + { + get { return _APoints; } + set { _APoints = value; } + } + + private IList _BPoints; + + public IList BPoints + { + get { return _BPoints; } + set { _BPoints = value; } + } + + #endregion public ColorCalibrationViewVM(INotificationProvider notification) @@ -199,6 +240,9 @@ namespace Tango.MachineStudio.RML.ViewModels this.Points = new List(); TargetPoints = new List(); LinearizationPoints = new List(); + LPoints = new List(); + APoints = new List(); + BPoints = new List(); } public void Loading() @@ -254,7 +298,7 @@ namespace Tango.MachineStudio.RML.ViewModels List items;//List items ColorLinearizationModel model = new ColorLinearizationModel(); model.GetDataFromFile(dlg.FileName, out items); - if (items.Count == 0) + if (items == null || items.Count == 0) return; Measurements.Clear(); items.ForEach(x => Measurements.Add(new CalibrationMeasurementModel(x))); @@ -345,7 +389,7 @@ namespace Tango.MachineStudio.RML.ViewModels List items; model.GetDataFromFile(fileName, out items); - if (items.Count == 0) + if (items == null || items.Count == 0) return; List outputPoints = new List(); @@ -355,6 +399,20 @@ namespace Tango.MachineStudio.RML.ViewModels }); LinearizationPoints.Clear(); + LPoints.Clear(); + APoints.Clear(); + BPoints.Clear(); + LabMinVal = LabMaxVal = 0; + + LabMinVal = items.Min(x => Math.Min(x.L, Math.Min(x.A, x.B))); + LabMaxVal = items.Max(x => Math.Max(x.L, Math.Max(x.A, x.B))); + foreach (var labItem in items) + { + LPoints.Add(new DataPoint(labItem.InkPercentage, labItem.L)); + APoints.Add(new DataPoint(labItem.InkPercentage, labItem.A)); + BPoints.Add(new DataPoint(labItem.InkPercentage, labItem.B)); + } + LABLinearizationPlotControl.InvalidatePlot(true); if (outputPoints == null || outputPoints.Count != items.Count) return; -- cgit v1.3.1