diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-03-05 09:12:59 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-03-05 09:12:59 +0200 |
| commit | 8e2cbf02b6c819e92ee4eec2a673586438edfa93 (patch) | |
| tree | c12fd2c91c5abb4cae725ac39792c69b25118faa /Software | |
| parent | 2b8e41b5279c2d3ab370595f6593b64ea734ef87 (diff) | |
| download | Tango-8e2cbf02b6c819e92ee4eec2a673586438edfa93.tar.gz Tango-8e2cbf02b6c819e92ee4eec2a673586438edfa93.zip | |
Some work on embroidery import/export.
Diffstat (limited to 'Software')
13 files changed, 49 insertions, 12 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex fa3574dc5..ce28c30c9 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 553558665..db9c7db73 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs index 9d7475aea..1ed1e5b18 100644 --- a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs @@ -215,6 +215,7 @@ namespace Tango.EmbroideryUI { path.PathFigure.Segments.Add(new LineSegment(new Point(_currentPoint.X, _currentPoint.Y), true)); path.Length += Math.Abs(GetDistance(_lastStitch.XX, _lastStitch.YY, stitch.XX, stitch.YY)); + path.StitchCount++; } _mode = StitchFlag.Normal; break; diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs index 385266228..5999845bf 100644 --- a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs @@ -37,7 +37,13 @@ namespace Tango.EmbroideryUI public static readonly DependencyProperty PathFigureProperty = DependencyProperty.Register("PathFigure", typeof(PathFigure), typeof(EmbroideryPath), new PropertyMetadata(null)); - + public int StitchCount + { + get { return (int)GetValue(StitchCountProperty); } + set { SetValue(StitchCountProperty, value); } + } + public static readonly DependencyProperty StitchCountProperty = + DependencyProperty.Register("StitchCount", typeof(int), typeof(EmbroideryPath), new PropertyMetadata(0)); private void OnBrushChanged() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/seamless-grid.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/seamless-grid.jpg Binary files differnew file mode 100644 index 000000000..59bb9c370 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/seamless-grid.jpg diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 378fb443b..0e64872f7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -353,5 +353,8 @@ <ItemGroup> <EmbeddedResource Include="bip.wav" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\seamless-grid.jpg" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs index a0f4314dc..530893535 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/EmbroideryImportViewVM.cs @@ -27,8 +27,17 @@ namespace Tango.MachineStudio.Developer.ViewModels public ObservableCollection<EmbroideryPath> Paths { get; set; } + private int _stitchLength; + + public int StitchLength + { + get { return _stitchLength; } + set { _stitchLength = value; RaisePropertyChangedAuto(); } + } + public EmbroideryImportViewVM() : base() { + StitchLength = 6; ImportCommand = new RelayCommand(Import); } 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 76fe33a87..aef928486 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 @@ -1639,7 +1639,7 @@ namespace Tango.MachineStudio.Developer.ViewModels if (jobName != null) { - AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.EmbroideryFile, dlg.FileName, view.EmbroideryImageBytes); + AddJobFromEmbroideryFile(jobName, vm.Paths.ToList(), vm.StitchLength, vm.EmbroideryFile, dlg.FileName, view.EmbroideryImageBytes); } }, () => @@ -1649,7 +1649,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } } - private async void AddJobFromEmbroideryFile(String jobName, List<EmbroideryPath> paths, EmbroideryFile embroideryFile, String fileName, byte[] imageBytes) + private async void AddJobFromEmbroideryFile(String jobName, List<EmbroideryPath> paths, int stitchLength, EmbroideryFile embroideryFile, String fileName, byte[] imageBytes) { LogManager.Log(String.Format("Adding new job from embroidery file {0}...", jobName)); @@ -1671,7 +1671,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var path in paths.Skip(1)) { Segment segment = new Segment(); - segment.Length = path.Length / 1000d; + segment.Length = ((double)path.StitchCount * (double)stitchLength) / 1000d; segment.Name = "Embroidery Segment"; segment.SegmentIndex = paths.IndexOf(path) + 2; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml index a753453f9..22414b4b2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml @@ -9,7 +9,7 @@ xmlns:converters="clr-namespace:Tango.MachineStudio.Developer.Converters" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" mc:Ignorable="d" - Width="600" Height="350" Background="White" d:DataContext="{d:DesignInstance Type=vm:EmbroideryDisplayViewVM, IsDesignTimeCreatable=False}"> + Width="1280" Height="720" Background="White" d:DataContext="{d:DesignInstance Type=vm:EmbroideryDisplayViewVM, IsDesignTimeCreatable=False}"> <UserControl.Resources> <converters:ByteArrayToBitmapSourceConverter x:Key="ByteArrayToBitmapSourceConverter" /> @@ -33,12 +33,18 @@ </Grid> <Grid Grid.Row="1"> + <Grid.Background> + <ImageBrush ImageSource="../Images/seamless-grid.jpg" Stretch="None" Opacity="0.5" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,32,32"></ImageBrush> + </Grid.Background> + <Rectangle HorizontalAlignment="Left" Stroke="Silver"></Rectangle> + <Rectangle HorizontalAlignment="Right" Stroke="Silver"></Rectangle> <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="{Binding Job.EmbroideryJpeg,Converter={StaticResource ByteArrayToBitmapSourceConverter}}"></Image> </Grid> <Grid Grid.Row="2"> + <Rectangle VerticalAlignment="Top" Stroke="Silver"></Rectangle> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> - <Button Height="40" Command="{Binding ExportCommand}"> + <Button Height="50" Command="{Binding ExportCommand}" Width="180"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="Export" Width="24" Height="24" /> <TextBlock Margin="5 0 0 0" FontSize="16">EXPORT</TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml index d084aabcf..17a5a5b8c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml @@ -6,6 +6,7 @@ xmlns:emb="clr-namespace:Tango.EmbroideryUI;assembly=Tango.EmbroideryUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" + xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:brushPicker="clr-namespace:Tango.BrushPicker;assembly=Tango.BrushPicker" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" mc:Ignorable="d" @@ -33,19 +34,30 @@ <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle> </Grid> - <Grid Grid.Row="1"> - <emb:EmbroideryFileEditor x:Name="editor" Background="White" FileName="{Binding FileName}" EmbroideryFile="{Binding EmbroideryFile,Mode=OneWayToSource}" Paths="{Binding Paths,Mode=OneWayToSource}" /> + <Grid Grid.Row="1" x:Name="gridEditor"> + <Grid.Background> + <ImageBrush ImageSource="../Images/seamless-grid.jpg" Stretch="None" Opacity="0.5" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,32,32"></ImageBrush> + </Grid.Background> + <Rectangle HorizontalAlignment="Left" Stroke="Silver"></Rectangle> + <emb:EmbroideryFileEditor x:Name="editor" Background="Transparent" FileName="{Binding FileName}" EmbroideryFile="{Binding EmbroideryFile,Mode=OneWayToSource}" Paths="{Binding Paths,Mode=OneWayToSource}" /> </Grid> <Grid Grid.Column="1" Grid.Row="1"> <StackPanel> <TextBlock Margin="5">Region Brush</TextBlock> <brushPicker:BrushPicker Margin="0 10 0 0" Background="White" BorderThickness="0" Brush="{Binding ElementName=editor,Path=SelectedPath.Brush,Mode=TwoWay}" /> + + <TextBlock Text="Stitch Length" Margin="5"></TextBlock> + <mahApps:NumericUpDown Margin="5" Minimum="1" Maximum="20" StringFormat="# mm" Value="{Binding StitchLength}" HasDecimals="False" HorizontalContentAlignment="Center" /> </StackPanel> <Rectangle HorizontalAlignment="Left" Stroke="Silver" /> </Grid> + <Grid Grid.Row="2" Grid.ColumnSpan="2"> + <Rectangle VerticalAlignment="Top" Stroke="Silver"></Rectangle> + </Grid> + <Grid Grid.Row="2" Grid.Column="1"> <Button Height="50" Click="OnImportClick" Command="{Binding ImportCommand}"> <StackPanel Orientation="Horizontal"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs index ce481a87b..0b368a809 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs @@ -30,7 +30,7 @@ namespace Tango.MachineStudio.Developer.Views private void OnImportClick(object sender, RoutedEventArgs e) { - var source = UIHelper.TakeSnapshot(editor); + var source = UIHelper.TakeSnapshot(gridEditor); EmbroideryImageBytes = source.ToJpegBytes(50); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml index ebacd122c..a8274a4f7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -14,7 +14,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" mc:Ignorable="d" - d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + x:Name="control" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> <UserControl.Resources> <localConverters:SegmentToBrushConverterMulti x:Key="SegmentToBrushConverterMulti" /> @@ -144,7 +144,7 @@ <DataTrigger Binding="{Binding HasEmbroideryFile}" Value="True"> <Setter Property="Content"> <Setter.Value> - <Button ToolTip="Press to display the embroidery file information." Style="{StaticResource emptyButton}" Cursor="Hand" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DisplayJobEmbroideryFileCommand}" CommandParameter="{Binding}"> + <Button ToolTip="Press to display the attached embroidery file information" Style="{StaticResource emptyButton}" Cursor="Hand" Command="{Binding DataContext.DisplayJobEmbroideryFileCommand, Source={x:Reference control}}" CommandParameter="{Binding}"> <Image Source="../Images/job-emb.png" Width="40" Margin="5"></Image> </Button> </Setter.Value> diff --git a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs index 8e898ac18..770931309 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs @@ -158,7 +158,7 @@ namespace Tango.BL foreach (var machine in Machines) { machine.MachinesConfigurations = machine.MachinesConfigurations.OrderByDescending(x => x.Configuration.CreationDate).Take(30).ToObservableCollection(); - machine.Jobs = machine.Jobs.OrderByDescending(x => x.CreationDate).ToObservableCollection(); + //machine.Jobs = machine.Jobs.OrderByDescending(x => x.CreationDate).ToObservableCollection(); //No need to load jobs. } MachinesConfigurations = Context.MachinesConfigurations.ToObservableCollection(); |
