Browse Source

A lot of small edits, and new proj name everywhere!

master
Nikita Romanenko 6 years ago
parent
commit
446ca8ec2f
  1. 25
      Pores.sln
  2. 4
      Pores/Controllers/ConnectedPoreReportGenerator.cs
  3. 2
      Pores/Controllers/ReportGenerator.cs
  4. 15
      Pores/Converters/CubicPowerOfInt.cs
  5. 5
      Pores/MODELING-DEF-DES-MI-VI.csproj
  6. 23
      Pores/MainWindow.xaml
  7. 15
      Pores/MainWindowViewModel.cs

25
Pores.sln

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pores", "Pores\Pores.csproj", "{12EAD304-2155-4F18-8373-3EEA60798B8D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{12EAD304-2155-4F18-8373-3EEA60798B8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12EAD304-2155-4F18-8373-3EEA60798B8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12EAD304-2155-4F18-8373-3EEA60798B8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12EAD304-2155-4F18-8373-3EEA60798B8D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {740ACE1D-F83D-4181-9888-B3EA705A5E70}
EndGlobalSection
EndGlobal

4
Pores/Controllers/ConnectedPoreReportGenerator.cs

@ -25,7 +25,9 @@ namespace MODELING_DEF_DES_MI_VI.Controllers
if (!report.Any(a => a.Item1.Id == p2.Id && a.Item2.Id == p1.Id)) if (!report.Any(a => a.Item1.Id == p2.Id && a.Item2.Id == p1.Id))
if (IsTwoPoresConnecting(p1, p2)) if (IsTwoPoresConnecting(p1, p2))
report.Add(Tuple.Create(p1, p2)); report.Add(Tuple.Create(p1, p2));
ReportGenerator.Save(report, ReportGenerator.AddOther("report_connected_pores_" + index));
var s = string.Format("report_connected_pores_{0}_n{1}", index, report.Count);
ReportGenerator.Save(report, ReportGenerator.AddTime(s));
} }
public double DistanceBetweenTwoPoints(Point3D point1, Point3D point2) public double DistanceBetweenTwoPoints(Point3D point1, Point3D point2)

2
Pores/Controllers/ReportGenerator.cs

