diff options
| author | Roy <Roy.mail.net@gmail.com> | 2023-01-02 14:20:24 +0200 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-01-02 14:20:24 +0200 |
| commit | 1ceac8f89fa391dabc74fc0e2a1fd747abd0ac97 (patch) | |
| tree | 81b24f5411a245b42d5fab8d06e7828f10f1d03a /Software/Visual_Studio/PPC | |
| parent | e89f04cbdda4e34baef11d43c9f812773911a33c (diff) | |
| parent | e1e20160c6976c7aeab89a8e92bb1220e12c7d58 (diff) | |
| download | Tango-1ceac8f89fa391dabc74fc0e2a1fd747abd0ac97.tar.gz Tango-1ceac8f89fa391dabc74fc0e2a1fd747abd0ac97.zip | |
Merge branch 'software' of https://twinetfs.visualstudio.com/Tango/_git/Tango into software
Diffstat (limited to 'Software/Visual_Studio/PPC')
10 files changed, 315 insertions, 70 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/HueValueToTextConvereter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/HueValueToTextConvereter.cs new file mode 100644 index 000000000..b7462cb30 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/HueValueToTextConvereter.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Globalization; +using System.Windows.Data; + +namespace Tango.PPC.Jobs.Converters +{ + public class HueValueToTextConvereter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (parameter == null || value == null) + return ""; + + string type = parameter as string; + double number; + if (double.TryParse(value.ToString(), out number)) + { + if (type == "Min") + { + if ((number >= 0 && number < 90)) + return "Redder"; + if ((number >= 90 && number < 180)) + return "Yellower"; + if ((number >= 180 && number < 270)) + return "Greener"; + if ((number >= 270 && number <= 360)) + return "Bluer"; + } + else if (type == "Max") + { + if ((number >= 0 && number < 90)) + return "Yellower"; + if ((number >= 90 && number < 180)) + return "Greener"; + if ((number >= 180 && number < 270)) + return "Bluer"; + if ((number >= 270 && number <= 360)) + return "Redder"; + } + } + + return ""; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/RoundDoubleConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/RoundDoubleConverter.cs new file mode 100644 index 000000000..15a10a249 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Converters/RoundDoubleConverter.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.PPC.Jobs.Converters +{ + public class RoundDoubleConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + double result = 0; + if (value != null && (double.TryParse(value.ToString(), out result))) + return Math.Round(result, 2); + else + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return value; + } + } +} 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 745455ca3..be3e0adc0 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 @@ -149,9 +149,20 @@ </Grid> <Canvas Grid.Column="1" Width="28" Height="28" VerticalAlignment="Top" HorizontalAlignment="Left"> - <touch:TouchToggleButton Canvas.Left="0" Canvas.Top="0" x:Name="addColorToGroup" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Command="{Binding SaveMyColorsCommand}" - IsEnabled="{Binding SelectedBrushStop.IsLiquidVolumesOutOfRange, Converter={StaticResource BooleanInverseConverter}}" Style="{StaticResource TangoTouchToggleButtonNoDisable}"> - + <touch:TouchToggleButton Canvas.Left="0" Canvas.Top="0" x:Name="addColorToGroup" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Command="{Binding SaveMyColorsCommand}" > + <touch:TouchToggleButton.Style> + <Style TargetType="touch:TouchToggleButton" BasedOn="{StaticResource TangoTouchToggleButtonNoDisable}"> + <Setter Property="IsEnabled" Value="True"/> + <Style.Triggers> + <DataTrigger Binding="{Binding SelectedBrushStop.IsLiquidVolumesOutOfRange}" Value="True"> + <Setter Property="IsEnabled" Value="False"/> + </DataTrigger> + <DataTrigger Binding="{Binding SelectedBrushStop.IsLiquidVolumeBelowMinLimit}" Value="True"> + <Setter Property="IsEnabled" Value="False"/> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchToggleButton.Style> <Border Height="26" Width="28" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" > <Image.Style> @@ -162,7 +173,10 @@ <Setter Property="Source" Value="../Images/ColorSelection/fillheart.png"/> </DataTrigger> <DataTrigger Binding="{Binding SelectedBrushStop.IsLiquidVolumesOutOfRange}" Value="True"> - <Setter Property="Source" Value="../Images/ColorSelection/Heart.png"/> + <Setter Property="Source" Value="../Images/ColorSelection/Heart_disable.png"/> + </DataTrigger> + <DataTrigger Binding="{Binding SelectedBrushStop.IsLiquidVolumeBelowMinLimit}" Value="True"> + <Setter Property="Source" Value="../Images/ColorSelection/Heart_disable.png"/> </DataTrigger> </Style.Triggers> </Style> @@ -427,8 +441,17 @@ <RowDefinition Height="1*" /> </Grid.RowDefinitions> - <touch:TouchImageButton Grid.Row="0" Margin="0 2 45 0" HorizontalAlignment="Right" Width="70" EnableDropShadow="False" Background="Transparent" BorderThickness="0" - Command="{ Binding VectorFineTuningCommand}" Image="{StaticResource VFineTuning_Dialog}"/> + <touch:TouchImageButton Grid.Row="0" Margin="0 2 45 0" HorizontalAlignment="Right" Width="Auto" Height="70" EnableDropShadow="False" Background="Transparent" BorderThickness="0" + Command="{ Binding VectorFineTuningCommand}" > + <touch:TouchImageButton.Template> + <ControlTemplate TargetType="touch:TouchImageButton"> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="Fine-Tuning" Foreground="{StaticResource TangoDarkForegroundBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="Regular" Margin="0 18 5 0"/> + <Image Source="{StaticResource VFineTuning_Dialog}"/> + </StackPanel> + </ControlTemplate> + </touch:TouchImageButton.Template> + </touch:TouchImageButton> <ContentControl Name="myLabColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}" IsTabStop="False"/> 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 5365cb198..889ceeeac 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 @@ -738,7 +738,7 @@ namespace Tango.PPC.Jobs.Dialogs protected override bool CanOK() { - return SelectedBrushStop != null && !SelectedBrushStop.IsLiquidVolumesOutOfRange; + return SelectedBrushStop != null && !SelectedBrushStop.IsLiquidVolumesOutOfRange && !SelectedBrushStop.IsLiquidVolumeBelowMinLimit; } #endregion @@ -1043,7 +1043,7 @@ namespace Tango.PPC.Jobs.Dialogs { SelectedBrushStop.SaveLABBeforeChanges(); - VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B, SelectedBrushStop.Color); + VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); IsOpenVectorFineTuningDialog = true; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs index bf3905104..0f4496904 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs @@ -8,7 +8,9 @@ using Tango.BL; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core.Commands; +using Tango.Core.DI; using Tango.PPC.Common; +using Tango.PPC.Common.Connection; using Tango.PPC.Common.Lubrication; using Tango.Settings; using Tango.SharedUI; @@ -30,6 +32,12 @@ namespace Tango.PPC.Jobs.Dialogs public String FinalName { get; set; } } + /// <summary> + /// Gets or sets the machine provider. + /// </summary> + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + private String _jobName; public String JobName 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 eefb85c57..89f6bf2d7 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 @@ -26,7 +26,9 @@ <sharedConverters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter"/> <converters:DoubleNullConverter x:Key="DoubleNullConverter" /> <converters:DeltaLCHToTextConverter x:Key="DeltaLCHToTextConverter"/> + <converters:HueValueToTextConvereter x:Key="HueValueToTextConvereter"/> <converters:ColorContrastConverter x:Key="ColorContrastConverter" /> + <converters:RoundDoubleConverter x:Key="RoundDoubleConverter"/> <BitmapImage x:Key="Close_mycolorsdlg" UriSource="../Images/ColorSelection/close_mycolorsdlg.png" /> <Style x:Key="GreyTextStyle" TargetType="TextBlock"> @@ -284,7 +286,7 @@ </StackPanel> <StackPanel Orientation="Vertical" Grid.Column="1"> - <TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}">Target Vs Results:</TextBlock> + <TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}">Result Vs. Target:</TextBlock> <UniformGrid Grid.Column="1" Columns="4" Rows="1" Height="Auto" VerticalAlignment="Top" Width="Auto" Margin="0 20 0 0"> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal"> @@ -377,7 +379,7 @@ </UniformGrid> </StackPanel> <StackPanel Orientation="Vertical" Grid.Column="1"> - <TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}" >Target Vs Results:</TextBlock> + <TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}" >Result Vs. Target:</TextBlock> <UniformGrid Grid.Column="1" Columns="4" Rows="1" Height="Auto" VerticalAlignment="Top" Width="Auto" Margin="0 20 0 0"> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal"> @@ -449,13 +451,17 @@ <ColumnDefinition Width="1*"/> <ColumnDefinition Width="55"/> </Grid.ColumnDefinitions> - <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MinLightness.ColorBrush}" CornerRadius="8" Margin="0 25 0 0" Height="55" /> + <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MinLightness.ColorBrush}" CornerRadius="8" Margin="0 25 0 0" Height="55" > + <TextBlock Text="Darker" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0 0 0 5" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{Binding VisualCorrectionModel.MinLightness.ColorBrush, Converter={StaticResource ColorContrastConverter}}"></TextBlock> + </Border> <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top"> - <TextBlock Text="Lightness:" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 0 0 5" FontSize="{StaticResource TangoSmallFontSize}"></TextBlock> - <touch:TouchNumericUpDownConrol Margin="10 16 10 0" Height="35" NumericPartWidth="50" HorizontalAlignment="Center" BorderThickness="2" MaxValue="6" MinValue="-6" Style="{StaticResource TouchNumericBorderUpDownControl}" Step="0.5" Value="{Binding LightnessOffset, Mode=TwoWay}" VerticalAlignment="Center" /> + <TextBlock Text="Lightness:" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 10 0 0" FontSize="{StaticResource TangoDefaultFontSize}"></TextBlock> + <touch:TouchNumericUpDownConrol Margin="10 5 10 0" Height="35" NumericPartWidth="50" HorizontalAlignment="Center" BorderThickness="2" MaxValue="6" MinValue="-6" Style="{StaticResource TouchNumericBorderUpDownControl}" Step="0.5" Value="{Binding LightnessOffset, Mode=TwoWay}" VerticalAlignment="Center" /> </StackPanel> - <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MaxLightness.ColorBrush}" CornerRadius="8" Grid.Column="2" Height="55" Margin="0 25 0 0" /> + <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MaxLightness.ColorBrush}" CornerRadius="8" Grid.Column="2" Height="55" Margin="0 25 0 0" > + <TextBlock Text="Lighter" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0 0 0 5" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{Binding VisualCorrectionModel.MaxLightness.ColorBrush, Converter={StaticResource ColorContrastConverter}}"></TextBlock> + </Border> </Grid> <Grid Height="Auto" Margin="0 0 0 0"> @@ -464,42 +470,50 @@ <ColumnDefinition Width="1*"/> <ColumnDefinition Width="55"/> </Grid.ColumnDefinitions> - <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MinChroma.ColorBrush}" CornerRadius="8" Margin="0 25 0 0" Height="55"/> - + <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MinChroma.ColorBrush}" CornerRadius="8" Margin="0 25 0 0" Height="55"> + <TextBlock Text="Duller" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0 0 0 5" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{Binding VisualCorrectionModel.MinChroma.ColorBrush, Converter={StaticResource ColorContrastConverter}}"></TextBlock> + </Border> <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top"> - <TextBlock Text="Chroma:" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 0 0 5" FontSize="{StaticResource TangoSmallFontSize}"></TextBlock> - <touch:TouchNumericUpDownConrol Margin="10 16 10 0" Padding="0" Height="35" NumericPartWidth="50" HorizontalAlignment="Center" BorderThickness="2" MaxValue="6" MinValue="-6" Style="{StaticResource TouchNumericBorderUpDownControl}" Step="0.5" Value="{Binding ChromaOffset, Mode=TwoWay}" VerticalAlignment="Center"/> + <TextBlock Text="Chroma:" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 10 0 0" FontSize="{StaticResource TangoDefaultFontSize}" ></TextBlock> + <touch:TouchNumericUpDownConrol Margin="10 5 10 0" Padding="0" Height="35" NumericPartWidth="50" HorizontalAlignment="Center" BorderThickness="2" MaxValue="6" MinValue="-6" Style="{StaticResource TouchNumericBorderUpDownControl}" Step="0.5" Value="{Binding ChromaOffset, Mode=TwoWay}" VerticalAlignment="Center"/> </StackPanel> - <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MaxChroma.ColorBrush}" CornerRadius="8" Grid.Column="2" Height="55" Margin="0 25 0 0" /> - </Grid> + <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MaxChroma.ColorBrush}" CornerRadius="8" Grid.Column="2" Height="55" Margin="0 25 0 0" > + <TextBlock Text="Brighter" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0 0 0 5" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{Binding VisualCorrectionModel.MaxChroma.ColorBrush, Converter={StaticResource ColorContrastConverter}}"></TextBlock> + </Border> + </Grid> <Grid Height="Auto" Margin="0 0 0 0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="55"/> <ColumnDefinition Width="1*"/> <ColumnDefinition Width="55"/> </Grid.ColumnDefinitions> - <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MinHue.ColorBrush}" CornerRadius="8" Margin="0 25 0 0" Height="55" /> - <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top"> - <TextBlock Text="Hue:" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 0 0 0" FontSize="{StaticResource TangoSmallFontSize}"></TextBlock> - <touch:TouchNumericUpDownConrol Margin="10 20 10 0" Height="35" NumericPartWidth="50" HorizontalAlignment="Center" BorderThickness="2" MaxValue="6" MinValue="-6" Style="{StaticResource TouchNumericBorderUpDownControl}" Step="0.5" Value="{Binding HueOffset, Mode=TwoWay}" VerticalAlignment="Center"/> + <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MinHue.ColorBrush}" CornerRadius="8" Margin="0 25 0 0" Height="55" > + <TextBlock Text="{Binding VisualCorrectionModel.MinHue.H, Converter={StaticResource HueValueToTextConvereter}, ConverterParameter=Min}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0 0 0 5" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{Binding VisualCorrectionModel.MinHue.ColorBrush, Converter={StaticResource ColorContrastConverter}}"></TextBlock> + </Border> + <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top"> + <TextBlock Text="Hue:" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 10 0 0" FontSize="{StaticResource TangoDefaultFontSize}"></TextBlock> + <touch:TouchNumericUpDownConrol Margin="10 5 10 0" Height="35" NumericPartWidth="50" HorizontalAlignment="Center" BorderThickness="2" MaxValue="6" MinValue="-6" Style="{StaticResource TouchNumericBorderUpDownControl}" Step="0.5" Value="{Binding HueOffset, Mode=TwoWay}" VerticalAlignment="Center"/> </StackPanel> - <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MaxHue.ColorBrush}" CornerRadius="8" Grid.Column="2" Height="55" Margin="0 25 0 0" /> - </Grid> + <Border BorderBrush="Transparent" Background="{Binding VisualCorrectionModel.MaxHue.ColorBrush}" CornerRadius="8" Grid.Column="2" Height="55" Margin="0 25 0 0" > + <TextBlock Text="{Binding VisualCorrectionModel.MaxHue.H, Converter={StaticResource HueValueToTextConvereter}, ConverterParameter=Max}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0 0 0 5" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{Binding VisualCorrectionModel.MaxHue.ColorBrush, Converter={StaticResource ColorContrastConverter}}"></TextBlock> + </Border> + </Grid> </StackPanel> <Grid Height="Auto" Margin="40 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Stretch"> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="1.8*"/> - </Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="20"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> <TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}" FontWeight="SemiBold" Grid.ColumnSpan="2" VerticalAlignment="Center">Adjustment Preview:</TextBlock> - <StackPanel Orientation="Vertical" Grid.ColumnSpan="2" Grid.Row="1" Margin="0 10 0 0"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" >Previous</TextBlock> - <Border Grid.Row="1" Height="220" Margin="0 10 0 0" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="1" Background="{Binding VisualCorrectionModel.SourceColorBrush}" CornerRadius="12" > + <StackPanel Orientation="Vertical" Grid.ColumnSpan="3" Grid.Row="1" Margin="0 10 0 0"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" >Result</TextBlock> + <Border Grid.Row="1" Height="220" Margin="0 10 0 0" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0" Background="{Binding VisualCorrectionModel.SourceColorBrush}" CornerRadius="12" > <UniformGrid Rows="3" Columns="1" VerticalAlignment="Bottom" Background="Transparent"> <TextBlock FontWeight="Medium" Margin="10 10 0 0" VerticalAlignment="Center" Foreground="{Binding VisualCorrectionModel.ManualColorBrush, Converter={StaticResource ColorContrastConverter}}" FontSize="{StaticResource TangoSmallFontSize}"> <Run Text="L:" ></Run> @@ -516,27 +530,31 @@ </UniformGrid> </Border> </StackPanel> - <StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="1" Margin="0 10 0 0"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" HorizontalAlignment="Center" >New</TextBlock> + <StackPanel Orientation="Vertical" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" Margin="0 10 0 0"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" HorizontalAlignment="Left" >Correction</TextBlock> - <Border Grid.Row="1" Height="220" Margin="0 10 0 0" CornerRadius="12" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}" Background="{Binding VisualCorrectionModel.ManualColorBrush}" > + <Border Grid.Row="1" Height="220" Margin="0 10 0 0" CornerRadius="12" BorderThickness="0" BorderBrush="{StaticResource TangoGrayBrush}" Background="{Binding VisualCorrectionModel.ManualColorBrush}" > <UniformGrid Rows="3" Columns="1" VerticalAlignment="Bottom" Background="Transparent"> <TextBlock FontWeight="Medium" Margin="10 10 0 0" VerticalAlignment="Center" Foreground="{Binding VisualCorrectionModel.ManualColorBrush, Converter={StaticResource ColorContrastConverter}}" FontSize="{StaticResource TangoSmallFontSize}"> <Run Text="L:" ></Run> - <Run Text="{Binding VisualCorrectionModel.L, StringFormat=0.##}"></Run> + <Run Text="{Binding VisualCorrectionModel.L, StringFormat={}{0:F2}}"></Run> </TextBlock> - <TextBlock FontWeight="Medium" Margin="10 5 0 0" VerticalAlignment="Center" Foreground="{Binding VisualCorrectionModel.ManualColorBrush, Converter={StaticResource ColorContrastConverter}}" FontSize="{StaticResource TangoSmallFontSize}"> + <TextBlock FontWeight="Medium" Margin="10 5 0 0" VerticalAlignment="Center" Foreground="{Binding VisualCorrectionModel.ManualColorBrush, Converter={StaticResource ColorContrastConverter}}" FontSize="{StaticResource TangoSmallFontSize}" > <Run Text="a:" ></Run> - <Run Text="{Binding VisualCorrectionModel.A, StringFormat=0.##}" ></Run> - </TextBlock> + <Run Text="{Binding VisualCorrectionModel.A, Converter={StaticResource RoundDoubleConverter}}" ></Run> + </TextBlock> <TextBlock FontWeight="Medium" Margin="10 5 0 10" VerticalAlignment="Center" Foreground="{Binding VisualCorrectionModel.ManualColorBrush, Converter={StaticResource ColorContrastConverter}}" FontSize="{StaticResource TangoSmallFontSize}"> <Run Text="b:"></Run> - <Run Text="{Binding VisualCorrectionModel.B, StringFormat=0.##}"></Run> + <Run Text="{Binding VisualCorrectionModel.B, StringFormat={}{0:F2}}"></Run> </TextBlock> </UniformGrid> </Border> </StackPanel> - </Grid> + <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="1" Margin="0 10 0 0"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" HorizontalAlignment="Left" >Target</TextBlock> + <Border Grid.Row ="1" Height="220" Margin="0 10 0 0" Background="{Binding ColorBrush}" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0" CornerRadius="12"></Border> + </StackPanel> + </Grid> </DockPanel> </Grid> </Grid> 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 c528bcc3f..7fa1f4e1b 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 @@ -41,6 +41,7 @@ using Tango.PPC.Storage; using Tango.PPC.Storage.Models; using Tango.Settings; using Tango.SharedUI; +using ColorMine.ColorSpaces; namespace Tango.PPC.Jobs.Dialogs { @@ -110,23 +111,26 @@ namespace Tango.PPC.Jobs.Dialogs } } - private System.Windows.Media.Color _targetcolor; + //private System.Windows.Media.Color _targetcolor; - public System.Windows.Media.Color TargetColor - { - get { return _targetcolor; } - set - { - _targetcolor = value; - RaisePropertyChanged(nameof(ColorBrush)); - } - } + //public System.Windows.Media.Color TargetColor + //{ + // get { return _targetcolor; } + // set + // { + // _targetcolor = value; + // RaisePropertyChanged(nameof(ColorBrush)); + // } + //} public SolidColorBrush ColorBrush { get { - return new SolidColorBrush(TargetColor); + Lab lab = new Lab(TargetL, TargetA, TargetB); + Rgb rgb = new Rgb(lab.ToRgb()); + return new SolidColorBrush() { Color = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B) }; + //return new SolidColorBrush(TargetColor); } } @@ -681,7 +685,7 @@ namespace Tango.PPC.Jobs.Dialogs TargetL = 100; TargetB = 0; TargetA = 0; - TargetColor = Colors.White; + //TargetColor = Colors.White; ClearTrialsCommand = new RelayCommand(ClearTrialsLog); ExportTrialsCommand = new RelayCommand(ExportTrialsLog); @@ -703,7 +707,7 @@ namespace Tango.PPC.Jobs.Dialogs /// <summary> /// Initializes at open the dialog. /// </summary> - public void Init(BrushStopModel brushstop, double l, double a, double b, System.Windows.Media.Color targetColor) + public void Init(BrushStopModel brushstop, double l, double a, double b)//, System.Windows.Media.Color targetColor) { SelectedTabIndex = 0; CorrectOnlyHue = false; @@ -731,7 +735,7 @@ namespace Tango.PPC.Jobs.Dialogs TargetB = b; TargetA = a; - TargetColor = targetColor; + //TargetColor = targetColor; BrushStopModel.ConvertColorToVolume(); BrushStopModel.ColorSpace = ColorSpaces.LAB; @@ -805,6 +809,7 @@ namespace Tango.PPC.Jobs.Dialogs RaisePropertyChanged(nameof(TrialsLogitems)); RaisePropertyChanged(nameof(IsDisableInputLAB)); RaisePropertyChanged(nameof(TrialNumber)); + RaisePropertyChanged(nameof(ColorBrush)); } public void InitManualCorrection() @@ -1182,7 +1187,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(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); DL = dL; DC = (Double?)dC; @@ -1587,13 +1593,18 @@ namespace Tango.PPC.Jobs.Dialogs //chroma calculation double samX_C = Math.Sqrt(a2 * a2 + b2 * b2); - dL = L1 - L2; - dC = samX_C - refX_C; + var dl = L1 - L2; + var dc = samX_C - refX_C; double da = a1 - a2; double db = b1 - b2; - dH = Math.Sqrt(Math.Max(da * da + db * db - dC * dC, 0.0)); + var dh = Math.Sqrt(Math.Max(da * da + db * db - dc * dc, 0.0)); + + double dECMC = Math.Sqrt(Math.Pow(dl / (2 * refX_SL), 2) + Math.Pow(dc / refX_SC, 2) + Math.Pow(dh / refX_SH, 2)); + + dL = (dl / (2 * refX_SL)); + dC = (dc / refX_SC); + dH = (dh / refX_SH); - double dECMC = Math.Sqrt(Math.Pow(dL / (2 * refX_SL), 2) + Math.Pow(dC / refX_SC, 2) + Math.Pow(dH / refX_SH, 2)); return dECMC; } 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 14c642cd1..dc4db9b8a 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 @@ -659,6 +659,59 @@ namespace Tango.PPC.Jobs.Models } } } + + [JsonIgnore] + public bool IsLiquidVolumeBelowMinLimit + { + get + { + if ( ColorSpace == ColorSpaces.Volume || ColorSpace == ColorSpaces.CMYK) + { + var minCyan = GetMinLimitLiquid(LiquidTypes.Cyan); + if(Cyan > 0 && Cyan < minCyan) + { + LiquidVolumeBelowMinLimit = true; + return LiquidVolumeBelowMinLimit; + } + var minMagenta = GetMinLimitLiquid(LiquidTypes.Magenta); + if (Magenta > 0 && Magenta < minMagenta) + { + LiquidVolumeBelowMinLimit = true; + return LiquidVolumeBelowMinLimit; + } + var minYellow = GetMinLimitLiquid(LiquidTypes.Yellow); + if (Yellow > 0 && Yellow < minYellow) + { + LiquidVolumeBelowMinLimit = true; + return LiquidVolumeBelowMinLimit; + } + var minBlack = GetMinLimitLiquid(LiquidTypes.Black); + if (Black > 0 && Black < minBlack) + { + LiquidVolumeBelowMinLimit = true; + return LiquidVolumeBelowMinLimit; + } + LiquidVolumeBelowMinLimit = false; + return false; + } + else return false; + } + } + + private bool _liquidVolumeBelowMinLimit; + [JsonIgnore] + public bool LiquidVolumeBelowMinLimit + { + get { return _liquidVolumeBelowMinLimit; } + set + { + if (_liquidVolumeBelowMinLimit != value) + { + _liquidVolumeBelowMinLimit = value; + LiquidVolumesOutOfRangeChanged?.Invoke(this, new EventArgs()); + } + } + } [JsonIgnore] public ColorSpaces LastChangedColorSpace { get; set; } @@ -1034,6 +1087,7 @@ namespace Tango.PPC.Jobs.Models ColorSpace = ColorSpaces.Volume; RequiredMaxLiquidTest = true; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); LastChangedColorSpace = ColorSpace; OnBrushStopFieldValueChanged(); @@ -1245,6 +1299,7 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(Blue)); RequiredMaxLiquidTest = false; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } } @@ -1326,6 +1381,7 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(B)); RequiredMaxLiquidTest = false; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } } @@ -1349,10 +1405,12 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(Magenta)); RaisePropertyChanged(nameof(Black)); IsOutOfGamut = false; - RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + // RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + // RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } ColorSpace = ColorSpaces.Volume; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); return; } ColorSpaces colorSpace = LastChangedColorSpace; @@ -1390,6 +1448,7 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(Magenta)); RaisePropertyChanged(nameof(Black)); RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } catch (Exception ex) { @@ -1404,6 +1463,7 @@ namespace Tango.PPC.Jobs.Models } ColorSpace = ColorSpaces.Volume; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } } @@ -1549,6 +1609,29 @@ namespace Tango.PPC.Jobs.Models } } + private double GetMinLimitLiquid( LiquidTypes type) + { + try + { + var tables = SegmentModel.Job.Rml.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); + + LiquidTypesRml liquidType = SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == type); + + if (tables.Count > 0 && liquidType != null && liquidType.MaxNlPerCm != 0) + { + return (0.5*tables[0].MinInkUptake)/ liquidType.MaxNlPerCm; + } + else + { + return 0; + } + } + catch + { + return 0; + } + } + public double GetColorNLPerCm(double color, LiquidTypes type) { StandardColorDispensingCalc calc = new StandardColorDispensingCalc(); @@ -1572,7 +1655,7 @@ namespace Tango.PPC.Jobs.Models if (ColorSpace == BL.Enumerations.ColorSpaces.Volume) { //RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); - if (IsLiquidVolumesOutOfRange) + if (IsLiquidVolumesOutOfRange || IsLiquidVolumeBelowMinLimit) { IsBusy = false; return; @@ -1630,7 +1713,18 @@ namespace Tango.PPC.Jobs.Models else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) { IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); - BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + if(IsOutOfGamut) + { + BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + } + else + { + BestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + } + if(IsOutOfGamut != output.OutOfGamut) + { + + } } //else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.HSB) //{ 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 82fe75828..8813e6a20 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 @@ -30,8 +30,17 @@ namespace Tango.PPC.Jobs.Models public double L { get; set; } public double C { get; set; } - public double H { get; set; } + private double _h; + + public double H + { + get { return _h; } + set { _h = value; + RaisePropertyChangedAuto(); + } + } + public SolidColorBrush ColorBrush { get @@ -356,6 +365,7 @@ namespace Tango.PPC.Jobs.Models L = lch.L; A = lch.C * Math.Cos(lch.H * (Math.PI / 180)); B = lch.C * Math.Sin(lch.H * (Math.PI / 180)); + RaisePropertyChanged(nameof(SourceColorBrush)); RaisePropertyChanged(nameof(ManualColorBrush)); @@ -370,10 +380,6 @@ namespace Tango.PPC.Jobs.Models /// <returns></returns> public Lch Correction( double lightnessOffset, double chromaOffset, double hueOffset) { - //LightnessOffset = lightnessOffset; - //ChromaOffset = chromaOffset; - //HueOffset = hueOffset; - double L1 = SourceL; double C1 = SourceC; double H1 = SourceH; @@ -382,10 +388,11 @@ namespace Tango.PPC.Jobs.Models double refX_C = C1; ///lightness double SL = 0; - if (L1 <= 16) + if (L1 < 16) SL = 0.511; else SL = L1 * 0.040975 / (1 + 0.01765 * L1); + L1 += lightnessOffset * 2 * SL; if(L1 > 100) L1 = 100; @@ -393,7 +400,8 @@ namespace Tango.PPC.Jobs.Models L1 = 0; double SC = (0.638 + 0.0638 * refX_C / (1 + 0.0131 * refX_C)); - C1 += chromaOffset * SC; + + C1 = C1 + (chromaOffset * SC); // if (C1 > 128) // C1 = 128; if (C1 < 0) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj index 2c62b4208..6263cab77 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj @@ -222,6 +222,7 @@ <Compile Include="Converters\ColorTabToVisibilityConverter.cs" /> <Compile Include="Converters\DeltaLCHToTextConverter.cs" /> <Compile Include="Converters\DoubleNullConverter.cs" /> + <Compile Include="Converters\HueValueToTextConvereter.cs" /> <Compile Include="Converters\InterSegmentLengthToWidthConverter.cs" /> <Compile Include="Converters\JobsCategoryToOpacityConverter.cs" /> <Compile Include="Converters\JobProgressToPositionConverter.cs" /> @@ -230,6 +231,7 @@ <Compile Include="Converters\JobToPieImageConverter.cs" /> <Compile Include="Converters\JobTypeToImageConverter.cs" /> <Compile Include="Converters\MarginOffsetSliderConverter .cs" /> + <Compile Include="Converters\RoundDoubleConverter.cs" /> <Compile Include="Dialogs\AddSegmentWarningDialog.xaml.cs"> <DependentUpon>AddSegmentWarningDialog.xaml</DependentUpon> </Compile> @@ -733,7 +735,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file |
