Materials were refactored
This commit is contained in:
@@ -20,26 +20,30 @@
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="SelectItems">
|
||||
<StackPanel>
|
||||
<StackPanel Height="25" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Button Content="Select All" Command="{Binding SelectAllCommand}"/>
|
||||
<Button Content="Unselect All" Command="{Binding UnSelectAllCommand}"/>
|
||||
<Button Content="Invert Selection" Command="{Binding InvertSelectionCommand}"/>
|
||||
</StackPanel>
|
||||
<ListBox ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem">
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="22"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox IsChecked="{Binding IsSelected}"/>
|
||||
<ContentControl Grid.Column="1" ContentTemplate="{StaticResource ColoredItemTemplate}" Content="{Binding Item}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="22"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox IsChecked="{Binding IsSelected}"/>
|
||||
<ContentControl Grid.Column="1" ContentTemplate="{StaticResource ColoredItemTemplate}" Content="{Binding Item}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
@@ -3,7 +3,24 @@
|
||||
|
||||
<DataTemplate x:Key="LibraryMaterial">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Library material"/>
|
||||
<TextBlock Text="Material Code"/>
|
||||
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding CodeList}" SelectedItem="{Binding CodeEntity}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}">
|
||||
<!--<ToolTip>
|
||||
<StackPanel>
|
||||
<TextBlock FontWeight="Bold" Text="Code short name:"/>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
<TextBlock FontWeight="Bold" Text="Full name:"/>
|
||||
<TextBlock Text="{Binding FullName}"/>
|
||||
</StackPanel>
|
||||
</ToolTip>-->
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<TextBlock Text="Material Kind"/>
|
||||
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding MaterialLibrary}" SelectedItem="{Binding MaterialEntity}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<Window x:Class="StructureHelper.Windows.ColorPickerWindow.ColorPickerView"
|
||||
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"
|
||||
xmlns:colorPickerWindow="clr-namespace:StructureHelper.Windows.ColorPickerWindow"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance colorPickerWindow:ColorPickerViewModel}"
|
||||
Title="Выбрать цвет" Height="200" Width="500" Topmost="True" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Красный"/>
|
||||
<Slider Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Value="{Binding Red}" Minimum="0" Maximum="255"/>
|
||||
<TextBox Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Red}"/>
|
||||
|
||||
<Border Grid.Column="3" Grid.RowSpan="3" Margin="10" BorderBrush="Black" BorderThickness="1">
|
||||
<Rectangle>
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding SelectedColor}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
</Border>
|
||||
|
||||
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Зеленый"/>
|
||||
<Slider Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Value="{Binding Green}" Minimum="0" Maximum="255"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Green}"/>
|
||||
|
||||
<TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Синий"/>
|
||||
<Slider Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Value="{Binding Blue}" Minimum="0" Maximum="255"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="10" Text="{Binding Blue}"/>
|
||||
|
||||
<Button Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Выбрать цвет" Command="{Binding SetColor}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,18 +0,0 @@
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.ColorPickerWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для ColorPickerView.xaml
|
||||
/// </summary>
|
||||
public partial class ColorPickerView : Window
|
||||
{
|
||||
public ColorPickerView(PrimitiveBase primitive)
|
||||
{
|
||||
var viewModel = new ColorPickerViewModel(primitive);
|
||||
DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
|
||||
namespace StructureHelper.Windows.ColorPickerWindow
|
||||
{
|
||||
public class ColorPickerViewModel : ViewModelBase
|
||||
{
|
||||
private int red, green, blue;
|
||||
|
||||
public int Red
|
||||
{
|
||||
get => red;
|
||||
set => OnColorItemChanged(value, ref red);
|
||||
}
|
||||
public int Green
|
||||
{
|
||||
get => green;
|
||||
set => OnColorItemChanged(value, ref green);
|
||||
}
|
||||
public int Blue
|
||||
{
|
||||
get => blue;
|
||||
set => OnColorItemChanged(value, ref blue);
|
||||
}
|
||||
|
||||
private Color selectedColor;
|
||||
public Color SelectedColor
|
||||
{
|
||||
get => selectedColor;
|
||||
set => OnPropertyChanged(value, ref selectedColor);
|
||||
}
|
||||
public ICommand SetColor { get; }
|
||||
public ColorPickerViewModel(PrimitiveBase primitive)
|
||||
{
|
||||
if (primitive != null)
|
||||
{
|
||||
var color = primitive.Color;
|
||||
Red = color.R;
|
||||
Green = color.G;
|
||||
Blue = color.B;
|
||||
|
||||
SetColor = new RelayCommand(o => primitive.Color = SelectedColor);
|
||||
}
|
||||
}
|
||||
private void OnColorItemChanged(int value, ref int colorItem, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (value >= 0 && value <= 255 && Math.Abs(colorItem - value) > 0.001)
|
||||
{
|
||||
colorItem = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
UpdateSelectedColor();
|
||||
}
|
||||
}
|
||||
private void UpdateSelectedColor()
|
||||
{
|
||||
var color = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue);
|
||||
SelectedColor = color;
|
||||
OnPropertyChanged(nameof(SelectedColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,6 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ColorPickerWindow;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.Beams;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
@@ -262,12 +260,12 @@ namespace StructureHelper.Windows.MainWindow
|
||||
}
|
||||
});
|
||||
|
||||
SetColor = new RelayCommand(o =>
|
||||
{
|
||||
var primitive = o as PrimitiveBase;
|
||||
var colorPickerView = new ColorPickerView(primitive);
|
||||
colorPickerView.ShowDialog();
|
||||
});
|
||||
//SetColor = new RelayCommand(o =>
|
||||
//{
|
||||
// var primitive = o as PrimitiveBase;
|
||||
// var colorPickerView = new ColorPickerView(primitive);
|
||||
// colorPickerView.ShowDialog();
|
||||
//});
|
||||
|
||||
ScaleCanvasDown = new RelayCommand(o =>
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.PrimitiveProperties"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance vm:SelectPrimitivesViewModel}"
|
||||
Title="Select Primitives" Height="250" Width="250" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
Title="Select Primitives" Height="250" Width="250" MinHeight="250" MinWidth="250" MaxHeight="500" MaxWidth="500" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class ConcreteViewModel : LibMaterialViewModel
|
||||
internal class ConcreteViewModel : LibMaterialViewModel<IConcreteMaterialEntity>
|
||||
{
|
||||
readonly IConcreteLibMaterial concreteMaterial;
|
||||
public bool TensionForULS
|
||||
@@ -45,16 +45,13 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<ILibMaterialEntity> MaterialLibrary => LibMaterialPepository.GetConcreteRepository(ProgramSetting.CodeType);
|
||||
|
||||
|
||||
public ConcreteViewModel(ILibMaterial material) : base(material)
|
||||
{
|
||||
if (material is not IConcreteLibMaterial)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $". Expected: {typeof(IConcreteLibMaterial)}, but was: {material.GetType()}");
|
||||
}
|
||||
this.concreteMaterial = material as IConcreteLibMaterial;
|
||||
concreteMaterial = material as IConcreteLibMaterial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
@@ -78,7 +79,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
else if (helperMaterial is IReinforcementLibMaterial)
|
||||
{
|
||||
var material = helperMaterial as IReinforcementLibMaterial;
|
||||
helperMaterialViewModel = new ReinforcementViewModel(material);
|
||||
helperMaterialViewModel = new LibMaterialViewModel<IReinforcementMaterialEntity>(material);
|
||||
}
|
||||
else if (helperMaterial is IElasticMaterial)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
|
||||
private void AddElasticMaterial()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200);
|
||||
material.Name = "New Elastic Material";
|
||||
HeadMaterials.Add(material);
|
||||
headMaterials.Add(material);
|
||||
@@ -163,7 +163,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
get
|
||||
{
|
||||
return LibMaterialPepository.GetConcreteRepository(ProgramSetting.CodeType);
|
||||
return LibMaterialPepository.GetConcreteRepository();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
get
|
||||
{
|
||||
return LibMaterialPepository.GetReinforcementRepository(ProgramSetting.CodeType);
|
||||
return LibMaterialPepository.GetReinforcementRepository();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
|
||||
private void AddConcreteMaterial()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
material.Name = "New Concrete";
|
||||
HeadMaterials.Add(material);
|
||||
headMaterials.Add(material);
|
||||
@@ -245,7 +245,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
|
||||
private void AddReinforcementMaterial()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
material.Name = "New Reinforcement";
|
||||
HeadMaterials.Add(material);
|
||||
headMaterials.Add(material);
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -13,11 +16,12 @@ using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal abstract class LibMaterialViewModel : HelperMaterialViewModel
|
||||
internal class LibMaterialViewModel<T> : HelperMaterialViewModel where T: class, ILibMaterialEntity
|
||||
{
|
||||
ILibMaterial material;
|
||||
ICommand showSafetyFactors;
|
||||
SafetyFactorsViewModel safetyFactorsViewModel;
|
||||
private ICodeEntity codeEntity;
|
||||
|
||||
public ILibMaterialEntity MaterialEntity
|
||||
{
|
||||
@@ -28,7 +32,43 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
OnPropertyChanged(nameof(MaterialEntity));
|
||||
}
|
||||
}
|
||||
public abstract IEnumerable<ILibMaterialEntity> MaterialLibrary { get; }
|
||||
public ICodeEntity CodeEntity
|
||||
{
|
||||
get
|
||||
{
|
||||
return codeEntity;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
codeEntity = value;
|
||||
OnPropertyChanged(nameof(CodeEntity));
|
||||
FillMaterialKinds();
|
||||
}
|
||||
}
|
||||
|
||||
private void FillMaterialKinds()
|
||||
{
|
||||
var materialKinds = ProgramSetting
|
||||
.MaterialRepository
|
||||
.Repository
|
||||
.Where(x => x.Code == codeEntity & x is T);
|
||||
|
||||
MaterialLibrary = new ObservableCollection<T>();
|
||||
if (materialKinds.Count() > 0)
|
||||
{
|
||||
foreach (var item in materialKinds)
|
||||
{
|
||||
MaterialLibrary.Add((T)item);
|
||||
}
|
||||
OnPropertyChanged(nameof(MaterialLibrary));
|
||||
material.MaterialEntity = MaterialLibrary.First();
|
||||
OnPropertyChanged(nameof(MaterialEntity));
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<ICodeEntity> CodeList { get; }
|
||||
public ObservableCollection<T> MaterialLibrary { get; private set; }
|
||||
public SafetyFactorsViewModel SafetyFactors => safetyFactorsViewModel;
|
||||
|
||||
public ICommand ShowSafetyFactors =>
|
||||
@@ -44,6 +84,21 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
public LibMaterialViewModel(ILibMaterial material)
|
||||
{
|
||||
this.material = material;
|
||||
var selectedMaterialKind = this.material.MaterialEntity;
|
||||
CodeList = new ObservableCollection<ICodeEntity>();
|
||||
var materialsKind = ProgramSetting.MaterialRepository.Repository
|
||||
.Where(x => x is T);
|
||||
var codes = materialsKind
|
||||
.Select(x => x.Code)
|
||||
.Distinct();
|
||||
foreach (var item in codes)
|
||||
{
|
||||
CodeList.Add(item);
|
||||
}
|
||||
CodeEntity = codes.Where(x => x == selectedMaterialKind.Code).Single();
|
||||
MaterialEntity = MaterialLibrary
|
||||
.Single(x => x.Id == selectedMaterialKind.Id);
|
||||
OnPropertyChanged(nameof(MaterialEntity));
|
||||
safetyFactorsViewModel = new SafetyFactorsViewModel(material.SafetyFactors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
|
||||
using System.Windows.Forms;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
@@ -76,31 +68,31 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
private void AddElastic()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200);
|
||||
material.Name = "New Elastic Material";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddCarbonFiber()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Carbon1400, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Carbon1400);
|
||||
material.Name = "New CFR Material";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddGlassFiber()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Glass1200, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Glass1200);
|
||||
material.Name = "New GFR Material";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddReinforcement()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
material.Name = "New Reinforcement";
|
||||
NewItem = material;
|
||||
}
|
||||
private void AddConcrete()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
material.Name = "New Concrete";
|
||||
NewItem = material;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
@@ -11,10 +12,17 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class ReinforcementViewModel : LibMaterialViewModel
|
||||
internal class ReinforcementViewModel
|
||||
{
|
||||
public override IEnumerable<ILibMaterialEntity> MaterialLibrary => LibMaterialPepository.GetReinforcementRepository(ProgramSetting.CodeType);
|
||||
public ReinforcementViewModel(ILibMaterial material) : base(material)
|
||||
public IEnumerable<ICodeEntity> CodeList => ProgramSetting
|
||||
.MaterialRepository
|
||||
.Repository
|
||||
.Select( x => x.Code)
|
||||
.Distinct();
|
||||
public IEnumerable<ILibMaterialEntity> MaterialLibrary => LibMaterialPepository.GetReinforcementRepository();
|
||||
|
||||
|
||||
public ReinforcementViewModel(ILibMaterial material)
|
||||
{
|
||||
if (material is not IReinforcementLibMaterial)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ColorPickerWindow;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
@@ -9,21 +8,13 @@ using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Linq;
|
||||
using PointViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
||||
using RectangleViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
||||
|
||||
|
||||
16
StructureHelperCommon/Infrastructures/Enums/NatSystems.cs
Normal file
16
StructureHelperCommon/Infrastructures/Enums/NatSystems.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Enums
|
||||
{
|
||||
public enum NatSystems
|
||||
{
|
||||
RU,
|
||||
EU,
|
||||
US,
|
||||
IS
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface IDataRepository<T>
|
||||
{
|
||||
void Save(T entity);
|
||||
T Load(Guid Id);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface ISaveable
|
||||
{
|
||||
int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Unique identifier
|
||||
/// </summary>
|
||||
Guid Id { get;}
|
||||
void Save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,55 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Codes.Factories;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
public static class ProgramSetting
|
||||
{
|
||||
private static List<ICodeEntity> codesList;
|
||||
private static IMaterialRepository materialRepository;
|
||||
private static NatSystems natSystem;
|
||||
|
||||
public static CodeTypes CodeType => CodeTypes.SP63_2018;
|
||||
public static CodeTypes FRCodeType => CodeTypes.SP164_2014;
|
||||
public static NatSystems NatSystem
|
||||
{
|
||||
get => natSystem;
|
||||
set
|
||||
{
|
||||
natSystem = value;
|
||||
codesList = CodeFactory.GetCodeEntities()
|
||||
.Where(x => x.NatSystem == natSystem)
|
||||
.ToList();
|
||||
materialRepository = new MaterialRepository(codesList);
|
||||
}
|
||||
}
|
||||
public static CrossSectionAxisNames CrossSectionAxisNames => new CrossSectionAxisNames();
|
||||
public static LimitStatesList LimitStatesList => new LimitStatesList();
|
||||
public static CalcTermList CalcTermList => new CalcTermList();
|
||||
public static List<ICodeEntity> CodesList
|
||||
{ get
|
||||
{
|
||||
codesList ??= CodeFactory.GetCodeEntities()
|
||||
.Where(x => x.NatSystem == NatSystem)
|
||||
.ToList();
|
||||
return codesList;
|
||||
}
|
||||
}
|
||||
|
||||
public static IMaterialRepository MaterialRepository
|
||||
{
|
||||
get
|
||||
{
|
||||
materialRepository ??= new MaterialRepository(codesList);
|
||||
return materialRepository;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
31
StructureHelperCommon/Models/Codes/CodeEntity.cs
Normal file
31
StructureHelperCommon/Models/Codes/CodeEntity.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Codes
|
||||
{
|
||||
public class CodeEntity : ICodeEntity
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public NatSystems NatSystem { get; }
|
||||
public string Name { get; set; }
|
||||
public string FullName { get; set; }
|
||||
|
||||
|
||||
public CodeEntity(Guid id, NatSystems natSystem)
|
||||
{
|
||||
Id = id;
|
||||
NatSystem = natSystem;
|
||||
Name = "";
|
||||
FullName = "";
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
61
StructureHelperCommon/Models/Codes/Factories/CodeFactory.cs
Normal file
61
StructureHelperCommon/Models/Codes/Factories/CodeFactory.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Codes.Factories
|
||||
{
|
||||
public static class CodeFactory
|
||||
{
|
||||
public static List<ICodeEntity> GetCodeEntities()
|
||||
{
|
||||
List<ICodeEntity> items = new List<ICodeEntity>();
|
||||
items.AddRange(GetRussianCodes());
|
||||
items.AddRange(GetEuropeanCodes());
|
||||
return items;
|
||||
}
|
||||
|
||||
private static List<ICodeEntity> GetRussianCodes()
|
||||
{
|
||||
const NatSystems natSystem = NatSystems.RU;
|
||||
return new List<ICodeEntity>
|
||||
{
|
||||
new CodeEntity(new Guid("d4ab402a-ce2f-46db-8b3b-a5a66fb384e1"), natSystem)
|
||||
{
|
||||
Name = "SP 63.13330.2018",
|
||||
FullName = "Plain concrete and reinforced concrete structures"
|
||||
},
|
||||
new CodeEntity(new Guid("1a717049-cee7-40e0-923c-7a32a573a303"), natSystem)
|
||||
{
|
||||
Name = "GOST 26633-2015",
|
||||
FullName = "Heavy-weight and sand concretes. Specifications"
|
||||
},
|
||||
new CodeEntity(new Guid("c7c0f60f-2c82-45d1-8786-4c340fb5fb98"), natSystem)
|
||||
{
|
||||
Name = "GOST 34028-2016",
|
||||
FullName = "Reinforcing rolled products for reinforced concrete constructions. Specifications"
|
||||
}
|
||||
,
|
||||
new CodeEntity(new Guid("d934763d-4cb4-4923-ad15-2e78b0fe3b37"), natSystem)
|
||||
{
|
||||
Name = "GOST 53772-2010",
|
||||
FullName = "Reinforced steel low-relaxation 7-wire strands. Specifications"
|
||||
}
|
||||
};
|
||||
}
|
||||
private static List<ICodeEntity> GetEuropeanCodes()
|
||||
{
|
||||
const NatSystems natSystem = NatSystems.EU;
|
||||
return new List<ICodeEntity>
|
||||
{
|
||||
new CodeEntity(new Guid("a72c4448-7d05-4076-9636-1a6da3bfdd40"), natSystem)
|
||||
{
|
||||
Name = "EuroCode2-1990",
|
||||
FullName = "Plain concrete and reinforced concrete structures"
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
18
StructureHelperCommon/Models/Codes/ICodeEntity.cs
Normal file
18
StructureHelperCommon/Models/Codes/ICodeEntity.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Codes
|
||||
{
|
||||
public interface ICodeEntity : ISaveable
|
||||
{
|
||||
NatSystems NatSystem { get; }
|
||||
string Name { get; set; }
|
||||
string FullName { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,25 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public class ConcreteMaterialEntity : IConcreteMaterialEntity
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public CodeTypes CodeType { get; set; }
|
||||
public ICodeEntity Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public double MainStrength { get; set; }
|
||||
|
||||
public ConcreteMaterialEntity(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
@@ -8,61 +14,293 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
public static List<ILibMaterialEntity> GetLibMaterials()
|
||||
{
|
||||
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||
libMaterials.AddRange(GetConcreteEurocode());
|
||||
libMaterials.AddRange(GetConcreteSP63());
|
||||
libMaterials.AddRange(GetReinforcementEurocode());
|
||||
libMaterials.AddRange(GetReinforcementSP63());
|
||||
if (ProgramSetting.NatSystem == NatSystems.RU)
|
||||
{
|
||||
libMaterials.AddRange(GetConcreteSP63());
|
||||
libMaterials.AddRange(GetReinforcementSP63());
|
||||
}
|
||||
else if (ProgramSetting.NatSystem == NatSystems.EU)
|
||||
{
|
||||
libMaterials.AddRange(GetConcreteEurocode());
|
||||
libMaterials.AddRange(GetReinforcementEurocode());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": {ProgramSetting.NatSystem}");
|
||||
}
|
||||
return libMaterials;
|
||||
}
|
||||
|
||||
private static IEnumerable<ILibMaterialEntity> GetConcreteEurocode()
|
||||
{
|
||||
var code = CodeTypes.EuroCode_2_1990;
|
||||
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C12", MainStrength = 12e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C20", MainStrength = 20e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C30", MainStrength = 30e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C40", MainStrength = 40e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C50", MainStrength = 50e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C60", MainStrength = 60e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C70", MainStrength = 70e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "C80", MainStrength = 80e6 });
|
||||
ICodeEntity code = ProgramSetting.CodesList.Where(x => x.Name == "EuroCode2-1990").Single();
|
||||
var codeType = CodeTypes.EuroCode_2_1990;
|
||||
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>
|
||||
{
|
||||
new ConcreteMaterialEntity(new Guid("145f3994-347b-466e-9c26-c7a8bf4a207a"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "C12",
|
||||
MainStrength = 12e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("f264ef97-ebbe-4c0b-b68e-905feb1e210e"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "C20",
|
||||
MainStrength = 20e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("b0d9df4d-f601-473e-8e52-05ef82b2d974"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "C30",
|
||||
MainStrength = 30e6 },
|
||||
new ConcreteMaterialEntity(new Guid("196dac5f-42b6-4a43-ab24-8cd5fe8af0a4"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "C40",
|
||||
MainStrength = 40e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("89e2ae9c-43e5-425f-93c6-f4b42e9916bd"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "C50",
|
||||
MainStrength = 50e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("0aea6c0d-6d49-4f61-a1c5-c599af73df76"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "C60",
|
||||
MainStrength = 60e6 },
|
||||
new ConcreteMaterialEntity(new Guid("a4fb66f8-6689-489e-ab40-adab1e90ab14"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "C70",
|
||||
MainStrength = 70e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("b5c36b22-ebb9-45c6-88cf-bb636187a2ed"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "C80",
|
||||
MainStrength = 80e6
|
||||
}
|
||||
};
|
||||
return libMaterials;
|
||||
}
|
||||
private static IEnumerable<ILibMaterialEntity> GetReinforcementEurocode()
|
||||
{
|
||||
var code = CodeTypes.EuroCode_2_1990;
|
||||
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "S240", MainStrength = 240e6 });
|
||||
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "S400", MainStrength = 400e6 });
|
||||
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "S500", MainStrength = 500e6 });
|
||||
ICodeEntity code = ProgramSetting.CodesList.Where(x => x.Name == "EuroCode2-1990").Single();
|
||||
var codeType = CodeTypes.EuroCode_2_1990;
|
||||
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>
|
||||
{
|
||||
new ReinforcementMaterialEntity(new Guid("5413ba46-9bad-4cb3-a129-4e1a09373fd9"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "S240",
|
||||
MainStrength = 240e6
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("c60c8296-82bd-4bf8-8bb5-d0cc532e7372"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "S400",
|
||||
MainStrength = 400e6
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("0efb56bf-dc7f-4970-86e7-ddefb5ea7b93"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "S500",
|
||||
MainStrength = 500e6
|
||||
}
|
||||
};
|
||||
return libMaterials;
|
||||
}
|
||||
private static IEnumerable<ILibMaterialEntity> GetConcreteSP63()
|
||||
{
|
||||
var code = CodeTypes.SP63_2018;
|
||||
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B5", MainStrength = 5e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B7,5", MainStrength = 7.5e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B10", MainStrength = 10e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B15", MainStrength = 15e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B20", MainStrength = 20e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B25", MainStrength = 25e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B30", MainStrength = 30e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B35", MainStrength = 35e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B40", MainStrength = 40e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B50", MainStrength = 50e6 });
|
||||
libMaterials.Add(new ConcreteMaterialEntity() { CodeType = code, Name = "B60", MainStrength = 60e6 });
|
||||
ICodeEntity code = ProgramSetting.CodesList
|
||||
.Where(x => x.Name == "GOST 26633-2015")
|
||||
.Single();
|
||||
var codeType = CodeTypes.SP63_2018;
|
||||
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>
|
||||
{
|
||||
new ConcreteMaterialEntity(new Guid("c63ce3b3-af54-44aa-bc06-130e6b6450ff"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B5",
|
||||
MainStrength = 5e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("9b679822-0332-4504-8435-c7e718cdb6f4"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B7,5",
|
||||
MainStrength = 7.5e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("9339af2b-46da-4354-a62e-fa330f46c165"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Name = "B10",
|
||||
Code = code,
|
||||
MainStrength = 10e6,
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("1cdc3598-c67b-4e35-89ac-3f7c0a9db167"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B15",
|
||||
MainStrength = 15e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("f1d05405-2fd7-465e-82fc-d69f74e482aa"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B20",
|
||||
MainStrength = 20e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("27ca419d-cff3-4f7f-82af-d577bb343651"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B25",
|
||||
MainStrength = 25e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("2f5b70b9-f4c1-470d-ac27-a39a7093b6ea"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Name = "B30",
|
||||
MainStrength = 30e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("edd16698-cbe8-43ba-b249-7bab99fa0163"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B35",
|
||||
MainStrength = 35e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("32614a91-fc85-4690-aa82-af45e00f7638"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B40",
|
||||
MainStrength = 40e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("6182b496-9d80-4323-8b1e-7347923d7ceb"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B50",
|
||||
MainStrength = 50e6
|
||||
},
|
||||
new ConcreteMaterialEntity(new Guid("96217bf1-564c-4150-afd6-9fe661c2e121"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B60",
|
||||
MainStrength = 60e6 }
|
||||
};
|
||||
return libMaterials;
|
||||
}
|
||||
private static IEnumerable<ILibMaterialEntity> GetReinforcementSP63()
|
||||
{
|
||||
var code = CodeTypes.SP63_2018;
|
||||
var codeType = CodeTypes.SP63_2018;
|
||||
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
|
||||
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "A240", MainStrength = 240e6 });
|
||||
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "A400", MainStrength = 400e6 });
|
||||
libMaterials.Add(new ReinforcementMaterialEntity() { CodeType = code, Name = "A500", MainStrength = 500e6 });
|
||||
libMaterials.AddRange(AddGOST34028(codeType));
|
||||
libMaterials.AddRange(AddGOST53772(codeType));
|
||||
return libMaterials;
|
||||
}
|
||||
|
||||
private static List<ILibMaterialEntity> AddGOST34028(CodeTypes codeType)
|
||||
{
|
||||
var code = ProgramSetting.CodesList
|
||||
.Where(x => x.Name == "GOST 34028-2016")
|
||||
.Single();
|
||||
List<ILibMaterialEntity> range = new List<ILibMaterialEntity>
|
||||
{
|
||||
new ReinforcementMaterialEntity(new Guid("c47ebbd7-2e0c-4247-81b6-dc3fbd064bab"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "A240",
|
||||
MainStrength = 240e6
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("ea422282-3465-433c-9b93-c5bbfba5a904"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "A400",
|
||||
MainStrength = 400e6
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("045b54b1-0bbf-41fd-a27d-aeb20f600bb4"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "A500",
|
||||
MainStrength = 500e6
|
||||
}
|
||||
};
|
||||
return range;
|
||||
}
|
||||
private static List<ILibMaterialEntity> AddGOST53772(CodeTypes codeType)
|
||||
{
|
||||
var code = ProgramSetting.CodesList
|
||||
.Where(x => x.Name == "GOST 53772-2010")
|
||||
.Single();
|
||||
List<ILibMaterialEntity> range = new List<ILibMaterialEntity>()
|
||||
{
|
||||
new ReinforcementMaterialEntity(new Guid("1b44e9eb-d19d-4fd5-9755-33ae01683dc1"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "K1400/1670",
|
||||
MainStrength = 1400e6
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("93c48a27-ab37-4bd2-aeb8-2a7247e74a1b"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "K1500/1770",
|
||||
MainStrength = 1500e6
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("6e0df35e-4839-4cf1-9182-c7ad7f81a548"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "K1600/1860",
|
||||
MainStrength = 1600e6
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("29d7ef1b-bd30-471e-af0e-8b419eb9f043"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "K1700/1960",
|
||||
MainStrength = 1700e6
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("494b959f-0194-4f02-9dcf-ff313c5e352b"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "K1800/2060",
|
||||
MainStrength = 1800e6
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("02031332-fe1e-456d-b339-143eb9ca8293"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "K1900/2160",
|
||||
MainStrength = 1900e6
|
||||
}
|
||||
};
|
||||
return range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
internal class FiberMaterialEntity : IFiberMaterialEntity
|
||||
{
|
||||
///<inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
public CodeTypes CodeType { get; }
|
||||
public ICodeEntity Code { get; set; }
|
||||
public string Name { get; }
|
||||
///<inheritdoc/>
|
||||
public double YoungsModulus { get; set; }
|
||||
///<inheritdoc/>
|
||||
public double MainStrength { get; }
|
||||
public FiberMaterialEntity(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "";
|
||||
}
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public interface IFiberMaterialEntity : ILibMaterialEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Modulus of elasticity, Pa
|
||||
/// </summary>
|
||||
double YoungsModulus { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,17 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public interface ILibMaterialEntity
|
||||
public interface ILibMaterialEntity : ISaveable
|
||||
{
|
||||
CodeTypes CodeType { get; }
|
||||
ICodeEntity Code { get; set; }
|
||||
string Name { get; }
|
||||
/// <summary>
|
||||
/// Strength of material, Pa
|
||||
/// </summary>
|
||||
double MainStrength { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public interface IMaterialRepository
|
||||
{
|
||||
List<ILibMaterialEntity> Repository { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
@@ -9,19 +10,31 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
private static List<ILibMaterialEntity> libMaterials;
|
||||
public static List<ILibMaterialEntity> GetRepository()
|
||||
{
|
||||
if (libMaterials is null) { libMaterials = LibMaterialFactory.GetLibMaterials(); }
|
||||
|
||||
libMaterials = LibMaterialFactory.GetLibMaterials();
|
||||
//if (libMaterials is null)
|
||||
//{
|
||||
//}
|
||||
return libMaterials;
|
||||
}
|
||||
|
||||
public static IEnumerable<ILibMaterialEntity> GetConcreteRepository(CodeTypes code)
|
||||
public static List<ILibMaterialEntity> GetConcreteRepository()
|
||||
{
|
||||
return GetRepository().Where(x => x.CodeType == code & x is IConcreteMaterialEntity); ;
|
||||
var natCodes = ProgramSetting.CodesList;
|
||||
var rep = GetRepository();
|
||||
var repository = rep
|
||||
.Where(x => natCodes.Contains(x.Code) & x is IConcreteMaterialEntity)
|
||||
.ToList();
|
||||
return repository;
|
||||
}
|
||||
|
||||
public static IEnumerable<ILibMaterialEntity> GetReinforcementRepository(CodeTypes code)
|
||||
public static List<ILibMaterialEntity> GetReinforcementRepository()
|
||||
{
|
||||
return GetRepository().Where(x => x.CodeType == code & x is IReinforcementMaterialEntity);
|
||||
var natCodes = ProgramSetting.CodesList;
|
||||
var rep = GetRepository();
|
||||
var repository = rep
|
||||
.Where(x => natCodes.Contains(x.Code) & x is IReinforcementMaterialEntity)
|
||||
.ToList();
|
||||
return repository;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public class MaterialRepository : IMaterialRepository
|
||||
{
|
||||
public List<ILibMaterialEntity> Repository { get; }
|
||||
|
||||
public MaterialRepository(IEnumerable<ICodeEntity> codes)
|
||||
{
|
||||
Repository = LibMaterialFactory.GetLibMaterials()
|
||||
.Where(x => codes.Contains(x.Code))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public class ReinforcementMaterialEntity : IReinforcementMaterialEntity
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public CodeTypes CodeType { get; set; }
|
||||
public ICodeEntity Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public double MainStrength { get; set; }
|
||||
|
||||
public ReinforcementMaterialEntity(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,30 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using LoaderMaterials = LoaderCalculator.Data.Materials;
|
||||
using LoaderMaterialBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using LoaderMaterialLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LMLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||
using LM = LoaderCalculator.Data.Materials;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class ConcreteLibMaterial : IConcreteLibMaterial
|
||||
{
|
||||
private LMBuilders.ConcreteOptions lmOptions;
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private IFactorLogic factorLogic => new FactorLogic(SafetyFactors);
|
||||
private LMLogic.ITrueStrengthLogic strengthLogic;
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||
public bool TensionForULS { get ; set; }
|
||||
public bool TensionForSLS { get; set; }
|
||||
public double Humidity { get; set; }
|
||||
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private LoaderMaterialLogic.ITrueStrengthLogic strengthLogic;
|
||||
|
||||
public ConcreteLibMaterial()
|
||||
{
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
lmOptions = new LMBuilders.ConcreteOptions();
|
||||
SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultConcreteSafetyFactors(ProgramSetting.CodeType));
|
||||
optionLogic = new MaterialOptionLogic(new LoaderMaterialBuilders.ConcreteOptions());
|
||||
TensionForULS = false;
|
||||
TensionForSLS = true;
|
||||
Humidity = 0.55d;
|
||||
@@ -41,29 +35,23 @@ namespace StructureHelperLogics.Models.Materials
|
||||
return new ConcreteLibMaterial() { MaterialEntity = MaterialEntity, TensionForULS = TensionForULS, TensionForSLS = TensionForSLS };
|
||||
}
|
||||
|
||||
public LoaderMaterials.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
public LM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm) as LoaderMaterialBuilders.ConcreteOptions;
|
||||
materialOptions.WorkInTension = false;
|
||||
if (limitState == LimitStates.ULS & TensionForULS == true)
|
||||
{
|
||||
materialOptions.WorkInTension = true;
|
||||
}
|
||||
if (limitState == LimitStates.SLS & TensionForSLS == true)
|
||||
{
|
||||
materialOptions.WorkInTension = true;
|
||||
}
|
||||
optionLogic = new MaterialCommonOptionLogic(MaterialEntity, limitState, calcTerm);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
optionLogic = new ConcreteMaterialOptionLogic(this, limitState);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
var strength = factorLogic.GetTotalFactor(limitState, calcTerm);
|
||||
materialOptions.ExternalFactor.Compressive = strength.Compressive;
|
||||
materialOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||
LoaderMaterialBuilders.IMaterialBuilder builder = new LoaderMaterialBuilders.ConcreteBuilder(materialOptions);
|
||||
LoaderMaterialBuilders.IBuilderDirector director = new LoaderMaterialBuilders.BuilderDirector(builder);
|
||||
lmOptions.ExternalFactor.Compressive = strength.Compressive;
|
||||
lmOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||
LMBuilders.IMaterialBuilder builder = new LMBuilders.ConcreteBuilder(lmOptions);
|
||||
LMBuilders.IBuilderDirector director = new LMBuilders.BuilderDirector(builder);
|
||||
return director.BuildMaterial();
|
||||
}
|
||||
|
||||
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
strengthLogic = new LoaderMaterialLogic.TrueStrengthConcreteLogicSP63_2018(MaterialEntity.MainStrength);
|
||||
strengthLogic = new LMLogic.TrueStrengthConcreteLogicSP63_2018(MaterialEntity.MainStrength);
|
||||
var strength = strengthLogic.GetTrueStrength();
|
||||
double compressionFactor = 1d;
|
||||
double tensionFactor = 1d;
|
||||
|
||||
@@ -3,8 +3,10 @@ using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -15,7 +17,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public enum HeadmaterialType
|
||||
{
|
||||
Concrete40,
|
||||
Reinforecement400,
|
||||
Reinforcement400,
|
||||
Reinforecement500,
|
||||
Elastic200,
|
||||
Carbon1400,
|
||||
@@ -25,14 +27,13 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public static class HeadMaterialFactory
|
||||
{
|
||||
private static CodeTypes codeType;
|
||||
private static IEnumerable<ILibMaterialEntity> LibConcreteMaterials => LibMaterialPepository.GetConcreteRepository(codeType);
|
||||
private static IEnumerable<ILibMaterialEntity> LibReinforcementMaterials => LibMaterialPepository.GetReinforcementRepository(codeType);
|
||||
private static IEnumerable<ILibMaterialEntity> LibConcreteMaterials => LibMaterialPepository.GetConcreteRepository();
|
||||
private static IEnumerable<ILibMaterialEntity> LibReinforcementMaterials => LibMaterialPepository.GetReinforcementRepository();
|
||||
|
||||
public static IHeadMaterial GetHeadMaterial(HeadmaterialType type, CodeTypes code)
|
||||
public static IHeadMaterial GetHeadMaterial(HeadmaterialType type)
|
||||
{
|
||||
codeType = code;
|
||||
if (type == HeadmaterialType.Concrete40) { return GetConcrete40(); }
|
||||
if (type == HeadmaterialType.Reinforecement400) { return GetReinforcement400(); }
|
||||
if (type == HeadmaterialType.Reinforcement400) { return GetReinforcement400(); }
|
||||
if (type == HeadmaterialType.Reinforecement500) { return GetReinforcement500(); }
|
||||
if (type == HeadmaterialType.Elastic200) { return GetElastic200(); }
|
||||
if (type == HeadmaterialType.Carbon1400) { return GetCarbon1400(); }
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace StructureHelper.Models.Materials
|
||||
{
|
||||
private Color color;
|
||||
|
||||
public string Id { get; }
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
public Color Color
|
||||
{
|
||||
@@ -31,12 +31,16 @@ namespace StructureHelper.Models.Materials
|
||||
}
|
||||
public IHelperMaterial HelperMaterial {get; set;}
|
||||
|
||||
public HeadMaterial()
|
||||
public HeadMaterial(Guid id)
|
||||
{
|
||||
Id = Convert.ToString(Guid.NewGuid());
|
||||
Id = id;
|
||||
Color = ColorProcessor.GetRandomColor();
|
||||
}
|
||||
|
||||
public HeadMaterial() : this(Guid.NewGuid())
|
||||
{
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
@@ -55,5 +59,9 @@ namespace StructureHelper.Models.Materials
|
||||
return material;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,9 +11,8 @@ using System.Windows.Media;
|
||||
|
||||
namespace StructureHelper.Models.Materials
|
||||
{
|
||||
public interface IHeadMaterial : ICloneable
|
||||
public interface IHeadMaterial : ISaveable, ICloneable
|
||||
{
|
||||
string Id { get; }
|
||||
string Name { get; set; }
|
||||
Color Color { get; set; }
|
||||
IHelperMaterial HelperMaterial { get; set; }
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public interface IMaterialOptionLogic
|
||||
{
|
||||
LCMB.IMaterialOptions SetMaterialOptions(ILibMaterialEntity materialEntity, LimitStates limitState, CalcTerms calcTerm);
|
||||
void SetMaterialOptions(LCMB.IMaterialOptions materialOptions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.Design.AxImporter;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class ConcreteMaterialOptionLogic : IMaterialOptionLogic
|
||||
{
|
||||
private IConcreteLibMaterial material;
|
||||
private LimitStates limitState;
|
||||
public ConcreteMaterialOptionLogic(IConcreteLibMaterial material, LimitStates limitState)
|
||||
{
|
||||
this.material = material;
|
||||
this.limitState = limitState;
|
||||
}
|
||||
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
|
||||
{
|
||||
Check(materialOptions);
|
||||
var concreteOptions = materialOptions as LCMB.ConcreteOptions;
|
||||
concreteOptions.WorkInTension = false;
|
||||
if (limitState == LimitStates.ULS & material.TensionForULS == true)
|
||||
{
|
||||
concreteOptions.WorkInTension = true;
|
||||
}
|
||||
if (limitState == LimitStates.SLS & material.TensionForSLS == true)
|
||||
{
|
||||
concreteOptions.WorkInTension = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void Check(LCMB.IMaterialOptions materialOptions)
|
||||
{
|
||||
if (materialOptions is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": expected {typeof(LCMB.ConcreteOptions)}, but was null");
|
||||
}
|
||||
if (materialOptions is not LCMB.ConcreteOptions)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": expected {typeof(LCMB.ConcreteOptions)}, but was {materialOptions.GetType()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,16 +11,20 @@ using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class MaterialOptionLogic : IMaterialOptionLogic
|
||||
public class MaterialCommonOptionLogic : IMaterialOptionLogic
|
||||
{
|
||||
private LCMB.IMaterialOptions materialOptions;
|
||||
private ILibMaterialEntity materialEntity;
|
||||
private LimitStates limitState;
|
||||
private CalcTerms calcTerm;
|
||||
|
||||
public MaterialOptionLogic(LCMB.IMaterialOptions materialOptions)
|
||||
public MaterialCommonOptionLogic(ILibMaterialEntity materialEntity, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
this.materialOptions = materialOptions;
|
||||
this.materialEntity = materialEntity;
|
||||
this.limitState = limitState;
|
||||
this.calcTerm = calcTerm;
|
||||
}
|
||||
|
||||
public LCMB.IMaterialOptions SetMaterialOptions(ILibMaterialEntity materialEntity, LimitStates limitState, CalcTerms calcTerm)
|
||||
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
|
||||
{
|
||||
materialOptions.Strength = materialEntity.MainStrength;
|
||||
if (materialEntity.CodeType == CodeTypes.EuroCode_2_1990)
|
||||
@@ -39,8 +43,6 @@ namespace StructureHelperLogics.Models.Materials
|
||||
if (calcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
|
||||
else if (calcTerm == CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
|
||||
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
|
||||
|
||||
return materialOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,24 +6,25 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Loadermaterials = LoaderCalculator.Data.Materials;
|
||||
using LoaderMaterialBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LoaderMaterialLogics = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class ReinforcementLibMaterial : IReinforcementLibMaterial
|
||||
{
|
||||
private LMBuilders.ReinforcementOptions lmOptions;
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private IFactorLogic factorLogic => new FactorLogic(SafetyFactors);
|
||||
private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
|
||||
|
||||
public ReinforcementLibMaterial()
|
||||
{
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
optionLogic = new MaterialOptionLogic(new LoaderMaterialBuilders.ReinforcementOptions());
|
||||
lmOptions = new LMBuilders.ReinforcementOptions();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
@@ -33,12 +34,13 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public Loadermaterials.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm);
|
||||
optionLogic = new MaterialCommonOptionLogic(MaterialEntity, limitState, calcTerm);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
var factors = factorLogic.GetTotalFactor(limitState, calcTerm);
|
||||
materialOptions.ExternalFactor.Compressive = factors.Compressive;
|
||||
materialOptions.ExternalFactor.Tensile = factors.Tensile;
|
||||
LoaderMaterialBuilders.IMaterialBuilder builder = new LoaderMaterialBuilders.ReinforcementBuilder(materialOptions);
|
||||
LoaderMaterialBuilders.IBuilderDirector director = new LoaderMaterialBuilders.BuilderDirector(builder);
|
||||
lmOptions.ExternalFactor.Compressive = factors.Compressive;
|
||||
lmOptions.ExternalFactor.Tensile = factors.Tensile;
|
||||
LMBuilders.IMaterialBuilder builder = new LMBuilders.ReinforcementBuilder(lmOptions);
|
||||
LMBuilders.IBuilderDirector director = new LMBuilders.BuilderDirector(builder);
|
||||
return director.BuildMaterial();
|
||||
}
|
||||
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class LinePrimitive : IPrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public IPoint2D Center { get; set; }
|
||||
public IShape Shape { get; }
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
public IEnumerable<IHeadMaterial> GetHeadMaterials()
|
||||
{
|
||||
var result = new List<IHeadMaterial>();
|
||||
var concrete = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||
var concrete = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
concrete.Name = "Concrete";
|
||||
concrete.Color = (Color)ColorConverter.ConvertFromString("AliceBlue");
|
||||
result.Add(concrete);
|
||||
var reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||
var reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
reinforcement.Name = "Reinforcement";
|
||||
reinforcement.Color = (Color)ColorConverter.ConvertFromString("Red");
|
||||
result.Add(reinforcement);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class CirclePrimitive : ICirclePrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
@@ -32,8 +32,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public bool Triangulate { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public CirclePrimitive()
|
||||
public CirclePrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Circle";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
@@ -43,6 +44,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
ClearUnderlying = false;
|
||||
Triangulate = true;
|
||||
}
|
||||
public CirclePrimitive() : this (Guid.NewGuid())
|
||||
{}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
@@ -75,5 +78,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
if (distance > Diameter / 2) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class PointPrimitive : IPointPrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get; }
|
||||
public string? Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
//public double NdmMaxSize { get; set; }
|
||||
//public int NdmMinDivision { get; set; }
|
||||
public StrainTuple UsersPrestrain { get; private set; }
|
||||
public StrainTuple AutoPrestrain { get; private set; }
|
||||
public double Area { get; set; }
|
||||
@@ -31,8 +31,9 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
public bool Triangulate { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public PointPrimitive()
|
||||
public PointPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Point";
|
||||
Area = 0.0005d;
|
||||
VisualProperty = new VisualProperty();
|
||||
@@ -40,7 +41,8 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
AutoPrestrain = new StrainTuple();
|
||||
Triangulate = true;
|
||||
}
|
||||
|
||||
public PointPrimitive() : this (Guid.NewGuid())
|
||||
{}
|
||||
public PointPrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class RectanglePrimitive : IRectanglePrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get;}
|
||||
public string Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
@@ -36,8 +36,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public RectanglePrimitive()
|
||||
public RectanglePrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Rectangle";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
@@ -47,6 +48,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
ClearUnderlying = false;
|
||||
Triangulate = true;
|
||||
}
|
||||
public RectanglePrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
@@ -18,6 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <inheritdoc/>
|
||||
public class ReinforcementPrimitive : IPointPrimitive, IHasHostPrimitive
|
||||
{
|
||||
IDataRepository<ReinforcementPrimitive> repository;
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
@@ -34,13 +36,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public IVisualProperty VisualProperty { get; private set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public double Area { get; set; }
|
||||
public INdmPrimitive HostPrimitive { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public ReinforcementPrimitive()
|
||||
public ReinforcementPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Reinforcement";
|
||||
Area = 0.0005d;
|
||||
VisualProperty = new VisualProperty();
|
||||
@@ -48,6 +51,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
AutoPrestrain = new StrainTuple();
|
||||
Triangulate = true;
|
||||
}
|
||||
public ReinforcementPrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
@@ -67,7 +74,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
repository.Save(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
List<INdm> ndms = new List<INdm>();
|
||||
var headMaterials = GetPrimitiveMaterials(ndmPrimitives);
|
||||
Dictionary<string, IMaterial> materials = GetMaterials(headMaterials, options);
|
||||
Dictionary<Guid, IMaterial> materials = GetMaterials(headMaterials, options);
|
||||
foreach (var ndmPrimitive in ndmPrimitives)
|
||||
{
|
||||
IHeadMaterial headMaterial = ndmPrimitive.HeadMaterial;
|
||||
@@ -36,9 +36,9 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
/// </summary>
|
||||
/// <param name="ndmPrimitives"></param>
|
||||
/// <returns></returns>
|
||||
private static Dictionary<string, IHeadMaterial> GetPrimitiveMaterials(IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||
private static Dictionary<Guid, IHeadMaterial> GetPrimitiveMaterials(IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||
{
|
||||
Dictionary<string, IHeadMaterial> headMaterials = new Dictionary<string, IHeadMaterial>();
|
||||
Dictionary<Guid, IHeadMaterial> headMaterials = new Dictionary<Guid, IHeadMaterial>();
|
||||
foreach (var ndmPrimitive in ndmPrimitives)
|
||||
{
|
||||
IHeadMaterial material = ndmPrimitive.HeadMaterial;
|
||||
@@ -53,12 +53,12 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="StructureHelperException"></exception>
|
||||
private static Dictionary<string, IMaterial> GetMaterials(Dictionary<string, IHeadMaterial> PrimitiveMaterials, ITriangulationOptions options)
|
||||
private static Dictionary<Guid, IMaterial> GetMaterials(Dictionary<Guid, IHeadMaterial> PrimitiveMaterials, ITriangulationOptions options)
|
||||
{
|
||||
Dictionary<string, IMaterial> materials = new Dictionary<string, IMaterial>();
|
||||
IEnumerable<string> keyCollection = PrimitiveMaterials.Keys;
|
||||
Dictionary<Guid, IMaterial> materials = new Dictionary<Guid, IMaterial>();
|
||||
IEnumerable<Guid> keyCollection = PrimitiveMaterials.Keys;
|
||||
IMaterial material;
|
||||
foreach (string id in keyCollection)
|
||||
foreach (var id in keyCollection)
|
||||
{
|
||||
IHeadMaterial headMaterial;
|
||||
if (PrimitiveMaterials.TryGetValue(id, out headMaterial) == false) { throw new StructureHelperException("Material dictionary is not valid"); }
|
||||
|
||||
@@ -12,6 +12,7 @@ using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
|
||||
namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
||||
{
|
||||
@@ -28,6 +29,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
||||
public void Run_ShouldPass(double topArea, double bottomArea, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||
{
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.EU;
|
||||
double width = 0.4;
|
||||
double height = 0.6;
|
||||
var ndmCollection = new List<INdm>();
|
||||
@@ -61,7 +63,8 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
||||
|
||||
private IEnumerable<INdmPrimitive> GetConcreteNdms(double width, double height)
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.EuroCode_2_1990);
|
||||
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var primitive = new RectanglePrimitive(material) {CenterX = 0, CenterY = 0, Width = width, Height = height, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||
List<INdmPrimitive> primitives = new List<INdmPrimitive> {primitive};
|
||||
return primitives;
|
||||
@@ -70,7 +73,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
||||
private IEnumerable<INdmPrimitive> GetReinforcementNdms(double width, double height, double topArea, double bottomArea)
|
||||
{
|
||||
double gap = 0.05d;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, CodeTypes.EuroCode_2_1990);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
IPoint2D centerRT = new Point2D { X = width / 2 - gap, Y = height / 2 - gap };
|
||||
IPoint2D centerLT = new Point2D { X = - (width / 2 - gap), Y = height / 2 - gap };
|
||||
IPoint2D centerRB = new Point2D { X = width / 2 - gap, Y = - (height / 2 - gap) };
|
||||
|
||||
@@ -24,7 +24,8 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
||||
public void Run_ShouldPass_Rectangle(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||
{
|
||||
//Arrange
|
||||
var headMaterial = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, CodeTypes.EuroCode_2_1990);
|
||||
ProgramSetting.NatSystem = NatSystems.EU;
|
||||
var headMaterial = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
var options = new TriangulationOptions { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm };
|
||||
var primitive = new RectanglePrimitive { CenterX = 0, CenterY = 0, Width = width, Height = height, HeadMaterial = headMaterial, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||
var primitives = new List<INdmPrimitive>() { primitive};
|
||||
@@ -58,7 +59,8 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
||||
public void Run_ShouldPass_Circle(double diameter, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||
{
|
||||
//Arrange
|
||||
var headMaterial = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, CodeTypes.EuroCode_2_1990);
|
||||
ProgramSetting.NatSystem = NatSystems.EU;
|
||||
var headMaterial = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
var options = new TriangulationOptions { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm };
|
||||
var primitive = new CirclePrimitive { CenterX = 0, CenterY = 0, Diameter = diameter, HeadMaterial = headMaterial, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||
var primitives = new List<INdmPrimitive>() { primitive };
|
||||
|
||||
@@ -5,14 +5,15 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace StructureHelperTests.UnitTests.MaterialTests
|
||||
{
|
||||
public class MaterialStrengthTest
|
||||
{
|
||||
[TestCase(HeadmaterialType.Reinforecement400, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.ShortTerm, 347826086.95652175d, 347826086.95652175d)]
|
||||
[TestCase(HeadmaterialType.Reinforecement400, CodeTypes.SP63_2018, LimitStates.SLS, CalcTerms.ShortTerm, 400000000d, 400000000d)]
|
||||
[TestCase(HeadmaterialType.Reinforcement400, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.ShortTerm, 347826086.95652175d, 347826086.95652175d)]
|
||||
[TestCase(HeadmaterialType.Reinforcement400, CodeTypes.SP63_2018, LimitStates.SLS, CalcTerms.ShortTerm, 400000000d, 400000000d)]
|
||||
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.ShortTerm, 400000000.0d, 434782608.69565225d)]
|
||||
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.LongTerm, 434782608.69565225d, 434782608.69565225d)]
|
||||
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_2018, LimitStates.SLS, CalcTerms.ShortTerm, 5e8d, 5e8d)]
|
||||
@@ -24,7 +25,8 @@ namespace StructureHelperTests.UnitTests.MaterialTests
|
||||
public void Run_ShouldPass(HeadmaterialType headmaterialType, CodeTypes code, LimitStates limitState, CalcTerms calcTerm, double expectedCompressive, double expectedTensile)
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(headmaterialType, code);
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(headmaterialType);
|
||||
var libMaterial = material.HelperMaterial as ILibMaterial;
|
||||
//Act
|
||||
var compressive = libMaterial.GetStrength(limitState, calcTerm).Compressive;
|
||||
|
||||
@@ -8,6 +8,7 @@ using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using LoaderCalculator.Logics.Geometry;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
|
||||
namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
{
|
||||
@@ -46,7 +47,8 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
public void Run_Shouldpass_RectOpeningRect(double centerX, double centerY, double width, double height, bool triangOpening, double expectedArea, double expectedMomX, double expectedMomY)
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_2018);
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var mainBlock = new RectanglePrimitive() { CenterX = centerX, CenterY = centerY, Width = width, Height = height, HeadMaterial = material };
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new RectanglePrimitive()
|
||||
@@ -71,7 +73,8 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
public void Run_Shouldpass_RectOpeningCircle(double centerX, double centerY, double width, double height, bool triangOpening, double expectedArea, double expectedMomX, double expectedMomY)
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_2018);
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var mainBlock = new RectanglePrimitive() { CenterX = centerX, CenterY = centerY, Width = width, Height = height, HeadMaterial = material };
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new CirclePrimitive()
|
||||
@@ -101,7 +104,8 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
public void Run_Shouldpass_CircleOpeningRect(double centerX, double centerY, double diameter, bool triangOpening, double expectedArea, double expectedMomX, double expectedMomY)
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_2018);
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var mainBlock = new CirclePrimitive() { CenterX = centerX, CenterY = centerY, Diameter = diameter, HeadMaterial = material };
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new RectanglePrimitive()
|
||||
|
||||
@@ -15,6 +15,7 @@ using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
|
||||
namespace StructureHelperTests.ViewModelTests
|
||||
{
|
||||
@@ -24,7 +25,7 @@ namespace StructureHelperTests.ViewModelTests
|
||||
public void Rectangle_Run_ShouldPass()
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_2018);
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var primitive = new RectanglePrimitive(material);
|
||||
var primitiveBase = new RectangleViewPrimitive(primitive);
|
||||
//Act
|
||||
@@ -36,7 +37,8 @@ namespace StructureHelperTests.ViewModelTests
|
||||
public void Circle_Run_ShouldPass()
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_2018);
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var primitive = new CirclePrimitive() { HeadMaterial = material};
|
||||
var primitiveBase = new CircleViewPrimitive(primitive);
|
||||
//Act
|
||||
@@ -49,7 +51,8 @@ namespace StructureHelperTests.ViewModelTests
|
||||
public void Point_Run_ShouldPass()
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_2018);
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var primitive = new PointPrimitive(material);
|
||||
var primitiveBase = new PointViewPrimitive(primitive);
|
||||
//Act
|
||||
@@ -61,7 +64,8 @@ namespace StructureHelperTests.ViewModelTests
|
||||
public void Reinforcement_Run_ShouldPass()
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_2018);
|
||||
ProgramSetting.NatSystem = NatSystems.RU;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var primitive = new ReinforcementPrimitive() { HeadMaterial = material };
|
||||
var primitiveBase = new ReinforcementViewPrimitive(primitive);
|
||||
//Act
|
||||
|
||||
Reference in New Issue
Block a user