Material diagram viewer was added
This commit is contained in:
Binary file not shown.
@@ -1,59 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using StructureHelper.Infrastructure;
|
|
||||||
using StructureHelper.Models.Materials;
|
|
||||||
|
|
||||||
namespace StructureHelper.MaterialCatalogWindow
|
|
||||||
{
|
|
||||||
public class MaterialCatalogModel
|
|
||||||
{
|
|
||||||
public NamedList<MaterialDefinitionBase> ConcreteDefinitions;
|
|
||||||
public NamedList<MaterialDefinitionBase> RebarDefinitions;
|
|
||||||
|
|
||||||
public List<NamedList<MaterialDefinitionBase>> Materials;
|
|
||||||
|
|
||||||
public MaterialCatalogModel()
|
|
||||||
{
|
|
||||||
InitializeMaterialCollections();
|
|
||||||
Materials = new List<NamedList<MaterialDefinitionBase>>();
|
|
||||||
Materials.Add(ConcreteDefinitions);
|
|
||||||
Materials.Add(RebarDefinitions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InitializeMaterialCollections()
|
|
||||||
{
|
|
||||||
InitializeConcreteDefinitions();
|
|
||||||
InitializeRebarDefinitions();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeRebarDefinitions()
|
|
||||||
{
|
|
||||||
RebarDefinitions = new NamedList<MaterialDefinitionBase>
|
|
||||||
{
|
|
||||||
new RebarDefinition("S240", 2, 240, 240, 1.15, 1.15),
|
|
||||||
new RebarDefinition("S400", 2, 400, 400, 1.15, 1.15),
|
|
||||||
new RebarDefinition("S500", 2, 500, 500, 1.15, 1.15)
|
|
||||||
};
|
|
||||||
RebarDefinitions.Name = "Арматура";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeConcreteDefinitions()
|
|
||||||
{
|
|
||||||
ConcreteDefinitions = new NamedList<MaterialDefinitionBase>
|
|
||||||
{
|
|
||||||
new ConcreteDefinition("C10", 0, 10, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C15", 0, 15, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C20", 0, 20, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C25", 0, 25, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C30", 0, 30, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C35", 0, 35, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C40", 0, 40, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C45", 0, 45, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C50", 0, 50, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C60", 0, 60, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C70", 0, 70, 0, 1.3, 1.5),
|
|
||||||
new ConcreteDefinition("C80", 0, 80, 0, 1.3, 1.5)
|
|
||||||
};
|
|
||||||
ConcreteDefinitions.Name = "Бетон";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
<Window x:Class="StructureHelper.MaterialCatalogWindow.MaterialCatalogView"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:local="clr-namespace:StructureHelper"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DataContext="{d:DesignInstance local:MaterialCatalogViewModel}"
|
|
||||||
Title="Справочник материалов" Height="900" Width="1100">
|
|
||||||
<Window.Resources>
|
|
||||||
<DataTemplate x:Key="RebarYoungModulusTemplate">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" Text="{Binding YoungModulus}"/>
|
|
||||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text=" x 10^11"/>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
<DataTemplate x:Key="CompressiveStrengthTemplate">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" Text="{Binding CompressiveStrength}"/>
|
|
||||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text=" x 10^6"/>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
<DataTemplate x:Key="TensileStrengthTemplate">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" Text="{Binding TensileStrength}"/>
|
|
||||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text=" x 10^6"/>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
<DataTemplate x:Key="MaterialClassTemplate">
|
|
||||||
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" Text="{Binding MaterialClass}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
<DataTemplate x:Key="MaterialCoefInCompressTemplate">
|
|
||||||
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" Text="{Binding MaterialCoefInCompress}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
<DataTemplate x:Key="MaterialCoefInTensionTemplate">
|
|
||||||
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" Text="{Binding MaterialCoefInTension}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</Window.Resources>
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<StackPanel Grid.Row="0" Margin="10">
|
|
||||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10,20,10,10" Text="Бетон" FontSize="16"/>
|
|
||||||
<DataGrid ItemsSource="{Binding ConcreteDefinitions}" AutoGenerateColumns="False" SelectedItem="{Binding SelectedMaterial}">
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridTemplateColumn Header="Класс" CellTemplate="{StaticResource MaterialClassTemplate}"/>
|
|
||||||
<DataGridTextColumn Header="Модуль упругости" Binding="{Binding YoungModulus, StringFormat={}{0} x 10^6}" IsReadOnly="True"/>
|
|
||||||
<DataGridTemplateColumn Header="Нормативная прочность на сжатие" CellTemplate="{StaticResource CompressiveStrengthTemplate}"/>
|
|
||||||
<DataGridTextColumn Header="Нормативная прочность на растяжение" Binding="{Binding TensileStrength, StringFormat={}{0} x 10^3}" IsReadOnly="True"/>
|
|
||||||
<DataGridTemplateColumn Header="Коэффициент надежности при сжатии" CellTemplate="{StaticResource MaterialCoefInCompressTemplate}"/>
|
|
||||||
<DataGridTemplateColumn Header="Коэффициент надежности при растяжении" CellTemplate="{StaticResource MaterialCoefInTensionTemplate}"/>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10,20,10,10" Text="Арматура" FontSize="16"/>
|
|
||||||
<DataGrid ItemsSource="{Binding RebarDefinitions}" AutoGenerateColumns="False" SelectedItem="{Binding SelectedMaterial}">
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridTemplateColumn Header="Класс" CellTemplate="{StaticResource MaterialClassTemplate}"/>
|
|
||||||
<DataGridTemplateColumn Header="Модуль упругости" CellTemplate="{StaticResource RebarYoungModulusTemplate}"/>
|
|
||||||
<DataGridTemplateColumn Header="Нормативная прочность на сжатие" CellTemplate="{StaticResource CompressiveStrengthTemplate}"/>
|
|
||||||
<DataGridTemplateColumn Header="Нормативная прочность на растяжение" CellTemplate="{StaticResource TensileStrengthTemplate}"/>
|
|
||||||
<DataGridTemplateColumn Header="Коэффициент надежности при сжатии" CellTemplate="{StaticResource MaterialCoefInCompressTemplate}"/>
|
|
||||||
<DataGridTemplateColumn Header="Коэффициент надежности при растяжении" CellTemplate="{StaticResource MaterialCoefInTensionTemplate}"/>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
</StackPanel>
|
|
||||||
<Grid Grid.Row="1">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="300"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="300"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Button Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Content="Добавить материал" Margin="10" Command="{Binding AddMaterial}"/>
|
|
||||||
<Button Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Выбрать материал" Margin="10" Command="{Binding SelectMaterial}" Visibility="{Binding SelectMaterialButtonVisibility}"/>
|
|
||||||
<Button Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Left" Content="Сохранить справочник" Margin="10" Command="{Binding SaveCatalog}"/>
|
|
||||||
<Button Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Загрузить справочник" Margin="10" Command="{Binding LoadCatalog}"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace StructureHelper.MaterialCatalogWindow
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Логика взаимодействия для MaterialCatalogView.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MaterialCatalogView : Window
|
|
||||||
{
|
|
||||||
public MaterialCatalogView(bool isMaterialCanBeSelected = false, PrimitiveBase primitive = null)
|
|
||||||
{
|
|
||||||
var materialCatalogModel = new MaterialCatalogModel();
|
|
||||||
var materialCatalogViewModel = new MaterialCatalogViewModel(materialCatalogModel, this, isMaterialCanBeSelected, primitive);
|
|
||||||
DataContext = materialCatalogViewModel;
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using StructureHelper.Infrastructure;
|
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
|
||||||
using StructureHelper.Models.Materials;
|
|
||||||
using StructureHelper.Properties;
|
|
||||||
using StructureHelper.Windows.AddMaterialWindow;
|
|
||||||
using OpenFileDialog = System.Windows.Forms.OpenFileDialog;
|
|
||||||
using SaveFileDialog = System.Windows.Forms.SaveFileDialog;
|
|
||||||
|
|
||||||
namespace StructureHelper.MaterialCatalogWindow
|
|
||||||
{
|
|
||||||
[JsonObject(MemberSerialization.OptIn)]
|
|
||||||
public class MaterialCatalogViewModel : INotifyPropertyChanged
|
|
||||||
{
|
|
||||||
private MaterialCatalogModel materialCatalogModel;
|
|
||||||
private MaterialCatalogView materialCatalogView;
|
|
||||||
|
|
||||||
[JsonProperty]
|
|
||||||
public ObservableCollection<MaterialDefinitionBase> ConcreteDefinitions { get; set; }
|
|
||||||
[JsonProperty]
|
|
||||||
public ObservableCollection<MaterialDefinitionBase> RebarDefinitions { get; set; }
|
|
||||||
public ICommand AddMaterial { get; }
|
|
||||||
public ICommand SaveCatalog { get; }
|
|
||||||
public ICommand LoadCatalog { get; }
|
|
||||||
public ICommand SelectMaterial { get; }
|
|
||||||
|
|
||||||
private MaterialDefinitionBase selectedMaterial;
|
|
||||||
public MaterialDefinitionBase SelectedMaterial
|
|
||||||
{
|
|
||||||
get => selectedMaterial;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
selectedMaterial = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool isMaterialCanBeSelected;
|
|
||||||
|
|
||||||
public bool IsMaterialCanBeSelected
|
|
||||||
{
|
|
||||||
get => isMaterialCanBeSelected;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
isMaterialCanBeSelected = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
OnPropertyChanged(nameof(SelectMaterialButtonVisibility));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Visibility SelectMaterialButtonVisibility => IsMaterialCanBeSelected ? Visibility.Visible : Visibility.Hidden;
|
|
||||||
public MaterialCatalogViewModel() { }
|
|
||||||
|
|
||||||
public MaterialCatalogViewModel(MaterialCatalogModel materialCatalogModel, MaterialCatalogView materialCatalogView, bool isMaterialCanBeSelected, PrimitiveBase primitive = null)
|
|
||||||
{
|
|
||||||
this.materialCatalogModel = materialCatalogModel;
|
|
||||||
this.materialCatalogView = materialCatalogView;
|
|
||||||
IsMaterialCanBeSelected = isMaterialCanBeSelected;
|
|
||||||
|
|
||||||
ConcreteDefinitions = new ObservableCollection<MaterialDefinitionBase>(materialCatalogModel.ConcreteDefinitions);
|
|
||||||
RebarDefinitions = new ObservableCollection<MaterialDefinitionBase>(materialCatalogModel.RebarDefinitions);
|
|
||||||
|
|
||||||
AddMaterial = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
AddMaterialView addMaterialView = new AddMaterialView(this.materialCatalogModel, this);
|
|
||||||
addMaterialView.ShowDialog();
|
|
||||||
OnPropertyChanged(nameof(ConcreteDefinitions));
|
|
||||||
OnPropertyChanged(nameof(RebarDefinitions));
|
|
||||||
});
|
|
||||||
SaveCatalog = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
string json = JsonConvert.SerializeObject(this, Formatting.Indented);
|
|
||||||
SaveFileDialog saveDialog = new SaveFileDialog();
|
|
||||||
saveDialog.InitialDirectory = @"C:\";
|
|
||||||
saveDialog.Filter = "json files (*.json)|*.json|All files(*.*)|*.*";
|
|
||||||
string path = null;
|
|
||||||
if (saveDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
path = saveDialog.FileName;
|
|
||||||
File.WriteAllText(path, json);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
LoadCatalog = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
||||||
openFileDialog.InitialDirectory = @"C:\";
|
|
||||||
openFileDialog.Filter = "json files (*.json)|*.json|All files(*.*)|*.*";
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
var path = openFileDialog.FileName;
|
|
||||||
var content = File.ReadAllText(path);
|
|
||||||
var vm = JsonConvert.DeserializeObject<MaterialCatalogViewModel>(content);
|
|
||||||
ConcreteDefinitions = vm.ConcreteDefinitions;
|
|
||||||
OnPropertyChanged(nameof(ConcreteDefinitions));
|
|
||||||
RebarDefinitions = vm.RebarDefinitions;
|
|
||||||
OnPropertyChanged(nameof(RebarDefinitions));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
|
||||||
|
|
||||||
[NotifyPropertyChangedInvocator]
|
|
||||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
|
||||||
{
|
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +1,11 @@
|
|||||||
using FieldVisualizer.Entities.Values.Primitives;
|
using FieldVisualizer.Entities.Values.Primitives;
|
||||||
using LoaderCalculator.Data.Materials;
|
|
||||||
using LoaderCalculator.Data.Matrix;
|
using LoaderCalculator.Data.Matrix;
|
||||||
using LoaderCalculator.Data.Ndms;
|
|
||||||
using LoaderCalculator.Logics;
|
|
||||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
|
||||||
using StructureHelperCommon.Infrastructures.Strings;
|
|
||||||
using StructureHelperCommon.Services.Units;
|
|
||||||
using StructureHelperLogics.Models.Materials;
|
|
||||||
using StructureHelperLogics.Models.Primitives;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.RC;
|
using StructureHelperLogics.NdmCalculations.Analyses.RC;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.Intrinsics.Arm;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelper.Services.ResultViewers
|
namespace StructureHelper.Services.ResultViewers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Autofac" Version="6.5.0" />
|
<PackageReference Include="Autofac" Version="6.5.0" />
|
||||||
|
<PackageReference Include="LiveCharts.Wpf" Version="0.9.7" />
|
||||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||||
<PackageReference Include="System.Windows.Interactivity.WPF" Version="2.0.20525" />
|
<PackageReference Include="System.Windows.Interactivity.WPF" Version="2.0.20525" />
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
<Compile Update="Windows\MainWindow\AboutView.xaml.cs">
|
<Compile Update="Windows\MainWindow\AboutView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\MainWindow\Materials\MaterialDiagramView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml.cs">
|
<Compile Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -35,6 +38,9 @@
|
|||||||
<Page Update="Windows\MainWindow\AboutView.xaml">
|
<Page Update="Windows\MainWindow\AboutView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Windows\MainWindow\Materials\MaterialDiagramView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml">
|
<Page Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
<Window x:Class="StructureHelper.Windows.AddMaterialWindow.AddMaterialView"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
|
|
||||||
xmlns:addMaterialWindow="clr-namespace:StructureHelper.Windows.AddMaterialWindow"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DataContext="{d:DesignInstance addMaterialWindow:AddMaterialViewModel}"
|
|
||||||
Title="Добавление материала" Height="350" Width="400">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
<RowDefinition Height="{Binding RowHeight}"/>
|
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
<RowDefinition Height="{Binding RowHeight}"/>
|
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
<RowDefinition Height="40"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="2.2*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Группа материалов"/>
|
|
||||||
<ComboBox Grid.Row="0" Grid.Column="1" Margin="10" ItemsSource="{Binding Materials}" DisplayMemberPath="Name" SelectedItem="{Binding MaterialCollection}"/>
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Класс"/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="10" Text="{Binding MaterialClass}"/>
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Модуль упругости" IsEnabled="{Binding IsNotConcrete}"/>
|
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="10" IsEnabled="{Binding IsNotConcrete}" Text="{Binding YoungModulus}"/>
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Нормативная прочность на сжатие"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="10" Text="{Binding CompressiveStrengthCoef}"/>
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Нормативная прочность на растяжение" IsEnabled="{Binding IsNotConcrete}"/>
|
|
||||||
<TextBox Grid.Row="4" Grid.Column="1" Margin="10" Text="{Binding TensileStrengthCoef}" IsEnabled="{Binding IsNotConcrete}"/>
|
|
||||||
<TextBlock Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Коэффициент надежности при сжатии"/>
|
|
||||||
<TextBox Grid.Row="5" Grid.Column="1" Margin="10" Text="{Binding MaterialCoefInCompress}"/>
|
|
||||||
<TextBlock Grid.Row="6" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Коэффициент надежности при расширении"/>
|
|
||||||
<TextBox Grid.Row="6" Grid.Column="1" Margin="10" Text="{Binding MaterialCoefInTension}"/>
|
|
||||||
</Grid>
|
|
||||||
<Button Grid.Row="1" Grid.Column="0" Margin="10" HorizontalAlignment="Left" Content="Добавить материал" Command="{Binding AddMaterial}"/>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using System.Windows;
|
|
||||||
using StructureHelper.MaterialCatalogWindow;
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.AddMaterialWindow
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Логика взаимодействия для AddMaterialView.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class AddMaterialView : Window
|
|
||||||
{
|
|
||||||
public AddMaterialView(MaterialCatalogModel model, MaterialCatalogViewModel materialCatalogViewModel)
|
|
||||||
{
|
|
||||||
var viewModel = new AddMaterialViewModel(model, this, materialCatalogViewModel);
|
|
||||||
DataContext = viewModel;
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using StructureHelper.Infrastructure;
|
|
||||||
using StructureHelper.MaterialCatalogWindow;
|
|
||||||
using StructureHelper.Models.Materials;
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.AddMaterialWindow
|
|
||||||
{
|
|
||||||
public class AddMaterialViewModel : ViewModelBase
|
|
||||||
{
|
|
||||||
private MaterialCatalogModel model;
|
|
||||||
private AddMaterialView view;
|
|
||||||
private MaterialCatalogViewModel materialCatalogViewModel;
|
|
||||||
public ObservableCollection<NamedList<MaterialDefinitionBase>> Materials { get; set; }
|
|
||||||
private NamedList<MaterialDefinitionBase> materialCollection;
|
|
||||||
public NamedList<MaterialDefinitionBase> MaterialCollection
|
|
||||||
{
|
|
||||||
get => materialCollection;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
OnPropertyChanged(value, ref materialCollection);
|
|
||||||
OnPropertyChanged(nameof(IsNotConcrete));
|
|
||||||
OnPropertyChanged(nameof(RowHeight));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public bool IsNotConcrete => MaterialCollection.Name != "Бетон";
|
|
||||||
|
|
||||||
private string materialClass;
|
|
||||||
private double youngModulus, compressiveStrengthCoef, tensileStrengthCoef, materialCoefInCompress, materialCoefInTension;
|
|
||||||
|
|
||||||
public string MaterialClass
|
|
||||||
{
|
|
||||||
get => materialClass;
|
|
||||||
set => OnPropertyChanged(value, ref materialClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double YoungModulus
|
|
||||||
{
|
|
||||||
get => youngModulus;
|
|
||||||
set => OnPropertyChanged(value, ref youngModulus);
|
|
||||||
}
|
|
||||||
public double CompressiveStrengthCoef
|
|
||||||
{
|
|
||||||
get => compressiveStrengthCoef;
|
|
||||||
set => OnPropertyChanged(value, ref compressiveStrengthCoef);
|
|
||||||
}
|
|
||||||
public double TensileStrengthCoef
|
|
||||||
{
|
|
||||||
get => tensileStrengthCoef;
|
|
||||||
set => OnPropertyChanged(value, ref tensileStrengthCoef);
|
|
||||||
}
|
|
||||||
public double MaterialCoefInCompress
|
|
||||||
{
|
|
||||||
get => materialCoefInCompress;
|
|
||||||
set => OnPropertyChanged(value, ref materialCoefInCompress);
|
|
||||||
}
|
|
||||||
public double MaterialCoefInTension
|
|
||||||
{
|
|
||||||
get => materialCoefInTension;
|
|
||||||
set => OnPropertyChanged(value, ref materialCoefInTension);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int RowHeight => IsNotConcrete ? 40 : 0;
|
|
||||||
public ICommand AddMaterial { get; }
|
|
||||||
public AddMaterialViewModel() { }
|
|
||||||
public AddMaterialViewModel(MaterialCatalogModel model, AddMaterialView view, MaterialCatalogViewModel materialCatalogViewModel)
|
|
||||||
{
|
|
||||||
this.model = model;
|
|
||||||
this.view = view;
|
|
||||||
this.materialCatalogViewModel = materialCatalogViewModel;
|
|
||||||
Materials = new ObservableCollection<NamedList<MaterialDefinitionBase>>(model.Materials);
|
|
||||||
MaterialCollection = Materials.First();
|
|
||||||
|
|
||||||
AddMaterial = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
if (MaterialCollection.Name == "Бетон")
|
|
||||||
this.materialCatalogViewModel.ConcreteDefinitions.Add(new ConcreteDefinition(MaterialClass, 0, CompressiveStrengthCoef, TensileStrengthCoef, MaterialCoefInCompress, MaterialCoefInTension));
|
|
||||||
if (MaterialCollection.Name == "Арматура")
|
|
||||||
this.materialCatalogViewModel.RebarDefinitions.Add(new RebarDefinition(MaterialClass, YoungModulus, CompressiveStrengthCoef, TensileStrengthCoef, MaterialCoefInCompress, MaterialCoefInTension));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow.CalculationPropertyView"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow"
|
|
||||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.CalculationProperies"
|
|
||||||
d:DataContext="{d:DesignInstance vm:CalculationPropertyViewModel}"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="Calculation Properties" Height="330" Width="400" MinHeight="330" MinWidth="400" WindowStartupLocation="CenterScreen" Closing="Window_Closing">
|
|
||||||
<Window.Resources>
|
|
||||||
<Style TargetType="TextBox" x:Key="ValidatedError">
|
|
||||||
<Style.Triggers>
|
|
||||||
<Trigger Property="Validation.HasError" Value="True">
|
|
||||||
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
|
|
||||||
</Trigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Window.Resources>
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition/>
|
|
||||||
<RowDefinition Height="10"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<TabControl>
|
|
||||||
<TabItem Header="Forces">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition/>
|
|
||||||
<RowDefinition Height="80"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<GroupBox Grid.Row="0" Header="Combinations of forces" Height="160">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="60"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<DataGrid x:Name="ForceGrid" AutoGenerateColumns="False" ItemsSource="{Binding Path=ForceCombinations}" SelectionChanged="ForceGrid_SelectionChanged"
|
|
||||||
SelectedItem="{Binding Path=SelectedCombination}">
|
|
||||||
<DataGrid.Columns>
|
|
||||||
<DataGridCheckBoxColumn Header="Active" Binding="{Binding Path=TakeInCalculate}"/>
|
|
||||||
<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding Path=ForceMatrix.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding Path=ForceMatrix.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
<DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding Path=ForceMatrix.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
|
||||||
</DataGrid.Columns>
|
|
||||||
</DataGrid>
|
|
||||||
<StackPanel Grid.Column="1">
|
|
||||||
<Button Margin="3" Content="Add" Command="{Binding Path=AddForceCombinationCommand}"/>
|
|
||||||
<Button Margin="3" Content="Remove" Command="{Binding Path=RemoveForceCombinationCommand}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</GroupBox>
|
|
||||||
<Grid Grid.Row="1" Height="80">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<GroupBox Header="Limit state">
|
|
||||||
<StackPanel>
|
|
||||||
<RadioButton x:Name="LsCollapse" Content="Limit state of collapse" Margin="5" IsChecked="True" GroupName="LimitState" Checked="LsCollapse_Checked"/>
|
|
||||||
<RadioButton x:Name="LsServiceability" Content="Limit state of serviceability" Margin="5" GroupName="LimitState" Checked="LsServiceability_Checked"/>
|
|
||||||
</StackPanel>
|
|
||||||
</GroupBox>
|
|
||||||
<GroupBox Grid.Column="1" Header="Duration of acting of loads">
|
|
||||||
<StackPanel>
|
|
||||||
<RadioButton x:Name="ShortLoads" Content="Short term loads" Margin="5" IsChecked="True" GroupName="LoadDuration" Checked="ShortLoads_Checked"/>
|
|
||||||
<RadioButton x:Name="LongLoads" Content="Long term loads" Margin="5" GroupName="LoadDuration" Checked="LongLoads_Checked"/>
|
|
||||||
</StackPanel>
|
|
||||||
</GroupBox>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="Iterations">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
<RowDefinition Height="30"/>
|
|
||||||
<RowDefinition/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Text="Required Accuracy" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
|
||||||
<TextBox Style="{StaticResource ValidatedError}" Grid.Column="1" Margin="5" Text="{Binding Path=IterationAccuracy, ValidatesOnDataErrors=True}"/>
|
|
||||||
<TextBlock Grid.Row="1" Text="Maximum Iteration Count" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
|
||||||
<TextBox Style="{StaticResource ValidatedError}" Grid.Column="1" Grid.Row="1" Margin="5" Text="{Binding Path=MaxIterationCount, ValidatesOnDataErrors=True}"/>
|
|
||||||
</Grid>
|
|
||||||
</TabItem>
|
|
||||||
</TabControl>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
|
|
||||||
namespace StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Логика взаимодействия для CalculationPropertyView.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class CalculationPropertyView : Window
|
|
||||||
{
|
|
||||||
private CalculationPropertyViewModel viewModel;
|
|
||||||
public CalculationPropertyView(CalculationPropertyViewModel calculationProperty)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
viewModel = calculationProperty;
|
|
||||||
this.DataContext = viewModel;
|
|
||||||
if (viewModel.LimitState == LimitStates.ULS) { LsCollapse.IsChecked = true; }
|
|
||||||
else { LsServiceability.IsChecked = true; }
|
|
||||||
if (viewModel.CalcTerm == CalcTerms.ShortTerm) { ShortLoads.IsChecked = true; }
|
|
||||||
else { LongLoads.IsChecked = true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
||||||
{
|
|
||||||
viewModel.SaveProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LsCollapse_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var chBox = sender as RadioButton;
|
|
||||||
if (chBox.IsChecked == true & viewModel != null)
|
|
||||||
{ viewModel.LimitState = LimitStates.ULS; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LsServiceability_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var chBox = sender as RadioButton;
|
|
||||||
if (chBox.IsChecked == true & viewModel != null)
|
|
||||||
{ viewModel.LimitState = LimitStates.SLS; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShortLoads_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var chBox = sender as RadioButton;
|
|
||||||
if (chBox.IsChecked == true & viewModel != null) { viewModel.CalcTerm = CalcTerms.ShortTerm; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LongLoads_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var chBox = sender as RadioButton;
|
|
||||||
if (chBox.IsChecked == true & viewModel != null) { viewModel.CalcTerm = CalcTerms.LongTerm; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ForceGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
var dg = sender as DataGrid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using LoaderCalculator.Logics.Geometry;
|
using LoaderCalculator.Logics.Geometry;
|
||||||
using StructureHelper.Infrastructure;
|
using StructureHelper.Infrastructure;
|
||||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||||
using StructureHelper.MaterialCatalogWindow;
|
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelper.Windows.ColorPickerWindow;
|
using StructureHelper.Windows.ColorPickerWindow;
|
||||||
using StructureHelper.Windows.MainWindow.Materials;
|
using StructureHelper.Windows.MainWindow.Materials;
|
||||||
@@ -12,7 +11,6 @@ using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Strings;
|
using StructureHelperCommon.Infrastructures.Strings;
|
||||||
using StructureHelperCommon.Models.Forces;
|
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||||
using StructureHelperLogics.Models.Templates.RCs;
|
using StructureHelperLogics.Models.Templates.RCs;
|
||||||
@@ -256,17 +254,6 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
EditHeadMaterialsCommand = new RelayCommand(o => EditHeadMaterials());
|
EditHeadMaterialsCommand = new RelayCommand(o => EditHeadMaterials());
|
||||||
OpenMaterialCatalog = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
var materialCatalogView = new MaterialCatalogView();
|
|
||||||
materialCatalogView.ShowDialog();
|
|
||||||
});
|
|
||||||
OpenMaterialCatalogWithSelection = new RelayCommand(o =>
|
|
||||||
{
|
|
||||||
var primitive = o as PrimitiveBase;
|
|
||||||
var materialCatalogView = new MaterialCatalogView(true, primitive);
|
|
||||||
materialCatalogView.ShowDialog();
|
|
||||||
});
|
|
||||||
|
|
||||||
SetColor = new RelayCommand(o =>
|
SetColor = new RelayCommand(o =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,6 +101,7 @@
|
|||||||
<Button Content="New Concrete" Command="{Binding AddNewConcreteMaterialCommand}"/>
|
<Button Content="New Concrete" Command="{Binding AddNewConcreteMaterialCommand}"/>
|
||||||
<Button Content="New Reinforcement" Command="{Binding AddNewReinforcementMaterialCommand}"/>
|
<Button Content="New Reinforcement" Command="{Binding AddNewReinforcementMaterialCommand}"/>
|
||||||
<Button Content="New Elastic Material" Command="{Binding AddElasticMaterialCommand}"/>
|
<Button Content="New Elastic Material" Command="{Binding AddElasticMaterialCommand}"/>
|
||||||
|
<Button Content="Show diagram" Command="{Binding ShowMaterialDiagram}"/>
|
||||||
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
||||||
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
||||||
<Button Content="Delete" Command="{Binding DeleteMaterialCommand}"/>
|
<Button Content="Delete" Command="{Binding DeleteMaterialCommand}"/>
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.MainWindow.Materials.MaterialDiagramView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow.Materials"
|
||||||
|
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
|
||||||
|
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Materials"
|
||||||
|
d:DataContext="{d:DesignInstance vm:MaterialDiagramViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Material Diagram" Height="450" Width="800" WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="22"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="{Binding MaterialName}"/>
|
||||||
|
<lvc:CartesianChart Grid.Row="1" Series="{Binding SeriesCollection}" LegendLocation="Right" >
|
||||||
|
<lvc:CartesianChart.AxisY>
|
||||||
|
<lvc:Axis Title="Stress"></lvc:Axis>
|
||||||
|
</lvc:CartesianChart.AxisY>
|
||||||
|
<lvc:CartesianChart.AxisX>
|
||||||
|
<lvc:Axis Title="Strain" Labels="{Binding Labels}"></lvc:Axis>
|
||||||
|
</lvc:CartesianChart.AxisX>
|
||||||
|
</lvc:CartesianChart>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using LiveCharts;
|
||||||
|
using LiveCharts.Wpf;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelper.Windows.ViewModels.Materials;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.MainWindow.Materials
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для MaterialDiagramView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MaterialDiagramView : Window
|
||||||
|
{
|
||||||
|
MaterialDiagramViewModel vm;
|
||||||
|
public MaterialDiagramView(MaterialDiagramViewModel vm)
|
||||||
|
{
|
||||||
|
this.vm = vm;
|
||||||
|
InitializeComponent();
|
||||||
|
this.DataContext = this.vm;
|
||||||
|
}
|
||||||
|
public MaterialDiagramView(IHeadMaterial material) : this(new MaterialDiagramViewModel(material))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ using StructureHelper.Models.Materials;
|
|||||||
using StructureHelper.Services.Primitives;
|
using StructureHelper.Services.Primitives;
|
||||||
using StructureHelper.Windows.AddMaterialWindow;
|
using StructureHelper.Windows.AddMaterialWindow;
|
||||||
using StructureHelper.Windows.MainWindow;
|
using StructureHelper.Windows.MainWindow;
|
||||||
|
using StructureHelper.Windows.MainWindow.Materials;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
using StructureHelperCommon.Models.Materials.Libraries;
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
@@ -57,9 +58,9 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
public ICommand DeleteMaterialCommand { get; set; }
|
public ICommand DeleteMaterialCommand { get; set; }
|
||||||
public ICommand EditHeadMaterial;
|
public ICommand EditHeadMaterial;
|
||||||
|
|
||||||
private RelayCommand showSafetyfactors;
|
private ICommand showSafetyfactors;
|
||||||
|
|
||||||
public RelayCommand ShowSafetyFactors
|
public ICommand ShowSafetyFactors
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -79,8 +80,24 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICommand ShowMaterialDiagram
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return showMaterialDiagram ??= new RelayCommand(o =>
|
||||||
|
{
|
||||||
|
var material = selectedMaterial;
|
||||||
|
var wnd = new MaterialDiagramView(material);
|
||||||
|
wnd.ShowDialog();
|
||||||
|
|
||||||
private ICommand addElasticMaterialCommand;
|
}, o => SelectedMaterial != null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ICommand? addElasticMaterialCommand;
|
||||||
|
private ICommand? showMaterialDiagram;
|
||||||
|
|
||||||
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
public ObservableCollection<IHeadMaterial> HeadMaterials { get; private set; }
|
||||||
public IHeadMaterial SelectedMaterial
|
public IHeadMaterial SelectedMaterial
|
||||||
@@ -89,7 +106,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
OnPropertyChanged(value, ref selectedMaterial);
|
OnPropertyChanged(value, ref selectedMaterial);
|
||||||
if (!(selectedMaterial is null))
|
if (selectedMaterial is not null && selectedMaterial.HelperMaterial is ILibMaterial)
|
||||||
{
|
{
|
||||||
var libMaterial = selectedMaterial.HelperMaterial as ILibMaterial;
|
var libMaterial = selectedMaterial.HelperMaterial as ILibMaterial;
|
||||||
selectedLibMaterial = libMaterial.MaterialEntity;
|
selectedLibMaterial = libMaterial.MaterialEntity;
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
using LiveCharts;
|
||||||
|
using LiveCharts.Wpf;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.ViewModels.Materials
|
||||||
|
{
|
||||||
|
public class MaterialDiagramViewModel
|
||||||
|
{
|
||||||
|
private IHeadMaterial material;
|
||||||
|
public string MaterialName => material.Name;
|
||||||
|
public SeriesCollection SeriesCollection { get; set; }
|
||||||
|
public List<string> Labels { get; set; }
|
||||||
|
public Func<double, string> YFormatter { get; set; }
|
||||||
|
|
||||||
|
public MaterialDiagramViewModel(IHeadMaterial material)
|
||||||
|
{
|
||||||
|
this.material = material;
|
||||||
|
SetLines();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetLines()
|
||||||
|
{
|
||||||
|
var titles = new List<string>() { "ULS Short Term", "ULS Long Term", "SLS Short Term","SLS Long Term"};
|
||||||
|
var limitStates = new List<LimitStates> { LimitStates.ULS, LimitStates.SLS };
|
||||||
|
var calcTerms = new List<CalcTerms> { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||||
|
var labels = new List<string>();
|
||||||
|
|
||||||
|
double minValue = -0.005d;
|
||||||
|
double maxValue = 0.005d;
|
||||||
|
if (material.HelperMaterial is IConcreteLibMaterial)
|
||||||
|
{
|
||||||
|
maxValue = 0.0005d;
|
||||||
|
}
|
||||||
|
int stepCount = 100;
|
||||||
|
double step = (maxValue - minValue) / stepCount;
|
||||||
|
|
||||||
|
SeriesCollection = new SeriesCollection();
|
||||||
|
|
||||||
|
for (int i = 0; i < limitStates.Count(); i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < calcTerms.Count(); j++)
|
||||||
|
{
|
||||||
|
int n = i * 2 + j;
|
||||||
|
var line = new LineSeries() { Title = titles[n], PointGeometry = null, Fill = Brushes.Transparent};
|
||||||
|
var chartValues = new ChartValues<double>();
|
||||||
|
|
||||||
|
var loaderMaterial = material.GetLoaderMaterial(limitStates[i], calcTerms[j]);
|
||||||
|
var title = titles[n];
|
||||||
|
for (double s = minValue; s < maxValue; s += step)
|
||||||
|
{
|
||||||
|
double diagramValue = loaderMaterial.Diagram.Invoke(loaderMaterial.DiagramParameters,s);
|
||||||
|
chartValues.Add(diagramValue);
|
||||||
|
labels.Add(Convert.ToString(Math.Round(s,4)));
|
||||||
|
}
|
||||||
|
line.Values = chartValues;
|
||||||
|
SeriesCollection.Add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Labels = labels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -84,7 +84,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
compressionFactor *= factors.Compressive;
|
compressionFactor *= factors.Compressive;
|
||||||
tensionFactor *= factors.Tensile;
|
tensionFactor *= factors.Tensile;
|
||||||
}
|
}
|
||||||
return (strength.Comressive * compressionFactor, strength.Tensile * tensionFactor);
|
return (strength.Compressive * compressionFactor, strength.Tensile * tensionFactor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
var factors = GetStrengthFactors(limitState, calcTerm);
|
var factors = GetStrengthFactors(limitState, calcTerm);
|
||||||
compressionFactor *= factors.Compressive;
|
compressionFactor *= factors.Compressive;
|
||||||
tensionFactor *= factors.Tensile;
|
tensionFactor *= factors.Tensile;
|
||||||
var compressiveStrength = strength.Comressive * compressionFactor;
|
var compressiveStrength = strength.Compressive * compressionFactor;
|
||||||
if (limitState == LimitStates.ULS)
|
if (limitState == LimitStates.ULS)
|
||||||
{
|
{
|
||||||
if (calcTerm == CalcTerms.ShortTerm)
|
if (calcTerm == CalcTerms.ShortTerm)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.AnchorageCalcula
|
|||||||
inputData.CrossSectionArea = Math.PI * diameter * diameter / 4d;
|
inputData.CrossSectionArea = Math.PI * diameter * diameter / 4d;
|
||||||
inputData.CrossSectionPerimeter = Math.PI * diameter;
|
inputData.CrossSectionPerimeter = Math.PI * diameter;
|
||||||
inputData.ReinforcementStress = stress;
|
inputData.ReinforcementStress = stress;
|
||||||
|
inputData.LappedCountRate = 0.5d;
|
||||||
var calculator = new AnchorageCalculator(inputData);
|
var calculator = new AnchorageCalculator(inputData);
|
||||||
//Act
|
//Act
|
||||||
var baseLength = calculator.GetBaseDevLength();
|
var baseLength = calculator.GetBaseDevLength();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="FunctionalTests\RCs\Anchorage\" />
|
<Folder Include="FunctionalTests\RCs\Anchorage\" />
|
||||||
|
<Folder Include="UnitTests\WindowTests\Calculations\CalculationProperties\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow;
|
|
||||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
|
|
||||||
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
|
|
||||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
|
||||||
|
|
||||||
namespace StructureHelperTests.UnitTests.WindowTests.Calculations.CalculationProperties
|
|
||||||
{
|
|
||||||
public class CalculationPropertyWindowTest
|
|
||||||
{
|
|
||||||
private CalculationPropertyViewModel viewModel;
|
|
||||||
private ICalculationProperty calculationProperty;
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
calculationProperty = new CalculationProperty();
|
|
||||||
viewModel = new CalculationPropertyViewModel(calculationProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Run_Shoulpass()
|
|
||||||
{
|
|
||||||
//Arrange
|
|
||||||
|
|
||||||
//Act
|
|
||||||
var wnd = new CalculationPropertyView(viewModel);
|
|
||||||
//Assert
|
|
||||||
Assert.NotNull(wnd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user