diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-12-11 15:40:56 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-12-11 15:40:56 +0200 |
| commit | d8aa923804abfa77bef60e4b1082f3cc8ba8347f (patch) | |
| tree | 73662701b27ea69d36924ca67bd10f6307901e11 /Software/Visual_Studio/PPC/Modules | |
| parent | d0a3f91acd04b65775afc615d426882d54dc4680 (diff) | |
| download | Tango-d8aa923804abfa77bef60e4b1082f3cc8ba8347f.tar.gz Tango-d8aa923804abfa77bef60e4b1082f3cc8ba8347f.zip | |
PPC. VFT. Set spool type from job. Clear values in VFT dialog after test.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
6 files changed, 74 insertions, 25 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DoubleNullConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DoubleNullConverter.cs index a71eda720..2ac51cb51 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DoubleNullConverter.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/DoubleNullConverter.cs @@ -11,12 +11,15 @@ namespace Tango.PPC.Jobs.Converters { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return value is null ? 0 : double.TryParse(value.ToString(), out var valueResult) ? valueResult : 0; + return value is null ? "-" : double.TryParse(value.ToString(), out var valueResult) ? valueResult.ToString("0.##") : ""; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { - throw new NotImplementedException(); + //throw new NotImplementedException(); + if(value is double) + return value; + return 0; } } } 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 85d0e0b86..7e5c49bfb 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 @@ -1037,6 +1037,7 @@ namespace Tango.PPC.Jobs.Dialogs #endregion #region Vector Fine tuning + private void OpenVectorFineTuning() { SelectedBrushStop.SaveLABBeforeChanges(); @@ -1073,6 +1074,10 @@ namespace Tango.PPC.Jobs.Dialogs //if not tested _selectedBrushStop.PreventPropertyUpdate = false; _selectedBrushStop.ConvertColor(); + _selectedBrushStop.UpdateColorFromFineTuningDlg(); + + + } Accept(); 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 93d42b610..d5a83c814 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 @@ -259,18 +259,18 @@ <UniformGrid Rows="3" Columns="1" Height="200" VerticalAlignment="Top" Width="Auto" HorizontalAlignment="Center" Margin="0 10 40 0"> <StackPanel Orientation="Horizontal"> <TextBlock Text="L" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" VerticalAlignment="Center" /> - <touch:TouchNumericTextBox Margin="20 0 20 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" Maximum="100" Minimum="0" Value="{Binding MeasuredL, Delay=1000}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" BorderBrush="{StaticResource TangoDividerBrush}" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> + <touch:TouchNumericTextBox Margin="20 0 20 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" Maximum="100" Minimum="0" Value="{Binding MeasuredL, Delay=1000, TargetNullValue=0}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" BorderBrush="{StaticResource TangoDividerBrush}" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> </StackPanel> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <TextBlock Text="a" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" VerticalAlignment="Center"/> - <touch:TouchNumericTextBox Margin="20 0 20 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" Maximum="127" Minimum="-128" Value="{Binding MeasuredA, Delay=1000}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" VerticalAlignment="Top" BorderBrush="{StaticResource TangoDividerBrush}" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> + <touch:TouchNumericTextBox Margin="20 0 20 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" Maximum="127" Minimum="-128" Value="{Binding MeasuredA, Delay=1000, TargetNullValue=0}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" VerticalAlignment="Top" BorderBrush="{StaticResource TangoDividerBrush}" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="b" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" VerticalAlignment="Center"/> - <touch:TouchNumericTextBox Margin="20 0 20 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" Maximum="127" Minimum="-128" Value="{Binding MeasuredB, Delay=1000}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" BorderBrush="{StaticResource TangoDividerBrush}" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> + <touch:TouchNumericTextBox Margin="20 0 20 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" Maximum="127" Minimum="-128" Value="{Binding MeasuredB, Delay=1000, TargetNullValue=0}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" BorderBrush="{StaticResource TangoDividerBrush}" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> </StackPanel> </UniformGrid> - <touch:TouchCheckBox Margin="0 30 0 0" IsChecked="{Binding CorrectHue, Mode=TwoWay}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Normal" BorderBrush="{StaticResource TangoPrimaryAccentBrush}">Correct Only Hue</touch:TouchCheckBox> + <touch:TouchCheckBox Margin="0 30 0 0" IsChecked="{Binding CorrectOnlyHue, Mode=TwoWay}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Normal" BorderBrush="{StaticResource TangoPrimaryAccentBrush}">Correct Only Hue</touch:TouchCheckBox> </StackPanel> <StackPanel Orientation="Vertical" Grid.Column="1"> @@ -344,15 +344,15 @@ <UniformGrid Rows="1" Columns="3" Height="Auto" VerticalAlignment="Top" Width="Auto" HorizontalAlignment="Left" Margin="0 20 0 0"> <StackPanel Orientation="Vertical" VerticalAlignment="Center"> <TextBlock Text="L" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Bold" VerticalAlignment="Center" Margin="10 0 0 0"/> - <touch:TouchNumericTextBox Margin="0 10 5 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" BorderBrush="{StaticResource TangoDividerBrush}" Maximum="100" Minimum="0" Value="{Binding MeasuredL, Delay=1000}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> + <touch:TouchNumericTextBox Margin="0 10 5 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" BorderBrush="{StaticResource TangoDividerBrush}" Maximum="100" Minimum="0" Value="{Binding MeasuredL, Delay=1000, TargetNullValue=0}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> </StackPanel> <StackPanel Orientation="Vertical" VerticalAlignment="Center"> <TextBlock Text="a" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Bold" VerticalAlignment="Center" Margin="10 0 0 0"/> - <touch:TouchNumericTextBox Margin="0 10 5 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" BorderBrush="{StaticResource TangoDividerBrush}" Maximum="127" Minimum="-128" Value="{Binding MeasuredA, Delay=1000}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> + <touch:TouchNumericTextBox Margin="0 10 5 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" BorderBrush="{StaticResource TangoDividerBrush}" Maximum="127" Minimum="-128" Value="{Binding MeasuredA, Delay=1000, TargetNullValue=0}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> </StackPanel> <StackPanel Orientation="Vertical"> <TextBlock Text="b" FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="Bold" VerticalAlignment="Center" Margin="10 0 0 0"/> - <touch:TouchNumericTextBox Margin="0 10 5 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" BorderBrush="{StaticResource TangoDividerBrush}" Maximum="127" Minimum="-128" Value="{Binding MeasuredB, Delay=1000}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> + <touch:TouchNumericTextBox Margin="0 10 5 0" Width="80" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" BorderBrush="{StaticResource TangoDividerBrush}" Maximum="127" Minimum="-128" Value="{Binding MeasuredB, Delay=1000, TargetNullValue=0}" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Bold" HideUnderline="True" HasDecimalPoint="True" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/> </StackPanel> </UniformGrid> </StackPanel> 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 85505379e..0cd6381a1 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 @@ -1024,7 +1024,7 @@ namespace Tango.PPC.Jobs.Dialogs return; } } - SaveTest(GetExcelDataItems(SelectedLog, true)); + // SaveTest(GetExcelDataItems(SelectedLog, true)); BrushStopModel.PreventPropertyUpdate = true; BrushStopModel.Cyan = SelectedLog.C; @@ -1088,10 +1088,10 @@ namespace Tango.PPC.Jobs.Dialogs TestColor.TrialslogList.Clear(); TestColor.TrialslogList.AddRange(TrialsLogitems); TrialsLogEngine.Default.UpdateTest(TestColor); - if(ActiveLogModel != null && !ActiveLogModel.IsTested) - { - SaveTest(GetExcelDataItems(ActiveLogModel, false)); - } + //if(ActiveLogModel != null && !ActiveLogModel.IsTested) + //{ + // SaveTest(GetExcelDataItems(ActiveLogModel, false)); + //} } } else if(TrialsLogitems.Count > 0 @@ -1106,12 +1106,12 @@ namespace Tango.PPC.Jobs.Dialogs TestColor.B = TargetB; TestColor.TrialslogList.AddRange(TrialsLogitems); TrialsLogEngine.Default.AddTest(TestColor); - if (ActiveLogModel != null && !ActiveLogModel.IsTested - && (MeasuredL != null && MeasuredA != null && MeasuredB != null) - || (IsManualFineTuning && (LightnessOffset != 0 || HueOffset != 0 || ChromaOffset != 0))) - { - SaveTest(GetExcelDataItems(ActiveLogModel, false)); - } + //if (ActiveLogModel != null && !ActiveLogModel.IsTested + // && (MeasuredL != null && MeasuredA != null && MeasuredB != null) + //|| (IsManualFineTuning && (LightnessOffset != 0 || HueOffset != 0 || ChromaOffset != 0))) + //{ + // SaveTest(GetExcelDataItems(ActiveLogModel, false)); + //} } base.Cancel(); } @@ -1146,11 +1146,11 @@ namespace Tango.PPC.Jobs.Dialogs RaisePropertyChanged(nameof(MeasuredB)); if (ActiveLogModel != null) { - VisualCorrectionModel.UpdateSourceLAB(ActiveLogModel.SuggestionL, ActiveLogModel.SuggestionA, ActiveLogModel.SuggestionB); + VisualCorrectionModel.ClearAll(ActiveLogModel.SuggestionL, ActiveLogModel.SuggestionA, ActiveLogModel.SuggestionB); } else { - VisualCorrectionModel.UpdateSourceLAB(TargetL, TargetA, TargetB); + VisualCorrectionModel.ClearAll(TargetL, TargetA, TargetB); } LightnessOffset = 0.0; ChromaOffset = 0.0; @@ -1313,7 +1313,7 @@ namespace Tango.PPC.Jobs.Dialogs var trialNumber = ActiveLogModel.TrialNumber + 1; job.Name = BrushStopModel.SegmentModel.Job.Name; job.Rml = await new RmlBuilder(db).Set(BrushStopModel.SegmentModel.Job.Rml.Guid).WithActiveParametersGroup().WithCAT(MachineProvider.Machine.Guid).WithCCT().WithGbdAndLub().WithLiquidFactors().WithSpools().BuildAsync(); - job.SpoolType = db.SpoolTypes.FirstOrDefault(x => x.Guid == settings.SpoolTypeGuid); + job.SpoolType = db.SpoolTypes.FirstOrDefault(x => x.Guid == BrushStopModel.SegmentModel.Job.SpoolGuid);// db.SpoolTypes.FirstOrDefault(x => x.Guid == settings.SpoolTypeGuid); job.WindingMethod = db.WindingMethods.FirstOrDefault(); job.VectorFineTuningRunModel = CreateFineTuningRunModel(); @@ -1510,7 +1510,7 @@ namespace Tango.PPC.Jobs.Dialogs //ActiveLogModel.TestM = BrushStopModel.Magenta; //ActiveLogModel.TestY = BrushStopModel.Yellow; //ActiveLogModel.TestK = BrushStopModel.Black; - SaveTest(GetExcelDataItems(ActiveLogModel, false)); + // SaveTest(GetExcelDataItems(ActiveLogModel, false)); if (ActiveLogModel != null && TrialsLogitems.Count <= 10) { var suggestionL = ActiveLogModel.NewSuggestionL; 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 d9d8142af..9f251939c 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 @@ -1106,7 +1106,7 @@ namespace Tango.PPC.Jobs.Models //throw new NotImplementedException(); } - private Rgb GetRGBColor() + public Rgb GetRGBColor() { if (ColorSpace == ColorSpaces.LAB) { @@ -1498,6 +1498,14 @@ namespace Tango.PPC.Jobs.Models InitColorsFromBestmatch(); } + public void UpdateColorFromFineTuningDlg() + { + Rgb rgb = GetRGBColor(); + _red = (int)rgb.R; + _green = (int)rgb.G; + _blue = (int)rgb.B; + InitColor(); + } #endregion #region color converters diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs index 042350cb0..7a2ee2add 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs @@ -279,6 +279,27 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(ManualColorBrush)); } + public void ClearAll(double l, double a, double b) + { + LightnessOffset = 0; + ChromaOffset = 0; + HueOffset = 0; + LabColor labColor = new LabColor(l, a, b); + var converter = new ColourfulConverter { WhitePoint = Illuminants.D65 }; + var last_LCH = converter.ToLChab(labColor); + SourceL = l; + SourceA = a; + SourceB = b; + SourceC = last_LCH.C; + SourceH = last_LCH.h; + L = l; + A = a; + B = b; + C = last_LCH.C; + H = last_LCH.h; + } + + public void UpdateSourceLAB(double l, double a, double b) { LabColor labColor = new LabColor(l, a, b); @@ -291,6 +312,18 @@ namespace Tango.PPC.Jobs.Models SourceH = last_LCH.h; } + public void UpdateLAB(double l, double a, double b) + { + LabColor labColor = new LabColor(l, a, b); + var converter = new ColourfulConverter { WhitePoint = Illuminants.D65 }; + var last_LCH = converter.ToLChab(labColor); + L = l; + A = a; + B = b; + C = last_LCH.C; + H = last_LCH.h; + } + public void UpdateManualColors() { Lch lch = Correction(-6, 0, 0); |
