From cd5a926df30ea7e7a4f4f4a55d71b43ec7aee3e1 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 22 Sep 2019 18:23:40 +0300 Subject: Implemented auto process selection on color space volume. Implemented number of units on Device. Fixed issue with color conversion process index. Increased max volume to 200 on PPC. Implemented Thread cloning on MS! --- .../ColorLib/Tango.ColorLib_v2/ColorConverter.cpp | 13 +++- .../Tango.ColorLib_v2/Utils/ColorTransf.cpp | 2 +- .../ViewModels/MainViewVM.cs | 74 +++++++++++++++++++++- .../Tango.MachineStudio.RML/Views/RmlsView.xaml | 6 ++ .../MachineStudioSettings.cs | 7 ++ .../Notifications/TextInputBoxWindow.xaml | 2 +- .../ViewModels/MainViewVM.cs | 1 + .../Tango.MachineStudio.UI/Views/AboutView.xaml | 12 ++-- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 2 +- .../Printing/DefaultPrintingManager.cs | 12 +--- .../Tango.Emulations/Emulators/MachineEmulator.cs | 9 +-- .../Operation/IMachineOperator.cs | 5 ++ .../Tango.Integration/Operation/JobUnitsMethods.cs | 23 +++++++ .../Tango.Integration/Operation/MachineOperator.cs | 34 ++++++++-- .../Tango.Integration/Tango.Integration.csproj | 3 +- .../Visual_Studio/Tango.PMR/Printing/JobTicket.cs | 45 ++++++------- 16 files changed, 194 insertions(+), 56 deletions(-) create mode 100644 Software/Visual_Studio/Tango.Integration/Operation/JobUnitsMethods.cs (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v2/ColorConverter.cpp b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v2/ColorConverter.cpp index 4c6186efb..61fc387c6 100644 --- a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v2/ColorConverter.cpp +++ b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v2/ColorConverter.cpp @@ -1333,8 +1333,19 @@ void Tango::ColorLib::ColorConverter::ConvertVolumeToRGBDisplay(ConversionInput* VectorXd NLInkP((int)(m_nVolumes)); VectorXd InkOut((int)(m_nVolumes)); //Convert to Nonlinear Inks + double SumVol_Ink = 0.0; + for (int i = 0; i < m_nVolumes; ++i) + { Volume(i) = conversionInput->inputcoordinates->inputliquids[i]->volume; //volume is given in % + SumVol_Ink += Volume(i); + } + for (int i = 0; i < int(conversionInput->n_processranges - 1); ++i) + { + if (SumVol_Ink > m_ProcessRangesMaxP[i]) + GamutRegion++; + } + VolumeToNLInkP(Volume, NLInkP); double *InkOutP = new double[m_nA2BnSepIn]; VectorToDouble(NLInkP, InkOutP); @@ -1367,7 +1378,6 @@ void Tango::ColorLib::ColorConverter::ConvertVolumeToRGBDisplay(ConversionInput* } //Convert to RGB - GamutRegion = 0; //Convert to Lab double *LabOutP = new double[m_nA2BnSepOut]; @@ -1606,6 +1616,7 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i output_coordinates__init(outputCoords); fillRGB(outputCoords, RGBOut); fillLab(outputCoords, LabOut); + outputCoords->has_processparameterstableindex = true; outputCoords->processparameterstableindex = GamutRegion; fillVolume(outputCoords, Volume); conversionOutput->has_outofgamut = true; diff --git a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v2/Utils/ColorTransf.cpp b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v2/Utils/ColorTransf.cpp index 39b8ee983..d695c71e6 100644 --- a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v2/Utils/ColorTransf.cpp +++ b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v2/Utils/ColorTransf.cpp @@ -457,7 +457,7 @@ void ColorTransf::evalInkP2Lab(double *ColorIn, double *&ColorOut, int &GamutReg ColorOut[0] = tmpLabOut.Get_x(); ColorOut[1] = tmpLabOut.Get_y(); ColorOut[2] = tmpLabOut.Get_z(); - GamutRegion = 0; + //GamutRegion = 0; if (iColorIn != NULL) { delete[] iColorIn; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index c2637b527..a76799881 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -20,6 +20,7 @@ using Tango.MachineStudio.RML.Models; using Tango.MachineStudio.RML.Views; using Tango.PMR.ColorLab; using System.Data.Entity; +using Tango.Core.ExtensionMethods; namespace Tango.MachineStudio.RML.ViewModels { @@ -178,11 +179,14 @@ namespace Tango.MachineStudio.RML.ViewModels public RelayCommand SaveCommand { get; set; } + public RelayCommand CloneRmlCommand { get; set; } + public MainViewVM(INotificationProvider notificationProvider) { _notification = notificationProvider; ManageRmlCommand = new RelayCommand(() => LoadActiveRML(SelectedRML.Guid), () => SelectedRML != null); - RemoveRmlCommand = new RelayCommand(RemoveSelectedRml); + RemoveRmlCommand = new RelayCommand(RemoveSelectedRml, () => SelectedRML != null); + CloneRmlCommand = new RelayCommand(CloneSelectedRml, () => SelectedRML != null); AddRmlCommand = new RelayCommand(AddNewRml); BackToRmlsCommand = new RelayCommand(BackToRmls, () => IsFree); AddProcessParametersTableCommand = new RelayCommand(AddProcessParametersTable, () => IsFree); @@ -443,6 +447,74 @@ namespace Tango.MachineStudio.RML.ViewModels } } + private async void CloneSelectedRml() + { + String name = _notification.ShowTextInput("Enter thread name", "thread name"); + + if (!String.IsNullOrWhiteSpace(name)) + { + using (_notification.PushTaskItem("Cloning thread...")) + { + try + { + IsFree = false; + + using (var context = ObservablesContext.CreateDefault()) + { + var rml = await new RmlBuilder(context).Set(SelectedRML.Guid).WithActiveParametersGroup().WithLiquidFactors().BuildAsync(); + + Rml cloned = new Rml(); + rml.MapPrimitivesWithStrings(cloned); + + cloned.Code = Rmls.Max(x => x.Code) + 1; + cloned.Guid = Guid.NewGuid().ToString(); + cloned.ID = 0; + cloned.Name = name; + + ProcessParametersTablesGroup group = new ProcessParametersTablesGroup(); + group.Name = rml.GetActiveProcessGroup().Name; + group.Active = true; + + foreach (var p in rml.GetActiveProcessGroup().ProcessParametersTables) + { + var pc = new ProcessParametersTable(); + p.MapPrimitivesTo(pc); + pc.Name = p.Name; + + group.ProcessParametersTables.Add(pc); + } + + cloned.ProcessParametersTablesGroups.Add(group); + + foreach (var liquidFactor in rml.LiquidTypesRmls) + { + LiquidTypesRml l = new LiquidTypesRml(); + l.DefaultCatData = liquidFactor.DefaultCatData; + l.LiquidType = liquidFactor.LiquidType; + l.MaxNlPerCm = liquidFactor.MaxNlPerCm; + cloned.LiquidTypesRmls.Add(l); + } + + context.Rmls.Add(cloned); + await context.SaveChangesAsync(); + } + + LoadRmls(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error cloning thread."); + _notification.ShowError($"An error occurred while trying to clone the selected thread\n{ex.Message}"); + } + finally + { + IsFree = true; + } + } + + } + } + private void AddProcessParametersTable() { var name = _notification.ShowTextInput("Enter table name", "Name"); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml index 9f09ad248..719167679 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -31,6 +31,12 @@ DELETE +