Add inclined rebar
This commit is contained in:
@@ -92,7 +92,10 @@ namespace DataAccess.DTOs
|
|||||||
rebarConvertStrategy.TraceLogger = TraceLogger;
|
rebarConvertStrategy.TraceLogger = TraceLogger;
|
||||||
RebarNdmPrimitive newItem = rebarConvertStrategy.Convert(rebar);
|
RebarNdmPrimitive newItem = rebarConvertStrategy.Convert(rebar);
|
||||||
TraceLogger?.AddMessage($"Primtive has been obtained successfully, Name = {newItem.Name}");
|
TraceLogger?.AddMessage($"Primtive has been obtained successfully, Name = {newItem.Name}");
|
||||||
|
if (rebar.HostPrimitive != null)
|
||||||
|
{
|
||||||
newItem.HostPrimitive = GetHostPrimitive(rebar);
|
newItem.HostPrimitive = GetHostPrimitive(rebar);
|
||||||
|
}
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ namespace DataAccess.DTOs
|
|||||||
public double Spacing { get; set; }
|
public double Spacing { get; set; }
|
||||||
[JsonProperty("CompressedGap")]
|
[JsonProperty("CompressedGap")]
|
||||||
public double CompressedGap { get; set; }
|
public double CompressedGap { get; set; }
|
||||||
|
[JsonProperty("IsSpiral")]
|
||||||
|
public bool IsSpiral { get; set; } = false;
|
||||||
|
|
||||||
public StirrupByRebarDTO(Guid id)
|
public StirrupByRebarDTO(Guid id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ namespace StructureHelper.Infrastructure.Enums
|
|||||||
public enum StirrupTypes
|
public enum StirrupTypes
|
||||||
{
|
{
|
||||||
Density,
|
Density,
|
||||||
UniformRebar
|
UniformRebar,
|
||||||
|
GroupOfStirrups,
|
||||||
|
InclinedRebar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -693,6 +693,15 @@
|
|||||||
</Canvas.Children>
|
</Canvas.Children>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="StirrupInclinedRebar">
|
||||||
|
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||||
|
<Canvas.Children>
|
||||||
|
<Line X1="2" Y1="12" X2="11" Y2="12" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="11" Y1="12" X2="21" Y2="22" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="21" Y1="22" X2="30" Y2="22" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
</Canvas.Children>
|
||||||
|
</Canvas>
|
||||||
|
</DataTemplate>
|
||||||
<DataTemplate x:Key="StirrupRebars">
|
<DataTemplate x:Key="StirrupRebars">
|
||||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||||
<Canvas.Children>
|
<Canvas.Children>
|
||||||
@@ -724,6 +733,20 @@
|
|||||||
</Canvas.Children>
|
</Canvas.Children>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="TreeGroup">
|
||||||
|
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||||
|
<Canvas.Children>
|
||||||
|
<Line X1="2" Y1="6" X2="12" Y2="6" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="12" Y1="6" X2="12" Y2="28" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Line X1="12" Y1="10" X2="18" Y2="10" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Rectangle Canvas.Top="8" Canvas.Left="18" Height="6" Width="12" Stroke="Black" Fill="White"/>
|
||||||
|
<Line X1="12" Y1="18" X2="18" Y2="18" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Rectangle Canvas.Top="16" Canvas.Left="18" Height="6" Width="12" Stroke="Black" Fill="White"/>
|
||||||
|
<Line X1="12" Y1="26" X2="18" Y2="26" Stroke="Black" StrokeThickness="1"/>
|
||||||
|
<Rectangle Canvas.Top="24" Canvas.Left="18" Height="6" Width="12" Stroke="Black" Fill="White"/>
|
||||||
|
</Canvas.Children>
|
||||||
|
</Canvas>
|
||||||
|
</DataTemplate>
|
||||||
<DataTemplate x:Key="ValuePointDiagram">
|
<DataTemplate x:Key="ValuePointDiagram">
|
||||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||||
<Canvas.Children>
|
<Canvas.Children>
|
||||||
|
|||||||
@@ -39,9 +39,15 @@
|
|||||||
<Compile Update="Windows\BeamShears\StirrupByDensityView.xaml.cs">
|
<Compile Update="Windows\BeamShears\StirrupByDensityView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\BeamShears\StirrupByInclinedReebarView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\BeamShears\StirrupByRebarView.xaml.cs">
|
<Compile Update="Windows\BeamShears\StirrupByRebarView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Windows\BeamShears\StirrupGroupView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\Cracks\CrackCalculatorInputDataView.xaml.cs">
|
<Compile Update="Windows\CalculationWindows\CalculatorsViews\Cracks\CrackCalculatorInputDataView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
|
||||||
xmlns:local="clr-namespace:StructureHelper.Windows.BeamShears"
|
xmlns:local="clr-namespace:StructureHelper.Windows.BeamShears"
|
||||||
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
||||||
d:DataContext="{d:DesignInstance local:BeamShearViewModel}"
|
d:DataContext="{d:DesignInstance local:BeamShearViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
@@ -41,6 +41,18 @@
|
|||||||
<ToolBar ToolTip="Stirrups" DataContext="{Binding Stirrups}">
|
<ToolBar ToolTip="Stirrups" DataContext="{Binding Stirrups}">
|
||||||
<Button Style="{StaticResource ToolButton}"
|
<Button Style="{StaticResource ToolButton}"
|
||||||
Command="{Binding Add}"
|
Command="{Binding Add}"
|
||||||
|
CommandParameter="{x:Static enums:StirrupTypes.GroupOfStirrups}">
|
||||||
|
<Button.ToolTip>
|
||||||
|
<uc:ButtonToolTipEh HeaderText="Add group of stirrup"
|
||||||
|
IconContent="{StaticResource TreeGroup}"
|
||||||
|
DescriptionText="Adds group of stirrup which can contain several types of child stirrups at the same time"/>
|
||||||
|
</Button.ToolTip>
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource TreeGroup}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Style="{StaticResource ToolButton}"
|
||||||
|
Command="{Binding Add}"
|
||||||
CommandParameter="{x:Static enums:StirrupTypes.Density}">
|
CommandParameter="{x:Static enums:StirrupTypes.Density}">
|
||||||
<Button.ToolTip>
|
<Button.ToolTip>
|
||||||
<uc:ButtonToolTipEh HeaderText="Add stirrups by density"
|
<uc:ButtonToolTipEh HeaderText="Add stirrups by density"
|
||||||
@@ -63,6 +75,18 @@
|
|||||||
<ContentControl ContentTemplate="{DynamicResource StirrupRebars}"/>
|
<ContentControl ContentTemplate="{DynamicResource StirrupRebars}"/>
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button Style="{StaticResource ToolButton}"
|
||||||
|
Command="{Binding Add}"
|
||||||
|
CommandParameter="{x:Static enums:StirrupTypes.InclinedRebar}">
|
||||||
|
<Button.ToolTip>
|
||||||
|
<uc:ButtonToolTipEh HeaderText="Add inclined rebar"
|
||||||
|
IconContent="{StaticResource StirrupInclinedRebar}"
|
||||||
|
DescriptionText="Adds inclined rebar by its diameter and strength"/>
|
||||||
|
</Button.ToolTip>
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource StirrupInclinedRebar}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<ToolBar ToolTip="Calculators" DataContext="{Binding Calculators}">
|
<ToolBar ToolTip="Calculators" DataContext="{Binding Calculators}">
|
||||||
<Button Style="{StaticResource ToolButton}"
|
<Button Style="{StaticResource ToolButton}"
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ namespace StructureHelper.Windows.BeamShears
|
|||||||
{
|
{
|
||||||
private const string ErrorText = "Error of creating of stirrup";
|
private const string ErrorText = "Error of creating of stirrup";
|
||||||
private IUpdateStrategy<IStirrup> updateStrategy;
|
private IUpdateStrategy<IStirrup> updateStrategy;
|
||||||
private readonly IBeamShearRepository shearRepository;
|
private readonly IHasStirrups hasStirrup;
|
||||||
private StirrupTypes stirrupType;
|
private StirrupTypes stirrupType;
|
||||||
|
|
||||||
public BeamStirrupsViewModel(IBeamShearRepository shearRepository) : base(shearRepository.Stirrups)
|
public BeamStirrupsViewModel(IHasStirrups hasStirrup) : base(hasStirrup.Stirrups)
|
||||||
{
|
{
|
||||||
this.shearRepository = shearRepository;
|
this.hasStirrup = hasStirrup;
|
||||||
}
|
}
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void EditMethod(object parameter)
|
public override void EditMethod(object parameter)
|
||||||
@@ -54,7 +54,11 @@ namespace StructureHelper.Windows.BeamShears
|
|||||||
{
|
{
|
||||||
Window window;
|
Window window;
|
||||||
IStirrup temporaryStirrup = SelectedItem.Clone() as IStirrup;
|
IStirrup temporaryStirrup = SelectedItem.Clone() as IStirrup;
|
||||||
if (SelectedItem is IStirrupByDensity stirrupByDensity)
|
if (SelectedItem is IStirrupGroup stirrupGroup)
|
||||||
|
{
|
||||||
|
window = new StirrupGroupView(stirrupGroup);
|
||||||
|
}
|
||||||
|
else if (SelectedItem is IStirrupByDensity stirrupByDensity)
|
||||||
{
|
{
|
||||||
window = new StirrupByDensityView(stirrupByDensity);
|
window = new StirrupByDensityView(stirrupByDensity);
|
||||||
}
|
}
|
||||||
@@ -62,6 +66,10 @@ namespace StructureHelper.Windows.BeamShears
|
|||||||
{
|
{
|
||||||
window = new StirrupByRebarView(stirrupByRebar);
|
window = new StirrupByRebarView(stirrupByRebar);
|
||||||
}
|
}
|
||||||
|
else if (SelectedItem is IStirrupByInclinedRebar stirrupByInclinedRebar)
|
||||||
|
{
|
||||||
|
window = new StirrupByInclinedReebarView(stirrupByInclinedRebar);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));
|
||||||
@@ -76,7 +84,11 @@ namespace StructureHelper.Windows.BeamShears
|
|||||||
|
|
||||||
private void AddStirrup()
|
private void AddStirrup()
|
||||||
{
|
{
|
||||||
if (stirrupType is StirrupTypes.Density)
|
if (stirrupType is StirrupTypes.GroupOfStirrups)
|
||||||
|
{
|
||||||
|
AddStirrupGroup();
|
||||||
|
}
|
||||||
|
else if (stirrupType is StirrupTypes.Density)
|
||||||
{
|
{
|
||||||
AddStirrupByDensity();
|
AddStirrupByDensity();
|
||||||
}
|
}
|
||||||
@@ -84,6 +96,10 @@ namespace StructureHelper.Windows.BeamShears
|
|||||||
{
|
{
|
||||||
AddUniformRebarStirrup();
|
AddUniformRebarStirrup();
|
||||||
}
|
}
|
||||||
|
else if (stirrupType is StirrupTypes.InclinedRebar)
|
||||||
|
{
|
||||||
|
AddInclinedRebarStirrup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(stirrupType));
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(stirrupType));
|
||||||
@@ -91,6 +107,22 @@ namespace StructureHelper.Windows.BeamShears
|
|||||||
base.AddMethod(stirrupType);
|
base.AddMethod(stirrupType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddInclinedRebarStirrup()
|
||||||
|
{
|
||||||
|
NewItem = new StirrupByInclinedRebar(Guid.NewGuid())
|
||||||
|
{
|
||||||
|
Name = "New inclined rebar"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddStirrupGroup()
|
||||||
|
{
|
||||||
|
NewItem = new StirrupGroup(Guid.NewGuid())
|
||||||
|
{
|
||||||
|
Name = "New group of stirrups"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private void AddUniformRebarStirrup()
|
private void AddUniformRebarStirrup()
|
||||||
{
|
{
|
||||||
IReinforcementLibMaterial reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400).HelperMaterial as IReinforcementLibMaterial;
|
IReinforcementLibMaterial reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400).HelperMaterial as IReinforcementLibMaterial;
|
||||||
@@ -117,7 +149,10 @@ namespace StructureHelper.Windows.BeamShears
|
|||||||
var dialogResult = System.Windows.Forms.MessageBox.Show("Delete stirrup?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
var dialogResult = System.Windows.Forms.MessageBox.Show("Delete stirrup?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||||
if (dialogResult == DialogResult.Yes)
|
if (dialogResult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
BeamShearRepositoryService.DeleteStirrup(shearRepository, SelectedItem);
|
if (hasStirrup is IBeamShearRepository repository)
|
||||||
|
{
|
||||||
|
BeamShearRepositoryService.DeleteStirrup(repository, SelectedItem);
|
||||||
|
}
|
||||||
base.DeleteMethod(parameter);
|
base.DeleteMethod(parameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.BeamShears
|
||||||
|
{
|
||||||
|
public class StirrupByInclinedRebarViewModel : OkCancelViewModelBase
|
||||||
|
{
|
||||||
|
private readonly IStirrupByInclinedRebar stirrupByInclinedRebar;
|
||||||
|
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => stirrupByInclinedRebar.Name;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
stirrupByInclinedRebar.Name = value;
|
||||||
|
OnPropertyChanged(nameof(Name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double CompressedGap
|
||||||
|
{
|
||||||
|
get => stirrupByInclinedRebar.CompressedGap;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
stirrupByInclinedRebar.CompressedGap = value;
|
||||||
|
OnPropertyChanged(nameof(CompressedGap));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double StartCoordinate
|
||||||
|
{
|
||||||
|
get => stirrupByInclinedRebar.StartCoordinate;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
stirrupByInclinedRebar.StartCoordinate = value;
|
||||||
|
OnPropertyChanged(nameof(StartCoordinate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double AngleOfInclination
|
||||||
|
{
|
||||||
|
get => stirrupByInclinedRebar.AngleOfInclination;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
stirrupByInclinedRebar.AngleOfInclination = value;
|
||||||
|
OnPropertyChanged(nameof(AngleOfInclination));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double OffSet
|
||||||
|
{
|
||||||
|
get => stirrupByInclinedRebar.OffSet;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
stirrupByInclinedRebar.OffSet = value;
|
||||||
|
OnPropertyChanged(nameof(OffSet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public StirrupByInclinedRebarViewModel(IStirrupByInclinedRebar stirrupByInclinedRebar)
|
||||||
|
{
|
||||||
|
this.stirrupByInclinedRebar = stirrupByInclinedRebar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.BeamShears.StirrupByInclinedReebarView"
|
||||||
|
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.BeamShears"
|
||||||
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
|
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
||||||
|
d:DataContext="{d:DesignInstance local:StirrupByInclinedRebarViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Inclined rebar" Height="450" Width="400" MaxHeight="450" MaxWidth="400" MinHeight="450" MinWidth="400" WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="Name"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
<TextBlock Grid.Row="1" Text="Start point coordinate"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartCoordinate, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
|
<TextBlock Grid.Row="2" Text="Angle of inclination"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding AngleOfInclination, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||||
|
<TextBlock Grid.Row="3" Text="Distance to compressed edge"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding CompressedGap, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
|
<TextBlock Grid.Row="4" Text="Offset"/>
|
||||||
|
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding OffSet, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||||
|
</Grid>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.BeamShears
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для StirrupByInclinedReebarView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class StirrupByInclinedReebarView : Window
|
||||||
|
{
|
||||||
|
private StirrupByInclinedRebarViewModel viewModel;
|
||||||
|
public StirrupByInclinedReebarView(StirrupByInclinedRebarViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
this.DataContext = viewModel;
|
||||||
|
viewModel.ParentWindow = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StirrupByInclinedReebarView(IStirrupByInclinedRebar stirrupByInclinedRebar) : this(new StirrupByInclinedRebarViewModel(stirrupByInclinedRebar))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
<RowDefinition Height="25"/>
|
<RowDefinition Height="25"/>
|
||||||
<RowDefinition Height="25"/>
|
<RowDefinition Height="25"/>
|
||||||
<RowDefinition Height="25"/>
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Text="Name"/>
|
<TextBlock Text="Name"/>
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
<TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource ValidatedError}" Text="{Binding LegCount, Converter={StaticResource PlainDouble},ValidatesOnDataErrors=True}"/>
|
<TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource ValidatedError}" Text="{Binding LegCount, Converter={StaticResource PlainDouble},ValidatesOnDataErrors=True}"/>
|
||||||
<TextBlock Grid.Row="3" Text="Spacing"/>
|
<TextBlock Grid.Row="3" Text="Spacing"/>
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Style="{StaticResource ValidatedError}" Text="{Binding Spacing, Converter={StaticResource LengthConverter},ValidatesOnDataErrors=True}"/>
|
<TextBox Grid.Row="3" Grid.Column="1" Style="{StaticResource ValidatedError}" Text="{Binding Spacing, Converter={StaticResource LengthConverter},ValidatesOnDataErrors=True}"/>
|
||||||
|
<CheckBox Grid.Row="4" Margin="0,2,0,0" Content="Spiral" IsChecked="{Binding IsSpiral}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Material" DataContext="{Binding Material}">
|
<TabItem Header="Material" DataContext="{Binding Material}">
|
||||||
|
|||||||
@@ -60,6 +60,16 @@ namespace StructureHelper.Windows.BeamShears
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsSpiral
|
||||||
|
{
|
||||||
|
get => stirrupByRebar.IsSpiral;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
stirrupByRebar.IsSpiral = value;
|
||||||
|
OnPropertyChanged(nameof(IsSpiral));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ReinforcementViewModel Material { get; private set; }
|
public ReinforcementViewModel Material { get; private set; }
|
||||||
|
|
||||||
public string Error => null;
|
public string Error => null;
|
||||||
|
|||||||
96
StructureHelper/Windows/BeamShears/StirrupGroupView.xaml
Normal file
96
StructureHelper/Windows/BeamShears/StirrupGroupView.xaml
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<Window x:Class="StructureHelper.Windows.BeamShears.StirrupGroupView"
|
||||||
|
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.BeamShears"
|
||||||
|
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||||
|
xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums"
|
||||||
|
d:DataContext="{d:DesignInstance local:StirrupGroupViewModel}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Stirrup Group" Height="450" Width="400" MaxHeight="450" MaxWidth="400" MinHeight="450" MinWidth="400" WindowStartupLocation="CenterScreen">
|
||||||
|
<DockPanel>
|
||||||
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
|
<ToolBar ToolTip="Stirrups" DataContext="{Binding Stirrups}">
|
||||||
|
<Button Style="{StaticResource ToolButton}"
|
||||||
|
Command="{Binding Add}"
|
||||||
|
CommandParameter="{x:Static enums:StirrupTypes.GroupOfStirrups}">
|
||||||
|
<Button.ToolTip>
|
||||||
|
<uc:ButtonToolTipEh HeaderText="Add group of stirrup"
|
||||||
|
IconContent="{StaticResource TreeGroup}"
|
||||||
|
DescriptionText="Adds group of stirrup which can contain several types of child stirrups at the same time"/>
|
||||||
|
</Button.ToolTip>
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource TreeGroup}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Style="{StaticResource ToolButton}"
|
||||||
|
Command="{Binding Add}"
|
||||||
|
CommandParameter="{x:Static enums:StirrupTypes.Density}">
|
||||||
|
<Button.ToolTip>
|
||||||
|
<uc:ButtonToolTipEh HeaderText="Add stirrups by density"
|
||||||
|
IconContent="{StaticResource StirrupDensity}"
|
||||||
|
DescriptionText="Adds uniformly distributed stirrups by value of density"/>
|
||||||
|
</Button.ToolTip>
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource StirrupDensity}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Style="{StaticResource ToolButton}"
|
||||||
|
Command="{Binding Add}"
|
||||||
|
CommandParameter="{x:Static enums:StirrupTypes.UniformRebar}">
|
||||||
|
<Button.ToolTip>
|
||||||
|
<uc:ButtonToolTipEh HeaderText="Add stirrup by rebars"
|
||||||
|
IconContent="{StaticResource StirrupRebars}"
|
||||||
|
DescriptionText="Adds uniformly distributed stirrups by rebars (step, diameter, strength)"/>
|
||||||
|
</Button.ToolTip>
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource StirrupRebars}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
<Button Style="{StaticResource ToolButton}"
|
||||||
|
Command="{Binding Add}"
|
||||||
|
CommandParameter="{x:Static enums:StirrupTypes.InclinedRebar}">
|
||||||
|
<Button.ToolTip>
|
||||||
|
<uc:ButtonToolTipEh HeaderText="Add inclined rebar"
|
||||||
|
IconContent="{StaticResource StirrupInclinedRebar}"
|
||||||
|
DescriptionText="Adds inclined rebar by its diameter and strength"/>
|
||||||
|
</Button.ToolTip>
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl ContentTemplate="{DynamicResource StirrupInclinedRebar}"/>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
</ToolBar>
|
||||||
|
</ToolBarTray>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="Name"/>
|
||||||
|
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||||
|
<Grid Grid.Row="1" Grid.ColumnSpan="2" DataContext="{Binding Stirrups}">
|
||||||
|
<ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" ContextMenu="{StaticResource EditCopyDelete}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="{Binding Name}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||||
|
</Grid>
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
36
StructureHelper/Windows/BeamShears/StirrupGroupView.xaml.cs
Normal file
36
StructureHelper/Windows/BeamShears/StirrupGroupView.xaml.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.BeamShears
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для StirrupGroupView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class StirrupGroupView : Window
|
||||||
|
{
|
||||||
|
StirrupGroupViewModel viewModel;
|
||||||
|
public StirrupGroupView(StirrupGroupViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
this.viewModel.ParentWindow = this;
|
||||||
|
this.DataContext = this.viewModel;
|
||||||
|
}
|
||||||
|
public StirrupGroupView(IStirrupGroup stirrupGroup) : this(new StirrupGroupViewModel(stirrupGroup))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
StructureHelper/Windows/BeamShears/StirrupGroupViewModel.cs
Normal file
28
StructureHelper/Windows/BeamShears/StirrupGroupViewModel.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using StructureHelper.Windows.ViewModels;
|
||||||
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StructureHelper.Windows.BeamShears
|
||||||
|
{
|
||||||
|
public class StirrupGroupViewModel : OkCancelViewModelBase
|
||||||
|
{
|
||||||
|
private IStirrupGroup _stirrupGroup;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get => _stirrupGroup.Name;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_stirrupGroup.Name = value;
|
||||||
|
OnPropertyChanged(nameof(Name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public BeamStirrupsViewModel Stirrups { get; }
|
||||||
|
|
||||||
|
public StirrupGroupViewModel(IStirrupGroup stirrupGroup)
|
||||||
|
{
|
||||||
|
_stirrupGroup = stirrupGroup;
|
||||||
|
Stirrups = new(_stirrupGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -91,7 +91,8 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
|||||||
return new FileVersion()
|
return new FileVersion()
|
||||||
{
|
{
|
||||||
VersionNumber = 1,
|
VersionNumber = 1,
|
||||||
SubVersionNumber = 2 //Add Beam shear analysis
|
//SubVersionNumber = 2 //Add Beam shear analysis
|
||||||
|
SubVersionNumber = 3 //Add stirrup group and inclined rebar
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.BeamShears
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Implements properies of stirrup by inclined rebar
|
||||||
|
/// </summary>
|
||||||
|
public interface IStirrupByInclinedRebar : IStirrup
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Coordinate of start point of inclination, m
|
||||||
|
/// </summary>
|
||||||
|
double StartCoordinate { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Distance beetwen start/end point and point where rebar work is started
|
||||||
|
/// </summary>
|
||||||
|
double OffSet { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Angle of inclination of rebar in degrees
|
||||||
|
/// </summary>
|
||||||
|
double AngleOfInclination { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,10 @@ namespace StructureHelperLogics.Models.BeamShears
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
IReinforcementLibMaterial Material { get; set; }
|
IReinforcementLibMaterial Material { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// True if hoop is spiral one
|
||||||
|
/// </summary>
|
||||||
|
bool IsSpiral { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// Count of legs of stirrup in specific cross-section
|
/// Count of legs of stirrup in specific cross-section
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double LegCount { get; set; }
|
double LegCount { get; set; }
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.Models.BeamShears
|
namespace StructureHelperLogics.Models.BeamShears
|
||||||
{
|
{
|
||||||
public interface IStirrupGroup : IStirrup
|
public interface IStirrupGroup : IStirrup, IHasStirrups
|
||||||
{
|
{
|
||||||
List<IStirrup> Stirrups { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
|||||||
|
|
||||||
private void InitializeStrategies()
|
private void InitializeStrategies()
|
||||||
{
|
{
|
||||||
convertStrategy ??= new StirrupByRebarToDensityConvertStrategy(TraceLogger);
|
convertStrategy ??= new StirrupByRebarToDensityConvertStrategy(TraceLogger, inclinedSection);
|
||||||
IStirrupByDensity stirrupByDensity = convertStrategy.Convert(stirrupByRebar);
|
IStirrupByDensity stirrupByDensity = convertStrategy.Convert(stirrupByRebar);
|
||||||
stirrupDensityStrengthLogic ??= new(stirrupEffectiveness, stirrupByDensity, inclinedSection, TraceLogger);
|
stirrupDensityStrengthLogic ??= new(stirrupEffectiveness, stirrupByDensity, inclinedSection, TraceLogger);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
|
|
||||||
@@ -8,13 +9,15 @@ namespace StructureHelperLogics.Models.BeamShears
|
|||||||
{
|
{
|
||||||
private const double stirrupStrengthFactor = 0.8d;
|
private const double stirrupStrengthFactor = 0.8d;
|
||||||
private const double maxStirrupStrength = 3e8;
|
private const double maxStirrupStrength = 3e8;
|
||||||
|
private IInclinedSection inclinedSection;
|
||||||
private IUpdateStrategy<IStirrup> updateStrategy;
|
private IUpdateStrategy<IStirrup> updateStrategy;
|
||||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
public IShiftTraceLogger TraceLogger { get; set; }
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
public StirrupByRebarToDensityConvertStrategy(IShiftTraceLogger traceLogger)
|
public StirrupByRebarToDensityConvertStrategy(IShiftTraceLogger traceLogger, IInclinedSection inclinedSection)
|
||||||
{
|
{
|
||||||
TraceLogger = traceLogger;
|
TraceLogger = traceLogger;
|
||||||
|
this.inclinedSection = inclinedSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StirrupByRebarToDensityConvertStrategy(IUpdateStrategy<IStirrup> updateStrategy, IShiftTraceLogger traceLogger)
|
public StirrupByRebarToDensityConvertStrategy(IUpdateStrategy<IStirrup> updateStrategy, IShiftTraceLogger traceLogger)
|
||||||
@@ -42,9 +45,33 @@ namespace StructureHelperLogics.Models.BeamShears
|
|||||||
TraceLogger?.AddMessage($"Strength of rebar Rsw = {stirrupStrengthFactor} * {materialStrength} = {stirrupStrength}(Pa)");
|
TraceLogger?.AddMessage($"Strength of rebar Rsw = {stirrupStrengthFactor} * {materialStrength} = {stirrupStrength}(Pa)");
|
||||||
double minimizedStrength = Math.Min(stirrupStrength, maxStirrupStrength);
|
double minimizedStrength = Math.Min(stirrupStrength, maxStirrupStrength);
|
||||||
TraceLogger?.AddMessage($"Strength of rebar Rsw = Min({stirrupStrength}, {maxStirrupStrength})= {minimizedStrength}(Pa)");
|
TraceLogger?.AddMessage($"Strength of rebar Rsw = Min({stirrupStrength}, {maxStirrupStrength})= {minimizedStrength}(Pa)");
|
||||||
double density = minimizedStrength * area * source.LegCount / source.Spacing;
|
double spiralEffectiveness = 1;
|
||||||
TraceLogger?.AddMessage($"Density of stirrups = {minimizedStrength} * {area} * {source.LegCount} / {source.Spacing} = {density}(N/m)");
|
if (source.IsSpiral = true)
|
||||||
|
{
|
||||||
|
spiralEffectiveness = GetSpiralEffectiveness(source);
|
||||||
|
}
|
||||||
|
double density = minimizedStrength * area * source.LegCount / source.Spacing * spiralEffectiveness;
|
||||||
|
TraceLogger?.AddMessage($"Density of stirrups = {minimizedStrength} * {area} * {source.LegCount} / {source.Spacing} * {spiralEffectiveness} = {density}(N/m)");
|
||||||
return density;
|
return density;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double GetSpiralEffectiveness(IStirrupByRebar source)
|
||||||
|
{
|
||||||
|
if (inclinedSection is null)
|
||||||
|
{
|
||||||
|
string errorString = ErrorStrings.ParameterIsNull + ": Inclined Section";
|
||||||
|
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
throw new StructureHelperException(errorString);
|
||||||
|
}
|
||||||
|
double spiralHeight = inclinedSection.EffectiveDepth - (inclinedSection.FullDepth - inclinedSection.EffectiveDepth);
|
||||||
|
TraceLogger?.AddMessage($"Spiral height = {spiralHeight}(m)");
|
||||||
|
double spiralSpacing = source.Spacing;
|
||||||
|
TraceLogger?.AddMessage($"Spiral spacing = {spiralSpacing}(m)");
|
||||||
|
double spiralAng = Math.Atan2(spiralHeight, spiralSpacing);
|
||||||
|
double spriralEffectiveness = Math.Sin(spiralAng);
|
||||||
|
double spiralAngInDegrees = 180 / (Math.PI) * spiralAng;
|
||||||
|
TraceLogger?.AddMessage($"Spiral effectiveness factor = sin({spiralAngInDegrees}(deg)) = {spriralEffectiveness}");
|
||||||
|
return spriralEffectiveness;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
|||||||
targetObject.Diameter = sourceObject.Diameter;
|
targetObject.Diameter = sourceObject.Diameter;
|
||||||
targetObject.LegCount = sourceObject.LegCount;
|
targetObject.LegCount = sourceObject.LegCount;
|
||||||
targetObject.Spacing = sourceObject.Spacing;
|
targetObject.Spacing = sourceObject.Spacing;
|
||||||
|
targetObject.IsSpiral = sourceObject.IsSpiral;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,49 +13,74 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
|
|||||||
{
|
{
|
||||||
private IUpdateStrategy<IStirrupByDensity> densityUpdateStrategy;
|
private IUpdateStrategy<IStirrupByDensity> densityUpdateStrategy;
|
||||||
private IUpdateStrategy<IStirrupByRebar> uniformUpdateStrategy;
|
private IUpdateStrategy<IStirrupByRebar> uniformUpdateStrategy;
|
||||||
|
private IUpdateStrategy<IStirrupGroup> groupUpdateStrategy;
|
||||||
|
private IUpdateStrategy<IStirrupByInclinedRebar> inclinedUpdateStrategy;
|
||||||
|
|
||||||
public void Update(IStirrup targetObject, IStirrup sourceObject)
|
public void Update(IStirrup targetObject, IStirrup sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.IsNull(targetObject);
|
CheckObject.IsNull(targetObject);
|
||||||
CheckObject.IsNull(sourceObject);
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
if (sourceObject is IStirrupByDensity density)
|
if (sourceObject is IStirrupGroup group)
|
||||||
{
|
{
|
||||||
UpdateByDensity(targetObject, density);
|
UpdateGroup(targetObject, group);
|
||||||
}
|
}
|
||||||
else if (sourceObject is IStirrupByRebar stirrupByUniformRebar)
|
else if (sourceObject is IStirrupByRebar stirrupByUniformRebar)
|
||||||
{
|
{
|
||||||
UpdateByUniformRebar(targetObject, stirrupByUniformRebar);
|
UpdateByUniformRebar(targetObject, stirrupByUniformRebar);
|
||||||
}
|
}
|
||||||
|
else if (sourceObject is IStirrupByDensity density)
|
||||||
|
{
|
||||||
|
UpdateByDensity(targetObject, density);
|
||||||
|
}
|
||||||
|
else if (sourceObject is IStirrupByInclinedRebar inclinedRebar)
|
||||||
|
{
|
||||||
|
UpdateByInclinedRebar(targetObject, inclinedRebar);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(sourceObject));
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(sourceObject));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateByUniformRebar(IStirrup targetObject, IStirrupByRebar stirrupByUniformRebar)
|
private void UpdateByInclinedRebar(IStirrup targetObject, IStirrupByInclinedRebar surceInclinedRebar)
|
||||||
{
|
{
|
||||||
uniformUpdateStrategy ??= new StirrupByRebarUpdateStrategy();
|
if (targetObject is not IStirrupByInclinedRebar targetInclinedRebar)
|
||||||
if (targetObject is IStirrupByRebar targetUniformRebar)
|
|
||||||
{
|
|
||||||
uniformUpdateStrategy.Update(targetUniformRebar, stirrupByUniformRebar);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
||||||
}
|
}
|
||||||
|
inclinedUpdateStrategy ??= new StirrupByInclinedRebarUpdateStrategy();
|
||||||
|
inclinedUpdateStrategy.Update(targetInclinedRebar, surceInclinedRebar);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateGroup(IStirrup targetObject, IStirrupGroup sourceGroup)
|
||||||
|
{
|
||||||
|
if (targetObject is not IStirrupGroup targetGroup)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
||||||
|
}
|
||||||
|
groupUpdateStrategy ??= new StirrupGroupUpdateStrategy();
|
||||||
|
groupUpdateStrategy.Update(targetGroup, sourceGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateByUniformRebar(IStirrup targetObject, IStirrupByRebar stirrupByUniformRebar)
|
||||||
|
{
|
||||||
|
if (targetObject is not IStirrupByRebar targetUniformRebar)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
||||||
|
}
|
||||||
|
uniformUpdateStrategy ??= new StirrupByRebarUpdateStrategy();
|
||||||
|
uniformUpdateStrategy.Update(targetUniformRebar, stirrupByUniformRebar);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateByDensity(IStirrup targetObject, IStirrupByDensity density)
|
private void UpdateByDensity(IStirrup targetObject, IStirrupByDensity density)
|
||||||
{
|
{
|
||||||
densityUpdateStrategy ??= new StirrupByDensityUpdateStrategy();
|
if (targetObject is not IStirrupByDensity targetDensity)
|
||||||
if (targetObject is IStirrupByDensity targetDensity)
|
|
||||||
{
|
|
||||||
densityUpdateStrategy.Update(targetDensity, density);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
||||||
}
|
}
|
||||||
|
densityUpdateStrategy ??= new StirrupByDensityUpdateStrategy();
|
||||||
|
densityUpdateStrategy.Update(targetDensity, density);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.BeamShears
|
||||||
|
{
|
||||||
|
public class StirrupByInclinedRebarUpdateStrategy : IUpdateStrategy<IStirrupByInclinedRebar>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IStirrup>? baseUpdateStrategy;
|
||||||
|
public void Update(IStirrupByInclinedRebar targetObject, IStirrupByInclinedRebar sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||||
|
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
baseUpdateStrategy ??= new StirrupBaseUpdateStrategy();
|
||||||
|
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
targetObject.StartCoordinate = sourceObject.StartCoordinate;
|
||||||
|
targetObject.OffSet = sourceObject.OffSet;
|
||||||
|
targetObject.AngleOfInclination = sourceObject.AngleOfInclination;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.BeamShears
|
||||||
|
{
|
||||||
|
public class StirrupGroupUpdateStrategy : IUpdateStrategy<IStirrupGroup>
|
||||||
|
{
|
||||||
|
private StirrupBaseUpdateStrategy baseUpdateStrategy;
|
||||||
|
|
||||||
|
public void Update(IStirrupGroup targetObject, IStirrupGroup sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||||
|
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
baseUpdateStrategy ??= new StirrupBaseUpdateStrategy();
|
||||||
|
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
|
CheckObject.IsNull(sourceObject.Stirrups);
|
||||||
|
CheckObject.IsNull(targetObject.Stirrups);
|
||||||
|
targetObject.Stirrups.Clear();
|
||||||
|
foreach (var item in sourceObject.Stirrups)
|
||||||
|
{
|
||||||
|
IStirrup? newItem = item.Clone() as IStirrup;
|
||||||
|
targetObject.Stirrups.Add(newItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.BeamShears
|
||||||
|
{
|
||||||
|
public class StirrupByInclinedRebar : IStirrupByInclinedRebar
|
||||||
|
{
|
||||||
|
private const int minInclinationAngle = 10;
|
||||||
|
private const int maxInclinationAngle = 80;
|
||||||
|
private double angleOfInclination = 45;
|
||||||
|
private double startCoordinate = 0.05;
|
||||||
|
private double compressedGap = 0.05;
|
||||||
|
|
||||||
|
/// <inheritdoc>
|
||||||
|
public Guid Id { get; }
|
||||||
|
public string? Name { get; set; } = string.Empty;
|
||||||
|
/// <inheritdoc>
|
||||||
|
public double CompressedGap
|
||||||
|
{
|
||||||
|
get => compressedGap;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.IncorrectValue + $": distance from compressed edge must be positive");
|
||||||
|
}
|
||||||
|
compressedGap = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <inheritdoc>
|
||||||
|
public double StartCoordinate
|
||||||
|
{
|
||||||
|
get => startCoordinate;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.IncorrectValue + $": start coordinate must be positive");
|
||||||
|
}
|
||||||
|
startCoordinate = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <inheritdoc>
|
||||||
|
public double OffSet { get; set; } = 0.05;
|
||||||
|
/// <inheritdoc>
|
||||||
|
public double AngleOfInclination
|
||||||
|
{
|
||||||
|
get => angleOfInclination;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < minInclinationAngle || value > maxInclinationAngle)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.IncorrectValue + $": angle of inclination of rebar must be beetwen {minInclinationAngle} and {maxInclinationAngle} degrees");
|
||||||
|
}
|
||||||
|
angleOfInclination = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public StirrupByInclinedRebar(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
var logic = new StirrupByInclinedRebarUpdateStrategy();
|
||||||
|
StirrupByInclinedRebar newItem = new(Guid.NewGuid());
|
||||||
|
logic.Update(newItem, this);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,7 +29,8 @@ namespace StructureHelperLogics.Models.BeamShears
|
|||||||
}
|
}
|
||||||
legCount = value;
|
legCount = value;
|
||||||
}
|
}
|
||||||
} /// <inheritdoc/>
|
}
|
||||||
|
/// <inheritdoc/>
|
||||||
public double Diameter
|
public double Diameter
|
||||||
{
|
{
|
||||||
get => diameter; set
|
get => diameter; set
|
||||||
@@ -44,7 +45,8 @@ namespace StructureHelperLogics.Models.BeamShears
|
|||||||
}
|
}
|
||||||
diameter = value;
|
diameter = value;
|
||||||
}
|
}
|
||||||
} /// <inheritdoc/>
|
}
|
||||||
|
/// <inheritdoc/>
|
||||||
public double Spacing
|
public double Spacing
|
||||||
{
|
{
|
||||||
get => step; set
|
get => step; set
|
||||||
@@ -55,8 +57,11 @@ namespace StructureHelperLogics.Models.BeamShears
|
|||||||
}
|
}
|
||||||
step = value;
|
step = value;
|
||||||
}
|
}
|
||||||
} /// <inheritdoc/>
|
}
|
||||||
|
/// <inheritdoc/>
|
||||||
public double CompressedGap { get; set; } = 0;
|
public double CompressedGap { get; set; } = 0;
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public bool IsSpiral { get; set; } = false;
|
||||||
|
|
||||||
public StirrupByRebar(Guid id)
|
public StirrupByRebar(Guid id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -9,18 +10,21 @@ namespace StructureHelperLogics.Models.BeamShears
|
|||||||
public class StirrupGroup : IStirrupGroup
|
public class StirrupGroup : IStirrupGroup
|
||||||
{
|
{
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
public List<IStirrup> Stirrups { get; } = new();
|
public List<IStirrup> Stirrups { get; } = new();
|
||||||
public double CompressedGap { get; set; }
|
public double CompressedGap { get; set; }
|
||||||
|
|
||||||
public double GetShearBearingCapacity(IInclinedSection inclinedSection)
|
public StirrupGroup(Guid id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
Id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var updateStrategy = new StirrupGroupUpdateStrategy();
|
||||||
|
StirrupGroup newItem = new(Guid.NewGuid());
|
||||||
|
updateStrategy.Update(newItem, this);
|
||||||
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
|
||||||
using StructureHelperCommon.Models.Forces.Logics;
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
@@ -19,6 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
private bool result;
|
private bool result;
|
||||||
private string checkResult;
|
private string checkResult;
|
||||||
private ICheckEntityLogic<IAccuracy> checkAccuracyLogic;
|
private ICheckEntityLogic<IAccuracy> checkAccuracyLogic;
|
||||||
|
private ICheckEntityLogic<IHasPrimitives> checkPrimitiveCollectionLogic;
|
||||||
|
|
||||||
public IForceCalculatorInputData InputData { get; set; }
|
public IForceCalculatorInputData InputData { get; set; }
|
||||||
|
|
||||||
@@ -66,11 +61,32 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
TraceMessage("Calculator does not contain any calc term");
|
TraceMessage("Calculator does not contain any calc term");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
CheckPrimitives();
|
||||||
CheckAccuracy();
|
CheckAccuracy();
|
||||||
CheckActions();
|
CheckActions();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckPrimitives()
|
||||||
|
{
|
||||||
|
checkPrimitiveCollectionLogic ??= new CheckPrimitiveCollectionLogic(
|
||||||
|
TraceLogger,
|
||||||
|
new CheckRebarPrimitiveLogic()
|
||||||
|
{
|
||||||
|
CheckRebarHostMaterial = false,
|
||||||
|
CheckRebarPlacement = false
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Entity = InputData,
|
||||||
|
};
|
||||||
|
if (checkPrimitiveCollectionLogic.Check() == false)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
TraceMessage(checkPrimitiveCollectionLogic.CheckResult);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckActions()
|
private void CheckActions()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckForceActionsLogic()
|
var checkLogic = new CheckForceActionsLogic()
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
|
||||||
using StructureHelperCommon.Models.Forces.Logics;
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using StructureHelperCommon.Models.Materials;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Media.Animation;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
@@ -22,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
public class CheckCrackCalculatorInputDataLogic : ICheckInputDataLogic<ICrackCalculatorInputData>
|
public class CheckCrackCalculatorInputDataLogic : ICheckInputDataLogic<ICrackCalculatorInputData>
|
||||||
{
|
{
|
||||||
private bool result;
|
private bool result;
|
||||||
private ICheckPrimitiveCollectionLogic checkPrimitiveCollectionLogic;
|
private ICheckEntityLogic<IHasPrimitives> checkPrimitiveCollectionLogic;
|
||||||
|
|
||||||
public ICrackCalculatorInputData InputData { get; set; }
|
public ICrackCalculatorInputData InputData { get; set; }
|
||||||
|
|
||||||
@@ -31,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public CheckCrackCalculatorInputDataLogic(ICheckPrimitiveCollectionLogic checkPrimitiveCollectionLogic)
|
public CheckCrackCalculatorInputDataLogic(ICheckEntityLogic<IHasPrimitives> checkPrimitiveCollectionLogic)
|
||||||
{
|
{
|
||||||
this.checkPrimitiveCollectionLogic = checkPrimitiveCollectionLogic;
|
this.checkPrimitiveCollectionLogic = checkPrimitiveCollectionLogic;
|
||||||
}
|
}
|
||||||
@@ -57,7 +49,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + ": check primitive logic");
|
throw new StructureHelperException(ErrorStrings.ParameterIsNull + ": check primitive logic");
|
||||||
}
|
}
|
||||||
checkPrimitiveCollectionLogic.HasPrimitives = InputData;
|
checkPrimitiveCollectionLogic.Entity = InputData;
|
||||||
checkPrimitiveCollectionLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger();
|
checkPrimitiveCollectionLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger();
|
||||||
if (checkPrimitiveCollectionLogic.Check() == false)
|
if (checkPrimitiveCollectionLogic.Check() == false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,22 +11,24 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||||
{
|
{
|
||||||
public class CheckPrimitiveCollectionLogic : ICheckPrimitiveCollectionLogic
|
public class CheckPrimitiveCollectionLogic : ICheckEntityLogic<IHasPrimitives>
|
||||||
{
|
{
|
||||||
private const string collectionDoesntHaveAnyPrimitives = "Calculator does not contain any primitives\n";
|
private const string collectionDoesntHaveAnyPrimitives = "Calculator does not contain any primitives\n";
|
||||||
private const string checkRebarLogic = ": check rebar logic";
|
private const string checkRebarLogic = ": check rebar logic";
|
||||||
|
|
||||||
private string checkResult;
|
private string checkResult;
|
||||||
private bool result;
|
private bool result;
|
||||||
private ICheckRebarPrimitiveLogic checkRebarPrimitiveLogic;
|
private ICheckEntityLogic<IRebarNdmPrimitive> checkRebarPrimitiveLogic;
|
||||||
|
|
||||||
public IHasPrimitives HasPrimitives { get; set; }
|
public IHasPrimitives Entity { get; set; }
|
||||||
|
|
||||||
public string CheckResult => checkResult;
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public CheckPrimitiveCollectionLogic(IShiftTraceLogger shiftTraceLogger, ICheckRebarPrimitiveLogic checkRebarPrimitiveLogic)
|
public CheckPrimitiveCollectionLogic(
|
||||||
|
IShiftTraceLogger shiftTraceLogger,
|
||||||
|
ICheckEntityLogic<IRebarNdmPrimitive> checkRebarPrimitiveLogic)
|
||||||
{
|
{
|
||||||
TraceLogger = shiftTraceLogger;
|
TraceLogger = shiftTraceLogger;
|
||||||
this.checkRebarPrimitiveLogic = checkRebarPrimitiveLogic;
|
this.checkRebarPrimitiveLogic = checkRebarPrimitiveLogic;
|
||||||
@@ -47,7 +49,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
|||||||
|
|
||||||
private void CheckPrimitives()
|
private void CheckPrimitives()
|
||||||
{
|
{
|
||||||
if (HasPrimitives.Primitives is null || (!HasPrimitives.Primitives.Any()))
|
if (Entity.Primitives is null || (!Entity.Primitives.Any()))
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
checkResult += collectionDoesntHaveAnyPrimitives;
|
checkResult += collectionDoesntHaveAnyPrimitives;
|
||||||
@@ -55,7 +57,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var primitive in HasPrimitives.Primitives)
|
foreach (var primitive in Entity.Primitives)
|
||||||
{
|
{
|
||||||
if (primitive is IRebarNdmPrimitive rebar)
|
if (primitive is IRebarNdmPrimitive rebar)
|
||||||
{
|
{
|
||||||
@@ -71,7 +73,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
|||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + checkRebarLogic);
|
throw new StructureHelperException(ErrorStrings.ParameterIsNull + checkRebarLogic);
|
||||||
}
|
}
|
||||||
checkRebarPrimitiveLogic.RebarPrimitive = rebar;
|
checkRebarPrimitiveLogic.Entity = rebar;
|
||||||
checkRebarPrimitiveLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger();
|
checkRebarPrimitiveLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger();
|
||||||
if (checkRebarPrimitiveLogic.Check() == false)
|
if (checkRebarPrimitiveLogic.Check() == false)
|
||||||
{
|
{
|
||||||
@@ -79,7 +81,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
|||||||
checkResult += checkRebarPrimitiveLogic.CheckResult;
|
checkResult += checkRebarPrimitiveLogic.CheckResult;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool isPrimitivesContainRebarHost = HasPrimitives.Primitives.Contains(rebar.HostPrimitive);
|
bool isPrimitivesContainRebarHost = Entity.Primitives.Contains(rebar.HostPrimitive);
|
||||||
if (isPrimitivesContainRebarHost == false)
|
if (isPrimitivesContainRebarHost == false)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Materials;
|
using StructureHelperCommon.Models.Materials;
|
||||||
using System;
|
using System;
|
||||||
@@ -9,12 +10,14 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||||
{
|
{
|
||||||
public class CheckRebarPrimitiveLogic : ICheckRebarPrimitiveLogic
|
public class CheckRebarPrimitiveLogic : ICheckEntityLogic<IRebarNdmPrimitive>
|
||||||
{
|
{
|
||||||
private string checkResult;
|
private string checkResult;
|
||||||
private bool result;
|
private bool result;
|
||||||
|
|
||||||
public IRebarNdmPrimitive RebarPrimitive { get; set; }
|
public bool CheckRebarPlacement { get; set; } = true;
|
||||||
|
public bool CheckRebarHostMaterial { get; set; } = true;
|
||||||
|
public IRebarNdmPrimitive Entity { get; set; }
|
||||||
|
|
||||||
public string CheckResult => checkResult;
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
@@ -40,33 +43,47 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
|||||||
|
|
||||||
private void CheckRebar()
|
private void CheckRebar()
|
||||||
{
|
{
|
||||||
if (RebarPrimitive.HostPrimitive is null)
|
if (Entity.HostPrimitive is null)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
string message = $"Primitive {RebarPrimitive.Name} does not have a host\n";
|
string message = $"Primitive {Entity.Name} does not have a host\n";
|
||||||
checkResult += message;
|
checkResult += message;
|
||||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (CheckRebarPlacement == true)
|
||||||
if (RebarPrimitive.HostPrimitive is IHasDivisionSize division)
|
|
||||||
{
|
{
|
||||||
if (!division.IsPointInside(RebarPrimitive.Center))
|
CheckIfRebarInsideHostPrimitive();
|
||||||
|
}
|
||||||
|
if (CheckRebarHostMaterial == true)
|
||||||
|
{
|
||||||
|
CheckIfRemarMaterialIsCrackedMaterial();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckIfRemarMaterialIsCrackedMaterial()
|
||||||
|
{
|
||||||
|
if (Entity.HostPrimitive.NdmElement.HeadMaterial.HelperMaterial is not ICrackedMaterial)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
string message = $"Primitive of rebar {RebarPrimitive.Name} is out of its host {RebarPrimitive.HostPrimitive.Name}";
|
string message = $"Material of host of {Entity.Name} ({Entity.HostPrimitive.NdmElement.HeadMaterial.Name}) does not support cracking\n";
|
||||||
checkResult += message;
|
checkResult += message;
|
||||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RebarPrimitive.HostPrimitive.NdmElement.HeadMaterial.HelperMaterial is not ICrackedMaterial)
|
private void CheckIfRebarInsideHostPrimitive()
|
||||||
|
{
|
||||||
|
if (Entity.HostPrimitive is IHasDivisionSize division)
|
||||||
|
{
|
||||||
|
if (!division.IsPointInside(Entity.Center))
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
string message = $"Material of host of {RebarPrimitive.Name} ({RebarPrimitive.HostPrimitive.NdmElement.HeadMaterial.Name}) does not support cracking\n";
|
string message = $"Primitive of rebar {Entity.Name} is out of its host {Entity.HostPrimitive.Name}";
|
||||||
checkResult += message;
|
checkResult += message;
|
||||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
|
||||||
{
|
|
||||||
public interface ICheckPrimitiveCollectionLogic : ICheckLogic
|
|
||||||
{
|
|
||||||
IHasPrimitives HasPrimitives { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
|
||||||
{
|
|
||||||
public interface ICheckRebarPrimitiveLogic : ICheckLogic
|
|
||||||
{
|
|
||||||
IRebarNdmPrimitive RebarPrimitive { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -53,6 +53,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
|
|
||||||
public Ndm GetConcreteNdm()
|
public Ndm GetConcreteNdm()
|
||||||
{
|
{
|
||||||
|
//#error //fix check rebar for host null
|
||||||
var hostPrimitive = options.HostPrimitive;
|
var hostPrimitive = options.HostPrimitive;
|
||||||
var material = hostPrimitive
|
var material = hostPrimitive
|
||||||
.NdmElement
|
.NdmElement
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace StructureHelperTests.UnitTests.Ndms
|
|||||||
CallBase = true
|
CallBase = true
|
||||||
};
|
};
|
||||||
|
|
||||||
_mockCheckPrimitiveCollectionLogic.Object.HasPrimitives = _mockHasPrimitives.Object;
|
_mockCheckPrimitiveCollectionLogic.Object.Entity = _mockHasPrimitives.Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace StructureHelperTests.UnitTests.Ndms
|
|||||||
|
|
||||||
_checkRebarPrimitiveLogic = new CheckRebarPrimitiveLogic(_mockTraceLogger.Object)
|
_checkRebarPrimitiveLogic = new CheckRebarPrimitiveLogic(_mockTraceLogger.Object)
|
||||||
{
|
{
|
||||||
RebarPrimitive = _mockRebarPrimitive.Object
|
Entity = _mockRebarPrimitive.Object
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user