@ -12,7 +12,7 @@ namespace MODELING_DEF_DES_MI_VI.Controllers
{ {
public class ReportGenerator : BaseSaveLoadController public class ReportGenerator : BaseSaveLoadController
{ {
public string AddOther(string fileName) public string AddTime(string fileName)
{ {
return return
".\\results\\" ".\\results\\"

15
Pores/Converters/CubicPowerOfInt.cs

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace Pores.Converters
{
public class CubicPowerOfInt : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> Math.Pow((int)value, 3).ToString();
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}
}

5
Pores/MODELING-DEF-DES-MI-VI.csproj

@ -8,8 +8,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{12EAD304-2155-4F18-8373-3EEA60798B8D}</ProjectGuid> <ProjectGuid>{12EAD304-2155-4F18-8373-3EEA60798B8D}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>Pores</RootNamespace> <RootNamespace>MODELING_DEF_DES_MI_VI</RootNamespace>
<AssemblyName>Pores</AssemblyName> <AssemblyName>MODELING_DEF_DES_MI_VI</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@ -85,6 +85,7 @@
<Compile Include="Controllers\ConnectedPoreReportGenerator.cs" /> <Compile Include="Controllers\ConnectedPoreReportGenerator.cs" />
<Compile Include="Controllers\ReportGenerator.cs" /> <Compile Include="Controllers\ReportGenerator.cs" />
<Compile Include="Controllers\PoreGenerator.cs" /> <Compile Include="Controllers\PoreGenerator.cs" />
<Compile Include="Converters\CubicPowerOfInt.cs" />
<Compile Include="Helpers\PropertyChanged.cs" /> <Compile Include="Helpers\PropertyChanged.cs" />
<Compile Include="Helpers\RelayCommand.cs" /> <Compile Include="Helpers\RelayCommand.cs" />
<Compile Include="Interfaces\IPoreGenerator.cs" /> <Compile Include="Interfaces\IPoreGenerator.cs" />

23
Pores/MainWindow.xaml

@ -4,11 +4,15 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:spreads="clr-namespace:MODELING_DEF_DES_MI_VI.Models.Spreads" xmlns:spreads="clr-namespace:MODELING_DEF_DES_MI_VI.Models.Spreads"
xmlns:converters="clr-namespace:Pores.Converters"
mc:Ignorable="d" mc:Ignorable="d"
Title="Pores" Height="600" Width="1000"> Title="MODELING-DEF-DES-MI-VI" Height="600" Width="1000">
<Window.Resources>
<converters:CubicPowerOfInt x:Key="CubicPowerOfInt"/>
</Window.Resources>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/> <ColumnDefinition Width="0"/>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
@ -34,8 +38,15 @@
<TextBox Text="{Binding CurrentMaterial.Depth}"/> <TextBox Text="{Binding CurrentMaterial.Depth}"/>
<TextBlock Text="Высота: "/> <TextBlock Text="Высота: "/>
<TextBox Text="{Binding CurrentMaterial.Height}"/> <TextBox Text="{Binding CurrentMaterial.Height}"/>
<TextBlock Text="Разрешение модели (n^3): " TextWrapping="Wrap"/> <ContentControl>
<TextBox Text="{Binding CurrentMaterial.NumberOfPores}"/> <StackPanel Orientation="Horizontal">
<TextBlock Text="Разрешение модели (n="/>
<TextBlock Text="{Binding CurrentMaterial.NumberOfPores,
Converter={StaticResource CubicPowerOfInt}, Mode=OneWay}"/>
<TextBlock Text="):"/>
</StackPanel>
</ContentControl>
<TextBox Text="{Binding CurrentMaterial.NumberOfPores, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="Параметры модели распределения:"/> <TextBlock Text="Параметры модели распределения:"/>
<ComboBox ItemsSource="{Binding Spreads}" SelectedItem="{Binding SelectedSpread}" HorizontalAlignment="Left" Width="198"></ComboBox> <ComboBox ItemsSource="{Binding Spreads}" SelectedItem="{Binding SelectedSpread}" HorizontalAlignment="Left" Width="198"></ComboBox>
<ContentControl Content="{Binding SelectedSpread}"> <ContentControl Content="{Binding SelectedSpread}">
@ -89,9 +100,9 @@
<TextBox Text="{Binding BatchPoint.Center.X}"/> <TextBox Text="{Binding BatchPoint.Center.X}"/>
<TextBlock Text="Координаты центра (Y): "/> <TextBlock Text="Координаты центра (Y): "/>
<TextBox Text="{Binding BatchPoint.Center.Y}"/> <TextBox Text="{Binding BatchPoint.Center.Y}"/>
<TextBlock Text="Координаты центра (Z): "/> <TextBlock Text="Координаты центра (Z-высота): "/>
<TextBox Text="{Binding BatchPoint.Center.Z}"/> <TextBox Text="{Binding BatchPoint.Center.Z}"/>
<TextBlock Text="Ширина: "/> <TextBlock Text="Длина и ширина основания: "/>
<TextBox Text="{Binding BatchPoint.Width}"/> <TextBox Text="{Binding BatchPoint.Width}"/>
<TextBlock Text="Глубина:"/> <TextBlock Text="Глубина:"/>
<TextBox Text="{Binding BatchPoint.Depth}"/> <TextBox Text="{Binding BatchPoint.Depth}"/>

15
Pores/MainWindowViewModel.cs

@ -8,6 +8,8 @@ using System.Threading;
using System.IO; using System.IO;
using System.Diagnostics; using System.Diagnostics;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Windows;
using System.Linq;
namespace MODELING_DEF_DES_MI_VI namespace MODELING_DEF_DES_MI_VI
{ {
@ -83,7 +85,7 @@ namespace MODELING_DEF_DES_MI_VI
public void Save() public void Save()
=> Save(Pores); => Save(Pores);
public void Save(IList<Pore> pores, int i = 0) public void Save(IList<Pore> pores, int i = -1)
{ {
var n = string.Format( var n = string.Format(
"model_{0}_w{1}_d{2}_h{3}_n{4}", "model_{0}_w{1}_d{2}_h{3}_n{4}",
@ -93,7 +95,8 @@ namespace MODELING_DEF_DES_MI_VI
CurrentMaterial.Height, CurrentMaterial.Height,
pores.Count); pores.Count);
ReportSaver.Save(pores, ReportSaver.AddOther(n)); ReportSaver.Save(pores, ReportSaver.AddTime(n));
if (i == -1) OperationCompletedMessage();
} }
public void SaveBatch() public void SaveBatch()
@ -102,8 +105,8 @@ namespace MODELING_DEF_DES_MI_VI
public IEnumerable<Pore> SaveBatch(IEnumerable<Pore> pores, int i = -1) public IEnumerable<Pore> SaveBatch(IEnumerable<Pore> pores, int i = -1)
{ {
var batch = BatchGenerator.GenerateBatch(BatchPoint, pores); var batch = BatchGenerator.GenerateBatch(BatchPoint, pores);
if (i != -1) var s = string.Format("batch_{0}_n{1}", i, batch.ToList().Count);
ReportSaver.Save(batch, ReportSaver.AddOther(string.Format("batch_{0}", i))); ReportSaver.Save(batch, ReportSaver.AddTime(s));
return batch; return batch;
} }
@ -121,8 +124,12 @@ namespace MODELING_DEF_DES_MI_VI
ConnectedPoreReportGenerator.CreateReport(list2, i); ConnectedPoreReportGenerator.CreateReport(list2, i);
} }
DisableGenerateAllFlag = false; DisableGenerateAllFlag = false;
OperationCompletedMessage();
}); });
AllSavingThread.Start(); AllSavingThread.Start();
} }
private void OperationCompletedMessage()
=> MessageBox.Show("Операция завершена!", "Сообщение");
} }
} }

Loading…
Cancel
Save