From 3b7c0783d71327c834cf957efd221a93f076c237 Mon Sep 17 00:00:00 2001 From: Nikita Romanenko Date: Fri, 14 Dec 2018 09:47:51 +0300 Subject: [PATCH] Added a lot of small edits, as visual and as feature sides. --- Pores/Bootstrap.cs | 6 +- Pores/Controllers/BatchGenerator.cs | 12 ++-- .../ConnectedPoreReportGenerator.cs | 4 +- Pores/Controllers/PoreGenerator.cs | 4 +- Pores/Interfaces/IPoreSpread.cs | 1 + Pores/MainWindow.xaml | 34 +++++----- Pores/MainWindowViewModel.cs | 68 ++++++++++--------- Pores/Models/Material.cs | 5 +- Pores/Models/Spreads/BaseSpread.cs | 1 + Pores/Models/Spreads/NormalSpread.cs | 50 +++++++++----- 10 files changed, 105 insertions(+), 80 deletions(-) diff --git a/Pores/Bootstrap.cs b/Pores/Bootstrap.cs index 1b9f811..292f264 100644 --- a/Pores/Bootstrap.cs +++ b/Pores/Bootstrap.cs @@ -19,12 +19,12 @@ namespace Pores ContainerBuilder build = new ContainerBuilder(); build - .Register(c => new Material()) - .As() + .Register(c => new MaterialModel()) + .As() .SingleInstance(); build - .Register(c => new ObservableCollection() { new NormalSpread(c.Resolve()) }) + .Register(c => new ObservableCollection() { new NormalSpread(c.Resolve()) }) .As>() .SingleInstance(); diff --git a/Pores/Controllers/BatchGenerator.cs b/Pores/Controllers/BatchGenerator.cs index e31e44b..2ba4b8e 100644 --- a/Pores/Controllers/BatchGenerator.cs +++ b/Pores/Controllers/BatchGenerator.cs @@ -10,16 +10,14 @@ namespace Pores.Controllers { public class BatchGenerator { - public ReportGenerator BatchSaver { get; set; } - public Material Material { get; set; } + public MaterialModel Material { get; set; } - public BatchGenerator(Material material, ReportGenerator batchSaver) + public BatchGenerator(MaterialModel material, ReportGenerator batchSaver) { Material = material; - BatchSaver = batchSaver; } - public void GenerateBatch(BatchPoint bp, IList pores, int index = 0) + public IEnumerable GenerateBatch(BatchPoint bp, IEnumerable pores) { var p1 = new Point3D() { @@ -33,9 +31,7 @@ namespace Pores.Controllers Y = bp.Center.Y + bp.Width / 2, Z = bp.Center.Z }; - BatchSaver.Save( - pores.Where(p => IsPointInsideOfCube(p.Point, p1, p2)), - BatchSaver.AddOther(string.Format("batch_{0}", index))); + return pores.Where(p => IsPointInsideOfCube(p.Point, p1, p2)).ToList(); } public bool IsPointInsideOfCube(Point3D p, Point3D vertex1, Point3D vertex2) diff --git a/Pores/Controllers/ConnectedPoreReportGenerator.cs b/Pores/Controllers/ConnectedPoreReportGenerator.cs index 388a96d..5d78e50 100644 --- a/Pores/Controllers/ConnectedPoreReportGenerator.cs +++ b/Pores/Controllers/ConnectedPoreReportGenerator.cs @@ -7,10 +7,10 @@ namespace Pores.Controllers { public class ConnectedPoreReportGenerator { - public Material Material { get; } + public MaterialModel Material { get; } public ReportGenerator ReportGenerator { get; } - public ConnectedPoreReportGenerator(Material material, ReportGenerator reportGenerator) + public ConnectedPoreReportGenerator(MaterialModel material, ReportGenerator reportGenerator) { Material = material; ReportGenerator = reportGenerator; diff --git a/Pores/Controllers/PoreGenerator.cs b/Pores/Controllers/PoreGenerator.cs index 02eddfd..020118a 100644 --- a/Pores/Controllers/PoreGenerator.cs +++ b/Pores/Controllers/PoreGenerator.cs @@ -8,9 +8,9 @@ namespace Pores.Controllers public class PoreGenerator : PropertyChangedClass, IPoreGenerator { public IPoreSpread PoresLocalization { get; set; } - public Material CurrentMaterial { get; set; } + public MaterialModel CurrentMaterial { get; set; } - public PoreGenerator(Material currentMaterial) + public PoreGenerator(MaterialModel currentMaterial) { CurrentMaterial = currentMaterial; } diff --git a/Pores/Interfaces/IPoreSpread.cs b/Pores/Interfaces/IPoreSpread.cs index 807748f..839a888 100644 --- a/Pores/Interfaces/IPoreSpread.cs +++ b/Pores/Interfaces/IPoreSpread.cs @@ -6,5 +6,6 @@ namespace Pores.Interfaces public interface IPoreSpread { ObservableCollection GetSpread(); + void LoadRecommendParams(); } } diff --git a/Pores/MainWindow.xaml b/Pores/MainWindow.xaml index 5dd160e..56a60e5 100644 --- a/Pores/MainWindow.xaml +++ b/Pores/MainWindow.xaml @@ -6,7 +6,7 @@ xmlns:spreads="clr-namespace:Pores.Models.Spreads" mc:Ignorable="d" Title="Pores" Height="600" Width="1000"> - + @@ -24,7 +24,6 @@ - @@ -44,16 +43,22 @@ - + - + + + + + + +