diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-01-27 20:31:11 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-01-27 20:31:11 +0200 |
| commit | 715be3c2639772c94a82cd7781450d3d2ec8b0ef (patch) | |
| tree | 7a38cdb6742a967bad1510d41e936ba20ff204d9 /Software/Visual_Studio/PPC | |
| parent | de03215322eb545bebdccba65b6f8f6b307b9f85 (diff) | |
| download | Tango-715be3c2639772c94a82cd7781450d3d2ec8b0ef.tar.gz Tango-715be3c2639772c94a82cd7781450d3d2ec8b0ef.zip | |
Fixes Vector fine tuning.
Diffstat (limited to 'Software/Visual_Studio/PPC')
3 files changed, 113 insertions, 99 deletions
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 5b750189f..576ec2850 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 @@ -46,7 +46,7 @@ namespace Tango.PPC.Jobs.Dialogs [Description("Catalog")] Catalog = 2 } - + public class DialogObject { @@ -284,7 +284,9 @@ namespace Tango.PPC.Jobs.Dialogs public ObservableCollection<ColorLibrary> Libraries { get { return _libraries; } - set { _libraries = value; + set + { + _libraries = value; RaisePropertyChangedAuto(); LoadLibraryDictionary(); } @@ -302,8 +304,9 @@ namespace Tango.PPC.Jobs.Dialogs public ColorLibrary SelectedColorLibraryMyColor { get { return _selectedColorLibraryMyColor; } - set { - if(_selectedColorLibraryMyColor != null) + set + { + if (_selectedColorLibraryMyColor != null) _selectedColorLibraryMyColor.IsSelected = false; _selectedColorLibraryMyColor = value; @@ -381,7 +384,8 @@ namespace Tango.PPC.Jobs.Dialogs public bool IsSelectedColorInLibrary { get { return _isSelectedColorInLibrary; } - set { + set + { _isSelectedColorInLibrary = value; RaisePropertyChangedAuto(); } @@ -402,8 +406,11 @@ namespace Tango.PPC.Jobs.Dialogs public bool IsOpenVectorFineTuningDialog { get { return _isOpenVectorFineTuningDialog; } - set { _isOpenVectorFineTuningDialog = value; - RaisePropertyChangedAuto();} + set + { + _isOpenVectorFineTuningDialog = value; + RaisePropertyChangedAuto(); + } } private VectorFineTuningDialogVM _vectorFineTuningDialogVM; @@ -434,8 +441,11 @@ namespace Tango.PPC.Jobs.Dialogs public String MyColorName { get { return _myColorName; } - set { _myColorName = value; - RaisePropertyChangedAuto();} + set + { + _myColorName = value; + RaisePropertyChangedAuto(); + } } private String _editColorButtonName; @@ -443,8 +453,11 @@ namespace Tango.PPC.Jobs.Dialogs public String EditColorButtonName { get { return _editColorButtonName; } - set { _editColorButtonName = value; - RaisePropertyChangedAuto();} + set + { + _editColorButtonName = value; + RaisePropertyChangedAuto(); + } } private PPCSettings _settings; @@ -500,7 +513,7 @@ namespace Tango.PPC.Jobs.Dialogs Libraries = MyColorsEngine.Default.GetAll().ToObservableCollection(); var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); InitColorTab(settings.DefaultTabColorSpace); - + _volumeConversionTimer = new ActionTimer(TimeSpan.FromMilliseconds(50)); _converter = new DefaultColorConverter(); CollectionFilter = new DefaultCollectionFilter(); @@ -516,7 +529,7 @@ namespace Tango.PPC.Jobs.Dialogs } else { - if(colorCatalogsItem.Name.ToLower().StartsWith(Filter.ToLower())) + if (colorCatalogsItem.Name.ToLower().StartsWith(Filter.ToLower())) { SelectedBrushStop.ColorCatalogsItem = colorCatalogsItem; } @@ -532,12 +545,12 @@ namespace Tango.PPC.Jobs.Dialogs OpenCloseAddMyColorDialogCommand = new RelayCommand(OpenCloseAddMyColorDialog); SaveMyColorsCommand = new RelayCommand(SaveMyColors); OpenMyColorsCommand = new RelayCommand(() => { MyColorsMode = true; }); - CloseMyColorsCommand = new RelayCommand(() => { MyColorsMode = false; SearchColorText = "";}); + CloseMyColorsCommand = new RelayCommand(() => { MyColorsMode = false; SearchColorText = ""; }); SelectColorCommand = new RelayCommand<FavoriteColor>(SelectColor); AddGroupCommand = new RelayCommand(AddGroup); AddNewGroupCommand = new RelayCommand<string>(AddNewGroup); AddNewGroupAndColorCommand = new RelayCommand<string>(AddNewGroupAndColor); - + SelectLibraryCommand = new RelayCommand<ColorLibrary>(SelectLibrary); DeleteGroupCommand = new RelayCommand<ColorLibrary>(DeleteGroup); EditColorsLibraryCommand = new RelayCommand<ColorLibrary>(EditColorsLibrary); @@ -560,36 +573,36 @@ namespace Tango.PPC.Jobs.Dialogs public override void OnShow() { Catalogs = DialogEditObject.Catalogs; - + Libraries.CollectionChanged -= Libraries_CollectionChanged; Libraries.CollectionChanged += Libraries_CollectionChanged; ColorLibrariesView = CollectionViewSource.GetDefaultView(Libraries); ColorLibrariesView.SortDescriptions.Add(new SortDescription(nameof(ColorLibrary.Name), ListSortDirection.Ascending)); - ColorLibrariesView.Filter = new Predicate<object> (item => - { - var ColorLibraryItem = item as ColorLibrary; + ColorLibrariesView.Filter = new Predicate<object>(item => + { + var ColorLibraryItem = item as ColorLibrary; - if (ColorLibraryItem != null) - { - if (String.IsNullOrEmpty(SearchColorText)) - { - ColorLibraryItem.ColorList.ToList().ForEach(x => x.IsSelected = false); - return true; - } - else - { - ColorLibraryItem.ColorList.ToList().ForEach( x=> x.IsSelected = x.Name.ToLower().StartsWith(SearchColorText.ToLower())); - - if(ColorLibraryItem.ColorList.ToList().Any(x=>x.Name.ToLower().StartsWith(SearchColorText.ToLower()))) - return true; - return (ColorLibraryItem.Name.ToLower().StartsWith(SearchColorText.ToLower())); - } - } - else - { - return true; - } - }); + if (ColorLibraryItem != null) + { + if (String.IsNullOrEmpty(SearchColorText)) + { + ColorLibraryItem.ColorList.ToList().ForEach(x => x.IsSelected = false); + return true; + } + else + { + ColorLibraryItem.ColorList.ToList().ForEach(x => x.IsSelected = x.Name.ToLower().StartsWith(SearchColorText.ToLower())); + + if (ColorLibraryItem.ColorList.ToList().Any(x => x.Name.ToLower().StartsWith(SearchColorText.ToLower()))) + return true; + return (ColorLibraryItem.Name.ToLower().StartsWith(SearchColorText.ToLower())); + } + } + else + { + return true; + } + }); base.OnShow(); SegmentIndex = DialogEditObject.SelectedSegment.SegmentIndex; @@ -602,7 +615,7 @@ namespace Tango.PPC.Jobs.Dialogs SelectedBrushStop.Guid = InitialBrushStop.Guid; SelectedBrushStop.ColorSpace = InitialBrushStop.ColorSpace; if (SelectedBrushStop.ColorSpace == ColorSpaces.Volume) - { + { SelectedColorTab = ColorTab.Volume; SelectedBrushStop.SaveColorBeforeChanges(); } @@ -650,8 +663,8 @@ namespace Tango.PPC.Jobs.Dialogs CheckIsSelectedColorInLibrary(); SelectedBrushStop.ConvertColor();//test OOG RaisePropertyChanged(nameof(FineTuningEnabled)); - } - + } + private void OnSelectedtabChanged() { switch (SelectedColorTab) @@ -742,9 +755,9 @@ namespace Tango.PPC.Jobs.Dialogs case ColorSpaces.CMYK: SelectedColorTab = ColorTab.Volume; break; - //case ColorSpaces.HSB: - // SelectedColorTab = ColorTab.HSB; - // break; + //case ColorSpaces.HSB: + // SelectedColorTab = ColorTab.HSB; + // break; } } } @@ -771,19 +784,19 @@ namespace Tango.PPC.Jobs.Dialogs private double GetMaxCMYKValueOrDefault(LiquidTypes type) { - if (SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null + if (SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null && SelectedBrushStop.SegmentModel.Job != null && SelectedBrushStop.SegmentModel.Job.Rml != null && SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Count > 0) - { + { var liquidTypesRml = SelectedBrushStop.SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == type); - var processParametersTable = SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Single().ProcessParametersTables.OrderBy(y=>y.TableIndex).LastOrDefault(); - + var processParametersTable = SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Single().ProcessParametersTables.OrderBy(y => y.TableIndex).LastOrDefault(); + if (liquidTypesRml != null && processParametersTable != null && liquidTypesRml.MaxNlPerCm != 0) { - //var test = (processParametersTable.MaxInkUptake /( liquidTypesRml.MaxNlPerCm)* 100); - + //var test = (processParametersTable.MaxInkUptake /( liquidTypesRml.MaxNlPerCm)* 100); + return (processParametersTable.MaxInkUptake / (liquidTypesRml.MaxNlPerCm) * 100); } @@ -801,16 +814,16 @@ namespace Tango.PPC.Jobs.Dialogs OKCommand.RaiseCanExecuteChanged(); } - + protected override async void Accept() { if (SelectedBrushStop.IsOutOfGamut) { - if( false == await NotificationProvider.ShowQuestion("The color you chose is not supported, by pressing OK the system will enter the best-match color.")) + if (false == await NotificationProvider.ShowQuestion("The color you chose is not supported, by pressing OK the system will enter the best-match color.")) { - return; + 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) @@ -819,18 +832,18 @@ namespace Tango.PPC.Jobs.Dialogs } } } - + _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; _selectedBrushStop.UpdateColorOnAccept(); base.Accept(); } protected override void Cancel() { - if(IsOpenVectorFineTuningDialog) + if (IsOpenVectorFineTuningDialog) return; - + var TestColor = TrialsLogEngine.Default.GetByBrushStopGuid(_selectedBrushStop.Guid); - if (TestColor != null && InitialBrushStop != null && + 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))) @@ -857,13 +870,14 @@ namespace Tango.PPC.Jobs.Dialogs private void OpenCloseAddMyColorDialog() { - if(IsBusy) + if (IsBusy) return; IsBusy = true; - - if(SaveMyColorMode == false && IsSelectedColorInLibrary) + + if (SaveMyColorMode == false && IsSelectedColorInLibrary) { - try { + try + { List<FavoriteColor> colors; if (_colorSpaceToFavoriteColorDictionary != null && SelectedBrushStop != null && _colorSpaceToFavoriteColorDictionary.TryGetValue(SelectedBrushStop.ColorSpace, out colors) && colors != null) { @@ -873,19 +887,19 @@ namespace Tango.PPC.Jobs.Dialogs MyColorName = favoriteColor.Name; foreach (var library in Libraries) { - if(library.IsColorExist(favoriteColor)) + if (library.IsColorExist(favoriteColor)) { library.RemoveFromLibrary(favoriteColor); LoadLibraryDictionary(); IsSelectedColorInLibrary = false; break; - } - } + } + } } - + } } - catch( Exception ex) + catch (Exception ex) { LogManager.Log(ex, "An error occurred while trying to delete My Colors."); } @@ -899,10 +913,10 @@ namespace Tango.PPC.Jobs.Dialogs SaveMyColorMode = !SaveMyColorMode; //Init MyColorName on open the dialog String colorName = "MyColor"; - if ( SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null && SelectedBrushStop.SegmentModel.Job != null ) + if (SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null && SelectedBrushStop.SegmentModel.Job != null) { colorName = SelectedBrushStop.SegmentModel.Job.Name; - if(colorName.Length > 40) + if (colorName.Length > 40) colorName = colorName.Substring(0, 40); } MyColorName = colorName; @@ -947,7 +961,7 @@ namespace Tango.PPC.Jobs.Dialogs { NewGroupName = "Library" + (Libraries.Count() + 1); AddGroupMode = false; - SaveMyColorMode = false; + SaveMyColorMode = false; } /// <summary> /// Adds the new group in Save My Colors list. @@ -955,9 +969,9 @@ namespace Tango.PPC.Jobs.Dialogs /// <param name="name">The name of the new Library.</param> private void AddNewGroup(string name) { - if (!String.IsNullOrEmpty(name) && false == Libraries.Any(x=>x.Name.ToUpper() == name.ToUpper())) + if (!String.IsNullOrEmpty(name) && false == Libraries.Any(x => x.Name.ToUpper() == name.ToUpper())) { - Libraries.Insert(0 ,MyColorsEngine.Default.AddLibrary(name)); + Libraries.Insert(0, MyColorsEngine.Default.AddLibrary(name)); } else { @@ -985,13 +999,13 @@ namespace Tango.PPC.Jobs.Dialogs } SelectedColorLibrary = library; - // AddColorToLibrary(library); + // AddColorToLibrary(library); } NewGroupName = "Library" + (Libraries.Count() + 1); //SaveMyColorMode = false; //AddGroupMode = false; } - + /// <summary> /// Adds the selected color to library in Save my Colors. /// </summary> @@ -1046,7 +1060,7 @@ namespace Tango.PPC.Jobs.Dialogs { SelectedColor = favoriteColor; MyColorsMode = false; - + //test RML? SelectedBrushStop.SetMyColor(favoriteColor); RaisePropertyChanged(nameof(SelectedBrushStop)); @@ -1060,7 +1074,7 @@ namespace Tango.PPC.Jobs.Dialogs case ColorSpaces.Volume: { SelectedColorTab = ColorTab.Volume; - if(favoriteColor.RmlGuid != SelectedBrushStop.SegmentModel.Job.Rml.Guid) + if (favoriteColor.RmlGuid != SelectedBrushStop.SegmentModel.Job.Rml.Guid) NotificationProvider.ShowInfo("The color may be different from the selected."); } break; @@ -1158,7 +1172,7 @@ namespace Tango.PPC.Jobs.Dialogs } } - private async void UploadFile() + private async void UploadFile() { if (Settings.StorageRootPath == null || false == Directory.Exists(Settings.StorageRootPath)) { @@ -1225,16 +1239,16 @@ namespace Tango.PPC.Jobs.Dialogs private void LoadLibraryDictionary() { _colorSpaceToFavoriteColorDictionary = new Dictionary<ColorSpaces, List<FavoriteColor>>(); - foreach( var library in Libraries) + foreach (var library in Libraries) { - foreach( var color in library.ColorList) + foreach (var color in library.ColorList) { List<FavoriteColor> colors; - if(!_colorSpaceToFavoriteColorDictionary.TryGetValue( color.ColorSpace, out colors) || colors == null) + if (!_colorSpaceToFavoriteColorDictionary.TryGetValue(color.ColorSpace, out colors) || colors == null) { colors = new List<FavoriteColor>(); colors.Add(color); - _colorSpaceToFavoriteColorDictionary[color.ColorSpace] = colors; + _colorSpaceToFavoriteColorDictionary[color.ColorSpace] = colors; } else { @@ -1250,7 +1264,7 @@ namespace Tango.PPC.Jobs.Dialogs switch (e.Action) { case NotifyCollectionChangedAction.Add: - var libraries= e.NewItems.Cast<ColorLibrary>().ToList(); + var libraries = e.NewItems.Cast<ColorLibrary>().ToList(); for (int i = 0; i < libraries.Count; i++) { Dictionary<ColorSpaces, List<FavoriteColor>> groups = libraries[i].ColorList.GroupBy(r => r.ColorSpace).ToDictionary(g => g.Key, g => g.ToList()); @@ -1299,8 +1313,8 @@ namespace Tango.PPC.Jobs.Dialogs SelectedBrushStop.SaveColorBeforeChanges(); - VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.ColorSpace);//SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); - + VectorFineTuningDialogVM.Init(SelectedBrushStop, SelectedBrushStop.ColorSpace);//SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); + IsOpenVectorFineTuningDialog = true; VectorFineTuningDialogVM.Canceled -= VectorFineTuningDialogCanceled; @@ -1325,7 +1339,7 @@ namespace Tango.PPC.Jobs.Dialogs VectorFineTuningDialogVM.Accepted -= VectorFineTuningDialogAccepted; IsOpenVectorFineTuningDialog = false; - if(VectorFineTuningDialogVM.SelectedLog != null ) + if (VectorFineTuningDialogVM.SelectedLog != null) { _selectedBrushStop.PreventPropertyUpdate = true; @@ -1336,12 +1350,12 @@ namespace Tango.PPC.Jobs.Dialogs _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = VectorFineTuningDialogVM.SelectedLog.K; _selectedBrushStop.L = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionL; - _selectedBrushStop.A = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionA; - _selectedBrushStop.B = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionB; + _selectedBrushStop.A = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionA; + _selectedBrushStop.B = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionB; _selectedBrushStop.ColorSpace = ColorSpaces.Volume; _selectedBrushStop.PreventPropertyUpdate = false; - + //if not tested // _selectedBrushStop.PreventPropertyUpdate = false; _selectedBrushStop.ConvertColor(); @@ -1361,7 +1375,7 @@ namespace Tango.PPC.Jobs.Dialogs { if (true == await NotificationProvider.ShowQuestion("The color correction is in progress, the trials data will be reset. Are you sure?")) { - TrialsLogEngine.Default.Delete( testColor); + TrialsLogEngine.Default.Delete(testColor); return true; } else @@ -1377,8 +1391,8 @@ namespace Tango.PPC.Jobs.Dialogs public async Task<bool> NotifyAboutTrialsDataColorsSpace() { var testColor = TrialsLogEngine.Default.GetByBrushStopGuid(SelectedBrushStop.Guid); - if (testColor != null && testColor.TrialslogList.Count > 0 && - ((testColor.OpenedFromCatalog && SelectedColorTab != ColorTab.Catalog) + 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))) { @@ -1392,7 +1406,7 @@ namespace Tango.PPC.Jobs.Dialogs await NotificationProvider.ShowInfo("The color will not be changed."); return false; } - + } return 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 183ce0185..a597a4c50 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 @@ -1684,10 +1684,10 @@ namespace Tango.PPC.Jobs.Dialogs private void UpdateOnEndJob() { ActiveLogModel.IsTested = true; - Cyan = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = Cyan; - Magenta = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = Magenta; - Yellow = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = Yellow; - Black = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = Black; + Cyan = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume; + Magenta = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume; + Yellow = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume; + Black = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume; if (ActiveLogModel != null && TrialsLogitems.Count <= 10) { 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 4fa45744b..d014aa000 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 @@ -1452,7 +1452,7 @@ namespace Tango.PPC.Jobs.Models foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) { - LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType).SetVolumeSilent(outputLiquid.Volume); + LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType)?.SetVolumeSilent(outputLiquid.Volume); } IsOutOfGamut = output.OutOfGamut; |
