diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-11-13 05:12:21 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-11-13 05:12:21 +0200 |
| commit | 331266b13685e16520ae5baa8a7aff50789c31df (patch) | |
| tree | e41c95c155aecccd43cac6498e4bd70a3e227f5a /Software | |
| parent | 46978af63f2f683eefb0cadb87c1ce7540b0038d (diff) | |
| download | Tango-331266b13685e16520ae5baa8a7aff50789c31df.tar.gz Tango-331266b13685e16520ae5baa8a7aff50789c31df.zip | |
Inks Extension Support.
Diffstat (limited to 'Software')
89 files changed, 3737 insertions, 1112 deletions
diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf Binary files differindex c8371da66..b46743b06 100644 --- a/Software/DB/PPC/Tango.mdf +++ b/Software/DB/PPC/Tango.mdf diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf Binary files differindex c909e3819..d6dfbec0c 100644 --- a/Software/DB/PPC/Tango_log.ldf +++ b/Software/DB/PPC/Tango_log.ldf diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf Binary files differindex b448bd61a..73ca0d09d 100644 --- a/Software/DB/TCC/TCC.mdf +++ b/Software/DB/TCC/TCC.mdf diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf Binary files differindex c0c13e74b..ea01a85d8 100644 --- a/Software/DB/TCC/TCC_log.ldf +++ b/Software/DB/TCC/TCC_log.ldf diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 7ffb8ecf1..a5cff1f74 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex f33d73883..e256469b7 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/PMR/Messages/ColorLab/ColorMeasurement.proto b/Software/PMR/Messages/ColorLab/ColorMeasurement.proto new file mode 100644 index 000000000..a5e179f2f --- /dev/null +++ b/Software/PMR/Messages/ColorLab/ColorMeasurement.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package Tango.PMR.ColorLab; +option java_package = "com.twine.tango.pmr.colorlab"; + +message ColorMeasurement +{ + double C = 1; + double M = 2; + double Y = 3; + double K = 4; + double V = 5; + + double L = 10; + double A = 11; + double B = 12; +}
\ No newline at end of file diff --git a/Software/PMR/Messages/ColorLab/ConversionInput.proto b/Software/PMR/Messages/ColorLab/ConversionInput.proto index 601a231a5..1b45ac5cf 100644 --- a/Software/PMR/Messages/ColorLab/ConversionInput.proto +++ b/Software/PMR/Messages/ColorLab/ConversionInput.proto @@ -7,6 +7,7 @@ import "InputCoordinates.proto"; import "ColorSpace.proto"; import "ProcessRange.proto"; import "ConversionType.proto"; +import "ColorMeasurement.proto"; message ConversionInput { @@ -28,4 +29,10 @@ message ConversionInput bytes LubData = 16; bool UseLubricantTransform = 17; ConversionType ConversionType = 18; + int32 CMYKVPredictionType = 19; + int32 CMYKVPredictionMethod = 20; + double CMYKVHueThreshhold = 21; + double CMYKV_K = 22; + double SimpleRGBPreviewFactor = 23; + repeated ColorMeasurement ColorMeasurements = 24; }
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs index cfa0eaa4e..948081a05 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs @@ -75,7 +75,15 @@ namespace Tango.FSE.Statistics.Controls private void PlaceInnerBorder() { - _innerBorder.Margin = new Thickness(LowerValue / Maximum * _outerBorder.ActualWidth, 0, _outerBorder.ActualWidth - (UpperValue / Maximum * _outerBorder.ActualWidth), 0); + try + { + _innerBorder.Margin = new Thickness(LowerValue / Maximum * _outerBorder.ActualWidth, 0, _outerBorder.ActualWidth - (UpperValue / Maximum * _outerBorder.ActualWidth), 0); + } + catch + { + + + } } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml index 25fc3f88e..9db3fc735 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml @@ -88,17 +88,18 @@ </ListBox.ItemContainerStyle> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> - <UniformGrid Columns="10"></UniformGrid> + <UniformGrid Rows="1"></UniformGrid> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> - <Grid> + <Grid MaxWidth="35"> <Grid.RowDefinitions> + <RowDefinition Height="11"/> <RowDefinition Height="1*"/> <RowDefinition Height="30"/> </Grid.RowDefinitions> - <UniformGrid Columns="1" Rows="2"> + <UniformGrid Grid.Row="1" Columns="1" Rows="2"> <Grid Margin="2"> <Image IsHitTestVisible="False" Source="../Images/dispenser.png" RenderOptions.BitmapScalingMode="Fant"> <Image.Style> @@ -144,7 +145,7 @@ </Grid> </UniformGrid> - <Grid Grid.Row="1" Margin="3" IsHitTestVisible="False"> + <Grid Grid.Row="2" Margin="3" IsHitTestVisible="False"> <Grid.Style> <Style TargetType="Grid"> <Style.Triggers> @@ -171,6 +172,8 @@ </Border.Background> </Border> </Grid> + + <TextBlock Grid.Row="0" FontSize="9" HorizontalAlignment="Center" VerticalAlignment="Top" Text="{Binding PackIndex}"></TextBlock> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> @@ -192,8 +195,8 @@ <Rectangle VerticalAlignment="Bottom" Stroke="DimGray" StrokeThickness="2"> <!--<Rectangle.Effect> - <DropShadowEffect ShadowDepth="1" Opacity="1" Color="Black" /> - </Rectangle.Effect>--> + <DropShadowEffect ShadowDepth="1" Opacity="1" Color="Black" /> + </Rectangle.Effect>--> </Rectangle> </Grid> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/LiquidTypeToColorConverter.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/LiquidTypeToColorConverter.cs index 672032868..5ae27f0ec 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/LiquidTypeToColorConverter.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/LiquidTypeToColorConverter.cs @@ -28,6 +28,8 @@ namespace Tango.FSE.Common.Converters return Brushes.Yellow; case LiquidTypes.Black: return Brushes.Black; + case LiquidTypes.Violet: + return Brushes.DarkViolet; case LiquidTypes.Lubricant: return Brushes.Beige; case LiquidTypes.LightCyan: 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 a32fa58df..073f79a97 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 @@ -233,7 +233,22 @@ namespace Tango.MachineStudio.Developer.ViewModels public List<LiquidTypesRml> LiquidTypesRmls { get { return _liquidTypesRmls; } - set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); } + set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(LiquidTypesRmlsOrdered)); } + } + + public List<LiquidTypesRml> LiquidTypesRmlsOrdered + { + get + { + if (Settings.UsePreferredLiquidVolumeIndex) + { + return LiquidTypesRmls.OrderBy(x => x.LiquidType.PreferredIndex).ToList(); + } + else + { + return LiquidTypesRmls; + } + } } private ProcessParametersTablesGroup _rmlProcessParametersTablesGroup; @@ -841,6 +856,14 @@ namespace Tango.MachineStudio.Developer.ViewModels { Settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>(); + Settings.PropertyChanged += (x, e) => + { + if (e.PropertyName == nameof(Settings.UsePreferredLiquidVolumeIndex)) + { + RaisePropertyChanged(nameof(LiquidTypesRmlsOrdered)); + } + }; + AutoProcessSelection = Settings.AutoProcessSelection; SelectedJobs = new ObservableCollection<Job>(); 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 4217d9712..c9842d494 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 @@ -793,7 +793,7 @@ </StackPanel> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="60 40 250 0" Visibility="{Binding IsSideBarOpened,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="60 25 350 0" Visibility="{Binding IsSideBarOpened,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <materialDesign:PackIcon Kind="ChevronLeft" Width="24" Height="24" /> <TextBlock Margin="0 -2 0 0" VerticalAlignment="Center"><Run>MEDIA LIQUIDS</Run> <Run FontSize="10" Foreground="{StaticResource DimGrayBrush}">( Max Nanolitter/CM )</Run></TextBlock> <materialDesign:PackIcon Kind="ChevronRight" Width="24" Height="24" /> @@ -802,7 +802,7 @@ <Grid HorizontalAlignment="Right" Margin="0 0 0 0"> <StackPanel HorizontalAlignment="Right" Margin="0 0 0 0"> <StackPanel Margin="0 10 0 0" Orientation="Horizontal" VerticalAlignment="Center"> - <ItemsControl ItemsSource="{Binding LiquidTypesRmls}" IsEnabled="{Binding AuthenticationProvider.CurrentUser,Converter={StaticResource UserRoleToBooleanConverter},ConverterParameter='Researcher'}"> + <ItemsControl ItemsSource="{Binding LiquidTypesRmlsOrdered}" IsEnabled="{Binding AuthenticationProvider.CurrentUser,Converter={StaticResource UserRoleToBooleanConverter},ConverterParameter='Researcher'}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel IsItemsHost="True"></WrapPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_dfcch3km_wpftmp.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_dfcch3km_wpftmp.csproj new file mode 100644 index 000000000..81201d169 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_dfcch3km_wpftmp.csproj @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{1674F726-0E66-414F-B9FD-C6F20D7F07C7}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.MachineStudio.Logging</RootNamespace> + <AssemblyName>Tango.MachineStudio.Logging</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\Machine Studio\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\Machine Studio\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="ControlledObservableCollection.cs" /> + <Compile Include="Controls\TimelineScrollViewer.cs" /> + <Compile Include="Controls\TimeRuler.cs" /> + <Compile Include="Converters\DateIsInListToBooleanConverter.cs" /> + <Compile Include="Converters\EventsToTimeRulerTicksConverter.cs" /> + <Compile Include="Converters\LogItemToMessageConverter.cs" /> + <Compile Include="Converters\MachineEventToXConverter.cs" /> + <Compile Include="Converters\SecondsToWidthConverter.cs" /> + <Compile Include="Converters\StringToFirstLineConverter.cs" /> + <Compile Include="Converters\TimeSpanToXConverter.cs" /> + <Compile Include="Helpers\TimelineHelper.cs" /> + <Compile Include="LoggingModule.cs" /> + <Compile Include="Navigation\LoggingNavigationManager.cs" /> + <Compile Include="Navigation\LoggingNavigationView.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\EmbeddedLogsViewVM.cs" /> + <Compile Include="ViewModels\ApplicationLogsViewVM.cs" /> + <Compile Include="ViewModels\EventDetailsViewVM.cs" /> + <Compile Include="ViewModels\HomeViewVM.cs" /> + <Compile Include="ViewModels\EventsViewVM.cs" /> + <Compile Include="ViewModels\LogDetailsViewVM.cs" /> + <Compile Include="ViewModels\TimelineEventGroup.cs" /> + <Compile Include="ViewModels\TimelineViewVM.cs" /> + <Compile Include="Views\EmbeddedLogDetailsView.xaml.cs"> + <DependentUpon>EmbeddedLogDetailsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\EmbeddedLogsView.xaml.cs"> + <DependentUpon>EmbeddedLogsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ApplicationLogDetailsView.xaml.cs"> + <DependentUpon>ApplicationLogDetailsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\EventDetailsView.xaml.cs"> + <DependentUpon>EventDetailsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ApplicationLogsView.xaml.cs"> + <DependentUpon>ApplicationLogsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\EventsView.xaml.cs"> + <DependentUpon>EventsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\HomeView.xaml.cs"> + <DependentUpon>HomeView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\TimelineView.xaml.cs"> + <DependentUpon>TimelineView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\TimelineWrapperView.xaml.cs"> + <DependentUpon>TimelineWrapperView.xaml</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="App.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj"> + <Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project> + <Name>Tango.AutoComplete</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj"> + <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> + <Name>Tango.MachineStudio.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <ProjectExtensions> + <VisualStudio> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + </VisualStudio> + </ProjectExtensions> + <ItemGroup> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.CSharp.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\PresentationCore.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\PresentationFramework.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.ComponentModel.DataAnnotations.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.DataSetExtensions.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xaml.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.Linq.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\SideChains\Tango.AutoComplete\bin\Debug\Tango.AutoComplete.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.BL.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Core.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Integration.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Logging.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Machine Studio\Debug\Tango.MachineStudio.Common.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.PMR.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Settings.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.SharedUI.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Transport.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\WindowsBase.dll" /> + </ItemGroup> + <ItemGroup> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\App.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\EmbeddedLogDetailsView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\EmbeddedLogsView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\ApplicationLogDetailsView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\EventDetailsView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\ApplicationLogsView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\EventsView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\HomeView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\MainView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\TimelineView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\TimelineWrapperView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\GeneratedInternalTypeHelper.g.cs" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index ddc0d91a3..8d539769c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -261,6 +261,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public RelayCommand MakePrototypeCommand { get; set; } public RelayCommand UpgradeToGen2Command { get; set; } + + public RelayCommand CreateDispenserCommand { get; set; } #endregion #region Constructors @@ -301,6 +303,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels TupViewVM = new TupViewVM(_notification); UpgradeToGen2Command = new RelayCommand(UpgradeToGEN2); + + CreateDispenserCommand = new RelayCommand(CreateDispenser); } #endregion @@ -318,7 +322,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { Task.Factory.StartNew(() => { - ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection(); + ActiveMachineAdapter.Dispensers = ActiveMachineAdapter.Context.Dispensers.Where(x => x.SerialNumber.ToLower().StartsWith(DispensersFilter.ToLower())).OrderBy(x => x.SerialNumber).ToSynchronizedObservableCollection().OrderByAlphaNumeric(x => x.SerialNumber).ToSynchronizedObservableCollection(); }); }); } @@ -394,6 +398,18 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="idsPack">The ids pack.</param> public void DropDispenser(Dispenser dispenser, IdsPack idsPack) { + if (ActiveMachine.Configuration.IdsPacks.Any(x => x.DispenserGuid == dispenser.Guid)) + { + _notification.ShowError("The selected dispenser is already installed on this machine."); + return; + } + + if (ActiveMachineAdapter.Context.IdsPacks.Any(x => x.DispenserGuid == dispenser.Guid)) + { + _notification.ShowError("The selected dispenser is already installed on another machine."); + return; + } + idsPack.Dispenser = dispenser; idsPack.DispenserGuid = dispenser.Guid; } @@ -966,6 +982,32 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } } + private async void CreateDispenser() + { + String serialNumber = _notification.ShowTextInput("Please enter new serial number", "Serial Number", ActiveMachine.SerialNumber + "_D" + (ActiveMachine.Configuration.IdsPacks.Where(x => x.Dispenser != null).Count() + 1).ToString()); + if (serialNumber.IsNullOrWhiteSpace()) return; + + if (ActiveMachineAdapter.Context.Dispensers.Any(x => x.SerialNumber == serialNumber)) + { + _notification.ShowError($"Dispenser '{serialNumber}' already exists. Please enter a different serial number."); + return; + } + + using (_notification.PushTaskItem("Creating new dispenser...")) + { + using (var db = ObservablesContext.CreateDefault()) + { + Dispenser dispenser = new Dispenser(); + dispenser.SerialNumber = serialNumber; + dispenser.DispenserTypeGuid = ActiveMachineAdapter.Context.DispenserTypes.First(x => x.Code == (int)DispenserTypes.StandardDispenser).Guid; + dispenser.NlPerPulse = 2.34; + db.Dispensers.Add(dispenser); + await db.SaveChangesAsync(); + DispensersFilter = serialNumber; + } + } + } + #endregion private void CloneMachine() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml index 9b99c9ec5..5278d1780 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ConfigurationView.xaml @@ -446,6 +446,7 @@ </DataTemplate> </ListBox.ItemTemplate> </ListBox> + <Button Margin="40 10" Command="{Binding CreateDispenserCommand}" Width="160" Height="35">CREATE DISPENSER</Button> </StackPanel> </Expander> <Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs index ca3c3e322..be7dc3a67 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs @@ -248,6 +248,12 @@ namespace Tango.MachineStudio.RML.ViewModels input.UseLubricantTransform = RML.UseLubricantTransform; input.VMax = RML.VMax; + input.SetPredictionType(RML.PredictionType); + input.SetPredictionMethod(RML.PredictionMethod); + input.CMYKVHueThreshhold = RML.CmykvHueThreshold; + input.CMYKVK = RML.KNearestK; + input.SimpleRGBPreviewFactor = RML.SimpleRgbPreviewFactor; + //Validate calibration data foreach (var vm in LiquidsCalibrationData.Where(x => x.LiquidType.HasPigment)) { @@ -387,6 +393,12 @@ namespace Tango.MachineStudio.RML.ViewModels input.UseLubricantTransform = RML.UseLubricantTransform; input.VMax = RML.VMax; + input.SetPredictionType(RML.PredictionType); + input.SetPredictionMethod(RML.PredictionMethod); + input.CMYKVHueThreshhold = RML.CmykvHueThreshold; + input.CMYKVK = RML.KNearestK; + input.SimpleRGBPreviewFactor = RML.SimpleRgbPreviewFactor; + foreach (var vm in LiquidsCalibrationData.Where(x => x.LiquidType.HasPigment)) { InputLiquid inputLiquid = new InputLiquid(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index e3c128cb7..db0d7e2aa 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -348,9 +348,33 @@ namespace Tango.MachineStudio.RML.ViewModels BatchConversionCommand = new RelayCommand(BatchConversion); } - public override void OnApplicationReady() + public override async void OnApplicationReady() { + using (_notification.PushTaskItem("Loading color measurements...")) + { + using (var db = ObservablesContext.CreateDefault()) + { + var measurements = await db.ColorMeasurements.ToListAsync(); + List<PMR.ColorLab.ColorMeasurement> pmrMeasurements = new List<PMR.ColorLab.ColorMeasurement>(); + foreach (var m in measurements) + { + pmrMeasurements.Add(new PMR.ColorLab.ColorMeasurement() + { + C = m.C, + M = m.M, + Y = m.Y, + K = m.K, + V = m.V, + L = m.L, + A = m.A, + B = m.B, + }); + } + + DefaultColorConverter.SetMeasurements(pmrMeasurements); + } + } } private async Task LoadRmls() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml index 8730355cc..cdacbae60 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml @@ -23,13 +23,14 @@ <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter"/> <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter"/> + <converters:EnumToVisibilityConverter x:Key="EnumToVisibilityConverter" /> <ObjectDataProvider x:Key="Plies" ObjectType="{x:Type sys:Enum}" MethodName="GetValues"> <ObjectDataProvider.MethodParameters> <x:Type TypeName="enumerations:Plies"/> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> - + </UserControl.Resources> <Grid Margin="20"> @@ -105,7 +106,7 @@ <TextBlock Text="Condition:" ></TextBlock> <ComboBox ItemsSource="{Binding Conditions}" SelectedItem="{Binding ActiveRML.MediaCondition,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox>--> - + <TextBlock Text="Linear Density:" ></TextBlock> <mahapps:NumericUpDown Minimum="0" Maximum="9999" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.FiberSize,Mode=TwoWay}" FontSize="16"></mahapps:NumericUpDown> @@ -124,7 +125,7 @@ <TextBlock Text="Count (den):" ></TextBlock> <TextBlock Text="{Binding ActiveRML.DencityCount}" Foreground="Blue" ></TextBlock> - + <!--<TextBlock Text="Fiber Shape:" ></TextBlock> <ComboBox ItemsSource="{Binding FiberShapes}" SelectedItem="{Binding ActiveRML.FiberShape,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox>--> @@ -139,7 +140,7 @@ <!--<TextBlock Text="Plies Per Thread:" ></TextBlock> <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.PliesPerThread,Mode=TwoWay}"></mahapps:NumericUpDown>--> - + <!--<TextBlock Text="Tensile Strength:" ></TextBlock> <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.TensileStrength,Mode=TwoWay}"></mahapps:NumericUpDown> @@ -224,11 +225,12 @@ </Grid> </Border> <Grid DockPanel.Dock="Top" Background="#35B5B5B5" Margin="20 0"> - <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <ScrollViewer HorizontalScrollBarVisibility="Disabled"> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <Grid> <StackPanel Orientation="Vertical" HorizontalAlignment="Left"> - <Image Source="../Images/data-table.png" Height="80" Opacity="0.8" ></Image> - <StackPanel VerticalAlignment="Center" Width="200" Margin="5 20 5 10"> + <Image Source="../Images/data-table.png" Height="20" Opacity="0.8" ></Image> + <StackPanel VerticalAlignment="Center" Margin="5 20 5 10"> <StackPanel> <StackPanel> @@ -286,7 +288,7 @@ </StackPanel> </StackPanel> - <TextBlock Margin="0 40 0 0" Text="Color Conversion Version:" HorizontalAlignment="Center"></TextBlock> + <TextBlock Margin="0 20 0 0" Text="Color Conversion Version:" HorizontalAlignment="Center"></TextBlock> <mahapps:NumericUpDown Minimum="1" Maximum="6" Value="{Binding ActiveRML.ColorConversionVersion}" HorizontalContentAlignment="Center" Background="Transparent" BorderBrush="{StaticResource DimGrayBrush}" HasDecimals="False" Margin="0 5 0 0" /> <CheckBox ToolTip="Use the color conversion engine to generate gradients" IsChecked="{Binding ActiveRML.UseColorLibGradients}" HorizontalAlignment="Left" Margin="0 20 0 0">Enable Gradient Generation</CheckBox> @@ -297,10 +299,36 @@ <TextBlock VerticalAlignment="Center" Text="V-Max:" ></TextBlock> <mahapps:NumericUpDown Minimum="1" Maximum="100" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" HorizontalAlignment="Right" Width="100" Value="{Binding ActiveRML.VMax,Mode=TwoWay}"></mahapps:NumericUpDown> </DockPanel> - </StackPanel> + + <Separator Margin="0 40 0 0" Foreground="Cyan" Background="Violet" Height="2" /> + <TextBlock Margin="0 10 0 0" Text="CMYKV Prediction Type" FontSize="10"></TextBlock> + <ComboBox Margin="0 5 0 0" Style="{StaticResource TransparentComboBoxStyle}" ItemsSource="{Binding Source={x:Type enumerations:CMYKVPredictionTypes},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ActiveRML.PredictionType}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> + + <StackPanel Visibility="{Binding ActiveRML.PredictionType,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Predict_CMYKV,Predict_RGB,PredictAll'}"> + <TextBlock Margin="0 20 0 0" Text="CMYKV Prediction Method" FontSize="10"></TextBlock> + <ComboBox Margin="0 5 0 0" Style="{StaticResource TransparentComboBoxStyle}" ItemsSource="{Binding Source={x:Type enumerations:CMYKVPredictionMethods},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ActiveRML.PredictionMethod}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> + + <StackPanel Margin="0 20 0 0" Visibility="{Binding ActiveRML.PredictionMethod,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='KNearestNeighbors'}"> + <TextBlock FontSize="10" Text="K-Value:"></TextBlock> + <mahapps:NumericUpDown Minimum="5" Maximum="1000" Value="{Binding ActiveRML.KNearestK}" HorizontalContentAlignment="Center" Background="Transparent" BorderBrush="{StaticResource DimGrayBrush}" HasDecimals="False" Margin="0 5 0 0" /> + </StackPanel> + + <TextBlock FontSize="10" Margin="0 20 0 0" Text="Hue Threshold:"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="360" Value="{Binding ActiveRML.CmykvHueThreshold}" HorizontalContentAlignment="Center" Background="Transparent" BorderBrush="{StaticResource DimGrayBrush}" HasDecimals="True" Margin="0 5 0 0" /> + </StackPanel> + + <StackPanel Visibility="{Binding ActiveRML.PredictionType,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='SimpleRGBPreview'}"> + <TextBlock FontSize="10" Margin="0 20 0 0"> + <Run>Blending Factor:</Run> + <Run Text="{Binding ActiveRML.SimpleRgbPreviewFactor,StringFormat=N2,Mode=OneWay}"></Run> + </TextBlock> + <Slider Minimum="0.1" Maximum="1" Value="{Binding ActiveRML.SimpleRgbPreviewFactor}" Margin="0 5 0 0" SmallChange="0.01" /> + </StackPanel> + </StackPanel> </StackPanel> </Grid> </StackPanel> + </ScrollViewer> </Grid> </DockPanel> </Grid> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index c60fed143..240abc688 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -372,7 +372,7 @@ <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" CornerRadius="12" BorderThickness="0" Padding="10" MinHeight="100" Margin="0 10 0 0"> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal" Height="60" > - <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoButtonFontSize}" Margin="20 0 0 0" >Name: </TextBlock> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoButtonFontSize}" Margin="20 0 0 0" >Name:</TextBlock> <touch:TouchTextBox Width="220" Height="40" FontSize="{StaticResource TangoButtonFontSize}" Margin=" 20 0 10 0" Text="{Binding MyColorName}" FocusSelectionMode="SelectAll"></touch:TouchTextBox> </StackPanel> <Grid Margin="14 10 14 10" > @@ -475,7 +475,7 @@ <!--<TextBlock HorizontalAlignment="Center" Visibility="Collapsed" >HSB</TextBlock>--> <DockPanel HorizontalAlignment="Stretch"> <TextBlock HorizontalAlignment="Center" >LAB</TextBlock> - + </DockPanel> <TextBlock HorizontalAlignment="Center" >RGB</TextBlock> <TextBlock HorizontalAlignment="Center" >CMYK</TextBlock> @@ -493,7 +493,7 @@ </touch:TouchNavigationLinks.Style> </touch:TouchNavigationLinks> - + <Grid Grid.Row="2" x:Name="ColorsGrid" Margin="0,0,0.4,0"> @@ -613,9 +613,35 @@ <ContentControl Name="segmentCMYKContent" Grid.Row="1" ContentTemplate="{StaticResource brushColorPanel}" Content="{Binding}" IsTabStop="False"/> <Grid x:Name="CMYKgrid" Grid.Row="2" Margin="80 0 93 0" Style="{StaticResource DisableOnSaveMyColorsGrid}"> - <touch:TouchColorPickerCMYKControl x:Name="CMYKPicker" ThumbHeight="30" ThumbHeightInside="28" - IsTabStop="False" + <DockPanel> + <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding SelectedBrushStop.LiquidVolumes}" IsTabStop="False" MinWidth="200"> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type models:LiquidVolumeModel}"> + <touch:TouchColorPickerControl Margin=" 0 10 0 0" MinWidth="200" MinValue="0" IsTabStop="False" + ColorPickerText="{Binding IdsPack.LiquidType.Name}" + AutoThumbColor="True" + ThumbHeightInside="28" + ThumbHeight="30" ThumbColor="{StaticResource TangoPrimaryBackgroundColor}" + PreviewTouchDown="LABPicker_PreviewTouchDown" + PreviewMouseDown="LABPicker_OnPreviewMouseDown" + ColorValue="{Binding Volume,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay,StringFormat=0.##}" + MaxValue="{Binding MaxVolume}"> + + <touch:TouchColorPickerControl.PickerBrush> + <LinearGradientBrush ColorInterpolationMode="SRgbLinearInterpolation"> + <GradientStop Color="White" Offset="0.0"></GradientStop> + <GradientStop Color="{Binding IdsPack.LiquidType.LiquidTypeColor}" Offset="1.0"></GradientStop> + </LinearGradientBrush> + </touch:TouchColorPickerControl.PickerBrush> + </touch:TouchColorPickerControl> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <!--<touch:TouchColorPickerCMYKControl DockPanel.Dock="Top" x:Name="CMYKPicker" ThumbHeight="30" ThumbHeightInside="28" + IsTabStop="False" + ThumbColor="{StaticResource TangoPrimaryBackgroundColor}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0 0 0 0" MinWidth="200" @@ -627,7 +653,8 @@ MaxMagentaValue="{Binding MaxMagentaValue, UpdateSourceTrigger=PropertyChanged}" MaxYellowValue="{Binding MaxYellowValue, UpdateSourceTrigger=PropertyChanged}" MaxKeyValue="{Binding MaxBlackValue, UpdateSourceTrigger=PropertyChanged}" - /> + />--> + </DockPanel> </Grid> <ContentControl Grid.Row="1" Grid.RowSpan="2" ContentTemplate="{StaticResource saveMyColorsDlg}" Content="{Binding}" IsTabStop="False"/> <ContentControl Grid.Row="3" ContentTemplate="{StaticResource bottomPanel}" Content="{Binding}" IsTabStop="False"/> @@ -653,7 +680,7 @@ </touch:TouchImageButton> <ContentControl Name="myCatalogsColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}" IsTabStop="False"/> <DockPanel Grid.Row="1" Margin="0 0 20 0"> - <Grid DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0 0 0 20"> + <Grid DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0 0 0 20"> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*"/> <ColumnDefinition Width="Auto"/> @@ -724,7 +751,7 @@ <DockPanel VerticalAlignment="Top"> <touch:TouchButton DockPanel.Dock="Right" Height="48" Command="{Binding DataContext.EditColorsLibrariesCommand, ElementName=colorSelectionView}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 0 30 10" Background="Transparent" ShadowDepth="0" ShadowColor="Transparent"> <StackPanel Height="48" Width="160" Orientation="Horizontal" > - <touch:TouchIcon Margin="0 9 0 0" Foreground="{StaticResource TangoBlackInkBrush}" Height="25" Icon="PencilAltSolid" /> + <touch:TouchIcon Margin="0 9 0 0" Foreground="{StaticResource TangoBlackInkBrush}" Height="25" Icon="PencilAltSolid" /> <TextBlock Text="{Binding EditColorButtonName, Mode=TwoWay, TargetNullValue=EDIT}" Height="30" Margin="25 12 0 0" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" VerticalAlignment="Bottom" Foreground="{StaticResource TangoBlackInkBrush}" ></TextBlock> </StackPanel> </touch:TouchButton> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index cc8ddc84e..4ba8a6ebf 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -17,6 +17,7 @@ using Tango.Core.Commands; using Tango.Core.DI; using Tango.Core.Threading; using Tango.PPC.Common; +using Tango.PPC.Common.Connection; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Jobs.ColorCorrectionTool; @@ -63,6 +64,9 @@ namespace Tango.PPC.Jobs.Dialogs [TangoInject] public INotificationProvider NotificationProvider { get; set; } + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + #region Properties private bool _isEditMode; @@ -217,38 +221,6 @@ namespace Tango.PPC.Jobs.Dialogs } } - public double MaxCyanValue - { - get - { - return GetMaxCMYKValueOrDefault(LiquidTypes.Cyan); - } - } - - public double MaxMagentaValue - { - get - { - return GetMaxCMYKValueOrDefault(LiquidTypes.Magenta); - } - } - - public double MaxYellowValue - { - get - { - return GetMaxCMYKValueOrDefault(LiquidTypes.Yellow); - } - } - - public double MaxBlackValue - { - get - { - return GetMaxCMYKValueOrDefault(LiquidTypes.Black); - } - } - public DialogObject DialogEditObject { get; set; } private List<ColorCatalog> _catalogs; @@ -649,6 +621,7 @@ namespace Tango.PPC.Jobs.Dialogs InitColorTab(settings.DefaultTabColorSpace); SelectedCatalog = Catalogs.FirstOrDefault(); } + SelectedBrushStop.ColorCatalogsItemChanged -= OnColorSelectionItemChanged; SelectedBrushStop.ColorCatalogsItemChanged += OnColorSelectionItemChanged; SelectedBrushStop.PreventPropertyUpdate = true; @@ -787,6 +760,7 @@ namespace Tango.PPC.Jobs.Dialogs && SelectedBrushStop.SegmentModel.Job.Rml != null && SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Count > 0) { + var liquidTypesRml = SelectedBrushStop.SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == type); var processParametersTable = SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Single().ProcessParametersTables.OrderBy(y=>y.TableIndex).LastOrDefault(); @@ -803,10 +777,7 @@ namespace Tango.PPC.Jobs.Dialogs private void UpdateVolumesMaxValues() { - RaisePropertyChanged(nameof(MaxCyanValue)); - RaisePropertyChanged(nameof(MaxMagentaValue)); - RaisePropertyChanged(nameof(MaxYellowValue)); - RaisePropertyChanged(nameof(MaxBlackValue)); + SelectedBrushStop.LiquidVolumes.RaiseMaxVolume(); } private void OnLiquidVolumesOutOfRangeChanged(object sender, EventArgs e) @@ -1017,10 +988,10 @@ namespace Tango.PPC.Jobs.Dialogs newcolor.Red = SelectedBrushStop.Red; newcolor.Green = SelectedBrushStop.Green; newcolor.Blue = SelectedBrushStop.Blue; - newcolor.Cyan = SelectedBrushStop.Cyan; - newcolor.Magenta = SelectedBrushStop.Magenta; - newcolor.Yellow = SelectedBrushStop.Yellow; - newcolor.Black = SelectedBrushStop.Black; + newcolor.Cyan = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume; + newcolor.Magenta = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume; + newcolor.Yellow = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume; + newcolor.Black = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume; newcolor.L = SelectedBrushStop.L; newcolor.A = SelectedBrushStop.A; newcolor.B = SelectedBrushStop.B; @@ -1341,10 +1312,12 @@ namespace Tango.PPC.Jobs.Dialogs if(VectorFineTuningDialogVM.SelectedLog != null ) { _selectedBrushStop.PreventPropertyUpdate = true; - _selectedBrushStop.Cyan = VectorFineTuningDialogVM.SelectedLog.C; - _selectedBrushStop.Magenta = VectorFineTuningDialogVM.SelectedLog.M; - _selectedBrushStop.Yellow = VectorFineTuningDialogVM.SelectedLog.Y; - _selectedBrushStop.Black = VectorFineTuningDialogVM.SelectedLog.K; + + _selectedBrushStop.LiquidVolumes.ResetVolume(); + _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = VectorFineTuningDialogVM.SelectedLog.C; + _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = VectorFineTuningDialogVM.SelectedLog.M; + _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = VectorFineTuningDialogVM.SelectedLog.Y; + _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = VectorFineTuningDialogVM.SelectedLog.K; _selectedBrushStop.L = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionL; _selectedBrushStop.A = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionA; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs index e6094d0d7..183ce0185 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -808,10 +808,11 @@ namespace Tango.PPC.Jobs.Dialogs TargetA = BrushStopModel.ColorCatalogsItem.A; TargetB = BrushStopModel.ColorCatalogsItem.B; BrushStopModel.PreventPropertyUpdate = true; - BrushStopModel.Cyan = brushstop.ColorCatalogsItem.Cyan; - BrushStopModel.Magenta = brushstop.ColorCatalogsItem.Magenta; - BrushStopModel.Yellow = brushstop.ColorCatalogsItem.Yellow; - BrushStopModel.Black = brushstop.ColorCatalogsItem.Black; + BrushStopModel.LiquidVolumes.ResetVolume(); + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = brushstop.ColorCatalogsItem.Cyan; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = brushstop.ColorCatalogsItem.Magenta; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = brushstop.ColorCatalogsItem.Yellow; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = brushstop.ColorCatalogsItem.Black; BrushStopModel.PreventPropertyUpdate = false; IsOnlyManual = false; } @@ -834,10 +835,11 @@ namespace Tango.PPC.Jobs.Dialogs TargetB = brushstop.B; TargetA = brushstop.A; BrushStopModel.ConvertColorToVolume(); - if (BrushStopModel.Black > 0 && BrushStopModel.Black < 0.5) + var blackVolume = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black); + if (blackVolume.Volume > 0 && blackVolume.Volume < 0.5) { BrushStopModel.PreventPropertyUpdate = true; - BrushStopModel.Black = 0; + blackVolume.Volume = 0; BrushStopModel.PreventPropertyUpdate = false; } BrushStopModel.ColorSpace = ColorSpaces.LAB; @@ -846,10 +848,10 @@ namespace Tango.PPC.Jobs.Dialogs _sessionID = BrushStopModel.Guid + $"{TargetL}{TargetA}{TargetB}"; - Cyan = BrushStopModel.Cyan; - Magenta = BrushStopModel.Magenta; - Yellow = BrushStopModel.Yellow; - Black = BrushStopModel.Black; + Cyan = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume; + Magenta = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume; + Yellow = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume; + Black = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume; MeasuredL = MeasuredB = MeasuredA = null; TestColor = null; @@ -1146,11 +1148,11 @@ namespace Tango.PPC.Jobs.Dialogs // SaveTest(GetExcelDataItems(SelectedLog, true)); BrushStopModel.PreventPropertyUpdate = true; - BrushStopModel.Cyan = SelectedLog.C; - BrushStopModel.Magenta = SelectedLog.M; - BrushStopModel.Yellow = SelectedLog.Y; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = SelectedLog.C; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = SelectedLog.M; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = SelectedLog.Y; BrushStopModel.PreventPropertyUpdate = false; - BrushStopModel.Black = SelectedLog.K; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = SelectedLog.K; BrushStopModel.PreventPropertyUpdate = true; BrushStopModel.L = SelectedLog.SuggestionL; @@ -1509,10 +1511,7 @@ namespace Tango.PPC.Jobs.Dialogs stop.A = BrushStopModel.A; stop.B = BrushStopModel.B; - stop.SetVolume(LiquidTypes.Cyan, BrushStopModel.Cyan); - stop.SetVolume(LiquidTypes.Magenta, BrushStopModel.Magenta); - stop.SetVolume(LiquidTypes.Yellow, BrushStopModel.Yellow); - stop.SetVolume(LiquidTypes.Black, BrushStopModel.Black); + BrushStopModel.LiquidVolumes.SetVolumesOnBrushStop(stop); segment.BrushStops.Add(stop); @@ -1685,10 +1684,10 @@ namespace Tango.PPC.Jobs.Dialogs private void UpdateOnEndJob() { ActiveLogModel.IsTested = true; - Cyan = BrushStopModel.Cyan; - Magenta = BrushStopModel.Magenta; - Yellow = BrushStopModel.Yellow; - Black = BrushStopModel.Black; + Cyan = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = Cyan; + Magenta = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = Magenta; + Yellow = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = Yellow; + Black = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = Black; if (ActiveLogModel != null && TrialsLogitems.Count <= 10) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index 5c0d9145a..7f8c7d6b5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -46,125 +46,6 @@ namespace Tango.PPC.Jobs.Models [JsonIgnore] public bool PreventPropertyUpdate { get; set; } - protected Double _cyan; - - /// <summary> - /// Gets or sets the BrushStopModel cyan. - /// </summary> - public Double Cyan - { - get - { - return _cyan; - } - - set - { - if (_cyan != value) - { - _cyan = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - protected Double _magenta; - - /// <summary> - /// Gets or sets the BrushStopModel magenta. - /// </summary> - - public Double Magenta - { - get - { - return _magenta; - } - - set - { - if (_magenta != value) - { - _magenta = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - protected Double _yellow; - - /// <summary> - /// Gets or sets the BrushStopModel yellow. - /// </summary> - - public Double Yellow - { - get - { - return _yellow; - } - - set - { - if (_yellow != value) - { - _yellow = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - protected Double _black; - - /// <summary> - /// Gets or sets the BrushStopModel black. - /// </summary> - public Double Black - { - get - { - return _black; - } - - set - { - if (_black != value) - { - _black = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - protected Double _violet; - - /// <summary> - /// Gets or sets the BrushStopModel violet. - /// </summary> - public Double Violet - { - get - { - return _violet; - } - - set - { - if (Violet != value) - { - _violet = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - - protected Int32 _red; /// <summary> @@ -660,7 +541,7 @@ namespace Tango.PPC.Jobs.Models { if (RequiredMaxLiquidTest && (ColorSpace == ColorSpaces.Volume || ColorSpace == ColorSpaces.CMYK)) { - var sum = GetColorNLPerCm(Cyan, LiquidTypes.Cyan) + GetColorNLPerCm(Magenta, LiquidTypes.Magenta) + GetColorNLPerCm(Yellow, LiquidTypes.Yellow) + GetColorNLPerCm(Black, LiquidTypes.Black) + GetColorNLPerCm(Violet, LiquidTypes.Violet); + var sum = LiquidVolumes.GetMaxNanoliterPerCM(); var maxLiq = GetTotalMaximumLiquidNlPerCMLimit(); LiquidVolumesOutOfRange = sum > GetTotalMaximumLiquidNlPerCMLimit(); @@ -692,41 +573,17 @@ namespace Tango.PPC.Jobs.Models { if (ColorSpace == ColorSpaces.Volume || ColorSpace == ColorSpaces.CMYK) { - var minCyan = GetMinLimitLiquid(LiquidTypes.Cyan); - if (Cyan > 0 && Cyan < minCyan) + foreach (var liquidVolume in LiquidVolumes) { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Cyan} Cyan should be > {minCyan.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; - } - var minMagenta = GetMinLimitLiquid(LiquidTypes.Magenta); - if (Magenta > 0 && Magenta < minMagenta) - { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Magenta} Magenta should be > {minMagenta.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; - } - var minYellow = GetMinLimitLiquid(LiquidTypes.Yellow); - if (Yellow > 0 && Yellow < minYellow) - { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Yellow} Yellow should be > {minYellow.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; - } - var minBlack = GetMinLimitLiquid(LiquidTypes.Black); - if (Black > 0 && Black < minBlack) - { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Black} Black should be > {minBlack.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; - } - var minViolet = GetMinLimitLiquid(LiquidTypes.Violet); - if (Violet > 0 && Violet < minViolet) - { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Violet} Violet should be > {minViolet.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; + var min = liquidVolume.GetMinLimit(); + if (liquidVolume.Volume > 0 && liquidVolume.Volume < min) + { + LiquidVolumeBelowMinLimit = true; + LiquidVolumeBelowMinLimitmessage = $"{liquidVolume.IdsPack.LiquidType.Name} Cyan should be > {min.ToString("N3")}"; + return LiquidVolumeBelowMinLimit; + } } + LiquidVolumeBelowMinLimit = false; LiquidVolumeBelowMinLimitmessage = ""; return false; @@ -772,19 +629,19 @@ namespace Tango.PPC.Jobs.Models public Double ABeforeChange { get; set; } [JsonIgnore] public Double BBeforeChange { get; set; } + [JsonIgnore] - public Double CyanBeforeChange { get; set; } - [JsonIgnore] - public Double MagentaBeforeChange { get; set; } - [JsonIgnore] - public Double YellowBeforeChange { get; set; } - [JsonIgnore] - public Double BlackBeforeChange { get; set; } - [JsonIgnore] - public Double VioletBeforeChange { get; set; } + public BrushStop BrushStop { get; set; } public bool FineTuningChanged { get; set; } + private LiquidVolumesCollection _liquidVolums; + public LiquidVolumesCollection LiquidVolumes + { + get { return _liquidVolums; } + set { _liquidVolums = value; RaisePropertyChangedAuto(); } + } + #endregion #region constructors @@ -794,13 +651,18 @@ namespace Tango.PPC.Jobs.Models Guid = System.Guid.NewGuid().ToString(); TangoIOC.Default.Inject(this); + + LiquidVolumes = new LiquidVolumesCollection(); } public BrushStopModel(SegmentModel segmentModel) : this() { - InitDefaultValues(); SegmentModel = segmentModel; + InitLiquidVolumes(); + + InitDefaultValues(); + Color = Colors.White; var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); ColorSpace = settings.DefaultTabColorSpace == null ? ColorSpaces.Volume : (ColorSpaces)settings.DefaultTabColorSpace; @@ -815,9 +677,13 @@ namespace Tango.PPC.Jobs.Models public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel, int version) : this() { + SegmentModel = segmentModel; + BrushStop = brushStop; + + InitLiquidVolumes(); + InitDefaultValues(); Guid = brushStop.Guid; - SegmentModel = segmentModel; OffsetPercent = brushStop.OffsetPercent; Color = brushStop.Color; BestMatchColor = brushStop.Color; @@ -829,33 +695,9 @@ namespace Tango.PPC.Jobs.Models _stopindex = brushStop.StopIndex; PreventPropertyUpdate = true; - if (version < 2)//loaded from MS - { - if (brushStop.ColorSpace.Space == ColorSpaces.CMYK) - { - Cyan = brushStop.Cyan * 100; - Magenta = brushStop.Magenta * 100; - Yellow = brushStop.Yellow * 100; - Black = brushStop.Black * 100; - Violet = brushStop.Violet * 100; - } - else - { - Cyan = brushStop.GetVolume(LiquidTypes.Cyan); - Magenta = brushStop.GetVolume(LiquidTypes.Magenta); - Yellow = brushStop.GetVolume(LiquidTypes.Yellow); - Black = brushStop.GetVolume(LiquidTypes.Black); - Violet = brushStop.GetVolume(LiquidTypes.Violet); - } - } - else - { - Cyan = brushStop.Cyan; - Magenta = brushStop.Magenta; - Yellow = brushStop.Yellow; - Black = brushStop.Black; - Violet = brushStop.Violet; - } + + LiquidVolumes.SetVolumesFromBrushStop(brushStop); + Red = brushStop.Red; Green = brushStop.Green; Blue = brushStop.Blue; @@ -869,6 +711,25 @@ namespace Tango.PPC.Jobs.Models LiquidVolumesOutOfRange = false; } + public void InitLiquidVolumes() + { + LiquidVolumes.Clear(); + + var supportedIdsPacks = SegmentModel.Job.Machine.Configuration.GetSupportedIdsPacks(SegmentModel.Job.Rml).Where(x => x.LiquidType.HasPigment && x.LiquidType.AvailableForStandardUser).OrderBy(x => x.LiquidType.PreferredIndex).ToList(); + + foreach (var idsPack in supportedIdsPacks) + { + var liquidVolume = new LiquidVolumeModel(this, idsPack); + liquidVolume.VolumeChanged += (x, e) => OnVolumeChanged(); + LiquidVolumes.Add(liquidVolume); + } + + if (BrushStop != null) + { + LiquidVolumes.SetVolumesFromBrushStopSilent(BrushStop); + } + } + private void InitDefaultValues() { _hue = 0; @@ -880,7 +741,7 @@ namespace Tango.PPC.Jobs.Models _bestMatchL = 100; _bestMatchA = _bestMatchB = 0; _red = _green = _blue = 255; - _cyan = _magenta = _yellow = _black = _violet = 0; + LiquidVolumes.ResetVolumeSilent(); StopIndex = 1; Position = PositionStatus.FirstColor; IsOutOfGamut = false; @@ -925,11 +786,8 @@ namespace Tango.PPC.Jobs.Models BestMatchA = newBrushStop.BestMatchA; BestMatchB = newBrushStop.BestMatchB; - Cyan = newBrushStop.Cyan; - Magenta = newBrushStop.Magenta; - Yellow = newBrushStop.Yellow; - Black = newBrushStop.Black; - Violet = newBrushStop.Violet; + LiquidVolumes.SetVolumesFromBrushStop(newBrushStop); + ColorCatalogsItem = newBrushStop.ColorCatalogsItem; PreventPropertyUpdate = false; @@ -954,11 +812,10 @@ namespace Tango.PPC.Jobs.Models if (s.ColorSpace.Space == ColorSpaces.Volume) { - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Cyan.ToInt32()).PackIndex, Cyan); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Magenta.ToInt32()).PackIndex, Magenta); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Yellow.ToInt32()).PackIndex, Yellow); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Black.ToInt32()).PackIndex, Black); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Violet.ToInt32()).PackIndex, Violet); + foreach (var liquidVolume in LiquidVolumes) + { + s.SetVolume(liquidVolume.IdsPack.PackIndex, liquidVolume.Volume); + } } else if (s.ColorSpace.Space == ColorSpaces.LAB) { @@ -1023,11 +880,7 @@ namespace Tango.PPC.Jobs.Models cloned.BestMatchL = BestMatchL; cloned.BestMatchA = BestMatchA; cloned.BestMatchB = BestMatchB; - cloned.Cyan = Cyan; - cloned.Magenta = Magenta; - cloned.Yellow = Yellow; - cloned.Black = Black; - cloned.Violet = Violet; + cloned.LiquidVolumes.SetVolumesFromBrushStop(this); cloned.Hue = Hue; cloned.Saturation = Saturation; cloned.Brightness = Brightness; @@ -1072,11 +925,13 @@ namespace Tango.PPC.Jobs.Models PreventPropertyUpdate = true; - Cyan = favoriteColor.Cyan; - Magenta = favoriteColor.Magenta; - Yellow = favoriteColor.Yellow; - Black = favoriteColor.Black; - Violet = favoriteColor.Violet; + + LiquidVolumes.ResetVolume(); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = favoriteColor.Cyan; + LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = favoriteColor.Magenta; + LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = favoriteColor.Yellow; + LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = favoriteColor.Black; + Red = favoriteColor.Red; Green = favoriteColor.Green; @@ -1116,11 +971,7 @@ namespace Tango.PPC.Jobs.Models s.ColorCatalog = ColorCatalog; s.ColorCatalogsItem = ColorCatalogsItem; - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Cyan.ToInt32()).PackIndex, Cyan); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Magenta.ToInt32()).PackIndex, Magenta); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Yellow.ToInt32()).PackIndex, Yellow); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Black.ToInt32()).PackIndex, Black); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Violet.ToInt32()).PackIndex, Violet); + LiquidVolumes.SetVolumesOnBrushStop(s); s.L = this.L; s.A = this.A; @@ -1147,12 +998,8 @@ namespace Tango.PPC.Jobs.Models else if (ColorSpace == ColorSpaces.Volume) { PreventPropertyUpdate = true; - Cyan = CyanBeforeChange; - Magenta = MagentaBeforeChange; - Yellow = YellowBeforeChange; - Violet = VioletBeforeChange; + LiquidVolumes.Undo(); PreventPropertyUpdate = false; - Black = BlackBeforeChange; } } @@ -1167,11 +1014,7 @@ namespace Tango.PPC.Jobs.Models } else if (ColorSpace == ColorSpaces.Volume) { - CyanBeforeChange = Cyan; - MagentaBeforeChange = Magenta; - YellowBeforeChange = Yellow; - BlackBeforeChange = Black; - VioletBeforeChange = Violet; + LiquidVolumes.SaveState(); } } @@ -1495,16 +1338,12 @@ namespace Tango.PPC.Jobs.Models { if (ColorCatalogsItem != null) { - _cyan = ColorCatalogsItem.Cyan; - _magenta = ColorCatalogsItem.Magenta; - _yellow = ColorCatalogsItem.Yellow; - _black = ColorCatalogsItem.Black; - _violet = 0; - RaisePropertyChanged(nameof(Cyan)); - RaisePropertyChanged(nameof(Yellow)); - RaisePropertyChanged(nameof(Magenta)); - RaisePropertyChanged(nameof(Black)); - RaisePropertyChanged(nameof(Violet)); + LiquidVolumes.ResetVolumeSilent(); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).SetVolumeSilent(ColorCatalogsItem.Cyan); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).SetVolumeSilent(ColorCatalogsItem.Magenta); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).SetVolumeSilent(ColorCatalogsItem.Yellow); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).SetVolumeSilent(ColorCatalogsItem.Black); + LiquidVolumes.RaiseVolume(); IsOutOfGamut = false; // RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); // RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); @@ -1531,11 +1370,11 @@ namespace Tango.PPC.Jobs.Models IsBusy = true; var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false); - _cyan = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume); - _yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume); - _magenta = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta).Volume); - _black = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black).Volume); - _violet = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet).Volume); + foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) + { + LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType).SetVolumeSilent(outputLiquid.Volume); + } + IsOutOfGamut = false; //if ( LastChangedColorSpace != ColorSpaces.RGB) //{ @@ -1545,11 +1384,7 @@ namespace Tango.PPC.Jobs.Models // InitColor(); // BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); //} - RaisePropertyChanged(nameof(Cyan)); - RaisePropertyChanged(nameof(Yellow)); - RaisePropertyChanged(nameof(Magenta)); - RaisePropertyChanged(nameof(Black)); - RaisePropertyChanged(nameof(Violet)); + LiquidVolumes.RaiseVolume(); RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } @@ -1604,15 +1439,21 @@ namespace Tango.PPC.Jobs.Models IsBusy = true; var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false, ConversionType.FineTuning); - _cyan = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume); - _yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume); - _magenta = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta).Volume); - _black = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black).Volume); - _violet = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet).Volume); - if (_black > 0 && _black < 0.5)//bug 7959 0.001 < K% < 0.5 ==> reset the K to 0. + var b = output.SingleCoordinates.OutputLiquids.FirstOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black); + + if (b != null) { - _black = 0; + if (b.Volume > 0 && b.Volume < 0.5)//bug 7959 0.001 < K% < 0.5 ==> reset the K to 0. + { + b.Volume = 0; + } } + + foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) + { + LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType).SetVolumeSilent(outputLiquid.Volume); + } + IsOutOfGamut = output.OutOfGamut; if (IsOutOfGamut) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumeModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumeModel.cs new file mode 100644 index 000000000..d36a8f297 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumeModel.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Dispensing; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core; + +namespace Tango.PPC.Jobs.Models +{ + public class LiquidVolumeModel : ExtendedObject + { + public event EventHandler<LiquidVolumeModel> VolumeChanged; + + public BrushStopModel BrushStopModel { get; set; } + + private double _volume; + public double Volume + { + get { return _volume; } + set + { + if (_volume != value) + { + _volume = value; + RaisePropertyChangedAuto(); + VolumeChanged?.Invoke(this, this); + } + } + } + + public void SetVolumeSilent(double volume) + { + _volume = volume; + } + + private IdsPack _idsPack; + public IdsPack IdsPack + { + get { return _idsPack; } + set { _idsPack = value; RaisePropertyChangedAuto(); } + } + + public double MaxVolume + { + get { return GetMaxCMYKValueOrDefault(); } + } + + public double VolumeBeforeChange { get; set; } + + public void RaiseMaxVolume() + { + RaisePropertyChanged(nameof(MaxVolume)); + } + + public void SaveState() + { + VolumeBeforeChange = Volume; + } + + public void RaiseVolume() + { + RaisePropertyChanged(nameof(Volume)); + } + + public LiquidVolumeModel(BrushStopModel brushStopModel, IdsPack idsPack) + { + BrushStopModel = brushStopModel; + IdsPack = idsPack; + } + + public void Undo() + { + Volume = VolumeBeforeChange; + VolumeBeforeChange = Volume; + } + + private double GetMaxCMYKValueOrDefault() + { + if (BrushStopModel != null && BrushStopModel.SegmentModel != null + && BrushStopModel.SegmentModel.Job != null + && BrushStopModel.SegmentModel.Job.Rml != null + && BrushStopModel.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Count > 0) + { + + var liquidTypesRml = BrushStopModel.SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == IdsPack.LiquidType.Type); + var processParametersTable = BrushStopModel.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Single().ProcessParametersTables.OrderBy(y => y.TableIndex).LastOrDefault(); + + if (liquidTypesRml != null && processParametersTable != null && liquidTypesRml.MaxNlPerCm != 0) + { + return (processParametersTable.MaxInkUptake / (liquidTypesRml.MaxNlPerCm) * 100); + } + + } + return 100; + } + + public double GetColorNLPerCm() + { + StandardColorDispensingCalc calc = new StandardColorDispensingCalc(); + + Rml rml = BrushStopModel.SegmentModel.Job.Rml; + LiquidTypesRml liquidType = rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == IdsPack.LiquidType.Type); + if (liquidType != null) + { + double maxNlPerCm = liquidType.MaxNlPerCm; + return calc.CalculateNanoliterPerCentimeter(Volume, maxNlPerCm); + } + return 0.0; + } + + public double GetMinLimit() + { + try + { + var tables = BrushStopModel.SegmentModel.Job.Rml.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); + + LiquidTypesRml liquidType = BrushStopModel.SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == IdsPack.LiquidType.Type); + + if (tables.Count > 0 && liquidType != null && liquidType.MaxNlPerCm != 0) + { + var vmax = Math.Max(BrushStopModel.SegmentModel.Job.Rml.VMax / 10d, 0); + + if (IdsPack.LiquidType.Type == LiquidTypes.Black) + { + vmax = Math.Max(BrushStopModel.SegmentModel.Job.Rml.VMax, 0); + } + + return (vmax * tables[0].MinInkUptake) / liquidType.MaxNlPerCm; + } + else + { + return 0; + } + } + catch + { + return 0; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs new file mode 100644 index 000000000..704fc36b0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.BL.Enumerations; + +namespace Tango.PPC.Jobs.Models +{ + public class LiquidVolumesCollection : ObservableCollection<LiquidVolumeModel> + { + + public void RaiseMaxVolume() + { + this.ToList().ForEach(x => x.RaiseMaxVolume()); + } + + public void RaiseVolume() + { + this.ToList().ForEach(x => x.RaiseVolume()); + } + + public void ResetVolume() + { + this.ToList().ForEach(x => x.Volume = 0); + } + + public void ResetVolumeSilent() + { + this.ToList().ForEach(x => x.SetVolumeSilent(0)); + } + + public LiquidVolumeModel GetLiquidVolume(LiquidTypes type) + { + return this.FirstOrDefault(x => x.IdsPack.LiquidType.Type == type); + } + + public LiquidVolumeModel GetLiquidVolume(PMR.ColorLab.LiquidType type) + { + return this.FirstOrDefault(x => x.IdsPack.LiquidType.Type == (LiquidTypes)type); + } + + public void Undo() + { + this.ToList().ForEach(x => x.Undo()); + } + + public void SaveState() + { + this.ToList().ForEach(x => x.SaveState()); + } + + public double GetMaxNanoliterPerCM() + { + return this.Sum(x => x.GetColorNLPerCm()); + } + + public void SetVolumesFromBrushStop(BrushStop stop) + { + foreach (var model in this) + { + model.Volume = 0; + try + { + var stopVolume = stop.GetVolume(model.IdsPack.PackIndex); + model.Volume = stopVolume; + } + catch + { + Debug.WriteLine($"No volume found for {model.IdsPack.LiquidType.Name} at index {model.IdsPack.PackIndex}"); + } + } + } + + public void SetVolumesFromBrushStopSilent(BrushStop stop) + { + foreach (var model in this) + { + model.SetVolumeSilent(0); + try + { + var stopVolume = stop.GetVolume(model.IdsPack.PackIndex); + model.SetVolumeSilent(stopVolume); + } + catch + { + Debug.WriteLine($"No volume found for {model.IdsPack.LiquidType.Name} at index {model.IdsPack.PackIndex}"); + } + } + } + + public void SetVolumesFromBrushStop(BrushStopModel brushStop) + { + foreach (var model in this) + { + model.Volume = 0; + var b = brushStop.LiquidVolumes.GetLiquidVolume(model.IdsPack.LiquidType.Type); + if (b != null) + { + model.Volume = b.Volume; + } + } + } + + public void SetVolumesOnBrushStop(BrushStop brushStop) + { + foreach (var model in this) + { + try + { + brushStop.SetVolume(model.IdsPack.PackIndex, model.Volume); + } + catch + { + Debug.WriteLine($"Could not set brush stop volume for {model.IdsPack.LiquidType.Name} at index {model.IdsPack.PackIndex}"); + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs index fb4932a2e..bfc7d2234 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs @@ -28,7 +28,7 @@ namespace Tango.PPC.Jobs.Models #region Properties public string GUID { get; set; } - + protected String _name; /// <summary> /// Gets or sets the SegmentModel name. @@ -85,7 +85,7 @@ namespace Tango.PPC.Jobs.Models return SegmentsGroupModel != null; } } - + public void LengthBeforeChange(double value) { _lastLength = Length; @@ -104,7 +104,7 @@ namespace Tango.PPC.Jobs.Models get { return _weight; } set { - if(_weight != value) + if (_weight != value) { _weight = value; OnWeightChanged(); @@ -139,8 +139,11 @@ namespace Tango.PPC.Jobs.Models public bool IsInterSegment { get { return _isInterSegment; } - set { _isInterSegment = value; - RaisePropertyChangedAuto(); } + set + { + _isInterSegment = value; + RaisePropertyChangedAuto(); + } } protected Boolean _enableintersegment; @@ -153,7 +156,7 @@ namespace Tango.PPC.Jobs.Models { _enableintersegment = value; RaisePropertyChangedAuto(); - + } RaisePropertyChanged(nameof(LengthWithInterSegment)); RaisePropertyChanged(nameof(InterSegmentLength)); @@ -200,7 +203,7 @@ namespace Tango.PPC.Jobs.Models /// Gets or sets the segmentbase brush stops. /// </summary> - public SynchronizedObservableCollection<BrushStopModel> BrushStops + public SynchronizedObservableCollection<BrushStopModel> BrushStops { get { @@ -247,11 +250,12 @@ namespace Tango.PPC.Jobs.Models [JsonIgnore] public bool IsOffsetChanged { get; set; } - + public double LeftOffset { - get { return FirstBrushStop != null? FirstBrushStop.OffsetPercent : 0; } - set { + get { return FirstBrushStop != null ? FirstBrushStop.OffsetPercent : 0; } + set + { if (FirstBrushStop != null && FirstBrushStop.OffsetPercent != value) { FirstBrushStop.OffsetPercent = value; @@ -270,13 +274,14 @@ namespace Tango.PPC.Jobs.Models public double LeftOffsetChangeComleted { get { return _leftOffsetChangeComleted; } - set { - if(_leftOffsetChangeComleted != value) + set + { + if (_leftOffsetChangeComleted != value) { _leftOffsetChangeComleted = value; RaisePropertyChangedAuto(); UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeOffsetCommand(this, LeftOffsetStartChanging, _leftOffsetChangeComleted, OffsetType.Left)); - + } } } @@ -297,12 +302,13 @@ namespace Tango.PPC.Jobs.Models public double MiddleOffset { get { return (MiddleBrushStop != null) ? MiddleBrushStop.OffsetPercent : 50; } - set { - + set + { + if (MiddleBrushStop != null && MiddleBrushStop.OffsetPercent != value) { MiddleBrushStop.OffsetPercent = value; - RaisePropertyChangedAuto(); + RaisePropertyChangedAuto(); IsOffsetChanged = true; RaisePropertyChanged(nameof(SegmentBrush)); RaisePropertyChanged(nameof(MiddleOffsetLabel)); @@ -324,7 +330,7 @@ namespace Tango.PPC.Jobs.Models _middleOffsetChangeComleted = value; RaisePropertyChangedAuto(); UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeOffsetCommand(this, MiddleOffsetStartChanging, _middleOffsetChangeComleted, OffsetType.Middle)); - + } } } @@ -344,9 +350,10 @@ namespace Tango.PPC.Jobs.Models public double RightOffset { - get { return SecondBrushStop != null ? SecondBrushStop.OffsetPercent: 100; } - set { - + get { return SecondBrushStop != null ? SecondBrushStop.OffsetPercent : 100; } + set + { + if (SecondBrushStop != null && SecondBrushStop.OffsetPercent != value) { SecondBrushStop.OffsetPercent = value; @@ -371,7 +378,7 @@ namespace Tango.PPC.Jobs.Models _rightOffsetChangeComleted = value; RaisePropertyChangedAuto(); UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeOffsetCommand(this, RightOffsetStartChanging, _rightOffsetChangeComleted, OffsetType.Right)); - + } } } @@ -393,8 +400,8 @@ namespace Tango.PPC.Jobs.Models { get { - double length = Math.Round( LeftOffset * Length / 100, 1); - return String.Format($"{Math.Round(LeftOffset,0)}%({length}m)" ); + double length = Math.Round(LeftOffset * Length / 100, 1); + return String.Format($"{Math.Round(LeftOffset, 0)}%({length}m)"); } } @@ -403,7 +410,7 @@ namespace Tango.PPC.Jobs.Models { get { - double length = Math.Round((100-RightOffset) * Length / 100, 1); + double length = Math.Round((100 - RightOffset) * Length / 100, 1); return String.Format($"{Math.Round(RightOffset, 0)}%({length}m)"); } } @@ -461,12 +468,12 @@ namespace Tango.PPC.Jobs.Models { get { - if(BrushStops.Count > 0) + if (BrushStops.Count > 0) { var brushStop = BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.FirstColor).FirstOrDefault(); return brushStop; } - + return null; } @@ -494,7 +501,7 @@ namespace Tango.PPC.Jobs.Models { bool hasError = (FirstBrushStop != null && FirstBrushStop.IsOutOfGamut) || (SecondBrushStop != null && SecondBrushStop.IsOutOfGamut); - + return hasError; } } @@ -504,7 +511,9 @@ namespace Tango.PPC.Jobs.Models public bool IsSelected { get { return _isSelected; } - set { _isSelected = value; + set + { + _isSelected = value; RaisePropertyChangedAuto(); } } @@ -585,9 +594,9 @@ namespace Tango.PPC.Jobs.Models foreach (var stop in BrushStops.ToList().OrderBy(x => x.StopIndex).ToList()) { //TODO test if displayed is valid stop.IsValid - + Color color = stop.BestMatchColor; - stops.Add(new GradientStop( color, stop.OffsetPercent / 100d)); + stops.Add(new GradientStop(color, stop.OffsetPercent / 100d)); } LinearGradientBrush brush = new LinearGradientBrush(); @@ -605,7 +614,7 @@ namespace Tango.PPC.Jobs.Models { //TODO test if displayed is valid stop.IsValid Color color = BrushStops[i].BestMatchColor; - _brush.GradientStops[i].Color = color; + _brush.GradientStops[i].Color = color; _brush.GradientStops[i].Offset = BrushStops[i].OffsetPercent / 100d; } @@ -632,7 +641,7 @@ namespace Tango.PPC.Jobs.Models cloned.EnableInterSegment = EnableInterSegment; cloned.BrushStops = BrushStops.Select(x => x.Clone()).ToSynchronizedObservableCollection(); cloned.BrushStops.ToList().ForEach(x => x.SegmentModel = cloned); - + cloned.SegmentIndex = SegmentIndex + 1; cloned.SegmentsGroupModel = SegmentsGroupModel; return cloned; @@ -651,7 +660,7 @@ namespace Tango.PPC.Jobs.Models Length = length, Name = "Inter Segment", BrushStops = new SynchronizedObservableCollection<BrushStopModel>() - + }; } /// <summary> @@ -672,7 +681,7 @@ namespace Tango.PPC.Jobs.Models colorbrushStop.StopIndex = 2; colorbrushStop.OffsetPercent = 0; BrushStops.Add(colorbrushStop); - + BrushStopModel middleBrushStop = firstBrush.Clone(); middleBrushStop.StopIndex = 3; middleBrushStop.Position = BrushStopModel.PositionStatus.Middle; @@ -703,23 +712,23 @@ namespace Tango.PPC.Jobs.Models BrushStops.Add(lastSecondBrushStop); } - public void SetNewColor(BrushStopModel target, BrushStopModel source ) + public void SetNewColor(BrushStopModel target, BrushStopModel source) { target.SetNewColor(source); target.IsOutOfGamut = source.IsOutOfGamut; if (target.Position == BrushStopModel.PositionStatus.FirstColor) { BrushStopModel first = BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.First).FirstOrDefault(); - if(first != null) + if (first != null) { first.SetNewColor(source); first.IsOutOfGamut = source.IsOutOfGamut; - } + } } - else if(target.Position == BrushStopModel.PositionStatus.SecondColor) + else if (target.Position == BrushStopModel.PositionStatus.SecondColor) { BrushStopModel last = BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.Last).FirstOrDefault(); - if(last != null) + if (last != null) { last.SetNewColor(source); last.IsOutOfGamut = source.IsOutOfGamut; @@ -728,7 +737,7 @@ namespace Tango.PPC.Jobs.Models UpdateMiddleColorBrush(); RaiseSegmentBrushChanged(); } - + public void UpdateMiddleColorBrush() { if (MiddleBrushStop != null && SecondBrushStop != null && FirstBrushStop != null) @@ -737,13 +746,13 @@ namespace Tango.PPC.Jobs.Models MiddleBrushStop.BestMatchColor = BrushStopModel.GetRelativeRGB(FirstBrushStop.BestMatchColor, SecondBrushStop.BestMatchColor, 0, 1, 0.5); } } - + public void RemoveSecondColorOfGradient() { if (BrushStops.Count < 5) - return ; - BrushStops.RemoveAt(4); - BrushStops.RemoveAt(3); + return; + BrushStops.RemoveAt(4); + BrushStops.RemoveAt(3); } public void ArrangeBrushStopsIndexes() @@ -764,7 +773,7 @@ namespace Tango.PPC.Jobs.Models else if (BrushStops.Count > 1) BrushStops.ToList().ForEach(x => x.Position = (BrushStopModel.PositionStatus)x.StopIndex); } - + public void SwapBrushStops() { if (BrushStops.Count > 1) @@ -776,7 +785,7 @@ namespace Tango.PPC.Jobs.Models var left_temp = BrushStops[index]; var right_stopIndex = BrushStops[lastIndex].StopIndex; var right_offsetPercent = BrushStops[lastIndex].OffsetPercent; - + BrushStops[index] = BrushStops[lastIndex]; BrushStops[index].StopIndex = left_temp.StopIndex; BrushStops[index].OffsetPercent = left_temp.OffsetPercent; @@ -834,7 +843,7 @@ namespace Tango.PPC.Jobs.Models if (Job != null && Job.Rml != null) { var gramPerlength = Job.Rml.GetGramPer1000mLength; - var weight = (Length * gramPerlength)/( 1000 );//(kg) + var weight = (Length * gramPerlength) / (1000);//(kg) _weight = weight; RaisePropertyChanged(nameof(Weight)); //if (_lastLength != length) @@ -858,7 +867,7 @@ namespace Tango.PPC.Jobs.Models if (Job != null && Job.Rml != null) { var gramPerlength = Job.Rml.GetGramPer1000mLength; - var length = (Weight * 1000 )/ gramPerlength;//(m) weight in gr + var length = (Weight * 1000) / gramPerlength;//(m) weight in gr _length = length; RaisePropertyChanged(nameof(Length)); @@ -867,7 +876,7 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(LeftOffsetLabel)); RaisePropertyChanged(nameof(MiddleOffsetLabel)); RaisePropertyChanged(nameof(RightOffsetLabel)); - + } } @@ -876,62 +885,68 @@ namespace Tango.PPC.Jobs.Models /// </summary> /// <param name="brushstops"></param> protected void OnBrushStopsChanged(SynchronizedObservableCollection<BrushStopModel> brushstops) + { + if (brushstops != null) { - if (brushstops != null) - { - brushstops.CollectionChanged -= BrushStops_CollectionChanged; - brushstops.CollectionChanged += BrushStops_CollectionChanged; + brushstops.CollectionChanged -= BrushStops_CollectionChanged; + brushstops.CollectionChanged += BrushStops_CollectionChanged; - foreach (var stop in brushstops.ToList()) - { - stop.RaiseOffsetChanged(); - } - - RaiseSegmentBrushChanged(); + foreach (var stop in brushstops.ToList()) + { + stop.RaiseOffsetChanged(); } - } - private void AddGap() - { - EnableInterSegment = true; + RaiseSegmentBrushChanged(); } + } - private void DeleteGap() - { - EnableInterSegment = false; - } + private void AddGap() + { + EnableInterSegment = true; + } - public void UpdateBrushStops() - { - foreach (var stop in BrushStops.Where(x => x.ColorSpace == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace == BL.Enumerations.ColorSpaces.LAB).ToList()) - { - try - { - stop.OnBrushStopFieldValueChanged(); - stop.InitColorsFromBestmatch(); - //TODO ASK ROY!!!!!! - //output.ApplyOnBrushStopVolumesOnly(stop); - } - catch (Exception ex) - { - LogManager.Log(ex, $"Error updating stop volumes after changing thread on segment {stop.SegmentModel.SegmentIndex}, stop {stop.StopIndex}."); - } - } - } + private void DeleteGap() + { + EnableInterSegment = false; + } - public void UpdateWeightOnRMLChange( bool isWeightView) + public void UpdateBrushStops() + { + foreach (var stop in BrushStops.Where(x => x.ColorSpace == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace == BL.Enumerations.ColorSpaces.LAB).ToList()) { - if(isWeightView) + try { - OnWeightChanged(); + stop.OnBrushStopFieldValueChanged(); + stop.InitColorsFromBestmatch(); + //TODO ASK ROY!!!!!! + //output.ApplyOnBrushStopVolumesOnly(stop); } - else + catch (Exception ex) { - OnLengthChanged(Length); + LogManager.Log(ex, $"Error updating stop volumes after changing thread on segment {stop.SegmentModel.SegmentIndex}, stop {stop.StopIndex}."); } } + foreach (var stop in BrushStops.Where(x => x.ColorSpace == ColorSpaces.Volume)) + { + stop.InitLiquidVolumes(); + } - #endregion } + + public void UpdateWeightOnRMLChange(bool isWeightView) + { + if (isWeightView) + { + OnWeightChanged(); + } + else + { + OnLengthChanged(Length); + } + } + + + #endregion } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj index 405f87b28..ca80b27a0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj @@ -322,6 +322,8 @@ <Compile Include="Models\FavoriteColor.cs" /> <Compile Include="Models\ISegmentModel.cs" /> <Compile Include="Models\JobModel.cs" /> + <Compile Include="Models\LiquidVolumeModel.cs" /> + <Compile Include="Models\LiquidVolumesCollection.cs" /> <Compile Include="Models\SegmentModel.cs" /> <Compile Include="Models\SegmentsGroupModel.cs" /> <Compile Include="Models\TestColor.cs" /> @@ -762,7 +764,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs index b879831b9..a5b68b368 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs @@ -205,6 +205,8 @@ namespace Tango.PPC.Jobs.ViewModels protected void OnUpdateCurrentBrush() { + CurrentBrushStop.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); + RaisePropertyChanged(nameof(CyanOutput)); RaisePropertyChanged(nameof(LightCyanOutput)); RaisePropertyChanged(nameof(MagentaOutput)); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index 970bbcd04..499d2c08c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -1672,10 +1672,6 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.L = stop.L; dbStop.A = stop.A; dbStop.B = stop.B; - dbStop.Cyan = stop.Cyan; - dbStop.Magenta = stop.Magenta; - dbStop.Yellow = stop.Yellow; - dbStop.Black = stop.Black; dbStop.BestMatchR = stop.BestMatchColor.R; dbStop.BestMatchG = stop.BestMatchColor.G; dbStop.BestMatchB = stop.BestMatchColor.B; @@ -1684,10 +1680,7 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.StopIndex = stop.StopIndex; dbStop.IsOutOfGamut = stop.IsOutOfGamut; - dbStop.SetVolume(LiquidTypes.Cyan, stop.Cyan); - dbStop.SetVolume(LiquidTypes.Magenta, stop.Magenta); - dbStop.SetVolume(LiquidTypes.Yellow, stop.Yellow); - dbStop.SetVolume(LiquidTypes.Black, stop.Black); + stop.LiquidVolumes.SetVolumesOnBrushStop(dbStop); dbStop.ColorCatalog = stop.ColorCatalog; dbStop.ColorCatalogsItem = stop.ColorCatalogsItem; @@ -1728,10 +1721,6 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.L = stop.L; dbStop.A = stop.A; dbStop.B = stop.B; - dbStop.Cyan = stop.Cyan; - dbStop.Magenta = stop.Magenta; - dbStop.Yellow = stop.Yellow; - dbStop.Black = stop.Black; dbStop.BestMatchR = stop.BestMatchColor.R; dbStop.BestMatchG = stop.BestMatchColor.G; dbStop.BestMatchB = stop.BestMatchColor.B; @@ -1740,10 +1729,7 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.StopIndex = stop.StopIndex; dbStop.IsOutOfGamut = stop.IsOutOfGamut; - dbStop.SetVolume(LiquidTypes.Cyan, stop.Cyan); - dbStop.SetVolume(LiquidTypes.Magenta, stop.Magenta); - dbStop.SetVolume(LiquidTypes.Yellow, stop.Yellow); - dbStop.SetVolume(LiquidTypes.Black, stop.Black); + stop.LiquidVolumes.SetVolumesOnBrushStop(dbStop); dbStop.ColorCatalog = stop.ColorCatalog; dbStop.ColorCatalogsItem = stop.ColorCatalogsItem; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml index adf8c22d5..980c38082 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml @@ -141,33 +141,24 @@ </UniformGrid> </DataTemplate> - <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> - <UniformGrid Rows="1" Columns="4" Height="30" > - <StackPanel Orientation="Horizontal"> - <TextBlock Text="C" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Cyan, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="0 0 0 0"> - <TextBlock Text="M" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Magenta, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> - <TextBlock Text="Y" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Yellow, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> - <TextBlock Text="K" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Black, StringFormat=0.##}"></TextBlock> - </Border> - </StackPanel> - </UniformGrid> + <DataTemplate x:Key="CMYK_Template" DataType="{x:Type model:BrushStopModel}"> + <ItemsControl ItemsSource="{Binding LiquidVolumes}" Height="30"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="0 0 15 0"> + <TextBlock Text="{Binding IdsPack.LiquidType.ShortName}" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> + <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Volume, StringFormat=0.##}" ></TextBlock> + </Border> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </DataTemplate> <DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml index 89b69a316..c80abe0e0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml @@ -23,32 +23,23 @@ </Style> <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> - <UniformGrid Rows="1" Columns="4" Height="Auto" MinWidth="180" HorizontalAlignment="Left"> - <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="Cyan" CornerRadius="16" HorizontalAlignment="Left" > - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Cyan, StringFormat=0.##}" VerticalAlignment="Center"></TextBlock> - </Border> - <TextBlock Margin="0 10 0 0" Text="C" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="0 0 0 0" Width="50"> - <Border Width="50" Height="50" Background="Magenta" CornerRadius="16" HorizontalAlignment="Left"> - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Magenta, StringFormat=0.##}" VerticalAlignment="Center" ></TextBlock> - </Border> - <TextBlock Margin="0 10 0 0" Text="M" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="10 0 0 0" Width="50"> - <Border Width="50" Height="50" Background="Yellow" CornerRadius="16" HorizontalAlignment="Left"> - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Yellow, StringFormat=0.##}" VerticalAlignment="Center" ></TextBlock> - </Border> - <TextBlock Margin="0 10 0 0" Text="Y" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="10 0 0 0" Width="50"> - <Border Width="50" Height="50" Background="Black" CornerRadius="16" HorizontalAlignment="Left"> - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Black, StringFormat=0.##}" VerticalAlignment="Center" Foreground="{StaticResource TangoLightForegroundBrush}"></TextBlock> - </Border> - <TextBlock Margin="0 10 0 0" Text="K" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - </StackPanel> - </UniformGrid> + <ItemsControl ItemsSource="{Binding LiquidVolumesOrderedPigmentedForStandardUser}" MinWidth="180" HorizontalAlignment="Left"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Margin="0 0 10 0" Orientation="Vertical" Width="50" HorizontalAlignment="Left"> + <Border Width="50" Height="50" Background="{Binding IdsPack.LiquidType.LiquidTypeBrush}" CornerRadius="16" HorizontalAlignment="Left" > + <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Volume, StringFormat=0.##}" VerticalAlignment="Center"></TextBlock> + </Border> + <TextBlock Margin="0 10 0 0" Text="{Binding IdsPack.LiquidType.ShortName}" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </DataTemplate> <DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}"> @@ -338,13 +329,13 @@ <Border Width="50" Height="50" Background="Transparent" CornerRadius="16" HorizontalAlignment="Left" BorderBrush="{StaticResource TangoDisabledForegroundBrush}" BorderThickness="1"> <TextBlock Margin="0 " Style="{StaticResource SliderGreyTextStyle}" Text="-" ></TextBlock> </Border> - <TextBlock Margin="0 10 0 0 " Text="a" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0 " Text="A" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> </StackPanel> <StackPanel Orientation="Vertical" Width="50"> <Border Width="50" Height="50" Background="Transparent" CornerRadius="16" HorizontalAlignment="Left" BorderBrush="{StaticResource TangoDisabledForegroundBrush}" BorderThickness="1"> <TextBlock Margin="0 " Style="{StaticResource SliderGreyTextStyle}" Text="-" ></TextBlock> </Border> - <TextBlock Margin="0 10 0 0 " Text="b" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0 " Text="B" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> </StackPanel> </UniformGrid> <Grid Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityConverter}}"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml index 038c4af0f..02ff30d24 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml @@ -137,33 +137,24 @@ </UniformGrid> </DataTemplate> - <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> - <UniformGrid Rows="1" Columns="4" Height="30" > - <StackPanel Orientation="Horizontal"> - <TextBlock Text="C" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Cyan, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="0 0 0 0"> - <TextBlock Text="M" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Magenta, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> - <TextBlock Text="Y" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Yellow, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> - <TextBlock Text="K" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Black, StringFormat=0.##}"></TextBlock> - </Border> - </StackPanel> - </UniformGrid> + <DataTemplate x:Key="CMYK_Template" DataType="{x:Type model:BrushStopModel}"> + <ItemsControl ItemsSource="{Binding LiquidVolumes}" Height="30"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="0 0 10 0"> + <TextBlock Text="{Binding IdsPack.LiquidType.ShortName}" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="5 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> + <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Volume, StringFormat=0.##}" ></TextBlock> + </Border> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </DataTemplate> <DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs index 3b10b7bdf..da9afc2c7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs @@ -55,6 +55,8 @@ namespace Tango.PPC.Maintenance.Converters return Application.Current.Resources["TangoLightMagentaInkBrush"] as Brush; case BL.Enumerations.LiquidTypes.LightYellow: return Application.Current.Resources["TangoLightYellowInkBrush"] as Brush; + case BL.Enumerations.LiquidTypes.Violet: + return Application.Current.Resources["TangoVioletInkBrush"] as Brush; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs index 00b4f5ad1..b42a3206c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/DefaultRemoteJobService.cs @@ -180,10 +180,14 @@ namespace Tango.PPC.Common.RemoteJob switch (colorSpace) { case BL.Enumerations.ColorSpaces.Volume: - inputOutput.Input.Add(new Tuple<string, String>("C", i.CurrentBrushStop.Cyan.ToString("0.00"))); - inputOutput.Input.Add(new Tuple<string, String>("M", i.CurrentBrushStop.Magenta.ToString("0.00"))); - inputOutput.Input.Add(new Tuple<string, String>("Y", i.CurrentBrushStop.Yellow.ToString("0.00"))); - inputOutput.Input.Add(new Tuple<string, String>("K", i.CurrentBrushStop.Black.ToString("0.00"))); + if (i.CurrentBrushStop.LiquidVolumes != null) + { + foreach (var input in i.CurrentBrushStop.LiquidVolumesOrderedPigmentedForStandardUser.ToList()) + { + inputOutput.Input.Add(new Tuple<string, string>(input.IdsPack.LiquidType.ShortName, input.Volume.ToString())); + } + } + break; case BL.Enumerations.ColorSpaces.RGB: inputOutput.Input.Add(new Tuple<string, String>("R", i.CurrentBrushStop.Red.ToString())); @@ -205,13 +209,10 @@ namespace Tango.PPC.Common.RemoteJob try { - inputOutput.Output.Add(new Tuple<string, string>("C", i.CyanOutput.ToString())); - inputOutput.Output.Add(new Tuple<string, string>("LC", i.LightCyanOutput.ToString())); - inputOutput.Output.Add(new Tuple<string, string>("M", i.MagentaOutput.ToString())); - inputOutput.Output.Add(new Tuple<string, string>("LM", i.LightMagentaOutput.ToString())); - inputOutput.Output.Add(new Tuple<string, string>("Y", i.YellowOutput.ToString())); - inputOutput.Output.Add(new Tuple<string, string>("LY", i.LightYellowOutput.ToString())); - inputOutput.Output.Add(new Tuple<string, string>("K", i.BlackOutput.ToString())); + foreach (var output in i.LiquidOutputs) + { + inputOutput.Output.Add(new Tuple<string, string>(output.LiquidType.ShortName, output.Volume.ToString())); + } } catch { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs index cc98bd419..85dd66f7c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/IRemoteJobInputOutputProvider.cs @@ -10,13 +10,6 @@ namespace Tango.PPC.Common.RemoteJob public interface IRemoteJobInputOutputProvider { BrushStop CurrentBrushStop { get; } - - double CyanOutput { get; } - double MagentaOutput { get; } - double YellowOutput { get; } - double BlackOutput { get; } - double LightCyanOutput { get; } - double LightMagentaOutput { get; } - double LightYellowOutput { get; } + List<LiquidOutputModel> LiquidOutputs { get; set; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/LiquidOutputModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/LiquidOutputModel.cs new file mode 100644 index 000000000..113d11ddc --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteJob/LiquidOutputModel.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Core; + +namespace Tango.PPC.Common.RemoteJob +{ + public class LiquidOutputModel : ExtendedObject + { + private LiquidType _liquidType; + public LiquidType LiquidType + { + get { return _liquidType; } + set { _liquidType = value; RaisePropertyChangedAuto(); } + } + + private double _volume; + public double Volume + { + get { return _volume; } + set { _volume = value; RaisePropertyChangedAuto(); } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Colors.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Colors.xaml index 816d72de3..acd4c7406 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Colors.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Colors.xaml @@ -9,6 +9,8 @@ <SolidColorBrush x:Key="TangoMagentaInkBrush" Color="#ed008c" /> <SolidColorBrush x:Key="TangoCyanInkBrush" Color="#1662EB" /> <SolidColorBrush x:Key="TangoYellowInkBrush" Color="#e8e10c" /> + <Color x:Key="TangoVioletInkColor">#7F00FF</Color> + <SolidColorBrush x:Key="TangoVioletInkBrush" Color="#7F00FF" /> <SolidColorBrush x:Key="TangoWasteBrush" Color="#2BA221" /> <SolidColorBrush x:Key="TangoTransparentInkBrush" Color="#A0A0A0" /> <SolidColorBrush x:Key="TangoLubricantBrush" Color="#B6AD7C" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 08ad6ec1c..97a89b082 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -224,6 +224,7 @@ <Compile Include="RemoteJob\IRemoteJobInputOutputProvider.cs" /> <Compile Include="RemoteJob\IRemoteJobService.cs" /> <Compile Include="RemoteActions\IRemoteActionsService.cs" /> + <Compile Include="RemoteJob\LiquidOutputModel.cs" /> <Compile Include="RemoteNotifications\DefaultRemoteNotificationsService.cs" /> <Compile Include="RemoteNotifications\IRemoteNotificationsService.cs" /> <Compile Include="Resume\DefaultJobResumeManager.cs" /> @@ -643,7 +644,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LiquidTypeToBrushConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LiquidTypeToBrushConverter.cs index 75846431f..0dbbdfd3c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LiquidTypeToBrushConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LiquidTypeToBrushConverter.cs @@ -32,6 +32,8 @@ namespace Tango.PPC.UI.Converters return Application.Current.Resources["TangoCyanInkBrush"] as Brush; case BL.Enumerations.LiquidTypes.Magenta: return Application.Current.Resources["TangoMagentaInkBrush"] as Brush; + case BL.Enumerations.LiquidTypes.Violet: + return Application.Current.Resources["TangoVioletInkBrush"] as Brush; case BL.Enumerations.LiquidTypes.LightCyan: return Application.Current.Resources["TangoLightCyanInkBrush"] as Brush; case BL.Enumerations.LiquidTypes.LightMagenta: diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 35620b261..c920fdbad 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -1004,7 +1004,7 @@ if $(ConfigurationName) == Eureka copy /Y "$(ProjectDir)Intro.wmv" "$(TargetDir) </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> <Import Project="..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets" Condition="Exists('..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets')" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index c7ba2e24d..afb536c58 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -180,6 +180,8 @@ namespace Tango.PPC.UI.ViewModels // if (_currentBrushStop != value) { _currentBrushStop = value; + + OnUpdateCurrentBrush(); RaisePropertyChangedAuto(); } @@ -188,41 +190,6 @@ namespace Tango.PPC.UI.ViewModels public JobBrushStop JobBrushStop { get; set; } - public double CyanOutput - { - get { return GetVolumeLiquidType(LiquidTypes.Cyan); } - } - - public double MagentaOutput - { - get { return GetVolumeLiquidType(LiquidTypes.Magenta); } - } - - public double YellowOutput - { - get { return GetVolumeLiquidType(LiquidTypes.Yellow); } - } - - public double BlackOutput - { - get { return GetVolumeLiquidType(LiquidTypes.Black); } - } - - public double LightCyanOutput - { - get { return GetVolumeLiquidType(LiquidTypes.LightCyan); } - } - - public double LightMagentaOutput - { - get { return GetVolumeLiquidType(LiquidTypes.LightMagenta); } - } - - public double LightYellowOutput - { - get { return GetVolumeLiquidType(LiquidTypes.LightYellow); } - } - //public double TransparentInkOutput //{ // get { return GetVolumeLiquidType(LiquidTypes.TransparentInk); } @@ -372,6 +339,12 @@ namespace Tango.PPC.UI.ViewModels } } + private List<LiquidOutputModel> _liquidOutputs; + public List<LiquidOutputModel> LiquidOutputs + { + get { return _liquidOutputs; } + set { _liquidOutputs = value; RaisePropertyChangedAuto(); } + } #endregion @@ -635,6 +608,22 @@ namespace Tango.PPC.UI.ViewModels { _handler = e.JobHandler; Job = e.Job; + + List<LiquidOutputModel> outputs = new List<LiquidOutputModel>(); + + var idsPacks = MachineProvider.Machine.Configuration.GetSupportedIdsPacks(Job.Rml); + + foreach (var idsPack in idsPacks.Where(x => x.LiquidType.HasPigment)) + { + outputs.Add(new LiquidOutputModel() + { + LiquidType = idsPack.LiquidType, + Volume = 0, + }); + } + + LiquidOutputs = outputs; + try { ResumeModel = JobResumeManager.GetJobResumeModel(Job.Guid); @@ -703,7 +692,14 @@ namespace Tango.PPC.UI.ViewModels { if (_runningJobStatus.CurrentSegment.IsInterSegment) { - CurrentBrushStop = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault(); + var brush = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault(); + if (brush != null) + { + brush = brush.CloneBrush(); + } + + CurrentBrushStop = brush; + JobBrushStop = null; } else @@ -731,7 +727,7 @@ namespace Tango.PPC.UI.ViewModels JobBrushStop = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)].BrushStops.First(); } } - CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; + CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop.CloneBrush(); } } } @@ -920,13 +916,12 @@ namespace Tango.PPC.UI.ViewModels protected void OnUpdateCurrentBrush() { - RaisePropertyChanged(nameof(CyanOutput)); - RaisePropertyChanged(nameof(LightCyanOutput)); - RaisePropertyChanged(nameof(MagentaOutput)); - RaisePropertyChanged(nameof(LightMagentaOutput)); - RaisePropertyChanged(nameof(YellowOutput)); - RaisePropertyChanged(nameof(LightYellowOutput)); - RaisePropertyChanged(nameof(BlackOutput)); + CurrentBrushStop.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); + + foreach (var output in LiquidOutputs) + { + output.Volume = GetVolumeLiquidType(output.LiquidType.Type); + } } private void HideJobOutline() diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index c567421aa..74db8e471 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -45,28 +45,22 @@ </Style> <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> - <UniformGrid Rows="1" Columns="4" Height="Auto" MinWidth="180"> - <StackPanel Orientation="Vertical"> - <Border Width="50" Height="50" Background="Cyan" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0" Text="C" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Cyan, StringFormat=0.##}" ></TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="0 0 0 0"> - <Border Width="50" Height="50" Background="Magenta" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0" Text="M" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Magenta, StringFormat=0.##}" ></TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="10 0 0 0"> - <Border Width="50" Height="50" Background="Yellow" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0" Text="Y" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Yellow, StringFormat=0.##}" ></TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="10 0 0 0"> - <Border Width="50" Height="50" Background="Black" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0" Text="K" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Black, StringFormat=0.##}"></TextBlock> - </StackPanel> - </UniformGrid> + <ItemsControl ItemsSource="{Binding LiquidVolumesOrderedPigmentedForStandardUser}" MinWidth="180" HorizontalAlignment="Left" Height="Auto"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Vertical" Margin="0 0 10 0"> + <Border Width="50" Height="50" Background="{Binding IdsPack.LiquidType.LiquidTypeBrush}" CornerRadius="16" HorizontalAlignment="Left"></Border> + <TextBlock Margin="0 10 0 0" Text="{Binding IdsPack.LiquidType.ShortName}" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Volume, StringFormat=0.##}" ></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </DataTemplate> <DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}"> @@ -101,12 +95,12 @@ </StackPanel> <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left" Margin="5 0 0 0"> <Border Width="50" Height="50" Background="red" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " Text="a" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0 " Text="A" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> <TextBlock Margin="0 10 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding A, StringFormat=0.##}" ></TextBlock> </StackPanel> <StackPanel Orientation="Vertical" Margin="10 0 0 0" Width="50"> <Border Width="50" Height="50" Background="Blue" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " Text="b" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0 " Text="B" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> <TextBlock Margin="0 10 0 0" HorizontalAlignment="Center" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding B, StringFormat=0.##}" ></TextBlock> </StackPanel> </UniformGrid> @@ -910,12 +904,12 @@ </StackPanel> <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left" Margin="5 0 0 0"> <Border Width="50" Height="50" Background="Transparent" CornerRadius="16" HorizontalAlignment="Left" BorderBrush="{StaticResource TangoDisabledForegroundBrush}" BorderThickness="1"></Border> - <TextBlock Margin="0 10 0 0 " Text="a" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0 " Text="A" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> <TextBlock Margin="0 10 0 0 " Style="{StaticResource SliderGreyTextStyle}" Text="-" ></TextBlock> </StackPanel> <StackPanel Orientation="Vertical" Margin="10 0 0 0" Width="50"> <Border Width="50" Height="50" Background="Transparent" CornerRadius="16" HorizontalAlignment="Left" BorderBrush="{StaticResource TangoDisabledForegroundBrush}" BorderThickness="1"></Border> - <TextBlock Margin="0 10 0 0 " Text="b" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0 " Text="B" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> <TextBlock Margin="0 10 0 0 " Style="{StaticResource SliderGreyTextStyle}" Text="-" ></TextBlock> </StackPanel> </UniformGrid> @@ -989,43 +983,23 @@ <TextBlock Margin="0 10 0 0 " Text="0%" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> </StackPanel> </UniformGrid> - <UniformGrid Columns="7" Rows="1" Margin="0 20 0 0" Width="440" HorizontalAlignment="Left" Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityConverter}}"> - <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="Cyan" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center">C</TextBlock> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding CyanOutput}"></TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="LightCyan" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center">LC</TextBlock> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding LightCyanOutput}"></TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="Magenta" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center">M</TextBlock> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding MagentaOutput}"></TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="LightPink" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center">LM</TextBlock> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding LightMagentaOutput}"></TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="Yellow" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center">Y</TextBlock> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding YellowOutput}"></TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="LightYellow" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center">LY</TextBlock> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding LightYellowOutput}"></TextBlock> - </StackPanel> - <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="Black" CornerRadius="16" HorizontalAlignment="Left"></Border> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center">K</TextBlock> - <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding BlackOutput}"></TextBlock> - </StackPanel> - </UniformGrid> + + <ItemsControl ItemsSource="{Binding LiquidOutputs}" Margin="0 20 0 0" HorizontalAlignment="Left" Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityConverter}}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Margin="0 0 10 0" Orientation="Vertical" Width="50" HorizontalAlignment="Left"> + <Border Width="50" Height="50" Background="{Binding LiquidType.LiquidTypeBrush}" CornerRadius="16" HorizontalAlignment="Left"></Border> + <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding LiquidType.ShortName}"></TextBlock> + <TextBlock Margin="0 10 0 0 " HorizontalAlignment="Center" Text="{Binding Volume}"></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </StackPanel> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> diff --git a/Software/Visual_Studio/Tango.BL/DTO/ColorMeasurementDTO.cs b/Software/Visual_Studio/Tango.BL/DTO/ColorMeasurementDTO.cs new file mode 100644 index 000000000..276b34408 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/DTO/ColorMeasurementDTO.cs @@ -0,0 +1,14 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.DTO +{ + public class ColorMeasurementDTO : ColorMeasurementDTOBase + { + + } +} diff --git a/Software/Visual_Studio/Tango.BL/DTO/ColorMeasurementDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/ColorMeasurementDTOBase.cs new file mode 100644 index 000000000..bb67290ac --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/DTO/ColorMeasurementDTOBase.cs @@ -0,0 +1,89 @@ + +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Tango Observables Generator +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. Do not modify! +// </auto-generated> +//------------------------------------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.BL.DTO +{ + public abstract class ColorMeasurementDTOBase : ObservableEntityDTO<ColorMeasurementDTO, ColorMeasurement> + { + + /// <summary> + /// c + /// </summary> + public Double C + { + get; set; + } + + /// <summary> + /// m + /// </summary> + public Double M + { + get; set; + } + + /// <summary> + /// y + /// </summary> + public Double Y + { + get; set; + } + + /// <summary> + /// k + /// </summary> + public Double K + { + get; set; + } + + /// <summary> + /// v + /// </summary> + public Double V + { + get; set; + } + + /// <summary> + /// l + /// </summary> + public Double L + { + get; set; + } + + /// <summary> + /// a + /// </summary> + public Double A + { + get; set; + } + + /// <summary> + /// b + /// </summary> + public Double B + { + get; set; + } + + } +} diff --git a/Software/Visual_Studio/Tango.BL/DTO/RmlDTOBase.cs b/Software/Visual_Studio/Tango.BL/DTO/RmlDTOBase.cs index e3b9f676c..2b842f59b 100644 --- a/Software/Visual_Studio/Tango.BL/DTO/RmlDTOBase.cs +++ b/Software/Visual_Studio/Tango.BL/DTO/RmlDTOBase.cs @@ -437,5 +437,45 @@ namespace Tango.BL.DTO get; set; } + /// <summary> + /// cmykv prediction type + /// </summary> + public Int32 CmykvPredictionType + { + get; set; + } + + /// <summary> + /// cmykv prediction method + /// </summary> + public Int32 CmykvPredictionMethod + { + get; set; + } + + /// <summary> + /// cmykv hue threshold + /// </summary> + public Double CmykvHueThreshold + { + get; set; + } + + /// <summary> + /// k nearest k + /// </summary> + public Int32 KNearestK + { + get; set; + } + + /// <summary> + /// simple rgb preview factor + /// </summary> + public Double SimpleRgbPreviewFactor + { + get; set; + } + } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorMeasurement.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorMeasurement.cs new file mode 100644 index 000000000..e9035d38d --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Entities/ColorMeasurement.cs @@ -0,0 +1,17 @@ +using ColorMine.ColorSpaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.Entities +{ + public class ColorMeasurement : ColorMeasurementBase + { + public override string ToString() + { + return $"{C},{M},{Y},{K},{V} | {L},{A},{B} | dE = {new Cmyk(C, M, Y, K).Compare(new Lab(L, A, B), new ColorMine.ColorSpaces.Comparisons.CieDe2000Comparison())}"; + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorMeasurementBase.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorMeasurementBase.cs new file mode 100644 index 000000000..0610a37eb --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Entities/ColorMeasurementBase.cs @@ -0,0 +1,341 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Tango Observables Generator +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. Do not modify! +// </auto-generated> +//------------------------------------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Xml.Serialization; +using Newtonsoft.Json; +using System.Linq; +using Tango.DAL.Remote.DB; +using Tango.Core; +using System.ComponentModel; +using Tango.Core.CustomAttributes; + +namespace Tango.BL.Entities +{ + [Table("COLOR_MEASUREMENTS")] + public abstract class ColorMeasurementBase : ObservableEntity<ColorMeasurement> + { + + public event EventHandler<Double> CChanged; + + public event EventHandler<Double> MChanged; + + public event EventHandler<Double> YChanged; + + public event EventHandler<Double> KChanged; + + public event EventHandler<Double> VChanged; + + public event EventHandler<Double> LChanged; + + public event EventHandler<Double> AChanged; + + public event EventHandler<Double> BChanged; + + protected Double _c; + + /// <summary> + /// Gets or sets the colormeasurementbase c. + /// </summary> + + [Column("C")] + + public Double C + { + get + { + return _c; + } + + set + { + if (_c != value) + { + _c = value; + + OnCChanged(value); + + } + } + } + + protected Double _m; + + /// <summary> + /// Gets or sets the colormeasurementbase m. + /// </summary> + + [Column("M")] + + public Double M + { + get + { + return _m; + } + + set + { + if (_m != value) + { + _m = value; + + OnMChanged(value); + + } + } + } + + protected Double _y; + + /// <summary> + /// Gets or sets the colormeasurementbase y. + /// </summary> + + [Column("Y")] + + public Double Y + { + get + { + return _y; + } + + set + { + if (_y != value) + { + _y = value; + + OnYChanged(value); + + } + } + } + + protected Double _k; + + /// <summary> + /// Gets or sets the colormeasurementbase k. + /// </summary> + + [Column("K")] + + public Double K + { + get + { + return _k; + } + + set + { + if (_k != value) + { + _k = value; + + OnKChanged(value); + + } + } + } + + protected Double _v; + + /// <summary> + /// Gets or sets the colormeasurementbase v. + /// </summary> + + [Column("V")] + + public Double V + { + get + { + return _v; + } + + set + { + if (_v != value) + { + _v = value; + + OnVChanged(value); + + } + } + } + + protected Double _l; + + /// <summary> + /// Gets or sets the colormeasurementbase l. + /// </summary> + + [Column("L")] + + public Double L + { + get + { + return _l; + } + + set + { + if (_l != value) + { + _l = value; + + OnLChanged(value); + + } + } + } + + protected Double _a; + + /// <summary> + /// Gets or sets the colormeasurementbase a. + /// </summary> + + [Column("A")] + + public Double A + { + get + { + return _a; + } + + set + { + if (_a != value) + { + _a = value; + + OnAChanged(value); + + } + } + } + + protected Double _b; + + /// <summary> + /// Gets or sets the colormeasurementbase b. + /// </summary> + + [Column("B")] + + public Double B + { + get + { + return _b; + } + + set + { + if (_b != value) + { + _b = value; + + OnBChanged(value); + + } + } + } + + /// <summary> + /// Called when the C has changed. + /// </summary> + protected virtual void OnCChanged(Double c) + { + CChanged?.Invoke(this, c); + RaisePropertyChanged(nameof(C)); + } + + /// <summary> + /// Called when the M has changed. + /// </summary> + protected virtual void OnMChanged(Double m) + { + MChanged?.Invoke(this, m); + RaisePropertyChanged(nameof(M)); + } + + /// <summary> + /// Called when the Y has changed. + /// </summary> + protected virtual void OnYChanged(Double y) + { + YChanged?.Invoke(this, y); + RaisePropertyChanged(nameof(Y)); + } + + /// <summary> + /// Called when the K has changed. + /// </summary> + protected virtual void OnKChanged(Double k) + { + KChanged?.Invoke(this, k); + RaisePropertyChanged(nameof(K)); + } + + /// <summary> + /// Called when the V has changed. + /// </summary> + protected virtual void OnVChanged(Double v) + { + VChanged?.Invoke(this, v); + RaisePropertyChanged(nameof(V)); + } + + /// <summary> + /// Called when the L has changed. + /// </summary> + protected virtual void OnLChanged(Double l) + { + LChanged?.Invoke(this, l); + RaisePropertyChanged(nameof(L)); + } + + /// <summary> + /// Called when the A has changed. + /// </summary> + protected virtual void OnAChanged(Double a) + { + AChanged?.Invoke(this, a); + RaisePropertyChanged(nameof(A)); + } + + /// <summary> + /// Called when the B has changed. + /// </summary> + protected virtual void OnBChanged(Double b) + { + BChanged?.Invoke(this, b); + RaisePropertyChanged(nameof(B)); + } + + /// <summary> + /// Initializes a new instance of the <see cref="ColorMeasurementBase" /> class. + /// </summary> + public ColorMeasurementBase() : base() + { + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Entities/LiquidType.cs b/Software/Visual_Studio/Tango.BL/Entities/LiquidType.cs index ce09d72ac..d7b0f4f58 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/LiquidType.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/LiquidType.cs @@ -27,6 +27,13 @@ namespace Tango.BL.Entities [NotMapped] [JsonIgnore] + public SolidColorBrush LiquidTypeBrush + { + get { return new SolidColorBrush(LiquidTypeColor); } + } + + [NotMapped] + [JsonIgnore] public LiquidTypes Type { get { return (LiquidTypes)Code; } diff --git a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs index fdeb8f05e..9c672fd3b 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs @@ -342,5 +342,39 @@ namespace Tango.BL.Entities } #endregion + + #region CMYKV + + [NotMapped] + [JsonIgnore] + public CMYKVPredictionTypes PredictionType + { + get + { + return (CMYKVPredictionTypes)CmykvPredictionType; + } + set + { + CmykvPredictionType = value.ToInt32(); + RaisePropertyChangedAuto(); + } + } + + [NotMapped] + [JsonIgnore] + public CMYKVPredictionMethods PredictionMethod + { + get + { + return (CMYKVPredictionMethods)CmykvPredictionMethod; + } + set + { + CmykvPredictionMethod = value.ToInt32(); + RaisePropertyChangedAuto(); + } + } + + #endregion } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs b/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs index 17b29d691..ec34e0254 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/RmlBase.cs @@ -109,6 +109,16 @@ namespace Tango.BL.Entities public event EventHandler<Double> BtsrTensionErrorChanged; + public event EventHandler<Int32> CmykvPredictionTypeChanged; + + public event EventHandler<Int32> CmykvPredictionMethodChanged; + + public event EventHandler<Double> CmykvHueThresholdChanged; + + public event EventHandler<Int32> KNearestKChanged; + + public event EventHandler<Double> SimpleRgbPreviewFactorChanged; + public event EventHandler<BtsrApplicationType> BtsrApplicationTypeChanged; public event EventHandler<BtsrYarnType> BtsrYarnTypeChanged; @@ -1540,6 +1550,141 @@ namespace Tango.BL.Entities } } + protected Int32 _cmykvpredictiontype; + + /// <summary> + /// Gets or sets the rmlbase cmykv prediction type. + /// </summary> + + [Column("CMYKV_PREDICTION_TYPE")] + + public Int32 CmykvPredictionType + { + get + { + return _cmykvpredictiontype; + } + + set + { + if (_cmykvpredictiontype != value) + { + _cmykvpredictiontype = value; + + OnCmykvPredictionTypeChanged(value); + + } + } + } + + protected Int32 _cmykvpredictionmethod; + + /// <summary> + /// Gets or sets the rmlbase cmykv prediction method. + /// </summary> + + [Column("CMYKV_PREDICTION_METHOD")] + + public Int32 CmykvPredictionMethod + { + get + { + return _cmykvpredictionmethod; + } + + set + { + if (_cmykvpredictionmethod != value) + { + _cmykvpredictionmethod = value; + + OnCmykvPredictionMethodChanged(value); + + } + } + } + + protected Double _cmykvhuethreshold; + + /// <summary> + /// Gets or sets the rmlbase cmykv hue threshold. + /// </summary> + + [Column("CMYKV_HUE_THRESHOLD")] + + public Double CmykvHueThreshold + { + get + { + return _cmykvhuethreshold; + } + + set + { + if (_cmykvhuethreshold != value) + { + _cmykvhuethreshold = value; + + OnCmykvHueThresholdChanged(value); + + } + } + } + + protected Int32 _knearestk; + + /// <summary> + /// Gets or sets the rmlbase k nearest k. + /// </summary> + + [Column("K_NEAREST_K")] + + public Int32 KNearestK + { + get + { + return _knearestk; + } + + set + { + if (_knearestk != value) + { + _knearestk = value; + + OnKNearestKChanged(value); + + } + } + } + + protected Double _simplergbpreviewfactor; + + /// <summary> + /// Gets or sets the rmlbase simple rgb preview factor. + /// </summary> + + [Column("SIMPLE_RGB_PREVIEW_FACTOR")] + + public Double SimpleRgbPreviewFactor + { + get + { + return _simplergbpreviewfactor; + } + + set + { + if (_simplergbpreviewfactor != value) + { + _simplergbpreviewfactor = value; + + OnSimpleRgbPreviewFactorChanged(value); + + } + } + } + protected BtsrApplicationType _btsrapplicationtype; /// <summary> @@ -2462,6 +2607,51 @@ namespace Tango.BL.Entities } /// <summary> + /// Called when the CmykvPredictionType has changed. + /// </summary> + protected virtual void OnCmykvPredictionTypeChanged(Int32 cmykvpredictiontype) + { + CmykvPredictionTypeChanged?.Invoke(this, cmykvpredictiontype); + RaisePropertyChanged(nameof(CmykvPredictionType)); + } + + /// <summary> + /// Called when the CmykvPredictionMethod has changed. + /// </summary> + protected virtual void OnCmykvPredictionMethodChanged(Int32 cmykvpredictionmethod) + { + CmykvPredictionMethodChanged?.Invoke(this, cmykvpredictionmethod); + RaisePropertyChanged(nameof(CmykvPredictionMethod)); + } + + /// <summary> + /// Called when the CmykvHueThreshold has changed. + /// </summary> + protected virtual void OnCmykvHueThresholdChanged(Double cmykvhuethreshold) + { + CmykvHueThresholdChanged?.Invoke(this, cmykvhuethreshold); + RaisePropertyChanged(nameof(CmykvHueThreshold)); + } + + /// <summary> + /// Called when the KNearestK has changed. + /// </summary> + protected virtual void OnKNearestKChanged(Int32 knearestk) + { + KNearestKChanged?.Invoke(this, knearestk); + RaisePropertyChanged(nameof(KNearestK)); + } + + /// <summary> + /// Called when the SimpleRgbPreviewFactor has changed. + /// </summary> + protected virtual void OnSimpleRgbPreviewFactorChanged(Double simplergbpreviewfactor) + { + SimpleRgbPreviewFactorChanged?.Invoke(this, simplergbpreviewfactor); + RaisePropertyChanged(nameof(SimpleRgbPreviewFactor)); + } + + /// <summary> /// Called when the BtsrApplicationType has changed. /// </summary> protected virtual void OnBtsrApplicationTypeChanged(BtsrApplicationType btsrapplicationtype) diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/CMYKVPredictionMethods.cs b/Software/Visual_Studio/Tango.BL/Enumerations/CMYKVPredictionMethods.cs new file mode 100644 index 000000000..0b97b34bf --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Enumerations/CMYKVPredictionMethods.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.Enumerations +{ + public enum CMYKVPredictionMethods + { + [Description("K-Nearest Neighbors (KNN)")] + KNearestNeighbors = 0, + [Description("Linear Interpolation")] + LinearInterpolation = 1, + [Description("Linear Regression")] + LinearRegression = 2, + [Description("Spline Interpolation")] + SplineInterpolation = 3 + } +} diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/CMYKVPredictionTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/CMYKVPredictionTypes.cs new file mode 100644 index 000000000..7d83e1f63 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/Enumerations/CMYKVPredictionTypes.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.BL.Enumerations +{ + public enum CMYKVPredictionTypes + { + [Description("None")] + None = 0, + [Description("Predict CMYKV")] + Predict_CMYKV = 1, + [Description("Predict RGB")] + Predict_RGB = 2, + [Description("Predict All")] + PredictAll = 3, + [Description("Simple RGB Preview")] + SimpleRGBPreview = 4, + } +} diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs index 259205160..3cabae68c 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContext.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContext.cs @@ -359,6 +359,14 @@ namespace Tango.BL } /// <summary> + /// Gets or sets the ColorMeasurements. + /// </summary> + public DbSet<ColorMeasurement> ColorMeasurements + { + get; set; + } + + /// <summary> /// Gets or sets the ColorProcessInkUptake. /// </summary> public DbSet<ColorProcessInkUptake> ColorProcessInkUptake diff --git a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs index 7a5a28050..cd082dae7 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapterExtension.cs @@ -1529,6 +1529,42 @@ namespace Tango.BL } + private ObservableCollection<ColorMeasurement> _colormeasurements; + /// <summary> + /// Gets or sets the ColorMeasurements. + /// </summary> + public ObservableCollection<ColorMeasurement> ColorMeasurements + { + get + { + return _colormeasurements; + } + + set + { + _colormeasurements = value; RaisePropertyChanged(nameof(ColorMeasurements)); + } + + } + + private ICollectionView _colormeasurementsViewSource; + /// <summary> + /// Gets or sets the ColorMeasurements View Source. + ///</summary> + public ICollectionView ColorMeasurementsViewSource + { + get + { + return _colormeasurementsViewSource; + } + + set + { + _colormeasurementsViewSource = value; RaisePropertyChanged(nameof(ColorMeasurementsViewSource)); + } + + } + private ObservableCollection<ColorProcessInkUptake> _colorprocessinkuptake; /// <summary> /// Gets or sets the ColorProcessInkUptake. @@ -4499,6 +4535,8 @@ namespace Tango.BL ColorCatalogsItemsRecipesViewSource = CreateCollectionView(ColorCatalogsItemsRecipes); + ColorMeasurementsViewSource = CreateCollectionView(ColorMeasurements); + ColorProcessInkUptakeViewSource = CreateCollectionView(ColorProcessInkUptake); ColorSpacesViewSource = CreateCollectionView(ColorSpaces); diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs index 45743d391..c996f09b7 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollectionsExtension.cs @@ -1529,6 +1529,42 @@ namespace Tango.BL } + private ObservableCollection<ColorMeasurement> _colormeasurements; + /// <summary> + /// Gets or sets the ColorMeasurements. + /// </summary> + public ObservableCollection<ColorMeasurement> ColorMeasurements + { + get + { + return _colormeasurements; + } + + set + { + _colormeasurements = value; RaisePropertyChanged(nameof(ColorMeasurements)); + } + + } + + private ICollectionView _colormeasurementsViewSource; + /// <summary> + /// Gets or sets the ColorMeasurements View Source. + ///</summary> + public ICollectionView ColorMeasurementsViewSource + { + get + { + return _colormeasurementsViewSource; + } + + set + { + _colormeasurementsViewSource = value; RaisePropertyChanged(nameof(ColorMeasurementsViewSource)); + } + + } + private ObservableCollection<ColorProcessInkUptake> _colorprocessinkuptake; /// <summary> /// Gets or sets the ColorProcessInkUptake. @@ -4499,6 +4535,8 @@ namespace Tango.BL ColorCatalogsItemsRecipesViewSource = CreateCollectionView(ColorCatalogsItemsRecipes); + ColorMeasurementsViewSource = CreateCollectionView(ColorMeasurements); + ColorProcessInkUptakeViewSource = CreateCollectionView(ColorProcessInkUptake); ColorSpacesViewSource = CreateCollectionView(ColorSpaces); diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index 83e4bf3ea..9fc04b814 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -180,6 +180,8 @@ <Compile Include="DTO\ColorCatalogsItemDTOBase.cs" /> <Compile Include="DTO\ColorCatalogsItemsRecipeDTO.cs" /> <Compile Include="DTO\ColorCatalogsItemsRecipeDTOBase.cs" /> + <Compile Include="DTO\ColorMeasurementDTO.cs" /> + <Compile Include="DTO\ColorMeasurementDTOBase.cs" /> <Compile Include="DTO\ColorProcessDataDTO.cs" /> <Compile Include="DTO\ColorProcessDataDTOBase.cs" /> <Compile Include="DTO\ColorProcessFactorDTO.cs" /> @@ -413,6 +415,8 @@ <Compile Include="Entities\ColorCatalogsItemBase.cs" /> <Compile Include="Entities\ColorCatalogsItemsRecipe.cs" /> <Compile Include="Entities\ColorCatalogsItemsRecipeBase.cs" /> + <Compile Include="Entities\ColorMeasurementBase.cs" /> + <Compile Include="Entities\ColorMeasurement.cs" /> <Compile Include="Entities\ColorProcessData.cs" /> <Compile Include="Entities\ColorProcessDataBase.cs" /> <Compile Include="Entities\ColorProcessFactor.cs" /> @@ -582,6 +586,8 @@ <Compile Include="Enumerations\BtsrApplicationTypes.cs" /> <Compile Include="Enumerations\BtsrYarnTypes.cs" /> <Compile Include="Enumerations\CatalogDesignType.cs" /> + <Compile Include="Enumerations\CMYKVPredictionMethods.cs" /> + <Compile Include="Enumerations\CMYKVPredictionTypes.cs" /> <Compile Include="Enumerations\ColorCatalogsItems.cs" /> <Compile Include="Enumerations\FactorColors.cs" /> <Compile Include="Enumerations\FSEBuildVariants.cs" /> @@ -833,7 +839,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/CMYKVColorConverter.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/CMYKVColorConverter.cs index 153d4caa7..bcb12602f 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/CMYKVColorConverter.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/CMYKVColorConverter.cs @@ -1,97 +1,64 @@ using System; using System.Collections.Generic; using System.Linq; +using Tango.BL.Enumerations; namespace Tango.ColorConversion { public class CMYKVColorConverter { - private IColorConverter colorConverter = new DefaultColorConverter(); + public List<CMYKVMeasurement> Measurements = new List<CMYKVMeasurement>(); + private int _k; - private List<CMYKVMeasurement> measurements = new List<CMYKVMeasurement>(); + public CMYKVColorConverter(int k = 5) + { + _k = k; + } public void AddMeasurement(CMYKV cmykv, LAB lab) { - measurements.Add(new CMYKVMeasurement { CMYKVValue = cmykv, LABValue = lab }); + Measurements.Add(new CMYKVMeasurement { CMYKV = cmykv, LAB = lab }); } - public CMYKV ConvertRGBToCMYKV(RGB rgb, PredictionMethod method) + public CMYKV ConvertRGBToCMYKV(RGB rgb, CMYKVPredictionMethods method) { - // Step 1: Convert RGB to LAB (Perceptual color space) - var LAB = new ColorMine.ColorSpaces.Rgb(rgb.R, rgb.G, rgb.B).ToLabUsingColorful(); - LAB lab = new LAB(LAB.L, LAB.A, LAB.B); - - // Step 2: Use LAB to predict the appropriate CMYKV values based on the chosen method - CMYKV predictedCMYKV = PredictCMYKV(lab, method); - - return predictedCMYKV; + IColorPrediction predictionMethod = GetPredictionMethod(method); + return predictionMethod.ConvertRGBToCMYKV(rgb); } - private CMYKV PredictCMYKV(LAB lab, PredictionMethod method) + public CMYKV ConvertLABToCMYKV(LAB lab, CMYKVPredictionMethods method) { - CMYKV predictedCMYKV; - - // Use the selected prediction method to find the best CMYKV values from LAB - switch (method) - { - case PredictionMethod.LinearInterpolation: - predictedCMYKV = new LinearInterpolationPrediction().PredictFromLAB(lab, measurements); - break; - case PredictionMethod.LinearRegression: - predictedCMYKV = new LinearRegressionPrediction().PredictFromLAB(lab, measurements); - break; - case PredictionMethod.KNearestNeighbors: - predictedCMYKV = new KNearestNeighborsPrediction(5).PredictFromLAB(lab, measurements); - break; - case PredictionMethod.SplineInterpolation: - predictedCMYKV = new SplineInterpolationPrediction().PredictFromLAB(lab, measurements); - break; - default: - throw new ArgumentException("Invalid prediction method"); - } - - return predictedCMYKV; + IColorPrediction predictionMethod = GetPredictionMethod(method); + return predictionMethod.PredictLABToCMYKV(lab); } - public RGB ConvertCMYKVToRGB(CMYKV cmykv, Func<CMYK, RGB> CMYKToRGB, PredictionMethod method) + public RGB ConvertCMYKVToRGB(CMYKV cmykv, CMYKVPredictionMethods method) { - // Step 1: Convert CMYK part to RGB using the existing CMYKToRGB method - RGB rgbFromCMYK = CMYKToRGB(new CMYK { C = cmykv.C, M = cmykv.M, Y = cmykv.Y, K = cmykv.K }); - - // Step 2: Use the prediction method to get LAB values (which will account for Violet ink) - LAB predictedLAB = PredictLAB(cmykv, method); - - // Step 3: Convert LAB (with Violet) back to RGB - var rgb = new ColorMine.ColorSpaces.Lab(predictedLAB.L, predictedLAB.A, predictedLAB.B).ToRgbUsingColorful(); - RGB adjustedRGB = new RGB(rgb.R, rgb.G, rgb.B); - - // Step 4: Combine the CMYK-based RGB with the Violet-adjusted RGB for final output - RGB finalRGB = MergeRGB(rgbFromCMYK, adjustedRGB); + IColorPrediction predictionMethod = GetPredictionMethod(method); + return predictionMethod.PredictCMYKVToRGB(cmykv); + } - return finalRGB; + public LAB ConvertCMYKVToLAB(CMYKV cmykv, CMYKVPredictionMethods method) + { + IColorPrediction predictionMethod = GetPredictionMethod(method); + return predictionMethod.PredictCMYKVToLAB(cmykv); } - private LAB PredictLAB(CMYKV cmykv, PredictionMethod method) + private IColorPrediction GetPredictionMethod(CMYKVPredictionMethods method) { - LAB predictedLAB; switch (method) { - case PredictionMethod.LinearInterpolation: - predictedLAB = new LinearInterpolationPrediction().Predict(cmykv, measurements); - break; - case PredictionMethod.LinearRegression: - predictedLAB = new LinearRegressionPrediction().Predict(cmykv, measurements); - break; - case PredictionMethod.KNearestNeighbors: - predictedLAB = new KNearestNeighborsPrediction(5).Predict(cmykv, measurements); - break; - case PredictionMethod.SplineInterpolation: - predictedLAB = new SplineInterpolationPrediction().Predict(cmykv, measurements); - break; + case CMYKVPredictionMethods.KNearestNeighbors: + return new KNearestNeighborsPrediction(Measurements, _k); + case CMYKVPredictionMethods.LinearInterpolation: + return new LinearInterpolationPrediction(Measurements); + case CMYKVPredictionMethods.LinearRegression: + return new LinearRegressionPrediction(Measurements); + //case CMYKVPredictionMethods.SplineInterpolation: + //return new SplineInterpolationPrediction(measurements); default: - throw new ArgumentException("Invalid prediction method"); + throw new System.Exception("Unsupported prediction method"); } - return predictedLAB; } private RGB MergeRGB(RGB baseRGB, RGB violetAdjustedRGB) diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/CMYKVMeasurement.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/CMYKVMeasurement.cs index 90e5b863b..533ca0cc2 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/CMYKVMeasurement.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/CMYKVMeasurement.cs @@ -2,7 +2,7 @@ namespace Tango.ColorConversion { public class CMYKVMeasurement { - public CMYKV CMYKVValue { get; set; } - public LAB LABValue { get; set; } + public CMYKV CMYKV { get; set; } + public LAB LAB { get; set; } } } diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/DemoData.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/DemoData.cs index acd66b14d..ea0c91c1c 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/DemoData.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/DemoData.cs @@ -36,8 +36,8 @@ namespace Tango.ColorConversion data.Add(new CMYKVMeasurement { - CMYKVValue = new CMYKV { C = C, M = M, Y = Y, K = K, V = V }, - LABValue = new LAB { L = L, A = A, B = B } + CMYKV = new CMYKV { C = C, M = M, Y = Y, K = K, V = V }, + LAB = new LAB { L = L, A = A, B = B } }); } diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/ExtensionMethods.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/ExtensionMethods.cs new file mode 100644 index 000000000..4aa4c477a --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/ExtensionMethods.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.ColorConversion; + +public static class ExtensionMethods +{ + public static RGB ToRGB(this LAB lab) + { + var rgb = new ColorMine.ColorSpaces.Lab(lab.L, lab.A, lab.B).To<ColorMine.ColorSpaces.Rgb>(); + return new RGB(rgb.R, rgb.G, rgb.B); + } + + public static LAB ToLAB(this RGB rgb) + { + var lab = new ColorMine.ColorSpaces.Rgb(rgb.R, rgb.G, rgb.B).To<ColorMine.ColorSpaces.Lab>(); + return new LAB(lab.L, lab.A, lab.B); + } +} diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/IColorPrediction.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/IColorPrediction.cs new file mode 100644 index 000000000..c2ec22132 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/IColorPrediction.cs @@ -0,0 +1,11 @@ + +namespace Tango.ColorConversion +{ + public interface IColorPrediction + { + CMYKV ConvertRGBToCMYKV(RGB rgb); + CMYKV PredictLABToCMYKV(LAB lab); + RGB PredictCMYKVToRGB(CMYKV cmykv); + LAB PredictCMYKVToLAB(CMYKV cmykv); + } +} diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/KNearestNeighborsPrediction.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/KNearestNeighborsPrediction.cs index 4e9e85554..5ceb4b63a 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/KNearestNeighborsPrediction.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/KNearestNeighborsPrediction.cs @@ -4,119 +4,94 @@ using System.Linq; namespace Tango.ColorConversion { - public class KNearestNeighborsPrediction + public class KNearestNeighborsPrediction : IColorPrediction { + private List<CMYKVMeasurement> measurements; private int k; - public KNearestNeighborsPrediction(int k) + public KNearestNeighborsPrediction(List<CMYKVMeasurement> measurements, int k = 3) { + this.measurements = measurements; this.k = k; } - public LAB Predict(CMYKV cmykv, List<CMYKVMeasurement> measurements) + // Predict CMYKV from RGB by first converting RGB to LAB + public CMYKV ConvertRGBToCMYKV(RGB rgb) { - // K-Nearest Neighbors logic: Find the k closest measurements and average their LAB values - if (measurements.Count < k) - throw new InvalidOperationException($"Not enough measurements for KNN (requires at least {k})"); + // Convert RGB to LAB + LAB lab = rgb.ToLAB(); - // Calculate distances and take the k nearest measurements - var nearest = measurements - .OrderBy(m => GetDistance(m.CMYKVValue, cmykv)) + // Now predict CMYKV using the LAB prediction method + return PredictLABToCMYKV(lab); + } + + // Predict CMYKV from LAB (directly use LAB measurements) + public CMYKV PredictLABToCMYKV(LAB lab) + { + var nearestNeighbors = measurements + .OrderBy(m => EuclideanDistanceLAB(lab, m.LAB)) .Take(k) - .ToArray(); + .ToList(); + + return AverageCMYKV(nearestNeighbors); + } - // Average their LAB values - var avgL = nearest.Average(m => m.LABValue.L); - var avgA = nearest.Average(m => m.LABValue.A); - var avgB = nearest.Average(m => m.LABValue.B); + // Predict RGB from CMYKV by first predicting LAB, then converting LAB to RGB + public RGB PredictCMYKVToRGB(CMYKV cmykv) + { + // Predict LAB from CMYKV + LAB lab = PredictCMYKVToLAB(cmykv); - return new LAB { L = avgL, A = avgA, B = avgB }; + // Convert LAB to RGB + return lab.ToRGB(); } - public CMYKV PredictFromLAB(LAB lab, List<CMYKVMeasurement> measurements) + // Predict LAB from CMYKV using nearest neighbors + public LAB PredictCMYKVToLAB(CMYKV cmykv) { - // Find the k-nearest neighbors based on LAB distances - var nearest = measurements - .OrderBy(m => CalculateLABDistance(m.LABValue, lab)) + var nearestNeighbors = measurements + .OrderBy(m => EuclideanDistanceCMYKV(cmykv, m.CMYKV)) .Take(k) - .ToArray(); + .ToList(); - // Average the CMYKV values of the nearest neighbors - double avgC = nearest.Average(m => m.CMYKVValue.C); - double avgM = nearest.Average(m => m.CMYKVValue.M); - double avgY = nearest.Average(m => m.CMYKVValue.Y); - double avgK = nearest.Average(m => m.CMYKVValue.K); - double avgV = nearest.Average(m => m.CMYKVValue.V); - - // Return the predicted CMYKV value - return new CMYKV - { - C = avgC, - M = avgM, - Y = avgY, - K = avgK, - V = avgV - }; + return AverageLAB(nearestNeighbors); } - private double CalculateLABDistance(LAB lab1, LAB lab2) + // Calculate Euclidean distance for LAB + private double EuclideanDistanceLAB(LAB lab1, LAB lab2) { - // Calculate Euclidean distance in LAB color space - return Math.Sqrt(Math.Pow(lab1.L - lab2.L, 2) + - Math.Pow(lab1.A - lab2.A, 2) + - Math.Pow(lab1.B - lab2.B, 2)); + return Math.Sqrt(Math.Pow(lab1.L - lab2.L, 2) + Math.Pow(lab1.A - lab2.A, 2) + Math.Pow(lab1.B - lab2.B, 2)); } - private double GetDistance(CMYKV m1, CMYKV m2) + // Calculate Euclidean distance for CMYKV + private double EuclideanDistanceCMYKV(CMYKV cmykv1, CMYKV cmykv2) { - return Math.Sqrt(Math.Pow(m1.C - m2.C, 2) + - Math.Pow(m1.M - m2.M, 2) + - Math.Pow(m1.Y - m2.Y, 2) + - Math.Pow(m1.K - m2.K, 2) + - Math.Pow(m1.V - m2.V, 2)); + return Math.Sqrt(Math.Pow(cmykv1.C - cmykv2.C, 2) + Math.Pow(cmykv1.M - cmykv2.M, 2) + + Math.Pow(cmykv1.Y - cmykv2.Y, 2) + Math.Pow(cmykv1.K - cmykv2.K, 2) + + Math.Pow(cmykv1.V - cmykv2.V, 2)); } - public static int FindBestK(List<CMYKVMeasurement> data, int maxK) + // Helper method to average CMYKV values from the k nearest neighbors + private CMYKV AverageCMYKV(List<CMYKVMeasurement> neighbors) { - // Split the data into training and validation sets - var trainingSet = data.Take(80).ToList(); // 80% training - var validationSet = data.Skip(80).Take(20).ToList(); // 20% validation - - double bestError = double.MaxValue; - int bestK = 1; + double C = neighbors.Average(m => m.CMYKV.C); + double M = neighbors.Average(m => m.CMYKV.M); + double Y = neighbors.Average(m => m.CMYKV.Y); + double K = neighbors.Average(m => m.CMYKV.K); + double V = neighbors.Average(m => m.CMYKV.V); - // Iterate over possible values of k - for (int k = 1; k <= maxK; k++) - { - double totalError = 0; - - // For each point in the validation set, predict using the KNN model - foreach (var validationPoint in validationSet) - { - var predictedLAB = new KNearestNeighborsPrediction(k).Predict(validationPoint.CMYKVValue, trainingSet); - totalError += CalculateError(predictedLAB, validationPoint.LABValue); - } - - double averageError = totalError / validationSet.Count; - - // Select the k with the smallest validation error - if (averageError < bestError) - { - bestError = averageError; - bestK = k; - } - } - - return bestK; + return new CMYKV { C = C, M = M, Y = Y, K = K, V = V }; } - private static double CalculateError(LAB predicted, LAB actual) + // Helper method to average LAB values from the k nearest neighbors + private LAB AverageLAB(List<CMYKVMeasurement> neighbors) { - // Calculate Euclidean distance in LAB space as error - return Math.Sqrt(Math.Pow(predicted.L - actual.L, 2) + - Math.Pow(predicted.A - actual.A, 2) + - Math.Pow(predicted.B - actual.B, 2)); - } + double L = neighbors.Average(m => m.LAB.L); + double A = neighbors.Average(m => m.LAB.A); + double B = neighbors.Average(m => m.LAB.B); + return new LAB { L = L, A = A, B = B }; + } } + } diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/LinearInterpolationPrediction.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/LinearInterpolationPrediction.cs index b47fa6305..3db69bb9c 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/LinearInterpolationPrediction.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/LinearInterpolationPrediction.cs @@ -4,78 +4,152 @@ using System.Linq; namespace Tango.ColorConversion { - public class LinearInterpolationPrediction + public class LinearInterpolationPrediction : IColorPrediction { - public LAB Predict(CMYKV cmykv, List<CMYKVMeasurement> measurements) + private List<CMYKVMeasurement> measurements; + + public LinearInterpolationPrediction(List<CMYKVMeasurement> measurements) { - // Linear interpolation logic: Find the two closest points and interpolate between them. + this.measurements = measurements; + } - if (measurements.Count < 2) - throw new InvalidOperationException("Not enough measurements for interpolation"); + // Predict CMYKV from RGB by first converting RGB to LAB and then interpolating + public CMYKV ConvertRGBToCMYKV(RGB rgb) + { + // Convert RGB to LAB + LAB lab = rgb.ToLAB(); - // Calculate the Euclidean distance between the input and each measurement's CMYKV values - var closest = measurements - .OrderBy(m => GetDistance(m.CMYKVValue, cmykv)) - .Take(2) - .ToArray(); + // Interpolate based on LAB + return PredictLABToCMYKV(lab); + } - // Perform interpolation between the two closest points - var weight1 = GetDistance(closest[1].CMYKVValue, cmykv); - var weight2 = GetDistance(closest[0].CMYKVValue, cmykv); - var totalWeight = weight1 + weight2; + // Predict CMYKV from LAB using linear interpolation + public CMYKV PredictLABToCMYKV(LAB lab) + { + // Find the two closest measurements based on LAB distance + var lowerBound = FindLowerBoundLAB(lab); + var upperBound = FindUpperBoundLAB(lab); - return new LAB - { - L = (closest[0].LABValue.L * weight2 + closest[1].LABValue.L * weight1) / totalWeight, - A = (closest[0].LABValue.A * weight2 + closest[1].LABValue.A * weight1) / totalWeight, - B = (closest[0].LABValue.B * weight2 + closest[1].LABValue.B * weight1) / totalWeight - }; + // Calculate interpolation factor 't' + double t = CalculateInterpolationFactorLAB(lab, lowerBound.LAB, upperBound.LAB); + + // Perform linear interpolation between the two closest CMYKV values + return InterpolateCMYKV(lowerBound.CMYKV, upperBound.CMYKV, t); } - private double GetDistance(CMYKV m1, CMYKV m2) + // Predict RGB from CMYKV by first predicting LAB, then converting LAB to RGB + public RGB PredictCMYKVToRGB(CMYKV cmykv) { - return Math.Sqrt(Math.Pow(m1.C - m2.C, 2) + - Math.Pow(m1.M - m2.M, 2) + - Math.Pow(m1.Y - m2.Y, 2) + - Math.Pow(m1.K - m2.K, 2) + - Math.Pow(m1.V - m2.V, 2)); + // Predict LAB using linear interpolation + LAB lab = PredictCMYKVToLAB(cmykv); + + // Convert LAB to RGB + return lab.ToRGB(); } - public CMYKV PredictFromLAB(LAB lab, List<CMYKVMeasurement> measurements) + // Predict LAB from CMYKV using linear interpolation + public LAB PredictCMYKVToLAB(CMYKV cmykv) { - if (measurements.Count < 2) - throw new InvalidOperationException("Not enough measurements for interpolation"); + // Find the two closest measurements based on CMYKV distance + var lowerBound = FindLowerBoundCMYKV(cmykv); + var upperBound = FindUpperBoundCMYKV(cmykv); - // Find the two closest measurements in LAB space based on distance - var closest = measurements - .OrderBy(m => CalculateLABDistance(m.LABValue, lab)) - .Take(2) - .ToArray(); + // Calculate interpolation factor 't' + double t = CalculateInterpolationFactorCMYKV(cmykv, lowerBound.CMYKV, upperBound.CMYKV); - // Perform linear interpolation between the two closest points - double distance1 = CalculateLABDistance(closest[0].LABValue, lab); - double distance2 = CalculateLABDistance(closest[1].LABValue, lab); - double totalDistance = distance1 + distance2; + // Perform linear interpolation between the two closest LAB values + return InterpolateLAB(lowerBound.LAB, upperBound.LAB, t); + } - // Interpolate CMYKV values based on the distances - double weight1 = distance2 / totalDistance; - double weight2 = distance1 / totalDistance; + // Find the two closest LAB measurements below and above the input LAB + private CMYKVMeasurement FindLowerBoundLAB(LAB lab) + { + return measurements + .Where(m => EuclideanDistanceLAB(m.LAB, lab) <= 0) + .OrderBy(m => EuclideanDistanceLAB(m.LAB, lab)) + .FirstOrDefault(); + } + + private CMYKVMeasurement FindUpperBoundLAB(LAB lab) + { + return measurements + .Where(m => EuclideanDistanceLAB(m.LAB, lab) >= 0) + .OrderBy(m => EuclideanDistanceLAB(m.LAB, lab)) + .FirstOrDefault(); + } + // Find the two closest CMYKV measurements below and above the input CMYKV + private CMYKVMeasurement FindLowerBoundCMYKV(CMYKV cmykv) + { + return measurements + .Where(m => EuclideanDistanceCMYKV(m.CMYKV, cmykv) <= 0) + .OrderBy(m => EuclideanDistanceCMYKV(m.CMYKV, cmykv)) + .FirstOrDefault(); + } + + private CMYKVMeasurement FindUpperBoundCMYKV(CMYKV cmykv) + { + return measurements + .Where(m => EuclideanDistanceCMYKV(m.CMYKV, cmykv) >= 0) + .OrderBy(m => EuclideanDistanceCMYKV(m.CMYKV, cmykv)) + .FirstOrDefault(); + } + + // Calculate the interpolation factor for LAB + private double CalculateInterpolationFactorLAB(LAB input, LAB lower, LAB upper) + { + double distInputToLower = EuclideanDistanceLAB(input, lower); + double distLowerToUpper = EuclideanDistanceLAB(lower, upper); + + return distInputToLower / distLowerToUpper; + } + + // Calculate the interpolation factor for CMYKV + private double CalculateInterpolationFactorCMYKV(CMYKV input, CMYKV lower, CMYKV upper) + { + double distInputToLower = EuclideanDistanceCMYKV(input, lower); + double distLowerToUpper = EuclideanDistanceCMYKV(lower, upper); + + return distInputToLower / distLowerToUpper; + } + + // Interpolate between two CMYKV values using factor t + private CMYKV InterpolateCMYKV(CMYKV lower, CMYKV upper, double t) + { return new CMYKV { - C = closest[0].CMYKVValue.C * weight1 + closest[1].CMYKVValue.C * weight2, - M = closest[0].CMYKVValue.M * weight1 + closest[1].CMYKVValue.M * weight2, - Y = closest[0].CMYKVValue.Y * weight1 + closest[1].CMYKVValue.Y * weight2, - K = closest[0].CMYKVValue.K * weight1 + closest[1].CMYKVValue.K * weight2, - V = closest[0].CMYKVValue.V * weight1 + closest[1].CMYKVValue.V * weight2 + C = lower.C + t * (upper.C - lower.C), + M = lower.M + t * (upper.M - lower.M), + Y = lower.Y + t * (upper.Y - lower.Y), + K = lower.K + t * (upper.K - lower.K), + V = lower.V + t * (upper.V - lower.V) }; } - private double CalculateLABDistance(LAB lab1, LAB lab2) + // Interpolate between two LAB values using factor t + private LAB InterpolateLAB(LAB lower, LAB upper, double t) { - return Math.Sqrt(Math.Pow(lab1.L - lab2.L, 2) + - Math.Pow(lab1.A - lab2.A, 2) + - Math.Pow(lab1.B - lab2.B, 2)); + return new LAB + { + L = lower.L + t * (upper.L - lower.L), + A = lower.A + t * (upper.A - lower.A), + B = lower.B + t * (upper.B - lower.B) + }; + } + + // Calculate Euclidean distance for LAB + private double EuclideanDistanceLAB(LAB lab1, LAB lab2) + { + return Math.Sqrt(Math.Pow(lab1.L - lab2.L, 2) + Math.Pow(lab1.A - lab2.A, 2) + Math.Pow(lab1.B - lab2.B, 2)); + } + + // Calculate Euclidean distance for CMYKV + private double EuclideanDistanceCMYKV(CMYKV cmykv1, CMYKV cmykv2) + { + return Math.Sqrt(Math.Pow(cmykv1.C - cmykv2.C, 2) + Math.Pow(cmykv1.M - cmykv2.M, 2) + + Math.Pow(cmykv1.Y - cmykv2.Y, 2) + Math.Pow(cmykv1.K - cmykv2.K, 2) + + Math.Pow(cmykv1.V - cmykv2.V, 2)); } } + } diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/LinearRegressionPrediction.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/LinearRegressionPrediction.cs index b0ecb3362..bf69f273a 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/LinearRegressionPrediction.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/LinearRegressionPrediction.cs @@ -1,121 +1,104 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; namespace Tango.ColorConversion { - public class LinearRegressionPrediction + using MathNet.Numerics.LinearAlgebra; + + public class LinearRegressionPrediction : IColorPrediction { - public LAB Predict(CMYKV cmykv, List<CMYKVMeasurement> measurements) - { - // Simple linear regression to fit LAB as a function of CMYKV + private List<CMYKVMeasurement> measurements; + private double[,] coefficients; - var n = measurements.Count; - if (n == 0) - throw new InvalidOperationException("No measurements for regression"); + public LinearRegressionPrediction(List<CMYKVMeasurement> measurements) + { + this.measurements = measurements; + coefficients = ComputeCoefficients(); + } - double sumC = 0, sumM = 0, sumY = 0, sumK = 0, sumV = 0; - double sumL = 0, sumA = 0, sumB = 0; + public CMYKV ConvertRGBToCMYKV(RGB rgb) + { + var lab = rgb.ToLAB(); + return PerformLinearRegression(new double[] { lab.L, lab.A, lab.B }); + } - // Sum up the CMYKV and LAB components - foreach (var m in measurements) - { - sumC += m.CMYKVValue.C; - sumM += m.CMYKVValue.M; - sumY += m.CMYKVValue.Y; - sumK += m.CMYKVValue.K; - sumV += m.CMYKVValue.V; + public CMYKV PredictLABToCMYKV(LAB lab) + { + return PerformLinearRegression(new double[] { lab.L, lab.A, lab.B }); + } - sumL += m.LABValue.L; - sumA += m.LABValue.A; - sumB += m.LABValue.B; - } + public RGB PredictCMYKVToRGB(CMYKV cmykv) + { + // First predict LAB, then convert to RGB + LAB lab = PerformInverseRegressionLAB(cmykv); + return lab.ToRGB(); + } - // Compute the averages - var avgC = sumC / n; - var avgM = sumM / n; - var avgY = sumY / n; - var avgK = sumK / n; - var avgV = sumV / n; + public LAB PredictCMYKVToLAB(CMYKV cmykv) + { + return PerformInverseRegressionLAB(cmykv); + } - var avgL = sumL / n; - var avgA = sumA / n; - var avgB = sumB / n; + private CMYKV PerformLinearRegression(double[] input) + { + double C = coefficients[0, 0] + coefficients[0, 1] * input[0] + coefficients[0, 2] * input[1] + coefficients[0, 3] * input[2]; + double M = coefficients[1, 0] + coefficients[1, 1] * input[0] + coefficients[1, 2] * input[1] + coefficients[1, 3] * input[2]; + double Y = coefficients[2, 0] + coefficients[2, 1] * input[0] + coefficients[2, 2] * input[1] + coefficients[2, 3] * input[2]; + double K = coefficients[3, 0]; + double V = coefficients[4, 0]; - // Predict LAB by applying the linear model (this is a simple averaging model) - return new LAB - { - L = avgL, - A = avgA, - B = avgB - }; + return new CMYKV { C = C, M = M, Y = Y, K = K, V = V }; } - public CMYKV PredictFromLAB(LAB lab, List<CMYKVMeasurement> measurements) + // Inverse regression for LAB prediction from CMYKV + private LAB PerformInverseRegressionLAB(CMYKV cmykv) { - // Perform linear regression using the LAB values as the independent variables - // (L, A, B) -> (C, M, Y, K, V) + // Use CMYKV values to predict LAB using the regression coefficients + double L = coefficients[0, 0] + coefficients[0, 1] * cmykv.C + coefficients[0, 2] * cmykv.M + coefficients[0, 3] * cmykv.Y; + double A = coefficients[1, 0] + coefficients[1, 1] * cmykv.C + coefficients[1, 2] * cmykv.M + coefficients[1, 3] * cmykv.Y; + double B = coefficients[2, 0] + coefficients[2, 1] * cmykv.C + coefficients[2, 2] * cmykv.M + coefficients[2, 3] * cmykv.Y; - double sumL = 0, sumA = 0, sumB = 0; - double sumC = 0, sumM = 0, sumY = 0, sumK = 0, sumV = 0; - double sumLC = 0, sumLM = 0, sumLY = 0, sumLK = 0, sumLV = 0; - double sumAC = 0, sumAM = 0, sumAY = 0, sumAK = 0, sumAV = 0; - double sumBC = 0, sumBM = 0, sumBY = 0, sumBK = 0, sumBV = 0; + return new LAB { L = L, A = A, B = B }; + } + // Now implementing the least-squares regression method based on LAB as input + private double[,] ComputeCoefficients() + { int n = measurements.Count; - if (n < 1) - throw new InvalidOperationException("No measurements for regression"); - foreach (var m in measurements) + // Create matrix X (n x 4) for input values (LAB values plus intercept term) + Matrix<double> X = Matrix<double>.Build.Dense(n, 4, (i, j) => { - sumL += m.LABValue.L; - sumA += m.LABValue.A; - sumB += m.LABValue.B; + if (j == 0) return measurements[i].LAB.L; // LAB input as the available property + if (j == 1) return measurements[i].LAB.A; + if (j == 2) return measurements[i].LAB.B; + return 1.0; // Intercept term + }); - sumC += m.CMYKVValue.C; - sumM += m.CMYKVValue.M; - sumY += m.CMYKVValue.Y; - sumK += m.CMYKVValue.K; - sumV += m.CMYKVValue.V; + // Create matrix Y (n x 5) for CMYKV values + Matrix<double> Y = Matrix<double>.Build.Dense(n, 5, (i, j) => + { + if (j == 0) return measurements[i].CMYKV.C; + if (j == 1) return measurements[i].CMYKV.M; + if (j == 2) return measurements[i].CMYKV.Y; + if (j == 3) return measurements[i].CMYKV.K; + return measurements[i].CMYKV.V; + }); - sumLC += m.LABValue.L * m.CMYKVValue.C; - sumLM += m.LABValue.L * m.CMYKVValue.M; - sumLY += m.LABValue.L * m.CMYKVValue.Y; - sumLK += m.LABValue.L * m.CMYKVValue.K; - sumLV += m.LABValue.L * m.CMYKVValue.V; + // Compute the least-squares solution for the coefficients: β = (X^T X)^{-1} X^T Y + Matrix<double> Xt = X.Transpose(); + Matrix<double> XtX = Xt * X; + Matrix<double> XtX_inv = XtX.Inverse(); + Matrix<double> XtY = Xt * Y; + Matrix<double> B = XtX_inv * XtY; - sumAC += m.LABValue.A * m.CMYKVValue.C; - sumAM += m.LABValue.A * m.CMYKVValue.M; - sumAY += m.LABValue.A * m.CMYKVValue.Y; - sumAK += m.LABValue.A * m.CMYKVValue.K; - sumAV += m.LABValue.A * m.CMYKVValue.V; + // Convert the result to a double[,] array for easy access in the model + return B.ToArray(); + } + } - sumBC += m.LABValue.B * m.CMYKVValue.C; - sumBM += m.LABValue.B * m.CMYKVValue.M; - sumBY += m.LABValue.B * m.CMYKVValue.Y; - sumBK += m.LABValue.B * m.CMYKVValue.K; - sumBV += m.LABValue.B * m.CMYKVValue.V; - } - double avgL = sumL / n; - double avgA = sumA / n; - double avgB = sumB / n; - double avgC = sumC / n; - double avgM = sumM / n; - double avgY = sumY / n; - double avgK = sumK / n; - double avgV = sumV / n; - // Linear regression to predict C, M, Y, K, V from L, A, B - return new CMYKV - { - C = (sumLC / sumL) + avgC, - M = (sumLM / sumL) + avgM, - Y = (sumLY / sumL) + avgY, - K = (sumLK / sumL) + avgK, - V = (sumLV / sumL) + avgV - }; - } - } } diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/PredictionMethod.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/PredictionMethod.cs deleted file mode 100644 index 200368571..000000000 --- a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/PredictionMethod.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Tango.ColorConversion -{ - public enum PredictionMethod - { - LinearInterpolation, - LinearRegression, - KNearestNeighbors, - SplineInterpolation - } -} diff --git a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/SplineInterpolationPrediction.cs b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/SplineInterpolationPrediction.cs index 9249b2aa8..3b66d5d6c 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/CMYKV/SplineInterpolationPrediction.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/CMYKV/SplineInterpolationPrediction.cs @@ -10,10 +10,10 @@ namespace Tango.ColorConversion public LAB Predict(CMYKV cmykv, List<CMYKVMeasurement> measurements) { // Spline interpolation logic: Perform cubic spline interpolation - var cValues = measurements.Select(m => m.CMYKVValue.C).ToArray(); - var lValues = measurements.Select(m => m.LABValue.L).ToArray(); - var aValues = measurements.Select(m => m.LABValue.A).ToArray(); - var bValues = measurements.Select(m => m.LABValue.B).ToArray(); + var cValues = measurements.Select(m => m.CMYKV.C).ToArray(); + var lValues = measurements.Select(m => m.LAB.L).ToArray(); + var aValues = measurements.Select(m => m.LAB.A).ToArray(); + var bValues = measurements.Select(m => m.LAB.B).ToArray(); var lSpline = CubicSpline.InterpolateNatural(cValues, lValues); var aSpline = CubicSpline.InterpolateNatural(cValues, aValues); @@ -30,12 +30,12 @@ namespace Tango.ColorConversion public CMYKV PredictFromLAB(LAB lab, List<CMYKVMeasurement> measurements) { // Extract L values and corresponding CMYKV values for spline interpolation - var lValues = measurements.Select(m => m.LABValue.L).ToArray(); - var cValues = measurements.Select(m => m.CMYKVValue.C).ToArray(); - var mValues = measurements.Select(m => m.CMYKVValue.M).ToArray(); - var yValues = measurements.Select(m => m.CMYKVValue.Y).ToArray(); - var kValues = measurements.Select(m => m.CMYKVValue.K).ToArray(); - var vValues = measurements.Select(m => m.CMYKVValue.V).ToArray(); + var lValues = measurements.Select(m => m.LAB.L).ToArray(); + var cValues = measurements.Select(m => m.CMYKV.C).ToArray(); + var mValues = measurements.Select(m => m.CMYKV.M).ToArray(); + var yValues = measurements.Select(m => m.CMYKV.Y).ToArray(); + var kValues = measurements.Select(m => m.CMYKV.K).ToArray(); + var vValues = measurements.Select(m => m.CMYKV.V).ToArray(); // Create cubic splines for each component var cSpline = CubicSpline.InterpolateNatural(lValues, cValues); diff --git a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs index dc9f1bd07..bff01dd83 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs @@ -35,6 +35,13 @@ namespace Tango.ColorConversion #region Color Conversion + private static List<PMR.ColorLab.ColorMeasurement> _measurements = new List<PMR.ColorLab.ColorMeasurement>(); + + public static void SetMeasurements(List<PMR.ColorLab.ColorMeasurement> measurements) + { + _measurements = measurements; + } + public ConversionOutput Convert(ConversionInput conversionInput, int version) { if (version < 1) version = 1; @@ -55,27 +62,81 @@ namespace Tango.ColorConversion NativePMR<ConversionInput, ConversionOutput> nativePMR = new NativePMR<ConversionInput, ConversionOutput>(convert); ConversionOutput output = nativePMR.Invoke(conversionInput); - if (conversionInput.ColorSpace == PMR.ColorLab.ColorSpace.Volume) + if (conversionInput.GetPredictionType() != CMYKVPredictionTypes.None) { - var violetInput = conversionInput.InputCoordinates.InputLiquids.FirstOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet); + CMYKVColorConverter cmykvConverter = new CMYKVColorConverter((int)conversionInput.CMYKVK); - //conversionInput.GenerateHive + //Custom Measurements + if (conversionInput.ColorMeasurements.Count > 0) + { + foreach (var m in conversionInput.ColorMeasurements) + { + cmykvConverter.AddMeasurement(new CMYKV() { C = m.C, M = m.M, Y = m.Y, K = m.K, V = m.V }, new LAB(m.L, m.A, m.B)); + } + } + else //Global Measurements + { + foreach (var m in _measurements) + { + cmykvConverter.AddMeasurement(new CMYKV() { C = m.C, M = m.M, Y = m.Y, K = m.K, V = m.V }, new LAB(m.L, m.A, m.B)); + } + } - //Blend violet to best match color. - if (violetInput != null && violetInput.Volume > 0) + + if (conversionInput.ColorSpace == PMR.ColorLab.ColorSpace.Volume) { - var color = BlendWithViolet(output.SingleCoordinates.Red, output.SingleCoordinates.Green, output.SingleCoordinates.Blue, (float)(violetInput.Volume / 100d)); - output.SingleCoordinates.Red = color.R; - output.SingleCoordinates.Green = color.G; - output.SingleCoordinates.Blue = color.B; + var violetInput = conversionInput.InputCoordinates.InputLiquids.FirstOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet); + + if (violetInput != null && violetInput.Volume > 0) + { + if (conversionInput.GetPredictionType() == CMYKVPredictionTypes.SimpleRGBPreview) + { + //Blend violet to best match color. + + if (conversionInput.SimpleRGBPreviewFactor == 0) conversionInput.SimpleRGBPreviewFactor = 1; + + var color = BlendWithViolet(output.SingleCoordinates.Red, output.SingleCoordinates.Green, output.SingleCoordinates.Blue, (float)((violetInput.Volume * Math.Max(conversionInput.SimpleRGBPreviewFactor, 0.01)) / 100d)); + output.SingleCoordinates.Red = (int)color.R; + output.SingleCoordinates.Green = (int)color.G; + output.SingleCoordinates.Blue = (int)color.B; + } + else if (cmykvConverter.Measurements.Count > 0 && (conversionInput.GetPredictionType() == CMYKVPredictionTypes.Predict_RGB || conversionInput.GetPredictionType() == CMYKVPredictionTypes.PredictAll)) + { + RGB rgb = cmykvConverter.ConvertCMYKVToRGB(CreateCMYKVFromConversionInput(conversionInput), conversionInput.GetPredictionMethod()); + output.SingleCoordinates.Red = (int)rgb.R; + output.SingleCoordinates.Green = (int)rgb.G; + output.SingleCoordinates.Blue = (int)rgb.B; + } + } + } + else if (conversionInput.ColorSpace == PMR.ColorLab.ColorSpace.Rgb && cmykvConverter.Measurements.Count > 0) + { + if (conversionInput.GetPredictionType() == CMYKVPredictionTypes.Predict_CMYKV || conversionInput.GetPredictionType() == CMYKVPredictionTypes.PredictAll) + { + var rgb = new RGB(conversionInput.InputCoordinates.Red, conversionInput.InputCoordinates.Green, conversionInput.InputCoordinates.Blue); + if (cmykvConverter.ShouldUseViolet(rgb, conversionInput.CMYKVHueThreshhold)) + { + var cmykv = cmykvConverter.ConvertRGBToCMYKV(rgb, conversionInput.GetPredictionMethod()); + SetCMYKVToConversionOutput(cmykv, output); + } + else + { + ResetVioletVolume(output); + } + } + else + { + ResetVioletVolume(output); + } + } + else + { + ResetVioletVolume(output); } } - else + else if (conversionInput.ColorSpace != PMR.ColorLab.ColorSpace.Volume) { - var violetOutput = new OutputLiquid() { LiquidType = PMR.ColorLab.LiquidType.Violet, Volume = 0 }; - output.SingleCoordinates.OutputLiquids.Add(violetOutput); - - output.HiveCoordinates.ToList().ForEach(x => x.OutputLiquids.Add(violetOutput)); + ResetVioletVolume(output); } bool result = NativeMethods.FreeLibrary(pDll); @@ -185,6 +246,13 @@ namespace Tango.ColorConversion conversionInput.VMax = rml.VMax; + //CMYKV + conversionInput.SetPredictionType(rml.PredictionType); + conversionInput.SetPredictionMethod(rml.PredictionMethod); + conversionInput.CMYKVHueThreshhold = rml.CmykvHueThreshold; + conversionInput.CMYKVK = rml.KNearestK; + conversionInput.SimpleRGBPreviewFactor = rml.SimpleRgbPreviewFactor; + conversionInput.ForwardData = ByteString.CopyFrom(rml.Cct.Data); if (rml.Gbd != null) @@ -1016,7 +1084,7 @@ namespace Tango.ColorConversion private static Color Violet = Color.FromRgb(127, 0, 255); - public static Color BlendWithViolet(int r, int g, int b, float violetFactor) + public static RGB BlendWithViolet(int r, int g, int b, float violetFactor) { // Ensure violetFactor is between 0.0 and 1.0 violetFactor = violetFactor.Clamp(0.0f, 1.0f); @@ -1036,7 +1104,115 @@ namespace Tango.ColorConversion blendedG = blendedG.Clamp(0, 255); blendedB = blendedB.Clamp(0, 255); - return Color.FromRgb((byte)blendedR, (byte)blendedG, (byte)blendedB); + return new RGB(blendedR, blendedG, blendedB); + } + + private CMYKV CreateCMYKVFromConversionInput(ConversionInput input) + { + CMYKV cmykv = new CMYKV(); + + foreach (var liquid in input.InputCoordinates.InputLiquids) + { + switch (liquid.LiquidType) + { + case PMR.ColorLab.LiquidType.Cyan: + cmykv.C = liquid.Volume; + break; + case PMR.ColorLab.LiquidType.Magenta: + cmykv.M = liquid.Volume; + break; + case PMR.ColorLab.LiquidType.Yellow: + cmykv.Y = liquid.Volume; + break; + case PMR.ColorLab.LiquidType.Black: + cmykv.K = liquid.Volume; + break; + case PMR.ColorLab.LiquidType.Violet: + cmykv.V = liquid.Volume; + break; + default: + break; + } + } + + return cmykv; + } + + private RGB CreateRGBFromConversionOutput(ConversionOutput output) + { + return new RGB(output.SingleCoordinates.Red, output.SingleCoordinates.Green, output.SingleCoordinates.Blue); + } + + private void ResetVioletVolume(ConversionOutput output) + { + var violetOutput = new OutputLiquid() { LiquidType = PMR.ColorLab.LiquidType.Violet, Volume = 0 }; + output.SingleCoordinates.OutputLiquids.Add(violetOutput); + + output.HiveCoordinates.ToList().ForEach(x => x.OutputLiquids.Add(violetOutput)); + } + + private void SetCMYKVToConversionOutput(CMYKV cmykv, ConversionOutput output) + { + var violetOutput = new OutputLiquid() { LiquidType = PMR.ColorLab.LiquidType.Violet, Volume = 0 }; + output.SingleCoordinates.OutputLiquids.Add(violetOutput); + + foreach (var liquid in output.SingleCoordinates.OutputLiquids) + { + switch (liquid.LiquidType) + { + case PMR.ColorLab.LiquidType.Cyan: + liquid.Volume = cmykv.C; + break; + case PMR.ColorLab.LiquidType.Magenta: + liquid.Volume = cmykv.M; + break; + case PMR.ColorLab.LiquidType.Yellow: + liquid.Volume = cmykv.Y; + break; + case PMR.ColorLab.LiquidType.Black: + liquid.Volume = cmykv.K; + break; + case PMR.ColorLab.LiquidType.Violet: + liquid.Volume = cmykv.V; + break; + default: + break; + } + } + + if (output.HiveCoordinates.Count > 0) + { + var vOutput = new OutputLiquid() { LiquidType = PMR.ColorLab.LiquidType.Violet, Volume = 0 }; + + foreach (var cell in output.HiveCoordinates) + { + cell.OutputLiquids.Add(vOutput); + + foreach (var liquid in cell.OutputLiquids) + { + switch (liquid.LiquidType) + { + case PMR.ColorLab.LiquidType.Cyan: + liquid.Volume = cmykv.C; + break; + case PMR.ColorLab.LiquidType.Magenta: + liquid.Volume = cmykv.M; + break; + case PMR.ColorLab.LiquidType.Yellow: + liquid.Volume = cmykv.Y; + break; + case PMR.ColorLab.LiquidType.Black: + liquid.Volume = cmykv.K; + break; + case PMR.ColorLab.LiquidType.Violet: + liquid.Volume = cmykv.V; + break; + default: + break; + } + } + } + } } #endregion diff --git a/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ConversionInputExtensions.cs b/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ConversionInputExtensions.cs new file mode 100644 index 000000000..252a77fe2 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ConversionInputExtensions.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; +using Tango.PMR.ColorLab; + +public static class ConversionInputExtensions +{ + public static CMYKVPredictionTypes GetPredictionType(this ConversionInput conversionInput) + { + return (CMYKVPredictionTypes)conversionInput.CMYKVPredictionType; + } + + public static CMYKVPredictionMethods GetPredictionMethod(this ConversionInput conversionInput) + { + return (CMYKVPredictionMethods)conversionInput.CMYKVPredictionMethod; + } + + public static void SetPredictionType(this ConversionInput conversionInput, CMYKVPredictionTypes predictionType) + { + conversionInput.CMYKVPredictionType = predictionType.ToInt32(); + } + + public static void SetPredictionMethod(this ConversionInput conversionInput, CMYKVPredictionMethods predictionMethod) + { + conversionInput.CMYKVPredictionMethod = predictionMethod.ToInt32(); + } +} diff --git a/Software/Visual_Studio/Tango.ColorConversion/Tango.ColorConversion.csproj b/Software/Visual_Studio/Tango.ColorConversion/Tango.ColorConversion.csproj index 5a583058f..bb1659381 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/Tango.ColorConversion.csproj +++ b/Software/Visual_Studio/Tango.ColorConversion/Tango.ColorConversion.csproj @@ -56,17 +56,19 @@ <Compile Include="CMYKV\CMYKVColorConverter.cs" /> <Compile Include="CMYKV\CMYKVMeasurement.cs" /> <Compile Include="CMYKV\DemoData.cs" /> + <Compile Include="CMYKV\ExtensionMethods.cs" /> + <Compile Include="CMYKV\IColorPrediction.cs" /> <Compile Include="CMYKV\KNearestNeighborsPrediction.cs" /> <Compile Include="CMYKV\LAB.cs" /> <Compile Include="CMYKV\LinearInterpolationPrediction.cs" /> <Compile Include="CMYKV\LinearRegressionPrediction.cs" /> - <Compile Include="CMYKV\PredictionMethod.cs" /> <Compile Include="CMYKV\RGB.cs" /> <Compile Include="CMYKV\SplineInterpolationPrediction.cs" /> <Compile Include="ColorConversionSettings.cs" /> <Compile Include="ColorConversionSuggestion.cs" /> <Compile Include="DefaultColorConverter.cs" /> <Compile Include="ExtensionMethods\ColorConversionSuggestionExtensions.cs" /> + <Compile Include="ExtensionMethods\ConversionInputExtensions.cs" /> <Compile Include="ExtensionMethods\ConversionOutputExtensions.cs" /> <Compile Include="ExtensionMethods\MathExtensions.cs" /> <Compile Include="IColorConverter.cs" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/COLOR_MEASUREMENTS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/COLOR_MEASUREMENTS.cs new file mode 100644 index 000000000..2531147db --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/COLOR_MEASUREMENTS.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.DAL.Remote.DB +{ + using System; + using System.Collections.Generic; + + public partial class COLOR_MEASUREMENTS + { + public int ID { get; set; } + public string GUID { get; set; } + public System.DateTime LAST_UPDATED { get; set; } + public double C { get; set; } + public double M { get; set; } + public double Y { get; set; } + public double K { get; set; } + public double V { get; set; } + public double L { get; set; } + public double A { get; set; } + public double B { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs index b1f71c687..90225e5f2 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs @@ -82,6 +82,11 @@ namespace Tango.DAL.Remote.DB public string BTSR_APPLICATION_TYPE_GUID { get; set; } public string BTSR_YARN_TYPE_GUID { get; set; } public double BTSR_TENSION_ERROR { get; set; } + public int CMYKV_PREDICTION_TYPE { get; set; } + public int CMYKV_PREDICTION_METHOD { get; set; } + public double CMYKV_HUE_THRESHOLD { get; set; } + public int K_NEAREST_K { get; set; } + public double SIMPLE_RGB_PREVIEW_FACTOR { get; set; } public virtual BTSR_APPLICATION_TYPES BTSR_APPLICATION_TYPES { get; set; } public virtual BTSR_YARN_TYPES BTSR_YARN_TYPES { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs index b611a0972..80f0a256f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs @@ -67,6 +67,7 @@ namespace Tango.DAL.Remote.DB public virtual DbSet<COLOR_CATALOGS_GROUPS> COLOR_CATALOGS_GROUPS { get; set; } public virtual DbSet<COLOR_CATALOGS_ITEMS> COLOR_CATALOGS_ITEMS { get; set; } public virtual DbSet<COLOR_CATALOGS_ITEMS_RECIPES> COLOR_CATALOGS_ITEMS_RECIPES { get; set; } + public virtual DbSet<COLOR_MEASUREMENTS> COLOR_MEASUREMENTS { get; set; } public virtual DbSet<COLOR_PROCESS_INK_UPTAKE> COLOR_PROCESS_INK_UPTAKE { get; set; } public virtual DbSet<COLOR_SPACES> COLOR_SPACES { get; set; } public virtual DbSet<CONFIGURATION> CONFIGURATIONS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 61d68c102..56b40d608 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -251,6 +251,22 @@ <Property Name="BLACK" Type="float" Nullable="false" /> <Property Name="PROCESS_PARAMETERS_TABLE_INDEX" Type="int" Nullable="false" /> </EntityType> + <EntityType Name="COLOR_MEASUREMENTS"> + <Key> + <PropertyRef Name="GUID" /> + </Key> + <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" /> + <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="LAST_UPDATED" Type="datetime2" Precision="3" Nullable="false" /> + <Property Name="C" Type="float" Nullable="false" /> + <Property Name="M" Type="float" Nullable="false" /> + <Property Name="Y" Type="float" Nullable="false" /> + <Property Name="K" Type="float" Nullable="false" /> + <Property Name="V" Type="float" Nullable="false" /> + <Property Name="L" Type="float" Nullable="false" /> + <Property Name="A" Type="float" Nullable="false" /> + <Property Name="B" Type="float" Nullable="false" /> + </EntityType> <EntityType Name="COLOR_PROCESS_DATA"> <Key> <PropertyRef Name="GUID" /> @@ -1384,6 +1400,11 @@ <Property Name="BTSR_APPLICATION_TYPE_GUID" Type="varchar" MaxLength="36" /> <Property Name="BTSR_YARN_TYPE_GUID" Type="varchar" MaxLength="36" /> <Property Name="BTSR_TENSION_ERROR" Type="float" Nullable="false" /> + <Property Name="CMYKV_PREDICTION_TYPE" Type="int" Nullable="false" /> + <Property Name="CMYKV_PREDICTION_METHOD" Type="int" Nullable="false" /> + <Property Name="CMYKV_HUE_THRESHOLD" Type="float" Nullable="false" /> + <Property Name="K_NEAREST_K" Type="int" Nullable="false" /> + <Property Name="SIMPLE_RGB_PREVIEW_FACTOR" Type="float" Nullable="false" /> </EntityType> <EntityType Name="RMLS_EXTENSIONS"> <Key> @@ -3624,6 +3645,7 @@ <EntitySet Name="COLOR_CATALOGS_GROUPS" EntityType="Self.COLOR_CATALOGS_GROUPS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="COLOR_CATALOGS_ITEMS" EntityType="Self.COLOR_CATALOGS_ITEMS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="COLOR_CATALOGS_ITEMS_RECIPES" EntityType="Self.COLOR_CATALOGS_ITEMS_RECIPES" Schema="dbo" store:Type="Tables" /> + <EntitySet Name="COLOR_MEASUREMENTS" EntityType="Self.COLOR_MEASUREMENTS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="COLOR_PROCESS_DATA" EntityType="Self.COLOR_PROCESS_DATA" Schema="dbo" store:Type="Tables" /> <EntitySet Name="COLOR_PROCESS_FACTORS" EntityType="Self.COLOR_PROCESS_FACTORS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="COLOR_PROCESS_INK_UPTAKE" EntityType="Self.COLOR_PROCESS_INK_UPTAKE" Schema="dbo" store:Type="Tables" /> @@ -4398,6 +4420,7 @@ <EntitySet Name="COLOR_CATALOGS_GROUPS" EntityType="RemoteModel.COLOR_CATALOGS_GROUPS" /> <EntitySet Name="COLOR_CATALOGS_ITEMS" EntityType="RemoteModel.COLOR_CATALOGS_ITEMS" /> <EntitySet Name="COLOR_CATALOGS_ITEMS_RECIPES" EntityType="RemoteModel.COLOR_CATALOGS_ITEMS_RECIPES" /> + <EntitySet Name="COLOR_MEASUREMENTS" EntityType="RemoteModel.COLOR_MEASUREMENTS" /> <EntitySet Name="COLOR_PROCESS_INK_UPTAKE" EntityType="RemoteModel.COLOR_PROCESS_INK_UPTAKE" /> <EntitySet Name="COLOR_SPACES" EntityType="RemoteModel.COLOR_SPACES" /> <EntitySet Name="CONFIGURATIONS" EntityType="RemoteModel.CONFIGURATION" /> @@ -5892,6 +5915,22 @@ <NavigationProperty Name="COLOR_CATALOGS_ITEMS" Relationship="RemoteModel.FK_COLOR_CATALOGS_ITEMS_RECIPES_COLOR_CATALOGS_ITEMS" FromRole="COLOR_CATALOGS_ITEMS_RECIPES" ToRole="COLOR_CATALOGS_ITEMS" /> <NavigationProperty Name="RML" Relationship="RemoteModel.FK_COLOR_CATALOGS_ITEMS_RECIPES_RMLS" FromRole="COLOR_CATALOGS_ITEMS_RECIPES" ToRole="RML" /> </EntityType> + <EntityType Name="COLOR_MEASUREMENTS"> + <Key> + <PropertyRef Name="GUID" /> + </Key> + <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" /> + <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> + <Property Name="C" Type="Double" Nullable="false" /> + <Property Name="M" Type="Double" Nullable="false" /> + <Property Name="Y" Type="Double" Nullable="false" /> + <Property Name="K" Type="Double" Nullable="false" /> + <Property Name="V" Type="Double" Nullable="false" /> + <Property Name="L" Type="Double" Nullable="false" /> + <Property Name="A" Type="Double" Nullable="false" /> + <Property Name="B" Type="Double" Nullable="false" /> + </EntityType> <EntityType Name="COLOR_PROCESS_INK_UPTAKE"> <Key> <PropertyRef Name="GUID" /> @@ -6957,6 +6996,11 @@ <Property Name="BTSR_APPLICATION_TYPE_GUID" Type="String" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="BTSR_YARN_TYPE_GUID" Type="String" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="BTSR_TENSION_ERROR" Type="Double" Nullable="false" /> + <Property Name="CMYKV_PREDICTION_TYPE" Type="Int32" Nullable="false" /> + <Property Name="CMYKV_PREDICTION_METHOD" Type="Int32" Nullable="false" /> + <Property Name="CMYKV_HUE_THRESHOLD" Type="Double" Nullable="false" /> + <Property Name="K_NEAREST_K" Type="Int32" Nullable="false" /> + <Property Name="SIMPLE_RGB_PREVIEW_FACTOR" Type="Double" Nullable="false" /> <NavigationProperty Name="BTSR_APPLICATION_TYPES" Relationship="RemoteModel.FK_RMLS_BTSR_APPLICATION_TYPES" FromRole="RML" ToRole="BTSR_APPLICATION_TYPES" /> <NavigationProperty Name="BTSR_YARN_TYPES" Relationship="RemoteModel.FK_RMLS_BTSR_YARN_TYPES" FromRole="RML" ToRole="BTSR_YARN_TYPES" /> <NavigationProperty Name="CATS" Relationship="RemoteModel.FK_CATS_RMLS" FromRole="RML" ToRole="CAT" /> @@ -9417,6 +9461,23 @@ </MappingFragment> </EntityTypeMapping> </EntitySetMapping> + <EntitySetMapping Name="COLOR_MEASUREMENTS"> + <EntityTypeMapping TypeName="RemoteModel.COLOR_MEASUREMENTS"> + <MappingFragment StoreEntitySet="COLOR_MEASUREMENTS"> + <ScalarProperty Name="B" ColumnName="B" /> + <ScalarProperty Name="A" ColumnName="A" /> + <ScalarProperty Name="L" ColumnName="L" /> + <ScalarProperty Name="V" ColumnName="V" /> + <ScalarProperty Name="K" ColumnName="K" /> + <ScalarProperty Name="Y" ColumnName="Y" /> + <ScalarProperty Name="M" ColumnName="M" /> + <ScalarProperty Name="C" ColumnName="C" /> + <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> + <ScalarProperty Name="GUID" ColumnName="GUID" /> + <ScalarProperty Name="ID" ColumnName="ID" /> + </MappingFragment> + </EntityTypeMapping> + </EntitySetMapping> <EntitySetMapping Name="COLOR_PROCESS_INK_UPTAKE"> <EntityTypeMapping TypeName="RemoteModel.COLOR_PROCESS_INK_UPTAKE"> <MappingFragment StoreEntitySet="COLOR_PROCESS_INK_UPTAKE"> @@ -10366,6 +10427,11 @@ <EntitySetMapping Name="RMLS"> <EntityTypeMapping TypeName="RemoteModel.RML"> <MappingFragment StoreEntitySet="RMLS"> + <ScalarProperty Name="SIMPLE_RGB_PREVIEW_FACTOR" ColumnName="SIMPLE_RGB_PREVIEW_FACTOR" /> + <ScalarProperty Name="K_NEAREST_K" ColumnName="K_NEAREST_K" /> + <ScalarProperty Name="CMYKV_HUE_THRESHOLD" ColumnName="CMYKV_HUE_THRESHOLD" /> + <ScalarProperty Name="CMYKV_PREDICTION_METHOD" ColumnName="CMYKV_PREDICTION_METHOD" /> + <ScalarProperty Name="CMYKV_PREDICTION_TYPE" ColumnName="CMYKV_PREDICTION_TYPE" /> <ScalarProperty Name="BTSR_TENSION_ERROR" ColumnName="BTSR_TENSION_ERROR" /> <ScalarProperty Name="BTSR_YARN_TYPE_GUID" ColumnName="BTSR_YARN_TYPE_GUID" /> <ScalarProperty Name="BTSR_APPLICATION_TYPE_GUID" ColumnName="BTSR_APPLICATION_TYPE_GUID" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 66a74fb5e..c0d3bd959 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,102 +5,103 @@ <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1" ZoomLevel="58"> - <EntityTypeShape EntityType="RemoteModel.ACTION_LOGS" Width="1.5" PointX="11.25" PointY="32.625" /> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="85.375" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="1.5" PointY="76.25" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="73.25" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="1.5" PointY="70.375" /> - <EntityTypeShape EntityType="RemoteModel.BIT_TYPES" Width="1.5" PointX="0.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.ACTION_LOGS" Width="1.5" PointX="11.25" PointY="11.125" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="70.875" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="1.5" PointY="96.375" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="90.625" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="1.5" PointY="75" /> + <EntityTypeShape EntityType="RemoteModel.BIT_TYPES" Width="1.5" PointX="13.75" PointY="10.75" /> <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="18" PointY="20.625" /> - <EntityTypeShape EntityType="RemoteModel.BTSR_APPLICATION_TYPES" Width="1.5" PointX="0.75" PointY="14" /> - <EntityTypeShape EntityType="RemoteModel.BTSR_YARN_TYPES" Width="1.5" PointX="0.75" PointY="41.625" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="3.75" PointY="45.5" /> - <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="8.25" PointY="24.625" /> - <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="0.75" PointY="32" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="1.5" PointY="5.375" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_GROUPS" Width="1.5" PointX="3.75" PointY="5.875" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_ITEMS" Width="1.5" PointX="6" PointY="4.625" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_ITEMS_RECIPES" Width="1.5" PointX="8.25" PointY="20.5" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_PROCESS_INK_UPTAKE" Width="1.5" PointX="2.75" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="9" PointY="16" /> - <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3.75" PointY="71.5" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="89.5" /> - <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="9" PointY="28.875" /> - <EntityTypeShape EntityType="RemoteModel.DATA_STORE_ITEMS" Width="1.5" PointX="8.25" PointY="85.875" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="1.5" PointY="94" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="3.75" PointY="93.375" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="79.125" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="9" PointY="43.75" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="20.25" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="29.125" /> - <EntityTypeShape EntityType="RemoteModel.FSE_VERSIONS" Width="1.5" PointX="11.25" PointY="50" /> - <EntityTypeShape EntityType="RemoteModel.GBD" Width="1.5" PointX="0.75" PointY="24.875" /> - <EntityTypeShape EntityType="RemoteModel.GLOBAL_DATA_STORE_ITEMS" Width="1.5" PointX="4.75" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="7.5" PointY="94.5" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="9.75" PointY="66.125" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="7.5" PointY="90.5" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="9.75" PointY="62.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="6.5" PointY="70.5" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="8.75" PointY="70.375" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="9.5" PointY="76.375" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="11.75" PointY="70.125" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="1.5" PointY="55.5" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="3.75" PointY="63.625" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="4.5" PointY="51.5" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="6.75" PointY="66.25" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="65.75" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="1.5" PointY="59.5" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="3.75" PointY="59.25" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="3.75" PointY="42.125" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="6" PointY="42.25" /> - <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="13.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.BTSR_APPLICATION_TYPES" Width="1.5" PointX="0.75" PointY="28.375" /> + <EntityTypeShape EntityType="RemoteModel.BTSR_YARN_TYPES" Width="1.5" PointX="0.75" PointY="24.875" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="3" PointY="45.75" /> + <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="5.25" PointY="20.625" /> + <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="0.75" PointY="43.75" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="9" PointY="38.25" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_GROUPS" Width="1.5" PointX="13.5" PointY="19.875" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_ITEMS" Width="1.5" PointX="15.75" PointY="18.625" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS_ITEMS_RECIPES" Width="1.5" PointX="5.25" PointY="28.5" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_MEASUREMENTS" Width="1.5" PointX="14.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_PROCESS_INK_UPTAKE" Width="1.5" PointX="15.75" PointY="10.75" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="9" PointY="34.75" /> + <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="0.75" PointY="80.75" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="67" /> + <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="9" PointY="28.5" /> + <EntityTypeShape EntityType="RemoteModel.DATA_STORE_ITEMS" Width="1.5" PointX="5.25" PointY="67.25" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="0.75" PointY="2.25" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="3" PointY="1.625" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="93.5" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="9" PointY="65.625" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="37.875" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="31.625" /> + <EntityTypeShape EntityType="RemoteModel.FSE_VERSIONS" Width="1.5" PointX="11.25" PointY="32.375" /> + <EntityTypeShape EntityType="RemoteModel.GBD" Width="1.5" PointX="0.75" PointY="34.5" /> + <EntityTypeShape EntityType="RemoteModel.GLOBAL_DATA_STORE_ITEMS" Width="1.5" PointX="16.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="1.5" PointY="99.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="3.75" PointY="80.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="1.5" PointY="107.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="3.75" PointY="92.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="7.5" PointY="79.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="9.75" PointY="80.625" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="4.5" PointY="76.625" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="6.75" PointY="83.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="1.5" PointY="103.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="3.75" PointY="84.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="7.5" PointY="97.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="9.75" PointY="90.375" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="85.875" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="7.5" PointY="93.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="9.75" PointY="86.5" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="3" PointY="39.125" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="5.25" PointY="43.5" /> + <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="17.75" PointY="4.75" /> <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="11.25" PointY="20.875" /> - <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="17.25" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="13.25" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="5.25" PointY="20.75" /> - <EntityTypeShape EntityType="RemoteModel.LUB" Width="1.5" PointX="0.75" PointY="38.25" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_PROTOTYPES" Width="1.5" PointX="2.75" PointY="9.75" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="11.25" PointY="39.5" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3.75" PointY="82.125" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="6" PointY="73.75" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="11.25" PointY="57.125" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="40.75" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="6.375" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="8.25" PointY="24.75" /> + <EntityTypeShape EntityType="RemoteModel.LUB" Width="1.5" PointX="0.75" PointY="16.875" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_PROTOTYPES" Width="1.5" PointX="17.75" PointY="15.75" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="11.25" PointY="16.875" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="0.75" PointY="63.375" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="3" PointY="55.125" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="11.25" PointY="38" /> <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="11" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="44.875" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="35.375" /> - <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="3.75" PointY="38.875" /> - <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3.75" PointY="87.375" /> - <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="12" PointY="13.5" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="20.25" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="14" /> + <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="3" PointY="42.375" /> + <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="0.75" PointY="49" /> + <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="12" PointY="3" /> <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="49" /> <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="55.25" /> - <EntityTypeShape EntityType="RemoteModel.PUBLISHED_PROCEDURE_PROJECTS" Width="1.5" PointX="8.75" PointY="5" /> - <EntityTypeShape EntityType="RemoteModel.PUBLISHED_PROCEDURE_PROJECTS_VERSIONS" Width="1.5" PointX="11" PointY="5.125" /> - <EntityTypeShape EntityType="RemoteModel.RML_EXTENSION_TEST_WASHING_RESULTS" Width="1.5" PointX="11" PointY="1" /> - <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="18.5" /> - <EntityTypeShape EntityType="RemoteModel.RMLS_SPOOLS" Width="1.5" PointX="5.25" PointY="24.25" /> - <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="12" PointY="17.5" /> - <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="14.25" PointY="17.5" /> - <EntityTypeShape EntityType="RemoteModel.RUBBING_RESULTS" Width="1.5" PointX="5.75" PointY="10.75" /> + <EntityTypeShape EntityType="RemoteModel.PUBLISHED_PROCEDURE_PROJECTS" Width="1.5" PointX="5.75" PointY="5" /> + <EntityTypeShape EntityType="RemoteModel.PUBLISHED_PROCEDURE_PROJECTS_VERSIONS" Width="1.5" PointX="8" PointY="5.125" /> + <EntityTypeShape EntityType="RemoteModel.RML_EXTENSION_TEST_WASHING_RESULTS" Width="1.5" PointX="8" PointY="1" /> + <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="18" /> + <EntityTypeShape EntityType="RemoteModel.RMLS_SPOOLS" Width="1.5" PointX="8.25" PointY="20.25" /> + <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="12" PointY="6.875" /> + <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="14.25" PointY="7" /> + <EntityTypeShape EntityType="RemoteModel.RUBBING_RESULTS" Width="1.5" PointX="18.75" PointY="0.75" /> <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="15.75" PointY="24.625" /> <EntityTypeShape EntityType="RemoteModel.SEGMENTS_GROUPS" Width="1.5" PointX="13.5" PointY="24.875" /> - <EntityTypeShape EntityType="RemoteModel.SITE" Width="1.5" PointX="3" PointY="34.625" /> - <EntityTypeShape EntityType="RemoteModel.SITES_CATALOGS" Width="1.5" PointX="5.25" PointY="17.375" /> - <EntityTypeShape EntityType="RemoteModel.SITES_RMLS" Width="1.5" PointX="5.25" PointY="29" /> - <EntityTypeShape EntityType="RemoteModel.SITES_SPOOL_TYPES" Width="1.5" PointX="14.25" PointY="20.875" /> - <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="9" PointY="10.5" /> - <EntityTypeShape EntityType="RemoteModel.SPOOL" Width="1.5" PointX="11.25" PointY="45.875" /> - <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="14.75" PointY="11.75" /> - <EntityTypeShape EntityType="RemoteModel.TANGO_UPDATES" Width="1.5" PointX="15.75" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="14.25" PointY="58" /> - <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="15.75" PointY="5.75" /> - <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="16.75" PointY="9.75" /> - <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="16.75" PointY="12.75" /> - <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="16.75" PointY="15.75" /> - <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="17.75" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="17.75" PointY="5.75" /> - <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="9" PointY="35.125" /> - <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="14.25" PointY="36.5" /> - <EntityTypeShape EntityType="RemoteModel.WASHING_TEST_MATERIALS" Width="1.5" PointX="8.75" PointY="1.5" /> - <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="9" PointY="32" /> + <EntityTypeShape EntityType="RemoteModel.SITE" Width="1.5" PointX="3" PointY="13.625" /> + <EntityTypeShape EntityType="RemoteModel.SITES_CATALOGS" Width="1.5" PointX="14.25" PointY="28.5" /> + <EntityTypeShape EntityType="RemoteModel.SITES_RMLS" Width="1.5" PointX="5.25" PointY="25" /> + <EntityTypeShape EntityType="RemoteModel.SITES_SPOOL_TYPES" Width="1.5" PointX="8.25" PointY="10.375" /> + <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="6" PointY="14.875" /> + <EntityTypeShape EntityType="RemoteModel.SPOOL" Width="1.5" PointX="8.25" PointY="42.75" /> + <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="19.75" PointY="4.75" /> + <EntityTypeShape EntityType="RemoteModel.TANGO_UPDATES" Width="1.5" PointX="19.75" PointY="7.75" /> + <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="14.25" PointY="37.875" /> + <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="19.75" PointY="12.75" /> + <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="19.75" PointY="16.75" /> + <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="20.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="20.75" PointY="19.75" /> + <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="21.75" PointY="3.75" /> + <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="21.75" PointY="8.75" /> + <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="9" PointY="13.5" /> + <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="14.25" PointY="15" /> + <EntityTypeShape EntityType="RemoteModel.WASHING_TEST_MATERIALS" Width="1.5" PointX="5.75" PointY="1.5" /> + <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="9" PointY="31.625" /> <AssociationConnector Association="RemoteModel.FK_ACTION_LOGS_USERS" /> <AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" /> <AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj index 2357e9720..bbba7651f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj +++ b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj @@ -114,6 +114,9 @@ <Compile Include="DB\COLOR_CATALOGS_ITEMS_RECIPES.cs"> <DependentUpon>RemoteADO.tt</DependentUpon> </Compile> + <Compile Include="DB\COLOR_MEASUREMENTS.cs"> + <DependentUpon>RemoteADO.tt</DependentUpon> + </Compile> <Compile Include="DB\COLOR_PROCESS_DATA.cs"> <DependentUpon>RemoteADO.tt</DependentUpon> </Compile> @@ -497,7 +500,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/ColorMeasurement.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/ColorMeasurement.cs new file mode 100644 index 000000000..f11849c1f --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/ColorMeasurement.cs @@ -0,0 +1,357 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ColorMeasurement.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.ColorLab { + + /// <summary>Holder for reflection information generated from ColorMeasurement.proto</summary> + public static partial class ColorMeasurementReflection { + + #region Descriptor + /// <summary>File descriptor for ColorMeasurement.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ColorMeasurementReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChZDb2xvck1lYXN1cmVtZW50LnByb3RvEhJUYW5nby5QTVIuQ29sb3JMYWIi", + "agoQQ29sb3JNZWFzdXJlbWVudBIJCgFDGAEgASgBEgkKAU0YAiABKAESCQoB", + "WRgDIAEoARIJCgFLGAQgASgBEgkKAVYYBSABKAESCQoBTBgKIAEoARIJCgFB", + "GAsgASgBEgkKAUIYDCABKAFCHgocY29tLnR3aW5lLnRhbmdvLnBtci5jb2xv", + "cmxhYmIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.ColorMeasurement), global::Tango.PMR.ColorLab.ColorMeasurement.Parser, new[]{ "C", "M", "Y", "K", "V", "L", "A", "B" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ColorMeasurement : pb::IMessage<ColorMeasurement> { + private static readonly pb::MessageParser<ColorMeasurement> _parser = new pb::MessageParser<ColorMeasurement>(() => new ColorMeasurement()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<ColorMeasurement> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.ColorLab.ColorMeasurementReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ColorMeasurement() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ColorMeasurement(ColorMeasurement other) : this() { + c_ = other.c_; + m_ = other.m_; + y_ = other.y_; + k_ = other.k_; + v_ = other.v_; + l_ = other.l_; + a_ = other.a_; + b_ = other.b_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ColorMeasurement Clone() { + return new ColorMeasurement(this); + } + + /// <summary>Field number for the "C" field.</summary> + public const int CFieldNumber = 1; + private double c_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double C { + get { return c_; } + set { + c_ = value; + } + } + + /// <summary>Field number for the "M" field.</summary> + public const int MFieldNumber = 2; + private double m_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double M { + get { return m_; } + set { + m_ = value; + } + } + + /// <summary>Field number for the "Y" field.</summary> + public const int YFieldNumber = 3; + private double y_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double Y { + get { return y_; } + set { + y_ = value; + } + } + + /// <summary>Field number for the "K" field.</summary> + public const int KFieldNumber = 4; + private double k_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double K { + get { return k_; } + set { + k_ = value; + } + } + + /// <summary>Field number for the "V" field.</summary> + public const int VFieldNumber = 5; + private double v_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double V { + get { return v_; } + set { + v_ = value; + } + } + + /// <summary>Field number for the "L" field.</summary> + public const int LFieldNumber = 10; + private double l_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double L { + get { return l_; } + set { + l_ = value; + } + } + + /// <summary>Field number for the "A" field.</summary> + public const int AFieldNumber = 11; + private double a_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double A { + get { return a_; } + set { + a_ = value; + } + } + + /// <summary>Field number for the "B" field.</summary> + public const int BFieldNumber = 12; + private double b_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double B { + get { return b_; } + set { + b_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ColorMeasurement); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ColorMeasurement other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (C != other.C) return false; + if (M != other.M) return false; + if (Y != other.Y) return false; + if (K != other.K) return false; + if (V != other.V) return false; + if (L != other.L) return false; + if (A != other.A) return false; + if (B != other.B) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (C != 0D) hash ^= C.GetHashCode(); + if (M != 0D) hash ^= M.GetHashCode(); + if (Y != 0D) hash ^= Y.GetHashCode(); + if (K != 0D) hash ^= K.GetHashCode(); + if (V != 0D) hash ^= V.GetHashCode(); + if (L != 0D) hash ^= L.GetHashCode(); + if (A != 0D) hash ^= A.GetHashCode(); + if (B != 0D) hash ^= B.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (C != 0D) { + output.WriteRawTag(9); + output.WriteDouble(C); + } + if (M != 0D) { + output.WriteRawTag(17); + output.WriteDouble(M); + } + if (Y != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Y); + } + if (K != 0D) { + output.WriteRawTag(33); + output.WriteDouble(K); + } + if (V != 0D) { + output.WriteRawTag(41); + output.WriteDouble(V); + } + if (L != 0D) { + output.WriteRawTag(81); + output.WriteDouble(L); + } + if (A != 0D) { + output.WriteRawTag(89); + output.WriteDouble(A); + } + if (B != 0D) { + output.WriteRawTag(97); + output.WriteDouble(B); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (C != 0D) { + size += 1 + 8; + } + if (M != 0D) { + size += 1 + 8; + } + if (Y != 0D) { + size += 1 + 8; + } + if (K != 0D) { + size += 1 + 8; + } + if (V != 0D) { + size += 1 + 8; + } + if (L != 0D) { + size += 1 + 8; + } + if (A != 0D) { + size += 1 + 8; + } + if (B != 0D) { + size += 1 + 8; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ColorMeasurement other) { + if (other == null) { + return; + } + if (other.C != 0D) { + C = other.C; + } + if (other.M != 0D) { + M = other.M; + } + if (other.Y != 0D) { + Y = other.Y; + } + if (other.K != 0D) { + K = other.K; + } + if (other.V != 0D) { + V = other.V; + } + if (other.L != 0D) { + L = other.L; + } + if (other.A != 0D) { + A = other.A; + } + if (other.B != 0D) { + B = other.B; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 9: { + C = input.ReadDouble(); + break; + } + case 17: { + M = input.ReadDouble(); + break; + } + case 25: { + Y = input.ReadDouble(); + break; + } + case 33: { + K = input.ReadDouble(); + break; + } + case 41: { + V = input.ReadDouble(); + break; + } + case 81: { + L = input.ReadDouble(); + break; + } + case 89: { + A = input.ReadDouble(); + break; + } + case 97: { + B = input.ReadDouble(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs index 1b6c796c5..1d85f4c7c 100644 --- a/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs @@ -24,24 +24,29 @@ namespace Tango.PMR.ColorLab { string.Concat( "ChVDb252ZXJzaW9uSW5wdXQucHJvdG8SElRhbmdvLlBNUi5Db2xvckxhYhoW", "SW5wdXRDb29yZGluYXRlcy5wcm90bxoQQ29sb3JTcGFjZS5wcm90bxoSUHJv", - "Y2Vzc1JhbmdlLnByb3RvGhRDb252ZXJzaW9uVHlwZS5wcm90byKOBAoPQ29u", - "dmVyc2lvbklucHV0Eg8KB1RocmVhZEwYASABKAESDwoHVGhyZWFkQRgCIAEo", - "ARIPCgdUaHJlYWRCGAMgASgBEjIKCkNvbG9yU3BhY2UYBCABKA4yHi5UYW5n", - "by5QTVIuQ29sb3JMYWIuQ29sb3JTcGFjZRI+ChBJbnB1dENvb3JkaW5hdGVz", - "GAUgASgLMiQuVGFuZ28uUE1SLkNvbG9yTGFiLklucHV0Q29vcmRpbmF0ZXMS", - "EwoLRm9yd2FyZERhdGEYBiABKAwSEwoLSW52ZXJzZURhdGEYByABKAwSFQoN", - "U2VnbWVudExlbmd0aBgIIAEoARITCgtEZWx0YUNocm9tYRgJIAEoARIOCgZE", - "ZWx0YUwYCiABKAESNwoNUHJvY2Vzc1JhbmdlcxgLIAMoCzIgLlRhbmdvLlBN", - "Ui5Db2xvckxhYi5Qcm9jZXNzUmFuZ2USFAoMR2VuZXJhdGVIaXZlGAwgASgI", - "EhQKDFVzZUxpZ2h0SW5rcxgNIAEoCBIMCgRWTWF4GA4gASgBEg8KB0diZERh", - "dGEYDyABKAwSDwoHTHViRGF0YRgQIAEoDBIdChVVc2VMdWJyaWNhbnRUcmFu", - "c2Zvcm0YESABKAgSOgoOQ29udmVyc2lvblR5cGUYEiABKA4yIi5UYW5nby5Q", - "TVIuQ29sb3JMYWIuQ29udmVyc2lvblR5cGVCHgocY29tLnR3aW5lLnRhbmdv", - "LnBtci5jb2xvcmxhYmIGcHJvdG8z")); + "Y2Vzc1JhbmdlLnByb3RvGhRDb252ZXJzaW9uVHlwZS5wcm90bxoWQ29sb3JN", + "ZWFzdXJlbWVudC5wcm90byLYBQoPQ29udmVyc2lvbklucHV0Eg8KB1RocmVh", + "ZEwYASABKAESDwoHVGhyZWFkQRgCIAEoARIPCgdUaHJlYWRCGAMgASgBEjIK", + "CkNvbG9yU3BhY2UYBCABKA4yHi5UYW5nby5QTVIuQ29sb3JMYWIuQ29sb3JT", + "cGFjZRI+ChBJbnB1dENvb3JkaW5hdGVzGAUgASgLMiQuVGFuZ28uUE1SLkNv", + "bG9yTGFiLklucHV0Q29vcmRpbmF0ZXMSEwoLRm9yd2FyZERhdGEYBiABKAwS", + "EwoLSW52ZXJzZURhdGEYByABKAwSFQoNU2VnbWVudExlbmd0aBgIIAEoARIT", + "CgtEZWx0YUNocm9tYRgJIAEoARIOCgZEZWx0YUwYCiABKAESNwoNUHJvY2Vz", + "c1JhbmdlcxgLIAMoCzIgLlRhbmdvLlBNUi5Db2xvckxhYi5Qcm9jZXNzUmFu", + "Z2USFAoMR2VuZXJhdGVIaXZlGAwgASgIEhQKDFVzZUxpZ2h0SW5rcxgNIAEo", + "CBIMCgRWTWF4GA4gASgBEg8KB0diZERhdGEYDyABKAwSDwoHTHViRGF0YRgQ", + "IAEoDBIdChVVc2VMdWJyaWNhbnRUcmFuc2Zvcm0YESABKAgSOgoOQ29udmVy", + "c2lvblR5cGUYEiABKA4yIi5UYW5nby5QTVIuQ29sb3JMYWIuQ29udmVyc2lv", + "blR5cGUSGwoTQ01ZS1ZQcmVkaWN0aW9uVHlwZRgTIAEoBRIdChVDTVlLVlBy", + "ZWRpY3Rpb25NZXRob2QYFCABKAUSGgoSQ01ZS1ZIdWVUaHJlc2hob2xkGBUg", + "ASgBEg8KB0NNWUtWX0sYFiABKAESHgoWU2ltcGxlUkdCUHJldmlld0ZhY3Rv", + "chgXIAEoARI/ChFDb2xvck1lYXN1cmVtZW50cxgYIAMoCzIkLlRhbmdvLlBN", + "Ui5Db2xvckxhYi5Db2xvck1lYXN1cmVtZW50Qh4KHGNvbS50d2luZS50YW5n", + "by5wbXIuY29sb3JsYWJiBnByb3RvMw==")); 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, global::Tango.PMR.ColorLab.ConversionTypeReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tango.PMR.ColorLab.InputCoordinatesReflection.Descriptor, global::Tango.PMR.ColorLab.ColorSpaceReflection.Descriptor, global::Tango.PMR.ColorLab.ProcessRangeReflection.Descriptor, global::Tango.PMR.ColorLab.ConversionTypeReflection.Descriptor, global::Tango.PMR.ColorLab.ColorMeasurementReflection.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", "GenerateHive", "UseLightInks", "VMax", "GbdData", "LubData", "UseLubricantTransform", "ConversionType" }, 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", "GenerateHive", "UseLightInks", "VMax", "GbdData", "LubData", "UseLubricantTransform", "ConversionType", "CMYKVPredictionType", "CMYKVPredictionMethod", "CMYKVHueThreshhold", "CMYKVK", "SimpleRGBPreviewFactor", "ColorMeasurements" }, null, null, null) })); } #endregion @@ -90,6 +95,12 @@ namespace Tango.PMR.ColorLab { lubData_ = other.lubData_; useLubricantTransform_ = other.useLubricantTransform_; conversionType_ = other.conversionType_; + cMYKVPredictionType_ = other.cMYKVPredictionType_; + cMYKVPredictionMethod_ = other.cMYKVPredictionMethod_; + cMYKVHueThreshhold_ = other.cMYKVHueThreshhold_; + cMYKVK_ = other.cMYKVK_; + simpleRGBPreviewFactor_ = other.simpleRGBPreviewFactor_; + colorMeasurements_ = other.colorMeasurements_.Clone(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -294,6 +305,71 @@ namespace Tango.PMR.ColorLab { } } + /// <summary>Field number for the "CMYKVPredictionType" field.</summary> + public const int CMYKVPredictionTypeFieldNumber = 19; + private int cMYKVPredictionType_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CMYKVPredictionType { + get { return cMYKVPredictionType_; } + set { + cMYKVPredictionType_ = value; + } + } + + /// <summary>Field number for the "CMYKVPredictionMethod" field.</summary> + public const int CMYKVPredictionMethodFieldNumber = 20; + private int cMYKVPredictionMethod_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CMYKVPredictionMethod { + get { return cMYKVPredictionMethod_; } + set { + cMYKVPredictionMethod_ = value; + } + } + + /// <summary>Field number for the "CMYKVHueThreshhold" field.</summary> + public const int CMYKVHueThreshholdFieldNumber = 21; + private double cMYKVHueThreshhold_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double CMYKVHueThreshhold { + get { return cMYKVHueThreshhold_; } + set { + cMYKVHueThreshhold_ = value; + } + } + + /// <summary>Field number for the "CMYKV_K" field.</summary> + public const int CMYKVKFieldNumber = 22; + private double cMYKVK_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double CMYKVK { + get { return cMYKVK_; } + set { + cMYKVK_ = value; + } + } + + /// <summary>Field number for the "SimpleRGBPreviewFactor" field.</summary> + public const int SimpleRGBPreviewFactorFieldNumber = 23; + private double simpleRGBPreviewFactor_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double SimpleRGBPreviewFactor { + get { return simpleRGBPreviewFactor_; } + set { + simpleRGBPreviewFactor_ = value; + } + } + + /// <summary>Field number for the "ColorMeasurements" field.</summary> + public const int ColorMeasurementsFieldNumber = 24; + private static readonly pb::FieldCodec<global::Tango.PMR.ColorLab.ColorMeasurement> _repeated_colorMeasurements_codec + = pb::FieldCodec.ForMessage(194, global::Tango.PMR.ColorLab.ColorMeasurement.Parser); + private readonly pbc::RepeatedField<global::Tango.PMR.ColorLab.ColorMeasurement> colorMeasurements_ = new pbc::RepeatedField<global::Tango.PMR.ColorLab.ColorMeasurement>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<global::Tango.PMR.ColorLab.ColorMeasurement> ColorMeasurements { + get { return colorMeasurements_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ConversionInput); @@ -325,6 +401,12 @@ namespace Tango.PMR.ColorLab { if (LubData != other.LubData) return false; if (UseLubricantTransform != other.UseLubricantTransform) return false; if (ConversionType != other.ConversionType) return false; + if (CMYKVPredictionType != other.CMYKVPredictionType) return false; + if (CMYKVPredictionMethod != other.CMYKVPredictionMethod) return false; + if (CMYKVHueThreshhold != other.CMYKVHueThreshhold) return false; + if (CMYKVK != other.CMYKVK) return false; + if (SimpleRGBPreviewFactor != other.SimpleRGBPreviewFactor) return false; + if(!colorMeasurements_.Equals(other.colorMeasurements_)) return false; return true; } @@ -349,6 +431,12 @@ namespace Tango.PMR.ColorLab { if (LubData.Length != 0) hash ^= LubData.GetHashCode(); if (UseLubricantTransform != false) hash ^= UseLubricantTransform.GetHashCode(); if (ConversionType != 0) hash ^= ConversionType.GetHashCode(); + if (CMYKVPredictionType != 0) hash ^= CMYKVPredictionType.GetHashCode(); + if (CMYKVPredictionMethod != 0) hash ^= CMYKVPredictionMethod.GetHashCode(); + if (CMYKVHueThreshhold != 0D) hash ^= CMYKVHueThreshhold.GetHashCode(); + if (CMYKVK != 0D) hash ^= CMYKVK.GetHashCode(); + if (SimpleRGBPreviewFactor != 0D) hash ^= SimpleRGBPreviewFactor.GetHashCode(); + hash ^= colorMeasurements_.GetHashCode(); return hash; } @@ -428,6 +516,27 @@ namespace Tango.PMR.ColorLab { output.WriteRawTag(144, 1); output.WriteEnum((int) ConversionType); } + if (CMYKVPredictionType != 0) { + output.WriteRawTag(152, 1); + output.WriteInt32(CMYKVPredictionType); + } + if (CMYKVPredictionMethod != 0) { + output.WriteRawTag(160, 1); + output.WriteInt32(CMYKVPredictionMethod); + } + if (CMYKVHueThreshhold != 0D) { + output.WriteRawTag(169, 1); + output.WriteDouble(CMYKVHueThreshhold); + } + if (CMYKVK != 0D) { + output.WriteRawTag(177, 1); + output.WriteDouble(CMYKVK); + } + if (SimpleRGBPreviewFactor != 0D) { + output.WriteRawTag(185, 1); + output.WriteDouble(SimpleRGBPreviewFactor); + } + colorMeasurements_.WriteTo(output, _repeated_colorMeasurements_codec); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -485,6 +594,22 @@ namespace Tango.PMR.ColorLab { if (ConversionType != 0) { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) ConversionType); } + if (CMYKVPredictionType != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(CMYKVPredictionType); + } + if (CMYKVPredictionMethod != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(CMYKVPredictionMethod); + } + if (CMYKVHueThreshhold != 0D) { + size += 2 + 8; + } + if (CMYKVK != 0D) { + size += 2 + 8; + } + if (SimpleRGBPreviewFactor != 0D) { + size += 2 + 8; + } + size += colorMeasurements_.CalculateSize(_repeated_colorMeasurements_codec); return size; } @@ -548,6 +673,22 @@ namespace Tango.PMR.ColorLab { if (other.ConversionType != 0) { ConversionType = other.ConversionType; } + if (other.CMYKVPredictionType != 0) { + CMYKVPredictionType = other.CMYKVPredictionType; + } + if (other.CMYKVPredictionMethod != 0) { + CMYKVPredictionMethod = other.CMYKVPredictionMethod; + } + if (other.CMYKVHueThreshhold != 0D) { + CMYKVHueThreshhold = other.CMYKVHueThreshhold; + } + if (other.CMYKVK != 0D) { + CMYKVK = other.CMYKVK; + } + if (other.SimpleRGBPreviewFactor != 0D) { + SimpleRGBPreviewFactor = other.SimpleRGBPreviewFactor; + } + colorMeasurements_.Add(other.colorMeasurements_); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -633,6 +774,30 @@ namespace Tango.PMR.ColorLab { conversionType_ = (global::Tango.PMR.ColorLab.ConversionType) input.ReadEnum(); break; } + case 152: { + CMYKVPredictionType = input.ReadInt32(); + break; + } + case 160: { + CMYKVPredictionMethod = input.ReadInt32(); + break; + } + case 169: { + CMYKVHueThreshhold = input.ReadDouble(); + break; + } + case 177: { + CMYKVK = input.ReadDouble(); + break; + } + case 185: { + SimpleRGBPreviewFactor = input.ReadDouble(); + break; + } + case 194: { + colorMeasurements_.AddEntriesFrom(input, _repeated_colorMeasurements_codec); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index b5ea1877c..bd2c306f8 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -56,6 +56,7 @@ <Compile Include="ColorLab\CalibrationMeasurement.cs" /> <Compile Include="ColorLab\CalibrationOutput.cs" /> <Compile Include="ColorLab\CalibrationPoint.cs" /> + <Compile Include="ColorLab\ColorMeasurement.cs" /> <Compile Include="ColorLab\ColorSpace.cs" /> <Compile Include="ColorLab\ConversionInput.cs" /> <Compile Include="ColorLab\ConversionOutput.cs" /> @@ -527,7 +528,7 @@ </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs index ba94ed30f..77fb82898 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs @@ -41,6 +41,18 @@ namespace Tango.Touch.Controls } } + + + public bool EnableViolet + { + get { return (bool)GetValue(EnableVioletProperty); } + set { SetValue(EnableVioletProperty, value); } + } + public static readonly DependencyProperty EnableVioletProperty = + DependencyProperty.Register("EnableViolet", typeof(bool), typeof(TouchColorPickerCMYKControl), new PropertyMetadata(false)); + + + public double ThumbHeight { get { return (double)GetValue(ThumbHeightProperty); } diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs index ae94cf9ac..e2e717183 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs @@ -41,6 +41,18 @@ namespace Tango.Touch.Controls } + + public bool AutoThumbColor + { + get { return (bool)GetValue(AutoThumbColorProperty); } + set { SetValue(AutoThumbColorProperty, value); } + } + public static readonly DependencyProperty AutoThumbColorProperty = + DependencyProperty.Register("AutoThumbColor", typeof(bool), typeof(TouchColorPickerControl), new PropertyMetadata(false)); + + + + public double MinValue { get { return (double)GetValue(MinValueProperty); } diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml index 503b9188a..0bdbf4009 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml @@ -26,6 +26,7 @@ <local:TouchNumericUpDownConrol x:Name="PART_ColorPickerNumericUpDown" HorizontalAlignment="Right" BorderThickness="0.8" BorderBrush="{TemplateBinding BorderBrush}" Margin="0 0 5 0" MaxValue="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MaxValue, StringFormat='0.##'}" NumericPartWidth="68"/> </Grid> <local:TouchColorPickerSlider x:Name="PART_ColorPickerSlider" Grid.Row="1" Margin=" 0 10 0 0" Background="{TemplateBinding Background}" + AutoThumbColor="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=AutoThumbColor}" ThumbHeightInside ="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=ThumbHeightInside}" ThumbHeight="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=ThumbHeight}" ThumbColor="{Binding ThumbColor, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}}" diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerSlider.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerSlider.cs index fb07ee976..7fa310927 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerSlider.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerSlider.cs @@ -26,6 +26,15 @@ namespace Tango.Touch.Controls #region Properties + public bool AutoThumbColor + { + get { return (bool)GetValue(AutoThumbColorProperty); } + set { SetValue(AutoThumbColorProperty, value); } + } + public static readonly DependencyProperty AutoThumbColorProperty = + DependencyProperty.Register("AutoThumbColor", typeof(bool), typeof(TouchColorPickerSlider), new PropertyMetadata(false)); + + /// <summary> /// The selected color property /// </summary> @@ -155,6 +164,11 @@ namespace Tango.Touch.Controls args.RoutedEvent = TouchColorPickerSlider.PickerSliderValueChangedEvent; RaiseEvent(args); } + + if (AutoThumbColor && SliderBackground is LinearGradientBrush background) + { + SelectedColor = GetRelativeColor(background.GradientStops, GetOffset(newValue, Minimum, Maximum)); + } } #endregion @@ -175,6 +189,7 @@ namespace Tango.Touch.Controls } #endregion + #region Methods public void SetValueAnotherControl(double newValue) @@ -187,6 +202,41 @@ namespace Tango.Touch.Controls } } + public static Color GetRelativeColor(GradientStopCollection gsc, double offset) + { + var point = gsc.SingleOrDefault(f => f.Offset == offset); + if (point != null) return point.Color; + + GradientStop before = gsc.Where(w => w.Offset == gsc.Min(m => m.Offset)).First(); + GradientStop after = gsc.Where(w => w.Offset == gsc.Max(m => m.Offset)).First(); + + foreach (var gs in gsc) + { + if (gs.Offset < offset && gs.Offset > before.Offset) + { + before = gs; + } + if (gs.Offset > offset && gs.Offset < after.Offset) + { + after = gs; + } + } + + var color = new Color(); + + color.ScA = (float)((offset - before.Offset) * (after.Color.ScA - before.Color.ScA) / (after.Offset - before.Offset) + before.Color.ScA); + color.ScR = (float)((offset - before.Offset) * (after.Color.ScR - before.Color.ScR) / (after.Offset - before.Offset) + before.Color.ScR); + color.ScG = (float)((offset - before.Offset) * (after.Color.ScG - before.Color.ScG) / (after.Offset - before.Offset) + before.Color.ScG); + color.ScB = (float)((offset - before.Offset) * (after.Color.ScB - before.Color.ScB) / (after.Offset - before.Offset) + before.Color.ScB); + + return color; + } + + public static double GetOffset(double value, double minValue, double maxValue) + { + return ((value - minValue) / (maxValue - minValue)); + } + #endregion //Methods } } diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 2acf08f84..9feb6fc7e 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -485,6 +485,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tango.ColorLib_v6", "ColorL EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.FSE.Statistics", "FSE\Modules\Tango.FSE.Statistics\Tango.FSE.Statistics.csproj", "{7A30B35F-94DC-4A9C-B9D2-CB5CAA735788}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.ColorMeasurementsGenerator", "Utilities\Tango.ColorMeasurementsGenerator\Tango.ColorMeasurementsGenerator.csproj", "{04FCA0BA-A64B-4C6A-A011-A94CE335D616}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AppVeyor|Any CPU = AppVeyor|Any CPU @@ -21490,6 +21492,106 @@ Global {7A30B35F-94DC-4A9C-B9D2-CB5CAA735788}.TS|x64.Build.0 = TS|Any CPU {7A30B35F-94DC-4A9C-B9D2-CB5CAA735788}.TS|x86.ActiveCfg = TS|Any CPU {7A30B35F-94DC-4A9C-B9D2-CB5CAA735788}.TS|x86.Build.0 = TS|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|Any CPU.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|Any CPU.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|ARM.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|ARM.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|ARM64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|ARM64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|x64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|x64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|x86.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.AppVeyor|x86.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|ARM.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|ARM.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|ARM64.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|x64.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|x64.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|x86.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Debug|x86.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|Any CPU.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|ARM.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|ARM.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|ARM64.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|ARM64.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|x64.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|x64.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|x86.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka_Debug|x86.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|Any CPU.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|Any CPU.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|ARM.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|ARM.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|ARM64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|ARM64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|x64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|x64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|x86.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Eureka|x86.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|Any CPU.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|Any CPU.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|ARM.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|ARM.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|ARM64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|ARM64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|x64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|x64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|x86.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.0|x86.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|Any CPU.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|Any CPU.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|ARM.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|ARM.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|ARM64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|ARM64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|x64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|x64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|x86.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.5|x86.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|Any CPU.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|Any CPU.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|ARM.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|ARM.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|ARM64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|ARM64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|x64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|x64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|x86.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release 4.6.1|x86.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|Any CPU.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|ARM.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|ARM.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|ARM64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|ARM64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|x64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|x64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|x86.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.Release|x86.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|Any CPU.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|ARM.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|ARM.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|ARM64.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|ARM64.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|x64.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|x64.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|x86.ActiveCfg = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS_Debug|x86.Build.0 = Debug|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|Any CPU.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|Any CPU.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|ARM.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|ARM.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|ARM64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|ARM64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|x64.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|x64.Build.0 = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|x86.ActiveCfg = Release|Any CPU + {04FCA0BA-A64B-4C6A-A011-A94CE335D616}.TS|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -21663,14 +21765,15 @@ Global {DA4FCA0B-E0EA-431F-B0CC-AA9B0A4C73C2} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} {D74E49AA-4C6B-4427-BEFF-D7CE2690D059} = {7181F9DE-0760-46B7-AD8F-BDBCAEDEF1B7} {7A30B35F-94DC-4A9C-B9D2-CB5CAA735788} = {4EE6DBA1-71BC-49E2-8DC7-266487E61050} + {04FCA0BA-A64B-4C6A-A011-A94CE335D616} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} - BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear - BuildVersion_UpdateAssemblyVersion = True - BuildVersion_UpdateFileVersion = False - BuildVersion_StartDate = 2000/1/1 - BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs BuildVersion_UseGlobalSettings = False + BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs + BuildVersion_StartDate = 2000/1/1 + BuildVersion_UpdateFileVersion = False + BuildVersion_UpdateAssemblyVersion = True + BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear + SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} EndGlobalSection EndGlobal diff --git a/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/App.config b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/App.config new file mode 100644 index 000000000..4ef5218a0 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/App.config @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> + </startup> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.0.5.0" newVersion="5.0.5.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/Program.cs b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/Program.cs new file mode 100644 index 000000000..96b5023ec --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/Program.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.ColorConversion; + +namespace Tango.ColorMeasurementsGenerator +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Generating Colors..."); + Console.WriteLine(); + + var colors = RGBGenerator.GenerateRGBValues(1000); + + List<ColorMeasurement> measurements = new List<ColorMeasurement>(); + + for (int i = 0; i < colors.Count; i++) + { + var color = colors[i]; + //color = DefaultColorConverter.BlendWithViolet((int)color.R, (int)color.G, (int)color.B, ((float)i) / 100f); + var rgb = new ColorMine.ColorSpaces.Rgb(color.R, color.G, color.B); + var cmyk = rgb.To<ColorMine.ColorSpaces.Cmyk>(); + var lab = rgb.To<ColorMine.ColorSpaces.Lab>(); + + ColorMeasurement m = new ColorMeasurement(); + m.C = cmyk.C * 100; + m.M = cmyk.M * 100; + m.Y = cmyk.Y * 100; + m.K = cmyk.K * 100; + m.V = 0; + m.L = lab.L; + m.A = lab.A; + m.B = lab.B; + + measurements.Add(m); + + Console.WriteLine(m.ToString()); + } + + Console.WriteLine(); + + using (var db = ObservablesContext.CreateDefault()) + { + Console.WriteLine("Clearing previous color measurements..."); + db.Database.ExecuteSqlCommand("DELETE FROM COLOR_MEASUREMENTS"); + } + + using (var db = ObservablesContext.CreateDefault()) + { + foreach (var m in measurements) + { + db.ColorMeasurements.Add(m); + } + + Console.WriteLine("Adding new measurements to database..."); + + db.SaveChanges(); + } + + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine(); + Console.WriteLine("Done!"); + Console.ReadKey(); + Environment.Exit(0); + } + } + + public class RGBGenerator + { + public static List<RGB> GenerateRGBValues(int numberOfColors) + { + List<RGB> colors = new List<RGB>(); + int colorRange = (int)Math.Ceiling(Math.Pow(numberOfColors, 1.0 / 3.0)); + + for (int r = 0; r < colorRange; r++) + { + for (int g = 0; g < colorRange; g++) + { + for (int b = 0; b < colorRange; b++) + { + int red = (int)(r * 255.0 / (colorRange - 1)); + int green = (int)(g * 255.0 / (colorRange - 1)); + int blue = (int)(b * 255.0 / (colorRange - 1)); + + colors.Add(new RGB(red, green, blue)); + + if (colors.Count >= numberOfColors) + { + return colors; + } + } + } + } + + return colors; + } + } +} diff --git a/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..150cfb8d4 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.ColorMeasurementsGenerator")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.ColorMeasurementsGenerator")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("04fca0ba-a64b-4c6a-a011-a94ce335d616")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/Tango.ColorMeasurementsGenerator.csproj b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/Tango.ColorMeasurementsGenerator.csproj new file mode 100644 index 000000000..89062149c --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/Tango.ColorMeasurementsGenerator.csproj @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{04FCA0BA-A64B-4C6A-A011-A94CE335D616}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>Tango.ColorMeasurementsGenerator</RootNamespace> + <AssemblyName>Tango.ColorMeasurementsGenerator</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <Deterministic>true</Deterministic> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\SideChains\ColorMine\ColorMine.csproj"> + <Project>{37e4ceab-b54b-451f-b535-04cf7da9c459}</Project> + <Name>ColorMine</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.ColorConversion\Tango.ColorConversion.csproj"> + <Project>{b4fe6485-4161-4b36-bc08-67e0b53d01b7}</Project> + <Name>Tango.ColorConversion</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.CSV\Tango.CSV.csproj"> + <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project> + <Name>Tango.CSV</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/packages.config b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/packages.config new file mode 100644 index 000000000..b3daf0d6c --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ColorMeasurementsGenerator/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> +</packages>
\ No newline at end of file |
