From 4717b98b45c9e40e1329d3b49b91bfbd3feb50f6 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 5 Dec 2018 17:10:35 +0200 Subject: Optimized color conversion frequency on research module. --- .../ViewModels/MainViewVM.cs | 17 +- .../Views/JobView.xaml | 383 +++++++++++---------- .../Views/JobView.xaml.cs | 20 ++ 3 files changed, 227 insertions(+), 193 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index f15ffb2c7..b75a84a6c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -818,7 +818,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { try { - var stops = ActiveJob.Segments.SelectMany(x => x.BrushStops).ToList(); + var stops = ActiveJob.Segments.SelectMany(x => x.BrushStops).Where(x => !x.Corrected && !x.OutOfGamutChecked).ToList(); foreach (var stop in stops) { @@ -831,14 +831,17 @@ namespace Tango.MachineStudio.Developer.ViewModels stop.Red = output.SingleCoordinates.Red; stop.Green = output.SingleCoordinates.Green; stop.Blue = output.SingleCoordinates.Blue; + stop.Corrected = true; + stop.IsOutOfGamut = false; } catch { } } - else if (stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() && !stop.Corrected) + else if (stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() || stop.ColorSpace.Code == BL.Enumerations.ColorSpaces.LAB.ToInt32()) { try { stop.IsOutOfGamut = TangoColorConverter.IsOutOfGamut(stop); + stop.OutOfGamutChecked = true; } catch { } } @@ -908,6 +911,16 @@ namespace Tango.MachineStudio.Developer.ViewModels _hiveOpened = false; } + /// + /// Called when the brush stop field value has been changed (This called from the view!). + /// + /// The brush stop. + public void OnBrushStopFieldValueChanged(BrushStop brushStop) + { + brushStop.Corrected = false; + brushStop.OutOfGamutChecked = false; + } + #endregion #region Event Handlers diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 9151cbaa0..b9c27e4f9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -242,6 +242,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Liquid volumes exceeds the maximum range for color conversion! + + + + + + + Total: + % + ( + + nl + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - Liquid volumes exceeds the maximum range for color conversion! - - - - - - - Total: - % - ( - - nl - ) - - - - - - - - - - - - - - - - - - - - + - - - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs index d96f130ae..8c58690fd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs @@ -292,5 +292,25 @@ namespace Tango.MachineStudio.Developer.Views Keyboard.ClearFocus(); listBoxSegments.Focus(); } + + private void OnBrushStopFieldValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + BrushStop stop = null; + var dataContext = (sender as FrameworkElement).DataContext; + + if (dataContext != null) + { + if (dataContext is BrushStop) + { + stop = dataContext as BrushStop; + } + else + { + stop = (dataContext as LiquidVolume).BrushStop; + } + + _vm.OnBrushStopFieldValueChanged(stop); + } + } } } -- cgit v1.3.1