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 (IsTwoPoresConnecting(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)

2
Pores/Controllers/ReportGenerator.cs

@ -12,7 +12,7 @@ namespace MODELING_DEF_DES_MI_VI.Controllers
{
public class ReportGenerator : BaseSaveLoadController
{
public string AddOther(string fileName)
public string AddTime(string fileName)
{
return
".\\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>
<ProjectGuid>{12EAD304-2155-4F18-8373-3EEA60798B8D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Pores</RootNamespace>
<AssemblyName>Pores</AssemblyName>
<RootNamespace>MODELING_DEF_DES_MI_VI</RootNamespace>
<AssemblyName>MODELING_DEF_DES_MI_VI</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@ -85,6 +85,7 @@
<Compile Include="Controllers\ConnectedPoreReportGenerator.cs" />
<Compile Include="Controllers\ReportGenerator.cs" />
<Compile Include="Controllers\PoreGenerator.cs" />
<Compile Include="Converters\CubicPowerOfInt.cs" />
<Compile Include="Helpers\PropertyChanged.cs" />
<Compile Include="Helpers\RelayCommand.cs" />
<Compile Include="Interfaces\IPoreGenerator.cs" />

23
Pores/MainWindow.xaml

@ -4,11 +4,15 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:spreads="clr-namespace:MODELING_DEF_DES_MI_VI.Models.Spreads"
xmlns:converters="clr-namespace:Pores.Converters"
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.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="0"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
@ -34,8 +38,15 @@
<TextBox Text="{Binding CurrentMaterial.Depth}"/>
<TextBlock Text="Высота: "/>
<TextBox Text="{Binding CurrentMaterial.Height}"/>
<TextBlock Text="Разрешение модели (n^3): " TextWrapping="Wrap"/>
<TextBox Text="{Binding CurrentMaterial.NumberOfPores}"/>
<ContentControl>
<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="Параметры модели распределения:"/>
<ComboBox ItemsSource="{Binding Spreads}" SelectedItem="{Binding SelectedSpread}" HorizontalAlignment="Left" Width="198"></ComboBox>
<ContentControl Content="{Binding SelectedSpread}">
@ -89,9 +100,9 @@
<TextBox Text="{Binding BatchPoint.Center.X}"/>
<TextBlock Text="Координаты центра (Y): "/>
<TextBox Text="{Binding BatchPoint.Center.Y}"/>
<TextBlock Text="Координаты центра (Z): "/>
<TextBlock Text="Координаты центра (Z-высота): "/>
<TextBox Text="{Binding BatchPoint.Center.Z}"/>
<TextBlock Text="Ширина: "/>
<TextBlock Text="Длина и ширина основания: "/>
<TextBox Text="{Binding BatchPoint.Width}"/>
<TextBlock Text="Глубина:"/>
<TextBox Text="{Binding BatchPoint.Depth}"/>

15
Pores/MainWindowViewModel.cs

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

Loading…
Cancel
Save