From c5cde62cecfdd413e9902b26b30b0d4dfd05a24d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 14 Mar 2019 13:25:32 +0200 Subject: Machine Studio v4.0.10 PPC v1.0.9 --- .../ViewModels/MainViewVM.cs | 41 +++++++++++++++++----- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') 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 35aca807c..04d2fae4b 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 @@ -46,6 +46,7 @@ using System.Data.Entity; using System.Runtime.ExceptionServices; using Tango.BL.Builders; using Tango.MachineStudio.Common.Navigation; +using System.Diagnostics; namespace Tango.MachineStudio.Developer.ViewModels { @@ -78,6 +79,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private bool _dialog_shown; private bool _disable_gamut_check; private bool _rml_has_no_cct; + private TaskItem _preparingTaskItem; #region Properties @@ -739,8 +741,8 @@ namespace Tango.MachineStudio.Developer.ViewModels RemoveBrushStopCommand = new RelayCommand(RemoveSelectedBrushStops, () => SelectedBrushStop != null && CanWork); SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null && CanWork); DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null && CanWork); - StartJobCommand = new RelayCommand(() => StartJob(), () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.Actions.Contains(BL.Enumerations.EventTypeActions.PreventJob))); - StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.Actions.Contains(BL.Enumerations.EventTypeActions.PreventJob))); + StartJobCommand = new RelayCommand(() => StartJob(), () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null); + StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning && CanWork); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); LoadJobCommand = new RelayCommand(() => LoadSelectedJob(), () => SelectedMachineJob != null && CanWork); @@ -956,6 +958,17 @@ namespace Tango.MachineStudio.Developer.ViewModels MachineOperator.ResumingJob -= MachineOperator_ResumingJob; MachineOperator.ResumingJob += MachineOperator_ResumingJob; + + MachineOperator.PreparingJobProgress -= MachineOperator_PreparingJobProgress; + MachineOperator.PreparingJobProgress += MachineOperator_PreparingJobProgress; + } + } + + private void MachineOperator_PreparingJobProgress(object sender, PreparingJobProgressEventArgs e) + { + if (_preparingTaskItem != null) + { + _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%..."; } } @@ -991,6 +1004,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private void MachineEventsStateProvider_EventsChanged(object sender, IEnumerable changedEvents) { InvokeUI(StartJobCommand.RaiseCanExecuteChanged); + InvokeUI(StartJobAndRecordCommand.RaiseCanExecuteChanged); } /// @@ -1277,7 +1291,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// /// Starts the job. /// - private void StartJob(Func resumeFunc = null) + private async void StartJob(Func resumeFunc = null) { LogManager.Log(String.Format("Starting job {0}...", ActiveJob.Name)); if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected) @@ -1301,22 +1315,27 @@ namespace Tango.MachineStudio.Developer.ViewModels IsJobFailed = false; IsJobCanceled = false; IsJobCompleted = false; - IsJobRunning = true; - ShowJobStatus = true; RunningJob = ActiveJob; _runningJobEstimatedDuration = EstimatedDuration; RunningJobSegments = RunningJob.EffectiveSegments.ToList(); - _navigation.NavigateTo(DeveloperNavigationView.RunningJobView); - try { + IsFree = false; LogManager.Log("Sending job to machine operator..."); if (resumeFunc == null) { - JobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + using (var item = _notification.PushTaskItem("Preparing job for printing...")) + { + _preparingTaskItem = item; + JobHandler = await MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + } + + _navigation.NavigateTo(DeveloperNavigationView.RunningJobView); + IsJobRunning = true; + ShowJobStatus = true; } else { @@ -1403,6 +1422,10 @@ namespace Tango.MachineStudio.Developer.ViewModels SetJobFailed(); StopRecordingIfInProgress(); } + finally + { + IsFree = true; + } } /// @@ -2077,7 +2100,7 @@ namespace Tango.MachineStudio.Developer.ViewModels newJob.ColorSpace = _machineDbContext.ColorSpaces.FirstOrDefault(); newJob.Machine = SelectedMachine; - + SelectedMachine.Jobs.Add(newJob); var segment = newJob.AddSolidSegment(); -- cgit v1.3.1 From c4b03559eec69b2c69048dc88ed42ea1969b8d52 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 17 Mar 2019 18:47:20 +0200 Subject: Fixed issue with Machine Studio Resume. Worked on Scripting IDE. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1344 -> 1516 bytes .../ViewModels/MainViewVM.cs | 8 +- .../Tango.Scripting.Editors.csproj | 2 +- .../Tango.Scripting.IDE.UI/App.config | 37 +----- .../Tango.Scripting.IDE.UI/App.xaml | 20 +++- .../Tango.Scripting.IDE.UI/MainWindow.xaml | 7 +- .../Tango.Scripting.IDE.UI/MainWindow.xaml.cs | 5 +- .../Tango.Scripting.IDE.UI.csproj | 75 +++++++++++++ .../Tango.Scripting.IDE.UI/packages.config | 44 ++++++++ .../Controls/SolutionItemControl.cs | 52 +++++++++ .../Dialogs/NewProjectDialog.xaml | 12 ++ .../Dialogs/NewProjectDialog.xaml.cs | 28 +++++ .../Dialogs/NewProjectDialogVM.cs | 14 +++ .../Tango.Scripting.IDE/IProject.cs | 23 ++++ .../Tango.Scripting.IDE/IProjectItem.cs | 18 +++ .../Tango.Scripting.IDE/IProjectType.cs | 21 ++++ .../Tango.Scripting.IDE/IScriptFile.cs | 13 --- .../Tango.Scripting.IDE/IScriptProject.cs | 20 ---- .../Tango.Scripting.IDE/ISolutionItem.cs | 18 +++ .../Tango.Scripting.IDE/Images/CSharpProject.png | Bin 0 -> 200 bytes .../Images/CSharpScriptItem.png | Bin 0 -> 238 bytes .../Tango.Scripting.IDE/Images/Reference.png | Bin 0 -> 141 bytes .../Tango.Scripting.IDE/Images/StubProject.png | Bin 0 -> 392 bytes .../Tango.Scripting/Tango.Scripting.IDE/Project.cs | 56 +++++++++ .../Tango.Scripting.IDE/ProjectItem.cs | 57 ++++++++++ .../ProjectItems/CSharpScriptItem.cs | 30 +++++ .../ProjectItems/ReferenceAssembliesItem.cs | 27 +++++ .../ProjectItems/ReferenceAssemblyItem.cs | 24 ++++ .../ProjectItemsViews/CSharpScriptItemView.xaml | 13 +++ .../ProjectItemsViews/CSharpScriptItemView.xaml.cs | 29 +++++ .../ProjectTypes/StubProjectType.cs | 45 ++++++++ .../ProjectTypes/UnitTestProjectType.cs | 43 +++++++ .../Tango.Scripting.IDE/Projects/CSharpProject.cs | 14 +++ .../Tango.Scripting.IDE/Projects/StubProject.cs | 25 +++++ .../Projects/UnitTestProject.cs | 24 ++++ .../Tango.Scripting.IDE/Resources.xaml | 125 ++++++++++++++++++++- .../Tango.Scripting.IDE/ScriptIDEView.xaml | 73 ++++++++++-- .../Tango.Scripting.IDE/ScriptIDEViewVM.cs | 97 +++++++++++++++- .../Tango.Scripting.IDE/Solution.cs | 19 ++++ .../Tango.Scripting.IDE/StubsProject.cs | 17 --- .../Tango.Scripting.IDE/Tango.Scripting.IDE.csproj | 53 ++++++++- .../Tango.Scripting.IDE/Themes/Generic.xaml | 20 +++- .../Tango.Scripting/Tango.Scripting.IDE/app.config | 43 +++++++ .../Tango.Scripting.IDE/packages.config | 1 + 46 files changed, 1136 insertions(+), 116 deletions(-) create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Controls/SolutionItemControl.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialog.xaml create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialog.xaml.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialogVM.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProject.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProjectItem.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProjectType.cs delete mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IScriptFile.cs delete mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IScriptProject.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ISolutionItem.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/CSharpProject.png create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/CSharpScriptItem.png create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/Reference.png create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/StubProject.png create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Project.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItem.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/CSharpScriptItem.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/ReferenceAssembliesItem.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/ReferenceAssemblyItem.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItemsViews/CSharpScriptItemView.xaml create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItemsViews/CSharpScriptItemView.xaml.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectTypes/StubProjectType.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectTypes/UnitTestProjectType.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/CSharpProject.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/StubProject.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/UnitTestProject.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Solution.cs delete mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/StubsProject.cs create mode 100644 Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/app.config (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 6b59af4b3..fbc4736e1 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 5ab7fc785..cfd096d15 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index 57e613c14..b3a55c2f1 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ 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 04d2fae4b..1a295f23c 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 @@ -1332,16 +1332,16 @@ namespace Tango.MachineStudio.Developer.ViewModels _preparingTaskItem = item; JobHandler = await MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); } - - _navigation.NavigateTo(DeveloperNavigationView.RunningJobView); - IsJobRunning = true; - ShowJobStatus = true; } else { JobHandler = resumeFunc(ActiveJob); } + _navigation.NavigateTo(DeveloperNavigationView.RunningJobView); + IsJobRunning = true; + ShowJobStatus = true; + _eventLogger.Log(String.Format("Job '{0}' started...", ActiveJob.Name)); JobHandler.StatusChanged += (x, status) => diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj index 10236ee42..2a21f0264 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.Editors/Tango.Scripting.Editors.csproj @@ -625,7 +625,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/App.config b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/App.config index b7f531317..aa58e3cac 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/App.config +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/App.config @@ -5,42 +5,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/App.xaml b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/App.xaml index 9563551dd..be9fdd055 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/App.xaml +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/App.xaml @@ -4,6 +4,24 @@ xmlns:local="clr-namespace:Tango.Scripting.IDE.UI" StartupUri="MainWindow.xaml"> - + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/MainWindow.xaml b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/MainWindow.xaml index 0234ed063..2bc6100ce 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/MainWindow.xaml +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/MainWindow.xaml @@ -1,13 +1,14 @@ - + Title="MainWindow" Height="720" Width="1280" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}" TitlebarHeight="40" TitleCaps="False" BorderBrush="Gray" BorderThickness="1" WindowStartupLocation="CenterScreen"> - + diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/MainWindow.xaml.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/MainWindow.xaml.cs index be5d4ce2b..13f2bf7a9 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/MainWindow.xaml.cs @@ -1,4 +1,5 @@ -using System; +using MahApps.Metro.Controls; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -18,7 +19,7 @@ namespace Tango.Scripting.IDE.UI /// /// Interaction logic for MainWindow.xaml /// - public partial class MainWindow : Window + public partial class MainWindow : MetroWindow { public MainWindow() { diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/Tango.Scripting.IDE.UI.csproj b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/Tango.Scripting.IDE.UI.csproj index db8eff963..f87325bc9 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/Tango.Scripting.IDE.UI.csproj +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/Tango.Scripting.IDE.UI.csproj @@ -34,11 +34,70 @@ 4 + + ..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll + ..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll + + ..\packages\Microsoft.CodeAnalysis.Common.2.4.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll + + + ..\packages\Microsoft.CodeAnalysis.CSharp.2.4.0\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll + + + ..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll + + + ..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + + + ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll + + + ..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll + + + ..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll + + + ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll + + + ..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll + + + ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll + + + + ..\packages\System.Reflection.Metadata.1.4.2\lib\portable-net45+win8\System.Reflection.Metadata.dll + + + ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll + + + ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + + + ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + + + ..\packages\System.Text.Encoding.CodePages.4.3.0\lib\net46\System.Text.Encoding.CodePages.dll + + + ..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll + + + ..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll + ..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll @@ -51,6 +110,18 @@ 4.0 + + ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll + + + ..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll + + + ..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll + + + ..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll + ..\..\..\Build\Core\Debug\Tango.Core.dll @@ -121,5 +192,9 @@ Tango.Scripting + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/packages.config b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/packages.config index 07b683c3f..e207a9750 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/packages.config +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE.UI/packages.config @@ -1,4 +1,48 @@  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Controls/SolutionItemControl.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Controls/SolutionItemControl.cs new file mode 100644 index 000000000..ad6c65f22 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Controls/SolutionItemControl.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.Scripting.IDE.Controls +{ + public class SolutionItemControl : Control + { + public ISolutionItem SolutionItem + { + get { return (ISolutionItem)GetValue(SolutionItemProperty); } + set { SetValue(SolutionItemProperty, value); } + } + public static readonly DependencyProperty SolutionItemProperty = + DependencyProperty.Register("SolutionItem", typeof(ISolutionItem), typeof(SolutionItemControl), new PropertyMetadata(null)); + + public ICommand OpenCommand + { + get { return (ICommand)GetValue(OpenCommandProperty); } + set { SetValue(OpenCommandProperty, value); } + } + public static readonly DependencyProperty OpenCommandProperty = + DependencyProperty.Register("OpenCommand", typeof(ICommand), typeof(SolutionItemControl), new PropertyMetadata(null)); + + static SolutionItemControl() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(SolutionItemControl), new FrameworkPropertyMetadata(typeof(SolutionItemControl))); + } + + public SolutionItemControl() + { + PreviewMouseDoubleClick += (_, __) => + { + if (SolutionItem.CanOpen) + { + OpenCommand?.Execute(SolutionItem); + } + }; + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialog.xaml b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialog.xaml new file mode 100644 index 000000000..7942a7165 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialog.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialog.xaml.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialog.xaml.cs new file mode 100644 index 000000000..376190e3a --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialog.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.Scripting.IDE.Dialogs +{ + /// + /// Interaction logic for NewProjectDialog.xaml + /// + public partial class NewProjectDialog : UserControl + { + public NewProjectDialog() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialogVM.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialogVM.cs new file mode 100644 index 000000000..3c25e70f3 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Dialogs/NewProjectDialogVM.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.Scripting.IDE.Dialogs +{ + public class NewProjectDialogVM : ViewModel + { + + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProject.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProject.cs new file mode 100644 index 000000000..18d95a7d8 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProject.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; + +namespace Tango.Scripting.IDE +{ + public interface IProject : ISolutionItem + { + String FilePath { get; set; } + + String WorkingFolder { get; } + + ObservableCollection Items { get; set; } + + Task Build(); + + Task Run(); + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProjectItem.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProjectItem.cs new file mode 100644 index 000000000..0d34cf2e6 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProjectItem.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; + +namespace Tango.Scripting.IDE +{ + public interface IProjectItem : ISolutionItem + { + ObservableCollection Items { get; set; } + + FrameworkElement View { get; } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProjectType.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProjectType.cs new file mode 100644 index 000000000..ed9ff51a8 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IProjectType.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; + +namespace Tango.Scripting.IDE +{ + public interface IProjectType + { + IProject NewProject(String projectPath); + + String Name { get; } + + String Description { get; } + + BitmapSource Image { get; } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IScriptFile.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IScriptFile.cs deleted file mode 100644 index f26a0064f..000000000 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IScriptFile.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.Scripting.IDE -{ - public interface IScriptFile - { - String Name { get; set; } - } -} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IScriptProject.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IScriptProject.cs deleted file mode 100644 index f68114e8b..000000000 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/IScriptProject.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.Scripting.IDE -{ - public interface IScriptProject - { - String Name { get; set; } - - String FilePath { get; set; } - - ObservableCollection References { get; set; } - - ObservableCollection Items { get; set; } - } -} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ISolutionItem.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ISolutionItem.cs new file mode 100644 index 000000000..74bdab066 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ISolutionItem.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; + +namespace Tango.Scripting.IDE +{ + public interface ISolutionItem + { + String Name { get; } + + BitmapSource Image { get; } + + bool CanOpen { get; } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/CSharpProject.png b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/CSharpProject.png new file mode 100644 index 000000000..5b0f29960 Binary files /dev/null and b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/CSharpProject.png differ diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/CSharpScriptItem.png b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/CSharpScriptItem.png new file mode 100644 index 000000000..37e4e1727 Binary files /dev/null and b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/CSharpScriptItem.png differ diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/Reference.png b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/Reference.png new file mode 100644 index 000000000..fa5430947 Binary files /dev/null and b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/Reference.png differ diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/StubProject.png b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/StubProject.png new file mode 100644 index 000000000..cd0ad20ad Binary files /dev/null and b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Images/StubProject.png differ diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Project.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Project.cs new file mode 100644 index 000000000..5a950d2c7 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Project.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.SharedUI.Helpers; + +namespace Tango.Scripting.IDE +{ + public abstract class Project : IProject + { + private static Dictionary _imageCache; + + static Project() + { + _imageCache = new Dictionary(); + } + + public string FilePath { get; set; } + + public string WorkingFolder => Path.GetDirectoryName(FilePath); + + public string Name => Path.GetFileNameWithoutExtension(FilePath); + + public abstract BitmapSource Image { get; } + + public ObservableCollection Items { get; set; } + + public Project() + { + Items = new ObservableCollection(); + } + + public abstract Task Build(); + public abstract Task Run(); + + protected static BitmapSource GetImage(String name) + { + if (_imageCache.ContainsKey(name)) + { + return _imageCache[name]; + } + else + { + var image = ResourceHelper.GetImageFromResources(name); + _imageCache.Add(name, image); + return image; + } + } + + public bool CanOpen => false; + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItem.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItem.cs new file mode 100644 index 000000000..8adc26dc7 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItem.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.Core; +using Tango.SharedUI.Helpers; + +namespace Tango.Scripting.IDE +{ + public abstract class ProjectItem : ExtendedObject, IProjectItem + { + private static Dictionary _imageCache; + + static ProjectItem() + { + _imageCache = new Dictionary(); + } + + public string Name { get; set; } + public ObservableCollection Items { get; set; } + + public ProjectItem() + { + Items = new ObservableCollection(); + } + + public abstract BitmapSource Image { get; } + + public abstract FrameworkElement OnGetView(); + + private FrameworkElement GetView() + { + return OnGetView(); + } + + protected static BitmapSource GetImage(String name) + { + if (_imageCache.ContainsKey(name)) + { + return _imageCache[name]; + } + else + { + var image = ResourceHelper.GetImageFromResources(name); + _imageCache.Add(name, image); + return image; + } + } + + public abstract bool CanOpen { get; } + public FrameworkElement View => GetView(); + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/CSharpScriptItem.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/CSharpScriptItem.cs new file mode 100644 index 000000000..cf4811047 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/CSharpScriptItem.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.Scripting.IDE.ProjectItemsViews; + +namespace Tango.Scripting.IDE.ProjectItems +{ + public class CSharpScriptItem : ProjectItem + { + public override BitmapSource Image => GetImage("Images/CSharpScriptItem.png"); + + private String _code; + public String Code + { + get { return _code; } + set { _code = value; RaisePropertyChangedAuto(); } + } + + public override bool CanOpen => true; + + public override FrameworkElement OnGetView() + { + return new CSharpScriptItemView(this); + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/ReferenceAssembliesItem.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/ReferenceAssembliesItem.cs new file mode 100644 index 000000000..0e66fd241 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/ReferenceAssembliesItem.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; + +namespace Tango.Scripting.IDE.ProjectItems +{ + public class ReferenceAssembliesItem : ProjectItem + { + public ReferenceAssembliesItem() + { + Name = "References"; + } + + public override BitmapSource Image => GetImage("Images/Reference.png"); + + public override FrameworkElement OnGetView() + { + return null; + } + + public override bool CanOpen => false; + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/ReferenceAssemblyItem.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/ReferenceAssemblyItem.cs new file mode 100644 index 000000000..e9cd1e8f2 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItems/ReferenceAssemblyItem.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; + +namespace Tango.Scripting.IDE.ProjectItems +{ + public class ReferenceAssemblyItem : ProjectItem + { + public String Path { get; set; } + public override BitmapSource Image => GetImage("Images/Reference.png"); + + public override FrameworkElement OnGetView() + { + return null; + } + + public override bool CanOpen => false; + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItemsViews/CSharpScriptItemView.xaml b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItemsViews/CSharpScriptItemView.xaml new file mode 100644 index 000000000..682956205 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItemsViews/CSharpScriptItemView.xaml @@ -0,0 +1,13 @@ + + + + + diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItemsViews/CSharpScriptItemView.xaml.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItemsViews/CSharpScriptItemView.xaml.cs new file mode 100644 index 000000000..34c604b83 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectItemsViews/CSharpScriptItemView.xaml.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Scripting.IDE.ProjectItems; + +namespace Tango.Scripting.IDE.ProjectItemsViews +{ + /// + /// Interaction logic for CSharpScriptItemView.xaml + /// + public partial class CSharpScriptItemView : UserControl + { + public CSharpScriptItemView(CSharpScriptItem scriptItem) + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectTypes/StubProjectType.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectTypes/StubProjectType.cs new file mode 100644 index 000000000..e5947a38e --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectTypes/StubProjectType.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.Scripting.IDE.ProjectItems; +using Tango.Scripting.IDE.Projects; + +namespace Tango.Scripting.IDE.ProjectTypes +{ + public class StubProjectType : IProjectType + { + public IProject NewProject(string projectPath) + { + StubProject project = new StubProject(); + + project.FilePath = projectPath; + + var referenceAssembliesItem = new ReferenceAssembliesItem(); + + referenceAssembliesItem.Items.Add(new ReferenceAssemblyItem() + { + Path = "mscorelib.dll", + Name = "System.dll", + }); + referenceAssembliesItem.Items.Add(new ReferenceAssemblyItem() + { + Path = "System.Core.dll", + Name = "System.Core.dll", + }); + + project.Items.Add(referenceAssembliesItem); + + project.Items.Add(new CSharpScriptItem() { Name = "main.csx" }); + + return project; + } + + public string Name => "Unit Test Project"; + public string Description => "Create a unit test project template."; + public BitmapSource Image { get; } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectTypes/UnitTestProjectType.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectTypes/UnitTestProjectType.cs new file mode 100644 index 000000000..4519e5aca --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ProjectTypes/UnitTestProjectType.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.Scripting.IDE.ProjectItems; +using Tango.Scripting.IDE.Projects; + +namespace Tango.Scripting.IDE.ProjectTypes +{ + public class UnitTestProjectType : IProjectType + { + public IProject NewProject(string projectPath) + { + UnitTestProject project = new UnitTestProject(); + + project.FilePath = projectPath; + + var referenceAssembliesItem = new ReferenceAssembliesItem(); + + referenceAssembliesItem.Items.Add(new ReferenceAssemblyItem() + { + Path = "mscorelib.dll", + Name = "System.dll", + }); + referenceAssembliesItem.Items.Add(new ReferenceAssemblyItem() + { + Path = "System.Core.dll", + Name = "System.Core.dll", + }); + + project.Items.Add(referenceAssembliesItem); + + return project; + } + + public string Name => "Unit Test Project"; + public string Description => "Create a unit test project template."; + public BitmapSource Image { get; } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/CSharpProject.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/CSharpProject.cs new file mode 100644 index 000000000..62e830d06 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/CSharpProject.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Scripting.IDE.Projects +{ + public abstract class CSharpProject : Project + { + + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/StubProject.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/StubProject.cs new file mode 100644 index 000000000..bc915fa77 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/StubProject.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; + +namespace Tango.Scripting.IDE.Projects +{ + public class StubProject : CSharpProject + { + public override BitmapSource Image => GetImage("Images/StubProject.png"); + + public override Task Build() + { + throw new NotImplementedException(); + } + + public override Task Run() + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/UnitTestProject.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/UnitTestProject.cs new file mode 100644 index 000000000..e5510ad45 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Projects/UnitTestProject.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; + +namespace Tango.Scripting.IDE.Projects +{ + public class UnitTestProject : CSharpProject + { + public override BitmapSource Image { get; } + + public override Task Build() + { + throw new NotImplementedException(); + } + + public override Task Run() + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Resources.xaml b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Resources.xaml index 3393e6888..ef5d1b599 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Resources.xaml +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Resources.xaml @@ -1,8 +1,127 @@  - #202020 - + #202020 + #252526 + #2D2D30 + #676767 + #007ACC + #007ACC + + + + + + - \ No newline at end of file + + + + + #2D2D30 + #FFFFFFFF + #2D2D30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView.xaml b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView.xaml index 3636089da..7fc5bf930 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView.xaml +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEView.xaml @@ -3,9 +3,13 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" + xmlns:fa="http://schemas.fontawesome.io/icons/" + xmlns:controls="clr-namespace:Tango.Scripting.IDE.Controls" xmlns:local="clr-namespace:Tango.Scripting.IDE" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:ScriptIDEViewVM, IsDesignTimeCreatable=False}"> + d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:ScriptIDEViewVM, IsDesignTimeCreatable=False}" x:Name="control"> @@ -17,6 +21,7 @@ + @@ -28,7 +33,7 @@ - + @@ -58,7 +63,7 @@ - + @@ -69,20 +74,72 @@ - + + + + + + + + + + + - + - + - + - + + + + + + + + + + + + diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEViewVM.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEViewVM.cs index 16644b6da..e52b58775 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEViewVM.cs +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/ScriptIDEViewVM.cs @@ -1,19 +1,108 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Scripting.IDE.Projects; +using Tango.Scripting.IDE.ProjectTypes; using Tango.SharedUI; namespace Tango.Scripting.IDE { public class ScriptIDEViewVM : ViewModel { - private IScriptProject _project; - public IScriptProject Project + private List _projectTypes; + + #region Properties + + private Solution _solution; + public Solution Solution + { + get { return _solution; } + set { _solution = value; RaisePropertyChangedAuto(); } + } + + private IProject _selectedProject; + public IProject SelectedProject + { + get { return _selectedProject; } + set { _selectedProject = value; RaisePropertyChangedAuto(); } + } + + private IProjectItem _selectedProjectItem; + public IProjectItem SelectedProjectItem + { + get { return _selectedProjectItem; } + set { _selectedProjectItem = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _openProjectItems; + public ObservableCollection OpenProjectItems + { + get { return _openProjectItems; } + set { _openProjectItems = value; RaisePropertyChangedAuto(); } + } + + #endregion + + #region Commands + + public RelayCommand OpenProjectItemCommand { get; set; } + + public RelayCommand CloseProjectItemCommand { get; set; } + + #endregion + + #region Constructors + + public ScriptIDEViewVM() { - get { return _project; } - set { _project = value; RaisePropertyChangedAuto(); } + _projectTypes = new List(); + OpenProjectItems = new ObservableCollection(); + + RegisterProjectType(new StubProjectType()); + + Solution = new Solution(); + Solution.Projects.Add(_projectTypes.First().NewProject("Test Project.stub")); + + //Init Commands + OpenProjectItemCommand = new RelayCommand(OpenProjectItem); + CloseProjectItemCommand = new RelayCommand(CloseProjectItem); + } + + #endregion + + #region Public Methods + + private void OpenProjectItem(IProjectItem projectItem) + { + if (!OpenProjectItems.Contains(projectItem)) + { + OpenProjectItems.Add(projectItem); + } + + SelectedProjectItem = projectItem; + } + + private void CloseProjectItem(IProjectItem projectItem) + { + OpenProjectItems.Remove(projectItem); + + SelectedProjectItem = OpenProjectItems.FirstOrDefault(); + } + + public void RegisterProjectType(IProjectType projectType) + { + _projectTypes.Add(projectType); } + + public void UnRegisterProjectItemHandler(IProjectType projectType) + { + _projectTypes.Remove(projectType); + } + + #endregion } } diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Solution.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Solution.cs new file mode 100644 index 000000000..eded27413 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Solution.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Scripting.IDE +{ + public class Solution + { + public ObservableCollection Projects { get; set; } + + public Solution() + { + Projects = new ObservableCollection(); + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/StubsProject.cs b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/StubsProject.cs deleted file mode 100644 index 88f538e7c..000000000 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/StubsProject.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.Scripting.IDE -{ - public class StubsProject : IScriptProject - { - public string Name { get; set; } - public string FilePath { get; set; } - public ObservableCollection References { get; set; } - public ObservableCollection Items { get; set; } - } -} diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Tango.Scripting.IDE.csproj b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Tango.Scripting.IDE.csproj index 7c3b47ea6..d3d81640a 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Tango.Scripting.IDE.csproj +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Tango.Scripting.IDE.csproj @@ -31,6 +31,9 @@ 4 + + ..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll + ..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll @@ -60,13 +63,41 @@ - - + + + NewProjectDialog.xaml + + + + + + + CSharpScriptItemView.xaml + + + + + + + + + + + ScriptIDEView.xaml - + + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -98,6 +129,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator @@ -114,5 +146,20 @@ Tango.Scripting + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Themes/Generic.xaml b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Themes/Generic.xaml index d7cedf6c6..643fbf889 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Themes/Generic.xaml +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/Themes/Generic.xaml @@ -1,8 +1,26 @@ - + + diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/app.config b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/app.config new file mode 100644 index 000000000..a00da21b0 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/app.config @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/packages.config b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/packages.config index 07b683c3f..893958c68 100644 --- a/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/packages.config +++ b/Software/Visual_Studio/TEMP/Tango.Scripting/Tango.Scripting.IDE/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file -- cgit v1.3.1 From 1b0cc929b5641c58faf5830ec70d3dec4030b1fd Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 18 Mar 2019 10:38:56 +0200 Subject: Fixed issue with gradient generation. Added SingleMode to conversion Input. Changed default gradient resolution to 50 cm. Updated latest PMR. --- .../PMR/Messages/ColorLab/ConversionInput.proto | 1 + .../ViewModels/MainViewVM.cs | 2 +- .../Native/Tango.ColorLib/ColorConverter.cpp | 532 ++++++++++----------- .../PMR/ColorLab/ConversionInput.pb-c.c | 19 +- .../PMR/ColorLab/ConversionInput.pb-c.h | 4 +- .../ColorConversion/TangoColorConverter.cs | 9 +- .../Visual_Studio/Tango.BL/Entities/Segment.cs | 5 + .../DefaultGradientGenerationConfiguration.cs | 21 +- .../Operation/IGradientGenerationConfiguration.cs | 3 +- .../Tango.Integration/Operation/MachineOperator.cs | 4 +- .../Tango.PMR/ColorLab/ConversionInput.cs | 35 +- .../EmbeddedParameters/ConfigurationParameters.cs | 256 +++++++++- 12 files changed, 600 insertions(+), 291 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/PMR/Messages/ColorLab/ConversionInput.proto b/Software/PMR/Messages/ColorLab/ConversionInput.proto index 5e8f9e2dc..fe4470103 100644 --- a/Software/PMR/Messages/ColorLab/ConversionInput.proto +++ b/Software/PMR/Messages/ColorLab/ConversionInput.proto @@ -20,4 +20,5 @@ message ConversionInput double DeltaChroma = 9; double DeltaL = 10; repeated ProcessRange ProcessRanges = 11; + bool SingleMode = 12; } \ No newline at end of file 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 1a295f23c..41f57794a 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 @@ -742,7 +742,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null && CanWork); DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null && CanWork); StartJobCommand = new RelayCommand(() => StartJob(), () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null); - StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null); + StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && CanWork); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning && CanWork); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); LoadJobCommand = new RelayCommand(() => LoadSelectedJob(), () => SelectedMachineJob != null && CanWork); diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp index e99a56d26..d08e851c0 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp +++ b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp @@ -22,8 +22,8 @@ #include //#include -/*#define _CRTDBG_MAP_ALLOC -#include +/*#define _CRTDBG_MAP_ALLOC +#include #include #include @@ -51,7 +51,7 @@ Tango::ColorLib::ColorConverter::ColorConverter() :m_A2BTransform(NULL), m_B2ATransform(NULL), -m_GBD(NULL), m_CalibCurves(NULL), m_Conv02(NULL), +m_GBD(NULL), m_CalibCurves(NULL), m_Conv02(NULL), m_maxNlPerCM(NULL), m_nA2BnSepIn(0), m_nA2BnSepOut(0), m_nB2AnSepIn(0), m_nB2AnSepOut(0), m_nInks(0), m_nVolumes(0), m_AdaptWP(false), m_LinInterp(NULL), m_InvLinInterp(NULL) { @@ -90,12 +90,12 @@ Tango::ColorLib::ColorConverter::~ColorConverter() } if (m_LinInterp != NULL) { - delete [] m_LinInterp; + delete[] m_LinInterp; m_LinInterp = NULL; } if (m_InvLinInterp != NULL) { - delete [] m_InvLinInterp; + delete[] m_InvLinInterp; m_InvLinInterp = NULL; } } @@ -125,17 +125,17 @@ void Tango::ColorLib::ColorConverter::ProcessHiveNeighbors(VectorXd Lab, VectorX for (int i = 0; i < 6; ++i) { Jab1(i, 0) = Jab(0); - Jab1(i, 1) = Jab(1) + dC*cos(hue + i*dH6); - Jab1(i, 2) = Jab(2) + dC*sin(hue + i*dH6); + Jab1(i, 1) = Jab(1) + dC * cos(hue + i * dH6); + Jab1(i, 2) = Jab(2) + dC * sin(hue + i * dH6); } int j1 = 0, j2 = 0; - double dC2 = dC*2.0; + double dC2 = dC * 2.0; for (int i = 0; i < 12; ++i) { j1 = i + 6; Jab1(j1, 0) = Jab(0); - Jab1(j1, 1) = Jab(1) + dC2*cos(hue + i*dH12); - Jab1(j1, 2) = Jab(2) + dC2*sin(hue + i*dH12); + Jab1(j1, 1) = Jab(1) + dC2 * cos(hue + i * dH12); + Jab1(j1, 2) = Jab(2) + dC2 * sin(hue + i * dH12); } /* for (int i = 0; i < 2; ++i) { @@ -165,14 +165,14 @@ void Tango::ColorLib::ColorConverter::ProcessHiveNeighbors(VectorXd Lab, VectorX //double *tmpRGB = DBG_NEW double[3]; double *InkOut = new double[m_nInks]; //double *InkOut = DBG_NEW double[m_nInks]; - + int *GamutRegion = new int[nHive + 1]; //int *GamutRegion = DBG_NEW int[nHive + 1]; double *Lab1P = new double[3]; //double *Lab1P = DBG_NEW double[3]; VectorXd Vol(m_nVolumes); int j = 0; - double * LabInFinal1= new double[3]; + double * LabInFinal1 = new double[3]; //double * LabInFinal1 = DBG_NEW double[3]; double * LabInFinal2; //= new double[3]; for (int i = 0; i < nHive; ++i) @@ -199,7 +199,7 @@ void Tango::ColorLib::ColorConverter::ProcessHiveNeighbors(VectorXd Lab, VectorX if (m_AdaptWP) { //Convert to Strip whitepoint - m_Conv02->ChangeWP(LabInFinal2, LabInFinal2, m_whitepointXYZ_Strip, m_whitepointXYZ_CT); + m_Conv02->ChangeWP(LabInFinal2, LabInFinal2, m_whitepointXYZ_Strip, m_whitepointXYZ_CT); } m_Conv02->SetReferenceWhite(D65); //Convert to RGB @@ -268,7 +268,7 @@ void Tango::ColorLib::ColorConverter::ProcessHiveNeighbors(VectorXd Lab, VectorX void Tango::ColorLib::ColorConverter::FindTriplet(VectorXd Lab, MatrixXd Lab1, int nHive, int*indDataMax) { - int vecSize = nHive*(nHive - 1) / 2; + int vecSize = nHive * (nHive - 1) / 2; double *dECMC = new double[vecSize]; //double *dECMC = DBG_NEW double[vecSize]; int i, j; @@ -278,13 +278,13 @@ void Tango::ColorLib::ColorConverter::FindTriplet(VectorXd Lab, MatrixXd Lab1, //int **indexpairs = DBG_NEW int*[vecSize]; for (i = 0; i < vecSize; ++i) indexpairs[i] = new int[2]; - //indexpairs[i] = DBG_NEW int[2]; + //indexpairs[i] = DBG_NEW int[2]; int ind = -1; ColorConvert ColConv(D65, D65); VectorXd Labi(3); VectorXd Labj(3); - + for (i = 0; i < nHive; ++i) { Labi << Lab1(i, 0), Lab1(i, 1), Lab1(i, 2); @@ -394,16 +394,16 @@ void Tango::ColorLib::ColorConverter::fillRGB(OutputCoordinates *outputCoords, V void Tango::ColorLib::ColorConverter::readColorTransformations(ConversionInput* conversionInput) { //Read thread white. Thread White is given in CIELab Space - - m_whitepointLab.Set(conversionInput->threadl, conversionInput->threada, conversionInput->threadb); - //White point in XYZ Color Space - ColorConvert CConvert(D65, D65); - C_RGB_XYZ_Lab tmpW; - tmpW = CConvert.LabToXYZ(m_whitepointLab); - m_whitepointXYZ_Strip.Set(tmpW.Get_x(), tmpW.Get_y(), tmpW.Get_z()); + + m_whitepointLab.Set(conversionInput->threadl, conversionInput->threada, conversionInput->threadb); + //White point in XYZ Color Space + ColorConvert CConvert(D65, D65); + C_RGB_XYZ_Lab tmpW; + tmpW = CConvert.LabToXYZ(m_whitepointLab); + m_whitepointXYZ_Strip.Set(tmpW.Get_x(), tmpW.Get_y(), tmpW.Get_z()); + - //parse Color Tansformations, placed in forward data int bytesread = 0; NumConversions conv; @@ -570,9 +570,9 @@ void Tango::ColorLib::ColorConverter::readCalibrationTables(ConversionInput* con for (int i = 0; i < m_nInks; ++i) { InputLiquid* InkType = conversionInput->inputcoordinates->inputliquids[i]; - + m_CalibCurves[i].SetCalibName((int)(InkType->calibrationdata->liquidtype)); - + m_CalibCurves[i].SetMaxNlPerCM(conversionInput->inputcoordinates->inputliquids[i]->maxnanoliterpercentimeter); switch (InkType->calibrationdata->liquidtype) { @@ -669,11 +669,11 @@ void Tango::ColorLib::ColorConverter::ConvertColorToLinearInks(ConversionInput* //double *RGBOutP = DBG_NEW double[3]; VectorToDouble(RGBOut, RGBOutP); //RGB to Lab - CConvertD65.RGBtoLab(RGBOutP, LabIn); //Values are in Relative Colorimetric, D65 + CConvertD65.RGBtoLab(RGBOutP, LabIn); //Values are in Relative Colorimetric, D65 double *LabInFinal = new double[3]; //double *LabInFinal = DBG_NEW double[3]; - memcpy(LabInFinal , LabIn, 3*sizeof(double)); + memcpy(LabInFinal, LabIn, 3 * sizeof(double)); //Is In Gamut? InGamut = IsInGamut(LabIn, sur); //convert to inks @@ -716,22 +716,22 @@ void Tango::ColorLib::ColorConverter::ConvertColorToLinearInks(ConversionInput* } if (LabIn != NULL) { - delete [] LabIn; + delete[] LabIn; LabIn = NULL; } if (RGBOutP != NULL) { - delete [] RGBOutP; + delete[] RGBOutP; RGBOutP = NULL; } if (RGBOutP1 != NULL) { - delete [] RGBOutP1; + delete[] RGBOutP1; RGBOutP1 = NULL; } if (LabInFinal != NULL) { - delete [] LabInFinal; + delete[] LabInFinal; LabInFinal = NULL; } break; @@ -754,7 +754,7 @@ void Tango::ColorLib::ColorConverter::ConvertColorToLinearInks(ConversionInput* ColorConvert CConvertD65(D65, D65); //Destination, source double *LabInFinal1 = new double[3]; //double *LabInFinal1 = DBG_NEW double[3]; - memcpy(LabInFinal1, LabIn, 3*sizeof(double)); + memcpy(LabInFinal1, LabIn, 3 * sizeof(double)); //LabInFinal1 = LabIn; // Lab is assumed to match the color of the STRIP, however the tables could have a different WP //Check if Color Tables and Strip whitepoints are the same, otherwise convert @@ -778,7 +778,7 @@ void Tango::ColorLib::ColorConverter::ConvertColorToLinearInks(ConversionInput* InkOut = DoubleToVector(InkOutP, m_nInks); double *LabOutFinal = new double[3]; //double *LabOutFinal = DBG_NEW double[3]; - memcpy(LabOutFinal , LabIn, 3*sizeof(double)); + memcpy(LabOutFinal, LabIn, 3 * sizeof(double)); //LabOutFinal is in Relative Colorimetric //Reverse the conversion process to bring back Lab to STRIP white point CConvertD65.ChangeWP(LabOutFinal, LabOutFinal, m_whitepointXYZ_CT, m_WP); @@ -788,7 +788,7 @@ void Tango::ColorLib::ColorConverter::ConvertColorToLinearInks(ConversionInput* } CConvertD65.SetReferenceWhite(D65); //Convert to RGB - double *RGBOutP = new double[3]; + double *RGBOutP = new double[3]; // double *RGBOutP = DBG_NEW double[3]; //CConvertD65.LabtoRGB(LabOutFinal, RGBOutP); CConvertD65.LabtoRGB(LabIn, RGBOutP); @@ -825,7 +825,7 @@ void Tango::ColorLib::ColorConverter::ConvertColorToLinearInks(ConversionInput* delete[] RGBOutP; RGBOutP = NULL; } - break; + break; } case(COLOR_SPACE__CMYK): @@ -839,8 +839,8 @@ void Tango::ColorLib::ColorConverter::ConvertColorToLinearInks(ConversionInput* outData[1] = (double)(conversionInput->inputcoordinates->magenta); outData[2] = (double)(conversionInput->inputcoordinates->yellow); outData[3] = conversionInput->inputcoordinates->key; - CountSep=4; - + CountSep = 4; + if (CountSep != m_nA2BnSepIn) { //mismatch between table and sent data @@ -881,10 +881,10 @@ void Tango::ColorLib::ColorConverter::ConvertColorToLinearInks(ConversionInput* //CConvertD65.LabtoRGB(LabOutFinal1, RGBOutP); CConvertD65.LabtoRGB(LabOutP, RGBOutP); RGBOut = DoubleToVector(RGBOutP, 3); - + if (outData != NULL) { - delete[] outData; + delete[] outData; outData = NULL; } if (LabOutP != NULL) @@ -904,17 +904,17 @@ void Tango::ColorLib::ColorConverter::ConvertColorToLinearInks(ConversionInput* } if (LabOutFinal1 != NULL) { - delete [] LabOutFinal1; + delete[] LabOutFinal1; LabOutFinal1 = NULL; } if (LabOutFinal2 != NULL) { - delete [] LabOutFinal2; + delete[] LabOutFinal2; LabOutFinal2 = NULL; } if (RGBOutP != NULL) { - delete [] RGBOutP; + delete[] RGBOutP; RGBOutP = NULL; } break; @@ -1014,7 +1014,7 @@ void Tango::ColorLib::ColorConverter::VolumeToNLInkP(VectorXd Volume, VectorXd & //Solve System of Linear Equations MatrixXd MatNLIInv(m_nVolumes - 1, m_nVolumes - 1); MatNLIInv = MatNLI.inverse(); - VectorXd Result = MatNLIInv*RHSide; + VectorXd Result = MatNLIInv * RHSide; //VectorXd Result = MatNLI.colPivHouseholderQr().solve(RHSide); //rearrange solution ind = -1; @@ -1049,13 +1049,13 @@ void Tango::ColorLib::ColorConverter::NLInkPToVolume(VectorXd NLInk, VectorXd &V { for (i = 0; i < m_nInks; ++i) { - InkNorm(i) = MaxInk*NLInk(i) / InkSum; + InkNorm(i) = MaxInk * NLInk(i) / InkSum; Volume(i) = InkNorm(i); // InkNorm(i) * m_maxNlPerCM(i) / 100; // Volume is in % } // Round to k decimal digits, verify that sum in within allowed values. double sumNorm = 0.0; double RsumNorm = 0.0; - VectorXd RVolNorm(m_nInks); + VectorXd RVolNorm(m_nInks); double ROUNDINGTol = pow(10, ROUNDINGDigits); for (i = 0; i < m_nInks; ++i) @@ -1102,7 +1102,7 @@ void Tango::ColorLib::ColorConverter::ConvertVolumeToRGBDisplay(ConversionInput* // Set Calibration Data LiquidType LQ; if (m_CalibCurves == NULL) - { + { m_CalibCurves = new CalibData[m_nInks]; //m_CalibCurves = DBG_NEW CalibData[m_nInks]; for (int i = 0; i < m_nVolumes; ++i) @@ -1150,13 +1150,13 @@ void Tango::ColorLib::ColorConverter::ConvertVolumeToRGBDisplay(ConversionInput* LabOutFinal = LabOutFinal1; if (m_AdaptWP) { - CConvertD65.ChangeWP(LabOutFinal, LabOutFinal, m_whitepointXYZ_Strip, m_whitepointXYZ_CT); + CConvertD65.ChangeWP(LabOutFinal, LabOutFinal, m_whitepointXYZ_Strip, m_whitepointXYZ_CT); } CConvertD65.SetReferenceWhite(D65); double *RGBOutP = new double[3]; //double *RGBOutP = DBG_NEW double[3]; //CConvertD65.LabtoRGB(LabOutFinal, RGBOutP); - CConvertD65.LabtoRGB(LabOutP, RGBOutP); + CConvertD65.LabtoRGB(LabOutP, RGBOutP); for (int i = 0; i < 3; ++i) { RGBOut(i) = RGBOutP[i]; @@ -1175,12 +1175,12 @@ void Tango::ColorLib::ColorConverter::ConvertVolumeToRGBDisplay(ConversionInput* } if (RGBOutP != NULL) { - delete [] RGBOutP; + delete[] RGBOutP; RGBOutP = NULL; } if (LabOutFinal1 != NULL) { - delete [] LabOutFinal1; + delete[] LabOutFinal1; LabOutFinal1 = NULL; } return; @@ -1218,9 +1218,9 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i //Filter and arrange colors (Should change from 3 to 4 if black ink is included) - + int numofInks = CountNumberofInks(conversionInput); - if(numofInks <0) + if (numofInks < 0) throw std::exception("Duplicate inks"); int expected_liquids = numofInks; original_input_liquids_count = conversionInput->inputcoordinates->n_inputliquids; @@ -1268,32 +1268,32 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i // int numofInks = CountNumberofInks(conversionInput); readColorTransformations(conversionInput); - //read calibration tables and store them in m_CalibCurves - - readCalibrationTables(conversionInput); - m_LinInterp = new Interp[numofInks]; - //m_LinInterp = DBG_NEW Interp[numofInks]; - m_InvLinInterp = new Interp[numofInks]; - //m_InvLinInterp = DBG_NEW Interp[numofInks]; - InitInterpolations(numofInks, m_LinInterp, m_InvLinInterp); - - //Initialize CIECAM02 transformation - Illum IL = D65; - SURROUND sur = average; - CAM02CS CS = UCS; - m_Conv02 = new ColorConvert(IL, IL, Y_b, L_A, sur, CS); - //m_Conv02 = DBG_NEW ColorConvert(IL, IL, Y_b, L_A, sur, CS); - SetnA2BnSepIn(m_A2BTransform->GetSeparationsIn()); - SetnA2BnSepOut(m_A2BTransform->GetSeparationsOut()); - SetnB2AnSepIn(m_B2ATransform->GetSeparationsIn()); - SetnB2AnSepOut(m_B2ATransform->GetSeparationsOut()); - - SetNumberOfInks(m_nB2AnSepOut); - // Compare Strip White point to Color Table White Point - CompareWhitePoints(); - - if (numofInks != m_nB2AnSepOut) - throw std::exception("Number of available inks does not match ink tables"); + //read calibration tables and store them in m_CalibCurves + + readCalibrationTables(conversionInput); + m_LinInterp = new Interp[numofInks]; + //m_LinInterp = DBG_NEW Interp[numofInks]; + m_InvLinInterp = new Interp[numofInks]; + //m_InvLinInterp = DBG_NEW Interp[numofInks]; + InitInterpolations(numofInks, m_LinInterp, m_InvLinInterp); + + //Initialize CIECAM02 transformation + Illum IL = D65; + SURROUND sur = average; + CAM02CS CS = UCS; + m_Conv02 = new ColorConvert(IL, IL, Y_b, L_A, sur, CS); + //m_Conv02 = DBG_NEW ColorConvert(IL, IL, Y_b, L_A, sur, CS); + SetnA2BnSepIn(m_A2BTransform->GetSeparationsIn()); + SetnA2BnSepOut(m_A2BTransform->GetSeparationsOut()); + SetnB2AnSepIn(m_B2ATransform->GetSeparationsIn()); + SetnB2AnSepOut(m_B2ATransform->GetSeparationsOut()); + + SetNumberOfInks(m_nB2AnSepOut); + // Compare Strip White point to Color Table White Point + CompareWhitePoints(); + + if (numofInks != m_nB2AnSepOut) + throw std::exception("Number of available inks does not match ink tables"); VectorXd InkOut(m_nB2AnSepOut); VectorXd RGBOut(3); @@ -1332,86 +1332,88 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i conversionOutput->singlecoordinates = outputCoords; - //input was processed. - //process neighboring values - //nhive includes 2 outer neighbors of the central Lab value, chroma + delta, chroma + 2delta - // and variation in L positioned on the side of the beehive. - //The set is arrange in a 5x6 matrix, where the 5x5 contains the variation in (Hue, chroma) - // and the last 5 contain the variation in L - int nHive = 18; //22; // 18; - int MatHive = 25;// 30; //25; - - MatrixXd RGBHive(MatHive, 3); - VectorXd RGBHive1(3); - VectorXd VolumeHive1(m_nVolumes); - MatrixXd VolumeHive(MatHive, m_nVolumes); - int *GamutRegionV = new int[MatHive]; - //int *GamutRegionV = DBG_NEW int[MatHive]; - for (int i = 0; i < MatHive ; ++i) - GamutRegionV[i] = -1; - - int indDataMax[2]; - int j = 0; - // Matrix values are initially set to -1; - RGBHive.setConstant(NegValue); - VolumeHive.setConstant(NegValue); - - ProcessHiveNeighbors(LabOut, RGBOut, Volume, GamutRegion, RGBHive, VolumeHive, nHive, GamutRegionV, indDataMax); - OutputCoordinates** hiveData = (OutputCoordinates**)malloc(sizeof(OutputCoordinates*) * MatHive); - conversionOutput->hivecoordinates = hiveData; - conversionOutput->n_hivecoordinates = MatHive; - conversionOutput->n_triplecoordinates = 3; - for (int i = 0; i < MatHive; i++) - { - // OutputCoordinates SingleCell = OUTPUT_COORDINATES__INIT; - hiveData[i] = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); - output_coordinates__init(hiveData[i]); - if (RGBHive(i, 0) != NegValue) + if (!conversionInput->singlemode) //Skip if input requests single result only. { - for (j = 0; j < 3; ++j) - RGBHive1(j) = RGBHive(i, j); - fillRGB(hiveData[i], RGBHive1); - for (j = 0; j < m_nVolumes; ++j) - VolumeHive1(j) = VolumeHive(i, j); - fillVolume(hiveData[i], VolumeHive1); - hiveData[i]->has_processparameterstableindex = true; - hiveData[i]->processparameterstableindex = GamutRegionV[i]; - hiveData[i]->n_outputliquids = m_nInks; - } - conversionOutput->hivecoordinates[i] = hiveData[i]; - } + //input was processed. + //process neighboring values + //nhive includes 2 outer neighbors of the central Lab value, chroma + delta, chroma + 2delta + // and variation in L positioned on the side of the beehive. + //The set is arrange in a 5x6 matrix, where the 5x5 contains the variation in (Hue, chroma) + // and the last 5 contain the variation in L + int nHive = 18; //22; // 18; + int MatHive = 25;// 30; //25; + + MatrixXd RGBHive(MatHive, 3); + VectorXd RGBHive1(3); + VectorXd VolumeHive1(m_nVolumes); + MatrixXd VolumeHive(MatHive, m_nVolumes); + int *GamutRegionV = new int[MatHive]; + //int *GamutRegionV = DBG_NEW int[MatHive]; + for (int i = 0; i < MatHive; ++i) + GamutRegionV[i] = -1; + + int indDataMax[2]; + int j = 0; + // Matrix values are initially set to -1; + RGBHive.setConstant(NegValue); + VolumeHive.setConstant(NegValue); + + ProcessHiveNeighbors(LabOut, RGBOut, Volume, GamutRegion, RGBHive, VolumeHive, nHive, GamutRegionV, indDataMax); + OutputCoordinates** hiveData = (OutputCoordinates**)malloc(sizeof(OutputCoordinates*) * MatHive); + conversionOutput->hivecoordinates = hiveData; + conversionOutput->n_hivecoordinates = MatHive; + conversionOutput->n_triplecoordinates = 3; + for (int i = 0; i < MatHive; i++) + { + // OutputCoordinates SingleCell = OUTPUT_COORDINATES__INIT; + hiveData[i] = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); + output_coordinates__init(hiveData[i]); + if (RGBHive(i, 0) != NegValue) + { + for (j = 0; j < 3; ++j) + RGBHive1(j) = RGBHive(i, j); + fillRGB(hiveData[i], RGBHive1); + for (j = 0; j < m_nVolumes; ++j) + VolumeHive1(j) = VolumeHive(i, j); + fillVolume(hiveData[i], VolumeHive1); + hiveData[i]->has_processparameterstableindex = true; + hiveData[i]->processparameterstableindex = GamutRegionV[i]; + hiveData[i]->n_outputliquids = m_nInks; + } + conversionOutput->hivecoordinates[i] = hiveData[i]; + } - //Triplet - OutputCoordinates** TripletData = (OutputCoordinates**)malloc(sizeof(OutputCoordinates*) * 3); - conversionOutput->triplecoordinates = TripletData; - int tripletIndex[3] = { indDataMax[0] , (int)(12), indDataMax[1] }; - for (int i = 0; i < 3; ++i) - { - // OutputCoordinates SingleCell = OUTPUT_COORDINATES__INIT; - TripletData[i] = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); - output_coordinates__init(TripletData[i]); - for (j = 0; j < 3; ++j) - RGBHive1(j) = RGBHive(tripletIndex[i], j); - fillRGB(TripletData[i], RGBHive1); - for (j = 0; j < m_nVolumes; ++j) - VolumeHive1(j) = VolumeHive(tripletIndex[i], j); - fillVolume(TripletData[i], VolumeHive1); - TripletData[i]->has_processparameterstableindex = true; - TripletData[i]->processparameterstableindex = GamutRegionV[tripletIndex[i]]; - TripletData[i]->n_outputliquids = m_nInks; - conversionOutput->triplecoordinates[i] = TripletData[i]; - } - - //Clean up - if (GamutRegionV != NULL) - { - delete [] GamutRegionV; - GamutRegionV = NULL; - } + //Triplet + OutputCoordinates** TripletData = (OutputCoordinates**)malloc(sizeof(OutputCoordinates*) * 3); + conversionOutput->triplecoordinates = TripletData; + int tripletIndex[3] = { indDataMax[0] , (int)(12), indDataMax[1] }; + for (int i = 0; i < 3; ++i) + { + // OutputCoordinates SingleCell = OUTPUT_COORDINATES__INIT; + TripletData[i] = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); + output_coordinates__init(TripletData[i]); + for (j = 0; j < 3; ++j) + RGBHive1(j) = RGBHive(tripletIndex[i], j); + fillRGB(TripletData[i], RGBHive1); + for (j = 0; j < m_nVolumes; ++j) + VolumeHive1(j) = VolumeHive(tripletIndex[i], j); + fillVolume(TripletData[i], VolumeHive1); + TripletData[i]->has_processparameterstableindex = true; + TripletData[i]->processparameterstableindex = GamutRegionV[tripletIndex[i]]; + TripletData[i]->n_outputliquids = m_nInks; + conversionOutput->triplecoordinates[i] = TripletData[i]; + } + //Clean up + if (GamutRegionV != NULL) + { + delete[] GamutRegionV; + GamutRegionV = NULL; + } + } - //Pack output... + //Pack output... output_buffer = (uint8_t*)malloc(conversion_output__get_packed_size(conversionOutput)); int size = conversion_output__pack(conversionOutput, output_buffer); @@ -1437,7 +1439,7 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i conversionOutput->has_haserror = true; conversionOutput->haserror = true; - const char* what = e.what(); + const char* what = e.what(); conversionOutput->errormessage = (char*)malloc(strlen(what)); strcpy(conversionOutput->errormessage, e.what()); @@ -1458,13 +1460,11 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i } } - - void Tango::ColorLib::ColorConverter::InitInterpolations(int numofInks, Interp *linearInterp, Interp *InvLinearInterp) { double *xCoords; double *yCoords; - + for (int i = 0; i < numofInks; ++i) { xCoords = m_CalibCurves[i].getxCoords(); @@ -1534,7 +1534,7 @@ int Tango::ColorLib::ColorConverter::CountNumberofInks(ConversionInput* conversi bool Tango::ColorLib::ColorConverter::IsInGamut(double *InLab, SURROUND sur) { - int nInLab =3; + int nInLab = 3; double *xCoord = new double[nInLab]; //double *xCoord = DBG_NEW double[nInLab]; //Convert InLab to CIECam02 coordinates @@ -1557,7 +1557,7 @@ bool Tango::ColorLib::ColorConverter::IsInGamut(double *InLab, SURROUND sur) VectorXd V1(3); VectorXd V2(3); V1 << JLab[0], JLab[1], JLab[2]; - V2<< xCoord[0], xCoord[1], xCoord[2]; + V2 << xCoord[0], xCoord[1], xCoord[2]; double dECMC; m_Conv02->SymmetricaldECMC(V1, V2, dECMC); if (dECMC < dETol) @@ -1602,12 +1602,12 @@ Tango::CT_Header Tango::ColorLib::ColorConverter::read_header(ConversionInput* c Header.Version[2] = versionBCT[1] & 15; bytesread += 1; uint32_t tmp = Conv.ByteToInt(ColorTable, bytesread); - int n = sizeof((char*)&tmp); + int n = sizeof((char*)&tmp); //char *tmpC = DBG_NEW char[n]; char *tmpC = new char[n]; - Conv.getchar(tmp, n, tmpC); + Conv.getchar(tmp, n, tmpC); //Header.ColorSpace = DBG_NEW char[n]; - Header.ColorSpace = new char[n]; + Header.ColorSpace = new char[n]; memcpy_s(Header.ColorSpace, n + 1, tmpC, n); // strncpy_s(Header->ColorSpace, n+1, tmpC, n); //Header->ColorSpace = tmpC; @@ -1625,8 +1625,8 @@ Tango::CT_Header Tango::ColorLib::ColorConverter::read_header(ConversionInput* c //Header.DeviceManufacturer = DBG_NEW char[n]; Header.DeviceManufacturer = new char[n]; memcpy_s(Header.DeviceManufacturer, n + 1, tmpC, n); -// strncpy_s(Header->DeviceManufacturer, n + 1, tmpC, n); - //Header->DeviceManufacturer = tmpC; + // strncpy_s(Header->DeviceManufacturer, n + 1, tmpC, n); + //Header->DeviceManufacturer = tmpC; delete[]tmpC; bytesread += 4; //read illuminant @@ -1689,7 +1689,7 @@ void Tango::ColorLib::ColorConverter::read_xyz_type(int offset, int data_size, C NumConversions Conv; int bytesread = 0; int tmpxyz = Conv.ByteToInt(buff, bytesread); - + int n = sizeof(tmpxyz); //char* tmpC = DBG_NEW char[n]; char* tmpC = new char[n]; @@ -2042,7 +2042,7 @@ size_t Tango::ColorLib::ColorConverter::P_IsInGamut(uint8_t * input_buffer, size //read calibration tables and store them in m_CalibCurves readCalibrationTables(conversionInput); - + //Initialize CIECAM02 transformation Illum IL = D65; SURROUND sur = average; @@ -2066,120 +2066,120 @@ size_t Tango::ColorLib::ColorConverter::P_IsInGamut(uint8_t * input_buffer, size VectorXd LabOut(3); VectorXd NLInkOut(m_nB2AnSepOut); VectorXd Volume(m_nB2AnSepOut); - + C_RGB_XYZ_Lab DataLab; //SURROUND sur = m_Conv02->getSurround(); switch (conversionInput->colorspace) { case (COLOR_SPACE__RGB): { - // Basic assumption: if data is given in RGB space, conversion should be in relative colorimetric, - //We expect that [255,255,255](white) will be mapped to the thread white, meaning all inks should be zero - // and the coverted RGB will refect the color of the thread - //The workflow is a follows: - //1. Convert RGB to Lab (Whitepoint is D65, same as tables) - //2.Fiond if Lab is InGamut - - RGBOut(0) = conversionInput->inputcoordinates->red; - RGBOut(1) = conversionInput->inputcoordinates->green; - RGBOut(2) = conversionInput->inputcoordinates->blue; - //convert to Lab - ColorConvert CConvertD65(D65, D65); //Destination, source - //double *LabIn = DBG_NEW double[3]; - //double *RGBOutP = DBG_NEW double[3]; - double *LabIn = new double[3]; - double *RGBOutP = new double[3]; - VectorToDouble(RGBOut, RGBOutP); - //RGB to Lab - CConvertD65.RGBtoLab(RGBOutP, LabIn); //Values are in Relative Colorimetric, D65 - - //Is In Gamut? - InGamut = IsInGamut(LabIn, sur); - - if (LabIn != NULL) - { - delete [] LabIn; - LabIn = NULL; - } - if (RGBOutP != NULL) - { - delete [] RGBOutP; - RGBOutP = NULL; - } - break; + // Basic assumption: if data is given in RGB space, conversion should be in relative colorimetric, + //We expect that [255,255,255](white) will be mapped to the thread white, meaning all inks should be zero + // and the coverted RGB will refect the color of the thread + //The workflow is a follows: + //1. Convert RGB to Lab (Whitepoint is D65, same as tables) + //2.Fiond if Lab is InGamut + + RGBOut(0) = conversionInput->inputcoordinates->red; + RGBOut(1) = conversionInput->inputcoordinates->green; + RGBOut(2) = conversionInput->inputcoordinates->blue; + //convert to Lab + ColorConvert CConvertD65(D65, D65); //Destination, source + //double *LabIn = DBG_NEW double[3]; + //double *RGBOutP = DBG_NEW double[3]; + double *LabIn = new double[3]; + double *RGBOutP = new double[3]; + VectorToDouble(RGBOut, RGBOutP); + //RGB to Lab + CConvertD65.RGBtoLab(RGBOutP, LabIn); //Values are in Relative Colorimetric, D65 + + //Is In Gamut? + InGamut = IsInGamut(LabIn, sur); + + if (LabIn != NULL) + { + delete[] LabIn; + LabIn = NULL; } - case (COLOR_SPACE__LAB): + if (RGBOutP != NULL) { - // Basic assumption: Lab data has the same whitepoint as the STRIP thread. - //The workflow is a follows: - //1. Convert Lab to Relative colorimetric. check if there is a match between STRIP and Color Tables - //2. Find if Lab is InGamut - - double *LabIn = new double[3]; - //double *LabIn = DBG_NEW double[3]; - LabIn[0] = conversionInput->inputcoordinates->l; - LabIn[1] = conversionInput->inputcoordinates->a; - LabIn[2] = conversionInput->inputcoordinates->b; - //the assumption is that the color space has illumination that matches the whitepoint of the Strip - ColorConvert CConvertD65(D65, D65); //Destination, source - double *LabInFinal1 = new double[3]; - //double *LabInFinal1 = DBG_NEW double[3]; - memcpy(LabInFinal1, LabIn, 3*sizeof(double)); - // Lab is assumed to match the color of the STRIP, however the tables could have a different WP - //Check if Color Tables and Strip whitepoints are the same, otherwise convert - if (m_AdaptWP) - { - CConvertD65.ChangeWP(LabInFinal1, LabInFinal1, m_whitepointXYZ_CT, m_whitepointXYZ_Strip); //to Color Tables - LabIn = LabInFinal1; - } - double *LabInFinal2 = new double[3]; - //double *LabInFinal2 = DBG_NEW double[3]; - CConvertD65.ChangeWP(LabIn, LabInFinal2, m_WP, m_whitepointXYZ_CT); //to Relative - InGamut = IsInGamut(LabInFinal2, sur); - - if (LabIn != NULL) - { - delete[] LabIn; - LabIn = NULL; - } - if (LabInFinal1 != NULL) - { - delete[]LabInFinal1; - LabInFinal1 = NULL; - } - if (LabInFinal2 != NULL) - { - delete[]LabInFinal2; - LabInFinal2 = NULL; - } - break; + delete[] RGBOutP; + RGBOutP = NULL; } - case(COLOR_SPACE__CMYK): - {//no conversion - //missing from structure light inks or special colors - // just convert Lab for rgb display - InGamut = true; + break; + } + case (COLOR_SPACE__LAB): + { + // Basic assumption: Lab data has the same whitepoint as the STRIP thread. + //The workflow is a follows: + //1. Convert Lab to Relative colorimetric. check if there is a match between STRIP and Color Tables + //2. Find if Lab is InGamut + + double *LabIn = new double[3]; + //double *LabIn = DBG_NEW double[3]; + LabIn[0] = conversionInput->inputcoordinates->l; + LabIn[1] = conversionInput->inputcoordinates->a; + LabIn[2] = conversionInput->inputcoordinates->b; + //the assumption is that the color space has illumination that matches the whitepoint of the Strip + ColorConvert CConvertD65(D65, D65); //Destination, source + double *LabInFinal1 = new double[3]; + //double *LabInFinal1 = DBG_NEW double[3]; + memcpy(LabInFinal1, LabIn, 3 * sizeof(double)); + // Lab is assumed to match the color of the STRIP, however the tables could have a different WP + //Check if Color Tables and Strip whitepoints are the same, otherwise convert + if (m_AdaptWP) + { + CConvertD65.ChangeWP(LabInFinal1, LabInFinal1, m_whitepointXYZ_CT, m_whitepointXYZ_Strip); //to Color Tables + LabIn = LabInFinal1; + } + double *LabInFinal2 = new double[3]; + //double *LabInFinal2 = DBG_NEW double[3]; + CConvertD65.ChangeWP(LabIn, LabInFinal2, m_WP, m_whitepointXYZ_CT); //to Relative + InGamut = IsInGamut(LabInFinal2, sur); + + if (LabIn != NULL) + { + delete[] LabIn; + LabIn = NULL; } - case(COLOR_SPACE__PANTON): + if (LabInFinal1 != NULL) { - int32_t inData; - if (conversionInput->inputcoordinates->has_pantoncode) - inData = conversionInput->inputcoordinates->pantoncode; - else - { - //mismatch between color space and data - throw std::exception("Mismatch between color space and data"); - return(0); - } - break; - //missing calclulation method and pantone table, either in terms of RGB or CMY or Lab + delete[]LabInFinal1; + LabInFinal1 = NULL; } - default: + if (LabInFinal2 != NULL) { - throw std::exception(" Unsupported Color Space"); - return(0); + delete[]LabInFinal2; + LabInFinal2 = NULL; } + break; + } + case(COLOR_SPACE__CMYK): + {//no conversion + //missing from structure light inks or special colors + // just convert Lab for rgb display + InGamut = true; + } + case(COLOR_SPACE__PANTON): + { + int32_t inData; + if (conversionInput->inputcoordinates->has_pantoncode) + inData = conversionInput->inputcoordinates->pantoncode; + else + { + //mismatch between color space and data + throw std::exception("Mismatch between color space and data"); + return(0); } + break; + //missing calclulation method and pantone table, either in terms of RGB or CMY or Lab + } + default: + { + throw std::exception(" Unsupported Color Space"); + return(0); + } + } //Pack data OutputCoordinates *outputCoords = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.c b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.c index d71d3ac3b..5c4a964e6 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.c +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.c @@ -52,7 +52,7 @@ void conversion_input__free_unpacked assert(message->base.descriptor == &conversion_input__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } -static const ProtobufCFieldDescriptor conversion_input__field_descriptors[11] = +static const ProtobufCFieldDescriptor conversion_input__field_descriptors[12] = { { "ThreadL", @@ -186,6 +186,18 @@ static const ProtobufCFieldDescriptor conversion_input__field_descriptors[11] = 0, /* flags */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "SingleMode", + 12, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(ConversionInput, has_singlemode), + offsetof(ConversionInput, singlemode), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned conversion_input__field_indices_by_name[] = { 3, /* field[3] = ColorSpace */ @@ -196,6 +208,7 @@ static const unsigned conversion_input__field_indices_by_name[] = { 6, /* field[6] = InverseData */ 10, /* field[10] = ProcessRanges */ 7, /* field[7] = SegmentLength */ + 11, /* field[11] = SingleMode */ 1, /* field[1] = ThreadA */ 2, /* field[2] = ThreadB */ 0, /* field[0] = ThreadL */ @@ -203,7 +216,7 @@ static const unsigned conversion_input__field_indices_by_name[] = { static const ProtobufCIntRange conversion_input__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 11 } + { 0, 12 } }; const ProtobufCMessageDescriptor conversion_input__descriptor = { @@ -213,7 +226,7 @@ const ProtobufCMessageDescriptor conversion_input__descriptor = "ConversionInput", "", sizeof(ConversionInput), - 11, + 12, conversion_input__field_descriptors, conversion_input__field_indices_by_name, 1, conversion_input__number_ranges, diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.h b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.h index eac601d16..1dd3b5e85 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.h +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/ConversionInput.pb-c.h @@ -50,10 +50,12 @@ struct _ConversionInput double deltal; size_t n_processranges; ProcessRange **processranges; + protobuf_c_boolean has_singlemode; + protobuf_c_boolean singlemode; }; #define CONVERSION_INPUT__INIT \ { PROTOBUF_C_MESSAGE_INIT (&conversion_input__descriptor) \ - , 0, 0, 0, 0, 0, 0, 0, COLOR_SPACE__Volume, NULL, 0, {0,NULL}, 0, {0,NULL}, 0, 0, 0, 0, 0, 0, 0,NULL } + , 0, 0, 0, 0, 0, 0, 0, COLOR_SPACE__Volume, NULL, 0, {0,NULL}, 0, {0,NULL}, 0, 0, 0, 0, 0, 0, 0,NULL, 0, 0 } /* ConversionInput methods */ diff --git a/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs index 3c8a58459..37a246f10 100644 --- a/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs +++ b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs @@ -64,7 +64,7 @@ namespace Tango.BL.ColorConversion return output; } - public static ConversionOutput GetSuggestions(Job job, Color color) + public static ConversionOutput GetSuggestions(Job job, Color color, bool singleMode = false) { ConversionInput conversionInput = new ConversionInput(); @@ -79,6 +79,8 @@ namespace Tango.BL.ColorConversion conversionInput.ThreadA = 2.2555;//brushStop.Segment.Job.Rml.WhitePoint.A; conversionInput.ThreadB = -10.9325;//brushStop.Segment.Job.Rml.WhitePoint.B; + conversionInput.SingleMode = singleMode; + conversionInput.ForwardData = ByteString.CopyFrom(job.Rml.Ccts.FirstOrDefault().ForwardData); foreach (var processTable in job.Rml.ProcessParametersTablesGroups.First(x => x.Active).ProcessParametersTables) @@ -167,6 +169,11 @@ namespace Tango.BL.ColorConversion return suggestions; } + public static ColorConversionSuggestion CreateSingleSuggestion(ConversionOutput conversionOutput) + { + return new ColorConversionSuggestion(conversionOutput.SingleCoordinates, 0, 0); + } + public static bool IsOutOfGamut(BrushStop brushStop) { return GetSuggestions(brushStop).OutOfGamut; diff --git a/Software/Visual_Studio/Tango.BL/Entities/Segment.cs b/Software/Visual_Studio/Tango.BL/Entities/Segment.cs index 4e740f312..4cb7c47f0 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Segment.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Segment.cs @@ -307,6 +307,11 @@ namespace Tango.BL.Entities return Job.OrderedSegments.LastOrDefault(x => x.SegmentIndex < SegmentIndex); } + public List GetPreviousSegments() + { + return Job.OrderedSegments.Where(x => x.SegmentIndex < SegmentIndex).ToList(); + } + /// /// Gets the duration estimation for this job. /// diff --git a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs index 2f531a95f..45d31d9be 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs @@ -41,20 +41,23 @@ namespace Tango.Integration.Operation /// public DefaultGradientGenerationConfiguration() { - ResolutionCM = 10; + ResolutionCM = 50; } /// /// Creates a collection of brush stops representing the required gradient steps. /// /// The segment. + /// The job /// The process parameters. /// Progress callback. /// - public List Generate(Segment segment, ProcessParametersTable processParameters, Action progress = null) + public List Generate(Segment segment, Job job, ProcessParametersTable processParameters, Action progress = null) { List stops = new List(); + var previousSegmentsLength = segment.GetPreviousSegments().Sum(x => x.Length); + int stopIndex = 1; for (double cm = 0; cm < segment.Length; cm += (ResolutionCM / 100d)) @@ -62,7 +65,7 @@ namespace Tango.Integration.Operation double offset = (double)cm / segment.Length; var color = GetRelativeColor(segment.BrushStops.ToList(), offset); - var output = TangoColorConverter.GetSuggestions(segment.Job, color); + var output = TangoColorConverter.GetSuggestions(segment.Job, color, true); BrushStop s = new BrushStop(); s.Segment = segment; @@ -82,17 +85,17 @@ namespace Tango.Integration.Operation progress?.Invoke(new PreparingJobProgressEventArgs() { - Job = segment.Job, - Total = segment.Length, - Progress = cm, + Job = job, + Total = job.Length, + Progress = previousSegmentsLength + cm, }); } progress?.Invoke(new PreparingJobProgressEventArgs() { - Job = segment.Job, - Total = segment.Length, - Progress = segment.Length, + Job = job, + Total = job.Length, + Progress = previousSegmentsLength + segment.Length, }); return stops; diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IGradientGenerationConfiguration.cs b/Software/Visual_Studio/Tango.Integration/Operation/IGradientGenerationConfiguration.cs index 238d80d61..510b0149d 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IGradientGenerationConfiguration.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IGradientGenerationConfiguration.cs @@ -26,9 +26,10 @@ namespace Tango.Integration.Operation /// Creates a collection of brush stops representing the required gradient steps. /// /// The segment. + /// The job /// The process parameters. /// Progress callback. /// - List Generate(Segment segment, ProcessParametersTable processParameters, Action progress = null); + List Generate(Segment segment, Job job, ProcessParametersTable processParameters, Action progress = null); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index ba9d21451..4a2ecc9f0 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -951,9 +951,9 @@ namespace Tango.Integration.Operation var stops = segment.BrushStops.ToList(); - if (GradientGenerationConfiguration != null && GradientGenerationConfiguration.IsEnabled) + if (GradientGenerationConfiguration != null && GradientGenerationConfiguration.IsEnabled && segment.BrushStops.Count > 1) { - GradientGenerationConfiguration.Generate(segment, processParameters, (e) => + stops = GradientGenerationConfiguration.Generate(segment, job, processParameters, (e) => { PreparingJobProgress?.Invoke(this, e); }); diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs index bde03fc8a..70de7e843 100644 --- a/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs @@ -24,7 +24,7 @@ namespace Tango.PMR.ColorLab { string.Concat( "ChVDb252ZXJzaW9uSW5wdXQucHJvdG8SElRhbmdvLlBNUi5Db2xvckxhYhoW", "SW5wdXRDb29yZGluYXRlcy5wcm90bxoQQ29sb3JTcGFjZS5wcm90bxoSUHJv", - "Y2Vzc1JhbmdlLnByb3RvItcCCg9Db252ZXJzaW9uSW5wdXQSDwoHVGhyZWFk", + "Y2Vzc1JhbmdlLnByb3RvIusCCg9Db252ZXJzaW9uSW5wdXQSDwoHVGhyZWFk", "TBgBIAEoARIPCgdUaHJlYWRBGAIgASgBEg8KB1RocmVhZEIYAyABKAESMgoK", "Q29sb3JTcGFjZRgEIAEoDjIeLlRhbmdvLlBNUi5Db2xvckxhYi5Db2xvclNw", "YWNlEj4KEElucHV0Q29vcmRpbmF0ZXMYBSABKAsyJC5UYW5nby5QTVIuQ29s", @@ -32,11 +32,12 @@ namespace Tango.PMR.ColorLab { "CgtJbnZlcnNlRGF0YRgHIAEoDBIVCg1TZWdtZW50TGVuZ3RoGAggASgBEhMK", "C0RlbHRhQ2hyb21hGAkgASgBEg4KBkRlbHRhTBgKIAEoARI3Cg1Qcm9jZXNz", "UmFuZ2VzGAsgAygLMiAuVGFuZ28uUE1SLkNvbG9yTGFiLlByb2Nlc3NSYW5n", - "ZUIeChxjb20udHdpbmUudGFuZ28ucG1yLmNvbG9ybGFiYgZwcm90bzM=")); + "ZRISCgpTaW5nbGVNb2RlGAwgASgIQh4KHGNvbS50d2luZS50YW5nby5wbXIu", + "Y29sb3JsYWJiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.ColorLab.InputCoordinatesReflection.Descriptor, global::Tango.PMR.ColorLab.ColorSpaceReflection.Descriptor, global::Tango.PMR.ColorLab.ProcessRangeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.ConversionInput), global::Tango.PMR.ColorLab.ConversionInput.Parser, new[]{ "ThreadL", "ThreadA", "ThreadB", "ColorSpace", "InputCoordinates", "ForwardData", "InverseData", "SegmentLength", "DeltaChroma", "DeltaL", "ProcessRanges" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.ConversionInput), global::Tango.PMR.ColorLab.ConversionInput.Parser, new[]{ "ThreadL", "ThreadA", "ThreadB", "ColorSpace", "InputCoordinates", "ForwardData", "InverseData", "SegmentLength", "DeltaChroma", "DeltaL", "ProcessRanges", "SingleMode" }, null, null, null) })); } #endregion @@ -78,6 +79,7 @@ namespace Tango.PMR.ColorLab { deltaChroma_ = other.deltaChroma_; deltaL_ = other.deltaL_; processRanges_ = other.processRanges_.Clone(); + singleMode_ = other.singleMode_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -205,6 +207,17 @@ namespace Tango.PMR.ColorLab { get { return processRanges_; } } + /// Field number for the "SingleMode" field. + public const int SingleModeFieldNumber = 12; + private bool singleMode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool SingleMode { + get { return singleMode_; } + set { + singleMode_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ConversionInput); @@ -229,6 +242,7 @@ namespace Tango.PMR.ColorLab { if (DeltaChroma != other.DeltaChroma) return false; if (DeltaL != other.DeltaL) return false; if(!processRanges_.Equals(other.processRanges_)) return false; + if (SingleMode != other.SingleMode) return false; return true; } @@ -246,6 +260,7 @@ namespace Tango.PMR.ColorLab { if (DeltaChroma != 0D) hash ^= DeltaChroma.GetHashCode(); if (DeltaL != 0D) hash ^= DeltaL.GetHashCode(); hash ^= processRanges_.GetHashCode(); + if (SingleMode != false) hash ^= SingleMode.GetHashCode(); return hash; } @@ -297,6 +312,10 @@ namespace Tango.PMR.ColorLab { output.WriteDouble(DeltaL); } processRanges_.WriteTo(output, _repeated_processRanges_codec); + if (SingleMode != false) { + output.WriteRawTag(96); + output.WriteBool(SingleMode); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -333,6 +352,9 @@ namespace Tango.PMR.ColorLab { size += 1 + 8; } size += processRanges_.CalculateSize(_repeated_processRanges_codec); + if (SingleMode != false) { + size += 1 + 1; + } return size; } @@ -375,6 +397,9 @@ namespace Tango.PMR.ColorLab { DeltaL = other.DeltaL; } processRanges_.Add(other.processRanges_); + if (other.SingleMode != false) { + SingleMode = other.SingleMode; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -432,6 +457,10 @@ namespace Tango.PMR.ColorLab { processRanges_.AddEntriesFrom(input, _repeated_processRanges_codec); break; } + case 96: { + SingleMode = input.ReadBool(); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.PMR/EmbeddedParameters/ConfigurationParameters.cs b/Software/Visual_Studio/Tango.PMR/EmbeddedParameters/ConfigurationParameters.cs index 83861aef0..1177681a6 100644 --- a/Software/Visual_Studio/Tango.PMR/EmbeddedParameters/ConfigurationParameters.cs +++ b/Software/Visual_Studio/Tango.PMR/EmbeddedParameters/ConfigurationParameters.cs @@ -23,7 +23,7 @@ namespace Tango.PMR.EmbeddedParameters { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch1Db25maWd1cmF0aW9uUGFyYW1ldGVycy5wcm90bxIcVGFuZ28uUE1SLkVt", - "YmVkZGVkUGFyYW1ldGVycyLXBQoXQ29uZmlndXJhdGlvblBhcmFtZXRlcnMS", + "YmVkZGVkUGFyYW1ldGVycyLoBwoXQ29uZmlndXJhdGlvblBhcmFtZXRlcnMS", "GAoQQnJlYWtTZW5zb3JMaW1pdBgBIAEoDRIhChlEaWFnbm9zdGljQ29sbGVj", "dGlvbkxpbWl0GAIgASgNEhoKEk92ZXJIZWF0Q291bnRMaW1pdBgDIAEoDRIb", "ChNVbmRlckhlYXRDb3VudExpbWl0GAQgASgNEhkKEUNsb3NlVmFsdmVUaW1l", @@ -39,12 +39,18 @@ namespace Tango.PMR.EmbeddedParameters { "YXRlcnNVcHBlck9wZXJhdGlvbkxpbWl0GBEgASgNEiEKGU1pZFRhbmtQcmVz", "c3VyZUNvcnJlY3Rpb24YEiABKAESHwoXRGlzcGVuc2VyUHJlc2VnbWVudFdG", "Q0YYEyABKAESIgoaU3RhcnRIZWF0aW5nT25Jbml0U2VxdWVuY2UYFCABKAgS", - "GQoRR2VuZXJhbFBhcmFtZXRlcnMYFSADKAFCKAomY29tLnR3aW5lLnRhbmdv", - "LnBtci5lbWJlZGRlZHBhcmFtZXRlcnNiBnByb3RvMw==")); + "GQoRR2VuZXJhbFBhcmFtZXRlcnMYFSADKAESHAoUQ3VycmVudEFsYXJtTG93", + "TGltaXQYFiABKAESHQoVQ3VycmVudEFsYXJtSGlnaExpbWl0GBcgASgBEiAK", + "GElEU19TZWdtZW50UmVmaWxsVGltZW91dBgYIAEoARIhChlJRFNfUHJlU2Vn", + "bWVudEJ1aWxkdXBUaW1lGBkgASgBEhkKEUlEU19DbGVhbmluZ1NwZWVkGBog", + "ASgBEikKIUlEU19DbGVhbmluZ1N0b3BCZWZvcmVTZWdtZW50VGltZRgbIAEo", + "ARIiChpJRFNfTGVmdENsZWFuaW5nTW90b3JTcGVlZBgcIAEoARIjChtJRFNf", + "UmlnaHRDbGVhbmluZ01vdG9yU3BlZWQYHSABKAFCKAomY29tLnR3aW5lLnRh", + "bmdvLnBtci5lbWJlZGRlZHBhcmFtZXRlcnNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.EmbeddedParameters.ConfigurationParameters), global::Tango.PMR.EmbeddedParameters.ConfigurationParameters.Parser, new[]{ "BreakSensorLimit", "DiagnosticCollectionLimit", "OverHeatCountLimit", "UnderHeatCountLimit", "CloseValveTimeout", "OpenValveTimeout", "InitialDispenserPressure", "InitialDispenserTimeout", "InitialDispenserTimeLag", "DispenserBuildPressureSpeed", "DispenserBuildPressureLimit", "DispenserBuildPressureTimeout", "DispenserBuildPressureLag", "ACHeatersLowerOperationLimit", "ACHeatersUpperOperationLimit", "DCHeatersLowerOperationLimit", "DCHeatersUpperOperationLimit", "MidTankPressureCorrection", "DispenserPresegmentWFCF", "StartHeatingOnInitSequence", "GeneralParameters" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.EmbeddedParameters.ConfigurationParameters), global::Tango.PMR.EmbeddedParameters.ConfigurationParameters.Parser, new[]{ "BreakSensorLimit", "DiagnosticCollectionLimit", "OverHeatCountLimit", "UnderHeatCountLimit", "CloseValveTimeout", "OpenValveTimeout", "InitialDispenserPressure", "InitialDispenserTimeout", "InitialDispenserTimeLag", "DispenserBuildPressureSpeed", "DispenserBuildPressureLimit", "DispenserBuildPressureTimeout", "DispenserBuildPressureLag", "ACHeatersLowerOperationLimit", "ACHeatersUpperOperationLimit", "DCHeatersLowerOperationLimit", "DCHeatersUpperOperationLimit", "MidTankPressureCorrection", "DispenserPresegmentWFCF", "StartHeatingOnInitSequence", "GeneralParameters", "CurrentAlarmLowLimit", "CurrentAlarmHighLimit", "IDSSegmentRefillTimeout", "IDSPreSegmentBuildupTime", "IDSCleaningSpeed", "IDSCleaningStopBeforeSegmentTime", "IDSLeftCleaningMotorSpeed", "IDSRightCleaningMotorSpeed" }, null, null, null) })); } #endregion @@ -96,6 +102,14 @@ namespace Tango.PMR.EmbeddedParameters { dispenserPresegmentWFCF_ = other.dispenserPresegmentWFCF_; startHeatingOnInitSequence_ = other.startHeatingOnInitSequence_; generalParameters_ = other.generalParameters_.Clone(); + currentAlarmLowLimit_ = other.currentAlarmLowLimit_; + currentAlarmHighLimit_ = other.currentAlarmHighLimit_; + iDSSegmentRefillTimeout_ = other.iDSSegmentRefillTimeout_; + iDSPreSegmentBuildupTime_ = other.iDSPreSegmentBuildupTime_; + iDSCleaningSpeed_ = other.iDSCleaningSpeed_; + iDSCleaningStopBeforeSegmentTime_ = other.iDSCleaningStopBeforeSegmentTime_; + iDSLeftCleaningMotorSpeed_ = other.iDSLeftCleaningMotorSpeed_; + iDSRightCleaningMotorSpeed_ = other.iDSRightCleaningMotorSpeed_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -384,6 +398,112 @@ namespace Tango.PMR.EmbeddedParameters { get { return generalParameters_; } } + /// Field number for the "CurrentAlarmLowLimit" field. + public const int CurrentAlarmLowLimitFieldNumber = 22; + private double currentAlarmLowLimit_; + /// + /// a limit percentage for current deviation below predefined level + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double CurrentAlarmLowLimit { + get { return currentAlarmLowLimit_; } + set { + currentAlarmLowLimit_ = value; + } + } + + /// Field number for the "CurrentAlarmHighLimit" field. + public const int CurrentAlarmHighLimitFieldNumber = 23; + private double currentAlarmHighLimit_; + /// + /// a limit percentage for current deviation predefined level + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double CurrentAlarmHighLimit { + get { return currentAlarmHighLimit_; } + set { + currentAlarmHighLimit_ = value; + } + } + + /// Field number for the "IDS_SegmentRefillTimeout" field. + public const int IDSSegmentRefillTimeoutFieldNumber = 24; + private double iDSSegmentRefillTimeout_; + /// + ///how much time before next segment the automatic refill should stop + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double IDSSegmentRefillTimeout { + get { return iDSSegmentRefillTimeout_; } + set { + iDSSegmentRefillTimeout_ = value; + } + } + + /// Field number for the "IDS_PreSegmentBuildupTime" field. + public const int IDSPreSegmentBuildupTimeFieldNumber = 25; + private double iDSPreSegmentBuildupTime_; + /// + /// how much running to waste time during presegment + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double IDSPreSegmentBuildupTime { + get { return iDSPreSegmentBuildupTime_; } + set { + iDSPreSegmentBuildupTime_ = value; + } + } + + /// Field number for the "IDS_CleaningSpeed" field. + public const int IDSCleaningSpeedFieldNumber = 26; + private double iDSCleaningSpeed_; + /// + ///cleaning dispenser motorspeed + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double IDSCleaningSpeed { + get { return iDSCleaningSpeed_; } + set { + iDSCleaningSpeed_ = value; + } + } + + /// Field number for the "IDS_CleaningStopBeforeSegmentTime" field. + public const int IDSCleaningStopBeforeSegmentTimeFieldNumber = 27; + private double iDSCleaningStopBeforeSegmentTime_; + /// + ///cleaning dispenser stop before segment start + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double IDSCleaningStopBeforeSegmentTime { + get { return iDSCleaningStopBeforeSegmentTime_; } + set { + iDSCleaningStopBeforeSegmentTime_ = value; + } + } + + /// Field number for the "IDS_LeftCleaningMotorSpeed" field. + public const int IDSLeftCleaningMotorSpeedFieldNumber = 28; + private double iDSLeftCleaningMotorSpeed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double IDSLeftCleaningMotorSpeed { + get { return iDSLeftCleaningMotorSpeed_; } + set { + iDSLeftCleaningMotorSpeed_ = value; + } + } + + /// Field number for the "IDS_RightCleaningMotorSpeed" field. + public const int IDSRightCleaningMotorSpeedFieldNumber = 29; + private double iDSRightCleaningMotorSpeed_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double IDSRightCleaningMotorSpeed { + get { return iDSRightCleaningMotorSpeed_; } + set { + iDSRightCleaningMotorSpeed_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ConfigurationParameters); @@ -418,6 +538,14 @@ namespace Tango.PMR.EmbeddedParameters { if (DispenserPresegmentWFCF != other.DispenserPresegmentWFCF) return false; if (StartHeatingOnInitSequence != other.StartHeatingOnInitSequence) return false; if(!generalParameters_.Equals(other.generalParameters_)) return false; + if (CurrentAlarmLowLimit != other.CurrentAlarmLowLimit) return false; + if (CurrentAlarmHighLimit != other.CurrentAlarmHighLimit) return false; + if (IDSSegmentRefillTimeout != other.IDSSegmentRefillTimeout) return false; + if (IDSPreSegmentBuildupTime != other.IDSPreSegmentBuildupTime) return false; + if (IDSCleaningSpeed != other.IDSCleaningSpeed) return false; + if (IDSCleaningStopBeforeSegmentTime != other.IDSCleaningStopBeforeSegmentTime) return false; + if (IDSLeftCleaningMotorSpeed != other.IDSLeftCleaningMotorSpeed) return false; + if (IDSRightCleaningMotorSpeed != other.IDSRightCleaningMotorSpeed) return false; return true; } @@ -445,6 +573,14 @@ namespace Tango.PMR.EmbeddedParameters { if (DispenserPresegmentWFCF != 0D) hash ^= DispenserPresegmentWFCF.GetHashCode(); if (StartHeatingOnInitSequence != false) hash ^= StartHeatingOnInitSequence.GetHashCode(); hash ^= generalParameters_.GetHashCode(); + if (CurrentAlarmLowLimit != 0D) hash ^= CurrentAlarmLowLimit.GetHashCode(); + if (CurrentAlarmHighLimit != 0D) hash ^= CurrentAlarmHighLimit.GetHashCode(); + if (IDSSegmentRefillTimeout != 0D) hash ^= IDSSegmentRefillTimeout.GetHashCode(); + if (IDSPreSegmentBuildupTime != 0D) hash ^= IDSPreSegmentBuildupTime.GetHashCode(); + if (IDSCleaningSpeed != 0D) hash ^= IDSCleaningSpeed.GetHashCode(); + if (IDSCleaningStopBeforeSegmentTime != 0D) hash ^= IDSCleaningStopBeforeSegmentTime.GetHashCode(); + if (IDSLeftCleaningMotorSpeed != 0D) hash ^= IDSLeftCleaningMotorSpeed.GetHashCode(); + if (IDSRightCleaningMotorSpeed != 0D) hash ^= IDSRightCleaningMotorSpeed.GetHashCode(); return hash; } @@ -536,6 +672,38 @@ namespace Tango.PMR.EmbeddedParameters { output.WriteBool(StartHeatingOnInitSequence); } generalParameters_.WriteTo(output, _repeated_generalParameters_codec); + if (CurrentAlarmLowLimit != 0D) { + output.WriteRawTag(177, 1); + output.WriteDouble(CurrentAlarmLowLimit); + } + if (CurrentAlarmHighLimit != 0D) { + output.WriteRawTag(185, 1); + output.WriteDouble(CurrentAlarmHighLimit); + } + if (IDSSegmentRefillTimeout != 0D) { + output.WriteRawTag(193, 1); + output.WriteDouble(IDSSegmentRefillTimeout); + } + if (IDSPreSegmentBuildupTime != 0D) { + output.WriteRawTag(201, 1); + output.WriteDouble(IDSPreSegmentBuildupTime); + } + if (IDSCleaningSpeed != 0D) { + output.WriteRawTag(209, 1); + output.WriteDouble(IDSCleaningSpeed); + } + if (IDSCleaningStopBeforeSegmentTime != 0D) { + output.WriteRawTag(217, 1); + output.WriteDouble(IDSCleaningStopBeforeSegmentTime); + } + if (IDSLeftCleaningMotorSpeed != 0D) { + output.WriteRawTag(225, 1); + output.WriteDouble(IDSLeftCleaningMotorSpeed); + } + if (IDSRightCleaningMotorSpeed != 0D) { + output.WriteRawTag(233, 1); + output.WriteDouble(IDSRightCleaningMotorSpeed); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -602,6 +770,30 @@ namespace Tango.PMR.EmbeddedParameters { size += 2 + 1; } size += generalParameters_.CalculateSize(_repeated_generalParameters_codec); + if (CurrentAlarmLowLimit != 0D) { + size += 2 + 8; + } + if (CurrentAlarmHighLimit != 0D) { + size += 2 + 8; + } + if (IDSSegmentRefillTimeout != 0D) { + size += 2 + 8; + } + if (IDSPreSegmentBuildupTime != 0D) { + size += 2 + 8; + } + if (IDSCleaningSpeed != 0D) { + size += 2 + 8; + } + if (IDSCleaningStopBeforeSegmentTime != 0D) { + size += 2 + 8; + } + if (IDSLeftCleaningMotorSpeed != 0D) { + size += 2 + 8; + } + if (IDSRightCleaningMotorSpeed != 0D) { + size += 2 + 8; + } return size; } @@ -671,6 +863,30 @@ namespace Tango.PMR.EmbeddedParameters { StartHeatingOnInitSequence = other.StartHeatingOnInitSequence; } generalParameters_.Add(other.generalParameters_); + if (other.CurrentAlarmLowLimit != 0D) { + CurrentAlarmLowLimit = other.CurrentAlarmLowLimit; + } + if (other.CurrentAlarmHighLimit != 0D) { + CurrentAlarmHighLimit = other.CurrentAlarmHighLimit; + } + if (other.IDSSegmentRefillTimeout != 0D) { + IDSSegmentRefillTimeout = other.IDSSegmentRefillTimeout; + } + if (other.IDSPreSegmentBuildupTime != 0D) { + IDSPreSegmentBuildupTime = other.IDSPreSegmentBuildupTime; + } + if (other.IDSCleaningSpeed != 0D) { + IDSCleaningSpeed = other.IDSCleaningSpeed; + } + if (other.IDSCleaningStopBeforeSegmentTime != 0D) { + IDSCleaningStopBeforeSegmentTime = other.IDSCleaningStopBeforeSegmentTime; + } + if (other.IDSLeftCleaningMotorSpeed != 0D) { + IDSLeftCleaningMotorSpeed = other.IDSLeftCleaningMotorSpeed; + } + if (other.IDSRightCleaningMotorSpeed != 0D) { + IDSRightCleaningMotorSpeed = other.IDSRightCleaningMotorSpeed; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -766,6 +982,38 @@ namespace Tango.PMR.EmbeddedParameters { generalParameters_.AddEntriesFrom(input, _repeated_generalParameters_codec); break; } + case 177: { + CurrentAlarmLowLimit = input.ReadDouble(); + break; + } + case 185: { + CurrentAlarmHighLimit = input.ReadDouble(); + break; + } + case 193: { + IDSSegmentRefillTimeout = input.ReadDouble(); + break; + } + case 201: { + IDSPreSegmentBuildupTime = input.ReadDouble(); + break; + } + case 209: { + IDSCleaningSpeed = input.ReadDouble(); + break; + } + case 217: { + IDSCleaningStopBeforeSegmentTime = input.ReadDouble(); + break; + } + case 225: { + IDSLeftCleaningMotorSpeed = input.ReadDouble(); + break; + } + case 233: { + IDSRightCleaningMotorSpeed = input.ReadDouble(); + break; + } } } } -- cgit v1.3.1 From 73327143a2ac187695bed0ecded52c4d675165c4 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 18 Mar 2019 15:01:20 +0200 Subject: Fixed issue with brush stop duplication on developer module. --- .../Converters/LiquidVolumesToLubricantLiquidVolume.cs | 11 +++++++++-- .../Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 1 + .../Modules/Tango.MachineStudio.Developer/Views/JobView.xaml | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs index e59141e7f..5939bfd53 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs @@ -14,8 +14,15 @@ namespace Tango.MachineStudio.Developer.Converters { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - IEnumerable liquid_volumes = value as IEnumerable; - return liquid_volumes.SingleOrDefault(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.Lubricant.ToInt32()); + if (value != null) + { + IEnumerable liquid_volumes = value as IEnumerable; + return liquid_volumes.SingleOrDefault(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.Lubricant.ToInt32()); + } + else + { + return null; + } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 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 41f57794a..02431fd98 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 @@ -2179,6 +2179,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { var cloned = stop.Clone(); cloned.StopIndex = SelectedSegment.BrushStops.Max(x => x.StopIndex) + 1; + cloned.SetLiquidVolumes(ActiveJob.Machine.Configuration, SelectedRML, SelectedProcessParametersTable); SelectedSegment.BrushStops.Add(cloned); } 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 9504d5769..c4c831011 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 @@ -962,11 +962,11 @@ - + - + -- cgit v1.3.1 From 8e5db9349238f129d68dfa598341d5017778b096 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 26 Mar 2019 18:45:51 +0200 Subject: Fixed issue where process parameters history not loaded when opening a job on research module. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../ViewModels/MainViewVM.cs | 9 +-------- 3 files changed, 1 insertion(+), 8 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 55fd72be4..f100c30a2 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 843a9f168..4c5d4b936 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ 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 02431fd98..db9d9dbae 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 @@ -1506,14 +1506,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.Log("Invalidating liquid factors, process parameters and process group history..."); - if (_selectedRML != ActiveJob.Rml) - { - _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().Build(); - } - else - { - _selectedRML = ActiveJob.Rml; - } + _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().Build(); if (_selectedRML.Ccts.Count == 0) { -- cgit v1.3.1 From c2945492e7c4d168c36b632d1f28dd8ca569b5ac Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 22 Apr 2019 19:49:09 +0300 Subject: Improved ExternalBridge discovery greatly! Implemented volume gradient generation! --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/TCC/TCC.mdf | Bin 8388608 -> 8388608 bytes Software/DB/TCC/TCC_log.ldf | Bin 8388608 -> 8388608 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../ViewModels/MainViewVM.cs | 2 +- .../Views/JobView.xaml | 12 +- .../Connection/DefaultMachineProvider.cs | 17 ++- .../PPC/Tango.PPC.Common/PPCSettings.cs | 19 +++ .../Tango.Emulations/Emulators/MachineEmulator.cs | 7 +- .../ExternalBridge/ExternalBridgeScanner.cs | 57 +++++---- .../ExternalBridge/ExternalBridgeService.cs | 2 + .../DefaultGradientGenerationConfiguration.cs | 135 ++++++++++++++++++--- .../Tango.Transport/Discovery/DiscoveredService.cs | 14 ++- .../Discovery/UdpDiscoveryClient.cs | 23 +++- .../Discovery/UdpDiscoveryService.cs | 42 +++++-- .../Tango.Transport/Servers/TcpServer.cs | 5 +- 18 files changed, 273 insertions(+), 62 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 2ad3500d7..84785d8cf 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 64c4734b7..5e10994a1 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf index 430d0c50d..7670a3170 100644 Binary files a/Software/DB/TCC/TCC.mdf and b/Software/DB/TCC/TCC.mdf differ diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf index 51139d1a5..1cf272342 100644 Binary files a/Software/DB/TCC/TCC_log.ldf and b/Software/DB/TCC/TCC_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 84eb6afc9..548dda3df 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index f3b9858f1..550ccbeae 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ 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 db9d9dbae..0299940d3 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 @@ -1386,7 +1386,7 @@ namespace Tango.MachineStudio.Developer.ViewModels InvokeUI(() => { - _notification.ShowError("Job failed. " + ex.Message); + _notification.ShowError("Job failed. " + ex.FlattenMessage()); StopRecordingIfInProgress(); }); }; 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 c4c831011..bfa951c3b 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 @@ -865,9 +865,15 @@ - - - Enable Gradient Generation + + Generate Gradient + + Resolution: + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index 82d805a70..3ffb6f634 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -79,6 +79,13 @@ namespace Tango.PPC.Common.Connection MachineOperator.UseKeepAlive = true; MachineOperator.EnableDiagnostics = false; MachineOperator.EnableEmbeddedDebugging = false; + + var settings = SettingsManager.Default.GetOrCreate(); + + MachineOperator.JobUploadStrategy = settings.JobUploadStrategy; + + MachineOperator.GradientGenerationConfiguration.IsEnabled = settings.EnableGradientGeneration; + MachineOperator.GradientGenerationConfiguration.ResolutionCM = settings.GradientGenerationResolution; } private async void ConnectionThreadMethod() @@ -125,7 +132,15 @@ namespace Tango.PPC.Common.Connection UsbTransportAdapter adapter = new UsbTransportAdapter(settings.EmbeddedComPort, UsbSerialBaudRates.BR_115200); MachineOperator.Adapter = adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; - await MachineOperator.Connect(); + try + { + await MachineOperator.Connect(); + } + catch (Exception) + { + await adapter.Disconnect(); + throw; + } await Task.Delay(1000); await MachineOperator.UploadHardwareConfiguration(Machine.Configuration.HardwareVersion, Machine.Configuration); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 32181a753..698dbf374 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -5,6 +5,7 @@ using System.ServiceModel; using System.Text; using System.Threading.Tasks; using Tango.Logging; +using Tango.PMR.Printing; using Tango.Settings; using Tango.Web; @@ -81,6 +82,21 @@ namespace Tango.PPC.Common /// public bool EnableTechnicianModeByDefault { get; set; } + /// + /// Gets or sets the job upload strategy. + /// + public JobUploadStrategy JobUploadStrategy { get; set; } + + /// + /// Gets or sets a value indicating whether to enable gradient generation. + /// + public bool EnableGradientGeneration { get; set; } + + /// + /// Gets or sets the gradient generation resolution. + /// + public int GradientGenerationResolution { get; set; } + /// /// Gets the machine service address. /// @@ -95,6 +111,9 @@ namespace Tango.PPC.Common /// public PPCSettings() { + JobUploadStrategy = JobUploadStrategy.JobDescriptionFile; + EnableGradientGeneration = true; + GradientGenerationResolution = 20; MachineScanningTimeoutSeconds = 20; LoggingCategories = new List(); EmbeddedComPort = null; diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index f1d9487ff..7f99c8161 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -29,6 +29,7 @@ using Tango.PMR.IO; using System.IO; using Tango.Integration.Operation; using Tango.PMR.FirmwareUpgrade; +using System.Diagnostics; namespace Tango.Emulations.Emulators { @@ -68,6 +69,7 @@ namespace Tango.Emulations.Emulators private List _valveStates; private JobTicket _current_job_ticket; private String _current_job_resume_token; + private FileUploadRequest _lastFileUploadRequest; #region Properties @@ -1038,7 +1040,7 @@ namespace Tango.Emulations.Emulators response.Items.Add(new PMR.IO.FileInfo() { Attribute = FileAttribute.Directory, - FullPath = replaceSlash ? dir.Replace("\\","/") : dir, + FullPath = replaceSlash ? dir.Replace("\\", "/") : dir, LastModifiedDate = dirInfo.LastWriteTime.DayOfYear, LastModifiedTime = dirInfo.LastWriteTime.Hour, Name = Path.GetFileName(dir), @@ -1143,6 +1145,7 @@ namespace Tango.Emulations.Emulators private void HandleFileUploadRequest(TangoMessage request) { var message = request.Message; + _lastFileUploadRequest = message; Transporter.SendResponse(new FileUploadResponse() { MaxChunkLength = MAX_CHUNK_LENGTH, @@ -1160,6 +1163,8 @@ namespace Tango.Emulations.Emulators { byte[] buffer = message.Buffer.ToByteArray(); fs.Write(buffer, 0, buffer.Length); + + Debug.WriteLine($"Emulator file upload '{_lastFileUploadRequest.Path}' {fs.Length}/{_lastFileUploadRequest.Length} ..."); } Transporter.SendResponse(new FileChunkUploadResponse(), request.Container.Token); diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs index 110895bdd..0b1ac9c0e 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs @@ -32,12 +32,13 @@ namespace Tango.Integration.ExternalBridge private Thread _usbDiscoveryThread; private UdpClient _server; private IntegrationSettings _settings; + private const int DISCOVERY_PORT = 8888; - private ObservableCollection _availableMachines; + private SynchronizedObservableCollection _availableMachines; /// /// Gets the available machines. /// - public ObservableCollection AvailableMachines + public SynchronizedObservableCollection AvailableMachines { get { return _availableMachines; } private set { _availableMachines = value; RaisePropertyChangedAuto(); } @@ -60,7 +61,7 @@ namespace Tango.Integration.ExternalBridge { _settings = SettingsManager.Default.GetOrCreate(); _server = new UdpClient(_settings.ExternalBridgeServiceDiscoveryPort); - AvailableMachines = new ObservableCollection(); + AvailableMachines = new SynchronizedObservableCollection(); } /// @@ -136,42 +137,50 @@ namespace Tango.Integration.ExternalBridge { try { - var ClientEp = new IPEndPoint(IPAddress.Any, 0); + var ClientEp = new IPEndPoint(IPAddress.Any, DISCOVERY_PORT); _server.EnableBroadcast = true; var ClientRequestData = _server.Receive(ref ClientEp); ExternalBridgeUdpDiscoveryPacket packet = ExternalBridgeUdpDiscoveryPacket.Parser.ParseFrom(ClientRequestData); - if (packet.Time == String.Empty || (DateTime.Now - ParseDateTime(packet.Time)).TotalSeconds < 6) + String address = ClientEp.Address.ToString(); + + //validate service existence using TCP connection. + try + { + TcpClient client = new TcpClient(); + client.Connect(address, DISCOVERY_PORT); + client.Dispose(); + } + catch { - if (!AvailableMachines.OfType().ToList().Exists(x => x.SerialNumber == packet.SerialNumber && x.IPAddress == ClientEp.Address.ToString())) + var disconnected_machine = AvailableMachines.OfType().ToList().FirstOrDefault(x => x.SerialNumber == packet.SerialNumber && x.IPAddress == address); + + if (disconnected_machine != null) { - ExternalBridgeTcpClient newMachine = new ExternalBridgeTcpClient(packet.SerialNumber, ClientEp.Address.ToString()); + LogManager.Log("Disconnected machine detected via TCP: " + disconnected_machine.SerialNumber); + AvailableMachines.Remove(disconnected_machine); + } - LogManager.Log("Found a new machine via TCP " + newMachine.SerialNumber); + continue; + } - ThreadsHelper.InvokeUINow(() => - { - AvailableMachines.Insert(1, newMachine); - }); - } + if (!AvailableMachines.OfType().ToList().Exists(x => x.SerialNumber == packet.SerialNumber && x.IPAddress == address)) + { + ExternalBridgeTcpClient newMachine = new ExternalBridgeTcpClient(packet.SerialNumber, address); + + LogManager.Log("Found a new machine via TCP " + newMachine.SerialNumber); + + ThreadsHelper.InvokeUINow(() => + { + AvailableMachines.Insert(1, newMachine); + }); } - //else if (packet.Time != String.Empty && (DateTime.Now - DateTime.Parse(packet.Time)).TotalSeconds > 5) - //{ - // var machine = AvailableMachines.OfType().ToList().FirstOrDefault(x => x.SerialNumber == packet.SerialNumber && x.IPAddress == ClientEp.Address.ToString()); - - // if (machine != null) - // { - // AvailableMachines.Remove(machine); - // } - //} } catch (Exception ex) { LogManager.Log(ex); } - - //Thread.Sleep(1000); } } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs index 90d8995b0..3f4f8559c 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs @@ -28,6 +28,8 @@ namespace Tango.Integration.ExternalBridge private bool _send_app_logs; private String _app_logs_token; private Dictionary> _messageHandlers; + private const int DISCOVERY_PORT = 8888; + private const int EXTERNAL_BRIDGE_PORT = 1984; #region Events diff --git a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs index d4cc9ce21..68fd14ac2 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs @@ -16,6 +16,15 @@ namespace Tango.Integration.Operation /// public class DefaultGradientGenerationConfiguration : ExtendedObject, IGradientGenerationConfiguration { + private class CMYK + { + public double C { get; set; } + public double M { get; set; } + public double Y { get; set; } + public double K { get; set; } + public double OffsetPercent { get; set; } + } + private bool _isEnabled; /// /// Gets or sets a value indicating whether to generate the gradient steps. @@ -62,28 +71,64 @@ namespace Tango.Integration.Operation int stopIndex = 1; - for (double cm = 0; cm < segment.Length; cm += (ResolutionCM / 100d)) + var colorSpace = segment.BrushStops.First().BrushColorSpace; + + //validate all brush stops in the segment are the same color space! + if (segment.BrushStops.ToList().Exists(x => x.BrushColorSpace != colorSpace)) + { + throw new ArgumentException("Cannot generate gradient using multiple color spaces on the same segment."); + } + + if (ResolutionCM > segment.Length * 100d) + { + return segment.BrushStops.ToList(); + } + + var refStop = segment.BrushStops.First().Clone(segment); + + for (double cm = 0; cm <= segment.Length; cm += (ResolutionCM / 100d)) { double offset = (double)cm / segment.Length; - var color = GetRelativeColor(segment.BrushStops.ToList(), offset); - var output = TangoColorConverter.GetSuggestions(segment.Job, color, true); + if (colorSpace == ColorSpaces.RGB || colorSpace == ColorSpaces.LAB || colorSpace == ColorSpaces.CMYK) + { + var color = GetRelativeRGB(segment.BrushStops.ToList(), offset); + var output = TangoColorConverter.GetSuggestions(segment.Job, color, true); + + BrushStop s = new BrushStop(); + s.Segment = segment; + s.ColorSpace = new ColorSpace(); + s.ColorSpace.Code = ColorSpaces.RGB.ToInt32(); + s.Corrected = true; + s.OffsetPercent = offset * 100d; + s.OffsetMeters = segment.Length * offset; + s.Red = color.R; + s.Green = color.G; + s.Blue = color.B; + s.StopIndex = stopIndex++; + + TangoColorConverter.ApplyBrushStopCorrection(s, processParameters, output); + + stops.Add(s); + } + else if (colorSpace == ColorSpaces.Volume || colorSpace == ColorSpaces.Twine) + { + var cmyk = GetRelativeCMYK(segment.BrushStops.ToList(), offset); + var stop = refStop.Clone(segment); - BrushStop s = new BrushStop(); - s.Segment = segment; - s.ColorSpace = new ColorSpace(); - s.ColorSpace.Code = ColorSpaces.RGB.ToInt32(); - s.Corrected = true; - s.OffsetPercent = offset * 100d; - s.OffsetMeters = segment.Length * offset; - s.Red = color.R; - s.Green = color.G; - s.Blue = color.B; - s.StopIndex = stopIndex++; + stop.OffsetPercent = offset * 100d; + stop.OffsetMeters = segment.Length * offset; + stop.StopIndex = stopIndex++; - TangoColorConverter.ApplyBrushStopCorrection(s, processParameters, output); + stop.SetVolume(LiquidTypes.Cyan, cmyk.C); + stop.SetVolume(LiquidTypes.Magenta, cmyk.M); + stop.SetVolume(LiquidTypes.Yellow, cmyk.Y); + stop.SetVolume(LiquidTypes.Black, cmyk.K); - stops.Add(s); + stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters); + + stops.Add(stop); + } progress?.Invoke(new PreparingJobProgressEventArgs() { @@ -93,6 +138,9 @@ namespace Tango.Integration.Operation }); } + stops.Last().OffsetPercent = 100; + stops.Last().OffsetMeters = segment.Length; + progress?.Invoke(new PreparingJobProgressEventArgs() { Job = job, @@ -103,7 +151,60 @@ namespace Tango.Integration.Operation return stops; } - private Color GetRelativeColor(List brushStopsCollection, double offset) + private CMYK GetRelativeCMYK(List brushStopsCollection, double offset) + { + BrushStop refStop = brushStopsCollection.First().Clone(); + + brushStopsCollection = brushStopsCollection.Select(x => x.Clone()).ToList(); + brushStopsCollection.ForEach(x => x.OffsetPercent = x.OffsetPercent / 100d); + + var cmykCollection = brushStopsCollection.Select(x => GetCMYK(x)).ToList(); + + var stop = cmykCollection.SingleOrDefault(f => f.OffsetPercent == offset); + if (stop != null) return stop; + + CMYK before = cmykCollection.Where(w => w.OffsetPercent == cmykCollection.Min(m => m.OffsetPercent)).First(); + CMYK after = cmykCollection.Where(w => w.OffsetPercent == cmykCollection.Max(m => m.OffsetPercent)).First(); + + foreach (var gs in cmykCollection) + { + if (gs.OffsetPercent < offset && gs.OffsetPercent > before.OffsetPercent) + { + before = gs; + } + if (gs.OffsetPercent > offset && gs.OffsetPercent < after.OffsetPercent) + { + after = gs; + } + } + + CMYK cmyk = new CMYK(); + + cmyk.C = (float)((offset - before.OffsetPercent) * (after.C - before.C) / (after.OffsetPercent - before.OffsetPercent) + before.C); + cmyk.M = (float)((offset - before.OffsetPercent) * (after.M - before.M) / (after.OffsetPercent - before.OffsetPercent) + before.M); + cmyk.Y = (float)((offset - before.OffsetPercent) * (after.Y - before.Y) / (after.OffsetPercent - before.OffsetPercent) + before.Y); + cmyk.K = (float)((offset - before.OffsetPercent) * (after.K - before.K) / (after.OffsetPercent - before.OffsetPercent) + before.K); + + //cmyk.C *= 100d; + //cmyk.M *= 100d; + //cmyk.Y *= 100d; + //cmyk.K *= 100d; + + return cmyk; + } + + private CMYK GetCMYK(BrushStop stop) + { + CMYK cmyk = new CMYK(); + cmyk.C = stop.GetVolume(LiquidTypes.Cyan); + cmyk.M = stop.GetVolume(LiquidTypes.Magenta); + cmyk.Y = stop.GetVolume(LiquidTypes.Yellow); + cmyk.K = stop.GetVolume(LiquidTypes.Black); + cmyk.OffsetPercent = stop.OffsetPercent; + return cmyk; + } + + private Color GetRelativeRGB(List brushStopsCollection, double offset) { brushStopsCollection = brushStopsCollection.Select(x => x.ShallowClone()).ToList(); brushStopsCollection.ForEach(x => x.OffsetPercent = x.OffsetPercent / 100d); diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs b/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs index 27750492e..94e20a8b4 100644 --- a/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs +++ b/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs @@ -14,6 +14,8 @@ namespace Tango.Transport.Discovery /// public class DiscoveredService : EventArgs where DiscoveryMessage : IMessage { + private Func _validateDiscoveryAction; + /// /// Gets or sets the discovery message. /// @@ -35,11 +37,21 @@ namespace Tango.Transport.Discovery /// The address. /// The message. /// The host name. - public DiscoveredService(String address, String hostName, DiscoveryMessage message) + public DiscoveredService(String address, String hostName, DiscoveryMessage message, Func validateDiscoveryAction) { HostName = hostName; Address = address; Message = message; + _validateDiscoveryAction = validateDiscoveryAction; + } + + /// + /// Validates the service existence using a TCP request. + /// + /// + public bool ValidateServiceExistence() + { + return _validateDiscoveryAction(); } } } diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs index 9d043023b..773ba288a 100644 --- a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs +++ b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs @@ -88,7 +88,7 @@ namespace Tango.Transport.Discovery { UdpClient udpClient = new UdpClient(Port); udpClient.Client.ReceiveTimeout = (int)Interval.TotalMilliseconds; - var endPoint = new IPEndPoint(IPAddress.Any, 0); + var endPoint = new IPEndPoint(IPAddress.Any, Port); while (IsStarted) { @@ -110,12 +110,29 @@ namespace Tango.Transport.Discovery message = (DiscoveryMessage)parser.ParseFrom(data); var host = Dns.GetHostEntry(endPoint.Address); + string address = endPoint.Address.ToString(); ServiceDiscovered?.Invoke(this, new DiscoveredService( - endPoint.Address.ToString(), + address, host != null ? host.HostName : "Unresolved", - message)); + message + , () => + { + + try + { + TcpClient client = new TcpClient(); + client.Connect(address, Port); + client.Dispose(); + return true; + } + catch + { + return false; + } + + })); } } diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs index 1fa486e68..c37ab7f51 100644 --- a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs +++ b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs @@ -7,7 +7,9 @@ using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using System.Timers; +using Tango.Core; using Tango.PMR.Discovery; +using Tango.Transport.Servers; namespace Tango.Transport.Discovery { @@ -15,9 +17,10 @@ namespace Tango.Transport.Discovery /// Represents UDP discovery service broadcasting a discovery message of type . /// /// - public class UdpDiscoveryService : IDiscoveryService where DiscoveryMessage : IMessage + public class UdpDiscoveryService : ExtendedObject, IDiscoveryService where DiscoveryMessage : IMessage { private Timer _timer; + private TcpServer _tcpValidationServer; /// /// Occurs before broadcasting the discovery message and gives a chance to modify the packet message. @@ -60,6 +63,11 @@ namespace Tango.Transport.Discovery public UdpDiscoveryService(int port) : this() { Port = port; + _tcpValidationServer = new TcpServer(Port); + _tcpValidationServer.ClientConnected += (x, e) => + { + e.Socket.Dispose(); + }; } /// @@ -79,6 +87,8 @@ namespace Tango.Transport.Discovery { if (!IsStarted) { + _tcpValidationServer.Start(); + _timer = new Timer(); _timer.Interval = Interval.TotalMilliseconds; _timer.Elapsed += _timer_Elapsed; @@ -96,6 +106,10 @@ namespace Tango.Transport.Discovery { if (IsStarted) { + _tcpValidationServer.Stop(); + + //Transmit the discovery packet one more time so clients can tell that we have disconnected. + BroadcastDiscoveryPacket(); _timer.Stop(); IsStarted = false; } @@ -108,18 +122,30 @@ namespace Tango.Transport.Discovery /// The instance containing the event data. private void _timer_Elapsed(object sender, ElapsedEventArgs e) { - UdpClient client = new UdpClient(); + BroadcastDiscoveryPacket(); + } + + private void BroadcastDiscoveryPacket() + { + try + { + UdpClient client = new UdpClient(); - IPEndPoint endPoint = new IPEndPoint(IPAddress.Broadcast, Port); + IPEndPoint endPoint = new IPEndPoint(IPAddress.Broadcast, Port); - BeforeBroadcasting?.Invoke(this, CurrentDiscoveryMessage); + BeforeBroadcasting?.Invoke(this, CurrentDiscoveryMessage); - byte[] bytes = CurrentDiscoveryMessage.ToByteArray(); + byte[] bytes = CurrentDiscoveryMessage.ToByteArray(); - client.EnableBroadcast = true; - client.Send(bytes, bytes.Length, endPoint); + client.EnableBroadcast = true; + client.Send(bytes, bytes.Length, endPoint); - client.Close(); + client.Close(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error broadcasting discovery packet."); + } } } } diff --git a/Software/Visual_Studio/Tango.Transport/Servers/TcpServer.cs b/Software/Visual_Studio/Tango.Transport/Servers/TcpServer.cs index d6e2ad1d0..29cc3c7e8 100644 --- a/Software/Visual_Studio/Tango.Transport/Servers/TcpServer.cs +++ b/Software/Visual_Studio/Tango.Transport/Servers/TcpServer.cs @@ -60,7 +60,7 @@ namespace Tango.Transport.Servers Listener = new TcpListener(System.Net.IPAddress.Any, Port); Listener.Start(); IsStarted = true; - LogManager.Log("Server Started!"); + LogManager.Log($"TCP started on port {Port}."); WaitForConnection(); } } @@ -73,7 +73,7 @@ namespace Tango.Transport.Servers { Listener.Stop(); IsStarted = false; - LogManager.Log("Server Stopped!"); + LogManager.Log($"TCP stopped on port {Port}."); } } @@ -110,7 +110,6 @@ namespace Tango.Transport.Servers protected virtual void OnClientConnected(TcpClient socket) { - LogManager.Log("New client connected."); ClientConnected?.Invoke(this, new ClientConnectedEventArgs(socket)); } -- cgit v1.3.1 From 46f5f70e6055234bce3e9a105ab1ba86248b1713 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 22 Apr 2019 22:46:43 +0300 Subject: Implemented Volume color space gradients. Implemented volume gradients on PPC. Improved job running aspects on PPC. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1581 -> 1516 bytes .../ViewModels/MainViewVM.cs | 30 +++++-- .../Views/JobView.xaml | 2 +- .../Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml | 6 +- .../Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs | 2 +- .../Tango.PPC.Jobs/Views/JobProgressView.xaml | 2 +- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 8 +- .../Visual_Studio/Tango.BL/Entities/BrushStop.cs | 80 +++++++++--------- .../DefaultGradientGenerationConfiguration.cs | 18 +++- .../Operation/IGradientGenerationConfiguration.cs | 5 ++ .../Tango.Integration/Operation/JobHandler.cs | 2 +- .../Tango.Integration/Operation/MachineOperator.cs | 92 +++++++++++++++++---- 14 files changed, 174 insertions(+), 73 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 84785d8cf..87b59afc3 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 5e10994a1..79746966d 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index bd3a3933b..19334a605 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ 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 0299940d3..4d8ec954e 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 @@ -966,9 +966,23 @@ namespace Tango.MachineStudio.Developer.ViewModels private void MachineOperator_PreparingJobProgress(object sender, PreparingJobProgressEventArgs e) { - if (_preparingTaskItem != null) + var percent = (e.Progress / e.Total * 100d); + + if (_preparingTaskItem == null && percent == 0) + { + _preparingTaskItem = _notification.PushTaskItem("Preparing job for printing..."); + } + else if (percent == 100) { - _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%..."; + _preparingTaskItem.Pop(); + _preparingTaskItem = null; + } + else + { + if (_preparingTaskItem != null) + { + _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%..."; + } } } @@ -1327,11 +1341,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (resumeFunc == null) { - using (var item = _notification.PushTaskItem("Preparing job for printing...")) - { - _preparingTaskItem = item; - JobHandler = await MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); - } + JobHandler = await MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); } else { @@ -1408,6 +1418,12 @@ namespace Tango.MachineStudio.Developer.ViewModels JobHandler.Canceled += (x, y) => { + if (_preparingTaskItem != null) + { + _preparingTaskItem.Pop(); + _preparingTaskItem = null; + } + LogManager.Log(String.Format("Job {0} has been canceled.", RunningJob.Name)); _eventLogger.Log(String.Format("Job {0} has been canceled.", RunningJob.Name)); StopRecordingIfInProgress(); 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 bfa951c3b..a5d137e67 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 @@ -1220,7 +1220,7 @@ - +