From f77447003be8d40dfb37f0cda6f52482209b2099 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 23 Jan 2023 12:57:10 +0200 Subject: VFT. Text for deltaH - Wrong direction of color change in H Related Work Items: #8050 --- .../Converters/DeltaLCHToTextConverter.cs | 2 +- .../Dialogs/VectorFineTuningDialog.xaml | 4 ++-- .../Dialogs/VectorFineTuningDialogVM.cs | 20 +++++++++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs index 7d22245ed..3b5a28570 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs @@ -35,7 +35,7 @@ namespace Tango.PPC.Jobs.Converters } if (type == "H") { - if((number >0 && number <45) || (number >= 315 && number <360)) + if((number >=0 && number <45) || (number >= 315 && number <=360)) return "Redder"; if ((number >= 45 && number < 135) ) return "Yellower"; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml index 89f6bf2d7..330fad695 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml @@ -333,7 +333,7 @@ - + @@ -426,7 +426,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs index 5d3ab5504..09d11b96c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -270,7 +270,7 @@ namespace Tango.PPC.Jobs.Dialogs } } } - + protected Double? _dL; /// @@ -291,6 +291,23 @@ namespace Tango.PPC.Jobs.Dialogs } } + /// + /// Gets the measured h for show text in deltaH. + /// + public double? MeasuredH + { + get { + if(IsValidLAB()) + { + var converter = new ColourfulConverter { WhitePoint = Illuminants.D65 }; + LabColor labColor = new LabColor((double)MeasuredL, (double)MeasuredA, (double)MeasuredB); + var LCH_input = converter.ToLChab(labColor); + return LCH_input.h; + } + return null; + } + } + protected Double? _dC; /// /// Gets or sets the delta C @@ -325,6 +342,7 @@ namespace Tango.PPC.Jobs.Dialogs if (ActiveLogModel != null) ActiveLogModel.dH = _dH == null ? 0 : (double)_dH; RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(MeasuredH)); } } } -- cgit v1.3.1 From 0d27322088e63c91192ef8773af463f49856c3d7 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 23 Jan 2023 14:38:55 +0200 Subject: VFT. Show Target column color preview in Manual FT only when Measurement LAB is changed. Related Work Items: #8051 --- .../Dialogs/VectorFineTuningDialog.xaml | 10 ++++----- .../Dialogs/VectorFineTuningDialogVM.cs | 26 +++++++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml index 330fad695..5e74fb74b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml @@ -511,7 +511,7 @@ Adjustment Preview: - + Result @@ -530,10 +530,10 @@ - + Correction - + @@ -550,9 +550,9 @@ - + Target - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs index 09d11b96c..7527bfbdd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -308,6 +308,21 @@ namespace Tango.PPC.Jobs.Dialogs } } + private bool _IsTargetVisible; + + public bool IsTargetVisible + { + get { return _IsTargetVisible; } + set { + if (_IsTargetVisible != value) + { + _IsTargetVisible = value; + RaisePropertyChangedAuto(); + } + } + } + + protected Double? _dC; /// /// Gets or sets the delta C @@ -719,6 +734,7 @@ namespace Tango.PPC.Jobs.Dialogs PressedCommand = new RelayCommand((x) => { }); ; IsExpanderOpened = true; + IsTargetVisible = false; TangoIOC.Default.Inject(this); @@ -1016,6 +1032,7 @@ namespace Tango.PPC.Jobs.Dialogs _measuredL = null; _measuredB = null; _measuredA = null; + IsTargetVisible = false; RaisePropertyChanged(nameof(MeasuredL)); RaisePropertyChanged(nameof(MeasuredA)); RaisePropertyChanged(nameof(MeasuredB)); @@ -1174,6 +1191,7 @@ namespace Tango.PPC.Jobs.Dialogs RaisePropertyChanged(nameof(MeasuredL)); RaisePropertyChanged(nameof(MeasuredA)); RaisePropertyChanged(nameof(MeasuredB)); + IsTargetVisible = false; if (ActiveLogModel != null) { VisualCorrectionModel.ClearAll(ActiveLogModel.SuggestionL, ActiveLogModel.SuggestionA, ActiveLogModel.SuggestionB); @@ -1224,11 +1242,13 @@ namespace Tango.PPC.Jobs.Dialogs OnLightnessOffsetChanged(); OnChromaOffsetChanged(); OnHueOffsetChanged(); + IsTargetVisible = true; // ValidationTests(); } else if(DeltaE != null) { DL = DC = DH = DeltaE = null; + IsTargetVisible = false; } TestCommand.RaiseCanExecuteChanged(); ByPassTestCommand.RaiseCanExecuteChanged(); @@ -1557,11 +1577,7 @@ namespace Tango.PPC.Jobs.Dialogs Magenta = BrushStopModel.Magenta; Yellow = BrushStopModel.Yellow; Black = BrushStopModel.Black; - //ActiveLogModel.TestC = BrushStopModel.Cyan; - //ActiveLogModel.TestM = BrushStopModel.Magenta; - //ActiveLogModel.TestY = BrushStopModel.Yellow; - //ActiveLogModel.TestK = BrushStopModel.Black; - // SaveTest(GetExcelDataItems(ActiveLogModel, false)); + if (ActiveLogModel != null && TrialsLogitems.Count <= 10) { var suggestionL = ActiveLogModel.NewSuggestionL; -- cgit v1.3.1 From 9c14a83c49a6dc6c449c98f3d5754dd45313c68c Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 25 Jan 2023 11:43:21 +0200 Subject: PPC. My colors. Set max width test 12 pic ( was 6). Related Work Items: #8055 --- .../Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index 6c4803bd2..01f88930f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -303,22 +303,22 @@ - + - - + + - - + + - - + + -- cgit v1.3.1 From ff8c853951d903d33fd2f3290fd82fda018edd3c Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Sun, 29 Jan 2023 10:39:32 +0200 Subject: Fine Tuning in CMYK and Catalog Related Work Items: #8000, #8058 --- .../Converters/DeltaLCHToTextConverter.cs | 2 +- .../Dialogs/ColorSelectionView.xaml | 29 ++++- .../Dialogs/ColorSelectionViewVM.cs | 32 +++++- .../Dialogs/VectorFineTuningDialog.xaml | 26 ++++- .../Dialogs/VectorFineTuningDialog.xaml.cs | 16 +++ .../Dialogs/VectorFineTuningDialogVM.cs | 124 +++++++++++++++------ .../Modules/Tango.PPC.JobsV2/Models/TestColor.cs | 5 + 7 files changed, 191 insertions(+), 43 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs index 3b5a28570..63dc92bcf 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DeltaLCHToTextConverter.cs @@ -35,7 +35,7 @@ namespace Tango.PPC.Jobs.Converters } if (type == "H") { - if((number >=0 && number <45) || (number >= 315 && number <=360)) + if((number >0 && number <45) || (number >= 315 && number <=360)) return "Redder"; if ((number >= 45 && number < 135) ) return "Yellower"; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index 01f88930f..28958cbc8 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -317,8 +317,8 @@ - - + + @@ -471,7 +471,7 @@ - + @@ -530,6 +530,18 @@ + + + + + + + + + + + @@ -562,6 +574,17 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index f14da496b..698f80db8 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -1039,11 +1039,16 @@ namespace Tango.PPC.Jobs.Dialogs #region Vector Fine tuning - private void OpenVectorFineTuning() + private async void OpenVectorFineTuning() { + if (false == await NotifyAboutTrialsDataColorsSpace()) + { + return; + } + SelectedBrushStop.SaveLABBeforeChanges(); - VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); + VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.ColorSpace);//SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); IsOpenVectorFineTuningDialog = true; @@ -1113,6 +1118,29 @@ namespace Tango.PPC.Jobs.Dialogs return true; } + public async Task NotifyAboutTrialsDataColorsSpace() + { + var testColor = TrialsLogEngine.Default.GetByBrushStopGuid(SelectedBrushStop.Guid); + if (testColor != null && testColor.TrialslogList.Count > 0 && + ((testColor.OpenedFromCatalog && SelectedColorTab != ColorTab.Catalog) + || (testColor.OpenedFromCMYK && SelectedColorTab != ColorTab.Volume) + || (testColor.OpenedFromCatalog == false && testColor.OpenedFromCMYK == false && SelectedColorTab != ColorTab.CIELab))) + { + if (true == await NotificationProvider.ShowQuestion("The color correction is in progress, the trials data will be reset. Are you sure?")) + { + TrialsLogEngine.Default.Delete(testColor); + return true; + } + else + { + await NotificationProvider.ShowInfo("The color will not be changed."); + return false; + } + + } + return true; + } + #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml index 5e74fb74b..b967ddec2 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml @@ -81,13 +81,16 @@ - + + + + @@ -231,9 +234,19 @@ + FontSize="{StaticResource TangoNavigationLinksFontSize}" Grid.RowSpan="2" PreviewMouseDown="NavigationCSTLinks_PreviewMouseDown" PreviewTouchDown="NavigationCSTLinks_PreviewTouchDown" > - Automatic + + + + + Manual @@ -362,8 +376,8 @@ - Enter Measurement Result ( Optional): - + Enter Measurement Result (Optional): + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs index 01c4a2193..b0252be6f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs @@ -32,7 +32,23 @@ namespace Tango.PPC.Jobs.Dialogs private void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e) { + } + private void NavigationCSTLinks_PreviewMouseDown(object sender, MouseButtonEventArgs e) + { + if (_vm != null && _vm.IsOnlyManual) + { + e.Handled = true; + } + } + + private void NavigationCSTLinks_PreviewTouchDown(object sender, TouchEventArgs e) + { + if (_vm != null && _vm.IsOnlyManual) + { + e.Handled = true; + } } + } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs index 7527bfbdd..e473fa420 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -93,6 +93,7 @@ namespace Tango.PPC.Jobs.Dialogs public IPPCApplicationManager ApplicationManager { get; set; } public BrushStopModel BrushStopModel { get; set; } + public ColorSpaces OpenFromColorSpace { get; set; } private bool _isOutOfGamut; /// @@ -625,6 +626,20 @@ namespace Tango.PPC.Jobs.Dialogs } } + private bool _isOnlyManual; + /// + /// Gets or sets a value indicating whether this instance is only manual. Opened from CMYK tab. + /// + public bool IsOnlyManual + { + get { return _isOnlyManual; } + set { + _isOnlyManual = value; + RaisePropertyChangedAuto(); + } + } + + private int _selectedTabIndex; /// /// Gets or sets the index of the selected category. @@ -740,15 +755,15 @@ namespace Tango.PPC.Jobs.Dialogs _CorrectOnlyHue = true; IsManualFineTuning = false; + IsOnlyManual = false; VisualCorrectionModel = new VisualOffsetModel(); } /// /// Initializes at open the dialog. /// - public void Init(BrushStopModel brushstop, double l, double a, double b)//, System.Windows.Media.Color targetColor) + public void Init(BrushStopModel brushstop, ColorSpaces colorspace)// double l, double a, double b)//, System.Windows.Media.Color targetColor) { - SelectedTabIndex = 0; CorrectOnlyHue = false; LightnessOffset = 0.0; @@ -759,8 +774,7 @@ namespace Tango.PPC.Jobs.Dialogs DL = null; DH = null; DeltaE = null; - - _sessionID = brushstop.Guid + $"{l}{a}{b}"; + MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; @@ -770,14 +784,45 @@ namespace Tango.PPC.Jobs.Dialogs BrushStopModel = brushstop.Clone(); BrushStopModel.Guid = brushstop.Guid; IsOutOfGamut = brushstop.IsOutOfGamut; - TargetL = l; - TargetB = b; - TargetA = a; + OpenFromColorSpace = colorspace; + if (OpenFromColorSpace == ColorSpaces.Catalog && brushstop.ColorCatalogsItem != null) + { - //TargetColor = targetColor; + TargetL = BrushStopModel.ColorCatalogsItem.L; + TargetA = BrushStopModel.ColorCatalogsItem.A; + TargetB = BrushStopModel.ColorCatalogsItem.B; + BrushStopModel.PreventPropertyUpdate = true; + BrushStopModel.Cyan = brushstop.ColorCatalogsItem.Cyan; + BrushStopModel.Magenta = brushstop.ColorCatalogsItem.Magenta; + BrushStopModel.Yellow = brushstop.ColorCatalogsItem.Yellow; + BrushStopModel.Black = brushstop.ColorCatalogsItem.Black; + BrushStopModel.PreventPropertyUpdate = false; + IsOnlyManual = false; + } + else if(OpenFromColorSpace == ColorSpaces.Volume) + { + BrushStopModel.PreventPropertyUpdate = true; + BrushStopModel.L = 0; + BrushStopModel.A = 0; + BrushStopModel.B = 0; + BrushStopModel.PreventPropertyUpdate = false; + BrushStopModel.ConvertColorToLAB(); + TargetL = BrushStopModel.L; + TargetB = BrushStopModel.B; + TargetA = BrushStopModel.A; + IsOnlyManual = true; + } + else + { + TargetL = brushstop.L; + TargetB = brushstop.B; + TargetA = brushstop.A; + BrushStopModel.ConvertColorToVolume(); + BrushStopModel.ColorSpace = ColorSpaces.LAB; + IsOnlyManual = false; + } - BrushStopModel.ConvertColorToVolume(); - BrushStopModel.ColorSpace = ColorSpaces.LAB; + _sessionID = BrushStopModel.Guid + $"{TargetL}{TargetA}{TargetB}"; Cyan = BrushStopModel.Cyan; Magenta = BrushStopModel.Magenta; @@ -849,6 +894,10 @@ namespace Tango.PPC.Jobs.Dialogs RaisePropertyChanged(nameof(IsDisableInputLAB)); RaisePropertyChanged(nameof(TrialNumber)); RaisePropertyChanged(nameof(ColorBrush)); + if(IsOnlyManual) + SelectedTabIndex = 1; + else + SelectedTabIndex = 0; } public void InitManualCorrection() @@ -1131,6 +1180,8 @@ namespace Tango.PPC.Jobs.Dialogs TestColor.L = TargetL; TestColor.A = TargetA; TestColor.B = TargetB; + TestColor.OpenedFromCatalog = OpenFromColorSpace == ColorSpaces.Catalog; + TestColor.OpenedFromCMYK = OpenFromColorSpace == ColorSpaces.Volume; TestColor.BrushStopGuid = BrushStopModel.Guid; TestColor.TrialslogList.Clear(); TestColor.TrialslogList.AddRange(TrialsLogitems); @@ -1151,6 +1202,8 @@ namespace Tango.PPC.Jobs.Dialogs TestColor.L = TargetL; TestColor.A = TargetA; TestColor.B = TargetB; + TestColor.OpenedFromCatalog = OpenFromColorSpace == ColorSpaces.Catalog; + TestColor.OpenedFromCMYK = OpenFromColorSpace == ColorSpaces.Volume; TestColor.TrialslogList.AddRange(TrialsLogitems); TrialsLogEngine.Default.AddTest(TestColor); //if (ActiveLogModel != null && !ActiveLogModel.IsTested @@ -1182,7 +1235,8 @@ namespace Tango.PPC.Jobs.Dialogs public void ClearFoNextTrial() { - SelectedTabIndex = 0; + if(IsOnlyManual) + SelectedTabIndex = 1; CorrectOnlyHue = false; _measuredL = null; @@ -1231,7 +1285,8 @@ namespace Tango.PPC.Jobs.Dialogs double dL, dC, dH; //DeltaE = DeltaE_CMC(TargetL, TargetA, TargetB, (double)MeasuredL, (double)MeasuredA, (double)MeasuredB, out dL, out dC, out dH); - DeltaE = DeltaE_CMC( (double)MeasuredL, (double)MeasuredA, (double)MeasuredB, TargetL, TargetA, TargetB, out dL, out dC, out dH); + //DeltaE = DeltaE_CMC( (double)MeasuredL, (double)MeasuredA, (double)MeasuredB, TargetL, TargetA, TargetB, out dL, out dC, out dH); + DeltaE = DeltaE_CMC( TargetL, TargetA, TargetB, (double)MeasuredL, (double)MeasuredA, (double)MeasuredB, out dL, out dC, out dH); DL = dL; DC = (Double?)dC; @@ -1313,12 +1368,16 @@ namespace Tango.PPC.Jobs.Dialogs BrushStopModel.PreventPropertyUpdate = false; //calculate CMYK - BrushStopModel.FineTuningConverter(ActiveLogModel.C, ActiveLogModel.M, ActiveLogModel.Y, ActiveLogModel.K); - if (BrushStopModel.IsOutOfGamut) + if (OpenFromColorSpace == ColorSpaces.LAB || ((MeasuredL != null && MeasuredA != null && MeasuredB != null) + || IsManualFineTuning && (LightnessOffset != 0.0 || ChromaOffset != 0.0 || HueOffset != 0.0))) { - ActiveLogModel.NewSuggestionL = BrushStopModel.L; - ActiveLogModel.NewSuggestionA = BrushStopModel.A; - ActiveLogModel.NewSuggestionB = BrushStopModel.B; + BrushStopModel.FineTuningConverter(ActiveLogModel.C, ActiveLogModel.M, ActiveLogModel.Y, ActiveLogModel.K); + if (BrushStopModel.IsOutOfGamut) + { + ActiveLogModel.NewSuggestionL = BrushStopModel.L; + ActiveLogModel.NewSuggestionA = BrushStopModel.A; + ActiveLogModel.NewSuggestionB = BrushStopModel.B; + } } BrushStopModel.ColorSpace = ColorSpaces.LAB; @@ -1347,17 +1406,20 @@ namespace Tango.PPC.Jobs.Dialogs BrushStopModel.A = ActiveLogModel.NewSuggestionA; BrushStopModel.B = ActiveLogModel.NewSuggestionB; BrushStopModel.PreventPropertyUpdate = false; - + //calculate CMYK - BrushStopModel.FineTuningConverter(ActiveLogModel.C, ActiveLogModel.M, ActiveLogModel.Y, ActiveLogModel.K); - if(BrushStopModel.IsOutOfGamut) + if ( OpenFromColorSpace == ColorSpaces.LAB || ((MeasuredL != null && MeasuredA != null && MeasuredB != null) + || IsManualFineTuning && (LightnessOffset != 0.0 || ChromaOffset != 0.0 || HueOffset != 0.0))) { - ActiveLogModel.NewSuggestionL = BrushStopModel.L; - ActiveLogModel.NewSuggestionA = BrushStopModel.A; - ActiveLogModel.NewSuggestionB = BrushStopModel.B; + BrushStopModel.FineTuningConverter(ActiveLogModel.C, ActiveLogModel.M, ActiveLogModel.Y, ActiveLogModel.K); + if (BrushStopModel.IsOutOfGamut) + { + ActiveLogModel.NewSuggestionL = BrushStopModel.L; + ActiveLogModel.NewSuggestionA = BrushStopModel.A; + ActiveLogModel.NewSuggestionB = BrushStopModel.B; + } + BrushStopModel.ColorSpace = ColorSpaces.LAB; } - - BrushStopModel.ColorSpace = ColorSpaces.LAB; var settings = SettingsManager.Default.GetOrCreate(); using (ObservablesContext db = ObservablesContext.CreateDefault()) @@ -1647,16 +1709,16 @@ namespace Tango.PPC.Jobs.Dialogs double dECMC = Math.Sqrt(Math.Pow(deltaL / (2 * SL), 2) + Math.Pow(deltaC / SC, 2) + Math.Pow(deltaH / SH, 2)); - dL = (deltaL / (2 * SL)); - dC = (deltaC / SC); + dL = (deltaL / (2 * SL)) *(-1); + dC = (deltaC / SC)*(-1); - LabColor labColor = new LabColor(L1, a1, b1); - LabColor trget_labColor = new LabColor(L2, a2, b2); + LabColor target_labColor = new LabColor(L1, a1, b1); + LabColor labColor = new LabColor(L2, a2, b2); var converter = new ColourfulConverter { WhitePoint = Illuminants.D65 }; var LCH_input = converter.ToLChab(labColor); - var LCH_target = converter.ToLChab(trget_labColor); + var LCH_target = converter.ToLChab(target_labColor); if(LCH_target.h > LCH_input.h) - dH = (deltaH / SH) * (-1); + dH = (deltaH / SH) * (-1); else dH = (deltaH / SH); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs index a83e0e595..d6ea11b81 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs @@ -21,9 +21,14 @@ namespace Tango.PPC.Jobs.Models public double A { get; set; } public double B { get; set; } + public bool OpenedFromCMYK { get; set; } + public bool OpenedFromCatalog { get; set; } + public TestColor() { TrialslogList = new List(); + OpenedFromCMYK = false; + OpenedFromCatalog = false; } } -- cgit v1.3.1 From 418e1643cd49755a59b3d15c91303a386d0a635c Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Mon, 30 Jan 2023 20:19:16 +0200 Subject: PPC. FineTuning. Save colors before change in Fine tuning. If user changes a color and not wanted to delete FT Tests - return to colors. --- .../Dialogs/ColorSelectionViewVM.cs | 28 ++++++++--- .../Tango.PPC.JobsV2/Models/BrushStopModel.cs | 56 ++++++++++++++++++---- 2 files changed, 67 insertions(+), 17 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index 698f80db8..7e5f73637 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -509,11 +509,14 @@ namespace Tango.PPC.Jobs.Dialogs SelectedBrushStop.Guid = InitialBrushStop.Guid; SelectedBrushStop.ColorSpace = InitialBrushStop.ColorSpace; if (SelectedBrushStop.ColorSpace == ColorSpaces.Volume) + { SelectedColorTab = ColorTab.Volume; + SelectedBrushStop.SaveColorBeforeChanges(); + } if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) { SelectedColorTab = ColorTab.CIELab; - SelectedBrushStop.SaveLABBeforeChanges(); + SelectedBrushStop.SaveColorBeforeChanges(); } else if (SelectedBrushStop.ColorSpace == ColorSpaces.Catalog) { @@ -531,6 +534,7 @@ namespace Tango.PPC.Jobs.Dialogs // SelectedColorTab = ColorTab.HSB; else if (SelectedBrushStop.ColorSpace == ColorSpaces.RGB) SelectedColorTab = ColorTab.RGB; + SelectedBrushStop.FineTuningChanged = false; } else { @@ -707,7 +711,7 @@ namespace Tango.PPC.Jobs.Dialogs { return; } - if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) + // if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) { var testColor = TrialsLogEngine.Default.GetByBrushStopGuid(SelectedBrushStop.Guid); if (testColor != null && testColor.TrialslogList.Count > 0) @@ -727,11 +731,18 @@ namespace Tango.PPC.Jobs.Dialogs return; var TestColor = TrialsLogEngine.Default.GetByBrushStopGuid(_selectedBrushStop.Guid); - if (TestColor != null && InitialBrushStop != null && (InitialBrushStop.ColorSpace != ColorSpaces.LAB || TestColor.L != InitialBrushStop.L || TestColor.A != InitialBrushStop.A || TestColor.B != InitialBrushStop.B )) + if (TestColor != null && InitialBrushStop != null && + ((InitialBrushStop.ColorSpace == ColorSpaces.LAB && (TestColor.OpenedFromCatalog != false || TestColor.OpenedFromCMYK != false)) + || (InitialBrushStop.ColorSpace == ColorSpaces.Volume && TestColor.OpenedFromCMYK != true) + || (InitialBrushStop.ColorSpace == ColorSpaces.Catalog && TestColor.OpenedFromCatalog != true))) { TrialsLogEngine.Default.Delete(TestColor); } - + if (DialogEditObject.IsEditingMode) + { + InitialBrushStop.FineTuningChanged = true; + } + _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; base.Cancel(); } @@ -1046,12 +1057,14 @@ namespace Tango.PPC.Jobs.Dialogs return; } - SelectedBrushStop.SaveLABBeforeChanges(); + SelectedBrushStop.SaveColorBeforeChanges(); VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.ColorSpace);//SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); IsOpenVectorFineTuningDialog = true; - + + VectorFineTuningDialogVM.Canceled -= VectorFineTuningDialogCanceled; + VectorFineTuningDialogVM.Accepted -= VectorFineTuningDialogAccepted; VectorFineTuningDialogVM.Accepted += VectorFineTuningDialogAccepted; VectorFineTuningDialogVM.Canceled += VectorFineTuningDialogCanceled; @@ -1063,6 +1076,7 @@ namespace Tango.PPC.Jobs.Dialogs VectorFineTuningDialogVM.Canceled -= VectorFineTuningDialogCanceled; VectorFineTuningDialogVM.Accepted -= VectorFineTuningDialogAccepted; IsOpenVectorFineTuningDialog = false; + SelectedBrushStop.FineTuningChanged = true; } private void VectorFineTuningDialogAccepted() @@ -1111,7 +1125,7 @@ namespace Tango.PPC.Jobs.Dialogs else { await NotificationProvider.ShowInfo("The color will not be changed."); - SelectedBrushStop.UndoLABChanges(); + SelectedBrushStop.UndoColorChanges(); } return false; } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index d65c4e9e1..d415dbb79 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -733,12 +733,23 @@ namespace Tango.PPC.Jobs.Models [JsonIgnore] public ColorSpaces LastChangedColorSpace { get; set; } + //Fine Tuning [JsonIgnore] public Double LBeforeChange { get; set; } [JsonIgnore] public Double ABeforeChange { get; set; } [JsonIgnore] public Double BBeforeChange { get; set; } + [JsonIgnore] + public Double CyanBeforeChange { get; set; } + [JsonIgnore] + public Double MagentaBeforeChange { get; set; } + [JsonIgnore] + public Double YellowBeforeChange { get; set; } + [JsonIgnore] + public Double BlackBeforeChange { get; set; } + + public bool FineTuningChanged { get; set; } #endregion @@ -1078,21 +1089,46 @@ namespace Tango.PPC.Jobs.Models return s; } - public void UndoLABChanges() + //Fine Tuning + public void UndoColorChanges() { - PreventPropertyUpdate = true; - L = LBeforeChange; - A = ABeforeChange; - PreventPropertyUpdate = false; - B = BBeforeChange; + if(ColorSpace == ColorSpaces.LAB) + { + PreventPropertyUpdate = true; + L = LBeforeChange; + A = ABeforeChange; + PreventPropertyUpdate = false; + B = BBeforeChange; + } + else if(ColorSpace == ColorSpaces.Volume) + { + PreventPropertyUpdate = true; + Cyan = CyanBeforeChange; + Magenta = MagentaBeforeChange; + Yellow = YellowBeforeChange; + PreventPropertyUpdate = false; + Black = BlackBeforeChange; + } } - public void SaveLABBeforeChanges() + //Fine Tuning + public void SaveColorBeforeChanges() { - LBeforeChange = L; - ABeforeChange = A; - BBeforeChange = B; + if (ColorSpace == ColorSpaces.LAB) + { + LBeforeChange = L; + ABeforeChange = A; + BBeforeChange = B; + } + else if (ColorSpace == ColorSpaces.Volume) + { + CyanBeforeChange = Cyan; + MagentaBeforeChange = Magenta; + YellowBeforeChange = Yellow; + BlackBeforeChange = Black; + } } + #endregion #region changes -- cgit v1.3.1