Crack Calculator was added
This commit is contained in:
@@ -53,5 +53,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
OnPropertyChanged(nameof(PrimitiveLeft));
|
||||
OnPropertyChanged(nameof(PrimitiveTop));
|
||||
}
|
||||
public override void Refresh()
|
||||
{
|
||||
OnPropertyChanged(nameof(Diameter));
|
||||
OnPropertyChanged(nameof(PrimitiveLeft));
|
||||
OnPropertyChanged(nameof(PrimitiveTop));
|
||||
base.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,11 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
return primitive;
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
RefreshPlacement();
|
||||
base.Refresh();
|
||||
}
|
||||
private void RefreshPlacement()
|
||||
{
|
||||
OnPropertyChanged(nameof(Area));
|
||||
|
||||
@@ -39,19 +39,19 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
}
|
||||
public double CenterX
|
||||
{
|
||||
get => primitive.CenterX;
|
||||
get => primitive.Center.X;
|
||||
set
|
||||
{
|
||||
primitive.CenterX = value;
|
||||
primitive.Center.X = value;
|
||||
OnPropertyChanged(nameof(CenterX));
|
||||
}
|
||||
}
|
||||
public double CenterY
|
||||
{
|
||||
get => primitive.CenterY;
|
||||
get => primitive.Center.Y;
|
||||
set
|
||||
{
|
||||
primitive.CenterY = value;
|
||||
primitive.Center.Y = value;
|
||||
OnPropertyChanged(nameof(CenterY));
|
||||
OnPropertyChanged(nameof(InvertedCenterY));
|
||||
}
|
||||
@@ -261,5 +261,16 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
public virtual void Refresh()
|
||||
{
|
||||
OnPropertyChanged(nameof(Name));
|
||||
OnPropertyChanged(nameof(Color));
|
||||
OnPropertyChanged(nameof(CenterX));
|
||||
OnPropertyChanged(nameof(CenterY));
|
||||
OnPropertyChanged(nameof(SetMaterialColor));
|
||||
OnPropertyChanged(nameof(Triangulate));
|
||||
OnPropertyChanged(nameof(PrimitiveWidth));
|
||||
OnPropertyChanged(nameof(PrimitiveHeight));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
var circle = primitive as ICirclePrimitive;
|
||||
viewItem = new CircleViewPrimitive(circle);
|
||||
}
|
||||
else if (primitive is IPointPrimitive & primitive is not ReinforcementPrimitive)
|
||||
else if (primitive is IPointPrimitive & primitive is not RebarPrimitive)
|
||||
{
|
||||
var point = primitive as IPointPrimitive;
|
||||
viewItem = new PointViewPrimitive(point);
|
||||
}
|
||||
else if (primitive is ReinforcementPrimitive)
|
||||
else if (primitive is RebarPrimitive)
|
||||
{
|
||||
var point = primitive as ReinforcementPrimitive;
|
||||
var point = primitive as RebarPrimitive;
|
||||
viewItem = new ReinforcementViewPrimitive(point);
|
||||
}
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Actual type: {primitive.GetType()}");
|
||||
|
||||
@@ -42,7 +42,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
primitive = _primitive;
|
||||
DivisionViewModel = new HasDivisionViewModel(primitive);
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
OnPropertyChanged(nameof(PrimitiveLeft));
|
||||
OnPropertyChanged(nameof(PrimitiveTop));
|
||||
base.Refresh();
|
||||
}
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
return primitive;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public class ReinforcementViewPrimitive : PointViewPrimitive, IHasHostPrimitive
|
||||
{
|
||||
ReinforcementPrimitive primitive;
|
||||
RebarPrimitive primitive;
|
||||
|
||||
public INdmPrimitive HostPrimitive
|
||||
{
|
||||
@@ -21,9 +21,14 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
}
|
||||
}
|
||||
|
||||
public ReinforcementViewPrimitive(ReinforcementPrimitive _primitive) : base(_primitive)
|
||||
public ReinforcementViewPrimitive(RebarPrimitive _primitive) : base(_primitive)
|
||||
{
|
||||
primitive = _primitive;
|
||||
}
|
||||
public override void Refresh()
|
||||
{
|
||||
OnPropertyChanged(nameof(HostPrimitive));
|
||||
base.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,81 +0,0 @@
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Models.Primitives.Factories
|
||||
{
|
||||
internal static class PrimitiveFactory
|
||||
{
|
||||
public static IEnumerable<PrimitiveBase> GetRectangleRCElement(RectangleBeamTemplate template, IHeadMaterial concrete, IHeadMaterial reinforcement)
|
||||
{
|
||||
List<PrimitiveBase> primitives = new List<PrimitiveBase>();
|
||||
var rect = template.Shape as StructureHelperCommon.Models.Shapes.RectangleShape;
|
||||
var width = rect.Width;
|
||||
var height = rect.Height;
|
||||
var area1 = Math.PI * template.BottomDiameter * template.BottomDiameter / 4d;
|
||||
var area2 = Math.PI * template.TopDiameter * template.TopDiameter / 4d;
|
||||
var gap = template.CoverGap;
|
||||
|
||||
double[] xs = new double[] { -width / 2 + gap, width / 2 - gap };
|
||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||
|
||||
var rectangle = new RectanglePrimitive() { Width = width, Height = height, Name = "Concrete block" };
|
||||
primitives.Add(new RectangleViewPrimitive(rectangle) { HeadMaterial = concrete});
|
||||
var point = new PointPrimitive() { CenterX = xs[0], CenterY = ys[0], Area = area1};
|
||||
var viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Left bottom point" };
|
||||
viewPoint.RegisterDeltas(xs[0], ys[0]);
|
||||
primitives.Add(viewPoint);
|
||||
point = new PointPrimitive() {CenterX = xs[1], CenterY = ys[0], Area = area1 };
|
||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Right bottom point" };
|
||||
primitives.Add(viewPoint);
|
||||
point = new PointPrimitive() { CenterX = xs[0], CenterY = ys[1], Area = area2 };
|
||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Left top point" };
|
||||
primitives.Add(viewPoint);
|
||||
point = new PointPrimitive() { CenterX = xs[1], CenterY = ys[1], Area = area2 };
|
||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = "Right top point" };
|
||||
viewPoint.RegisterDeltas(xs[1], ys[1]);
|
||||
primitives.Add(viewPoint);
|
||||
|
||||
if (template.WidthCount > 2)
|
||||
{
|
||||
int count = template.WidthCount - 1;
|
||||
double dist = (xs[1] - xs[0]) / count;
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
point = new PointPrimitive() {CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1 };
|
||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Bottom point {i}" };
|
||||
primitives.Add(viewPoint);
|
||||
|
||||
point = new PointPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2 };
|
||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Top point {i}" };
|
||||
primitives.Add(viewPoint);
|
||||
}
|
||||
}
|
||||
if (template.HeightCount > 2)
|
||||
{
|
||||
int count = template.HeightCount - 1;
|
||||
double dist = (ys[1] - ys[0]) / count;
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
point = new PointPrimitive() {CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1 };
|
||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Left point {i}" };
|
||||
primitives.Add(viewPoint);
|
||||
|
||||
point = new PointPrimitive() { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1 };
|
||||
viewPoint = new PointViewPrimitive(point) { HeadMaterial = reinforcement, Name = $"Right point {i}" };
|
||||
primitives.Add(viewPoint);
|
||||
}
|
||||
}
|
||||
return primitives;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,9 +50,9 @@ namespace StructureHelper.Services.ResultViewers
|
||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||
foreach (var item in ndmPrimitives)
|
||||
{
|
||||
if (item is ReinforcementPrimitive)
|
||||
if (item is RebarPrimitive)
|
||||
{
|
||||
var primitive = item as ReinforcementPrimitive;
|
||||
var primitive = item as RebarPrimitive;
|
||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||
if (fullStrength == true)
|
||||
{
|
||||
@@ -73,9 +73,9 @@ namespace StructureHelper.Services.ResultViewers
|
||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||
foreach (var item in ndmPrimitives)
|
||||
{
|
||||
if (item is ReinforcementPrimitive)
|
||||
if (item is RebarPrimitive)
|
||||
{
|
||||
var primitive = item as ReinforcementPrimitive;
|
||||
var primitive = item as RebarPrimitive;
|
||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||
var calculator = new AnchorageCalculator(inputData);
|
||||
var val = calculator.GetBaseDevLength() * UnitConstants.Length;
|
||||
@@ -92,9 +92,9 @@ namespace StructureHelper.Services.ResultViewers
|
||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||
foreach (var item in ndmPrimitives)
|
||||
{
|
||||
if (item is ReinforcementPrimitive)
|
||||
if (item is RebarPrimitive)
|
||||
{
|
||||
var primitive = item as ReinforcementPrimitive;
|
||||
var primitive = item as RebarPrimitive;
|
||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||
if (fullStrength == true)
|
||||
{
|
||||
@@ -116,9 +116,9 @@ namespace StructureHelper.Services.ResultViewers
|
||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||
foreach (var item in ndmPrimitives)
|
||||
{
|
||||
if (item is ReinforcementPrimitive)
|
||||
if (item is RebarPrimitive)
|
||||
{
|
||||
var primitive = item as ReinforcementPrimitive;
|
||||
var primitive = item as RebarPrimitive;
|
||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, lapperdCountRate);
|
||||
if (fullStrength == true)
|
||||
{
|
||||
@@ -138,8 +138,8 @@ namespace StructureHelper.Services.ResultViewers
|
||||
{
|
||||
var valuePrimitive = new FieldVisualizer.Entities.Values.Primitives.CirclePrimitive()
|
||||
{
|
||||
CenterX = primitive.CenterX,
|
||||
CenterY = primitive.CenterY,
|
||||
CenterX = primitive.Center.X,
|
||||
CenterY = primitive.Center.Y,
|
||||
Diameter = Math.Sqrt(primitive.Area / Math.PI) * 2,
|
||||
Value = val
|
||||
};
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Documentation\Manuals\" />
|
||||
<Folder Include="Infrastructure\UI\DataContexts\Logics\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl>
|
||||
<TabItem Header="General">
|
||||
@@ -92,5 +92,6 @@
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
public ForceCalculatorView(ForceCalculatorViewModel _forceCalculatorViewModel)
|
||||
{
|
||||
viewModel = _forceCalculatorViewModel;
|
||||
viewModel.ParentWindow = this;
|
||||
DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
<Button Margin="3" Content="Set Prestrain" ToolTip="Set strains as auto prestrain" Command="{Binding SetPrestrainCommand}"/>
|
||||
<Button Margin="3" Content="Anchorage" ToolTip="Set strains as auto prestrain" Command="{Binding ShowAnchorageCommand}"/>
|
||||
<Button Margin="3" Content="Geometry" ToolTip="Show Geometry Properties" Command="{Binding ShowGeometryResultCommand}"/>
|
||||
<Button Margin="3" Content="Fcrc" ToolTip="Show crack force" Command="{Binding ShowCrackResultCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
<MenuItem Header="Add">
|
||||
<Button Content="Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button Content="Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||
<Button Content="Reinforcement" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}"/>
|
||||
<Button Content="Rebar" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}"/>
|
||||
<Button Content="Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
@@ -183,7 +183,7 @@
|
||||
<MenuItem Header="Add">
|
||||
<Button Content="Rectangle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button Content="Circle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||
<Button Content="Reinforcement" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}"/>
|
||||
<Button Content="Rebar" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Reinforcement}"/>
|
||||
<Button Content="Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Templates">
|
||||
|
||||
@@ -111,122 +111,129 @@
|
||||
</Expander>
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<TabControl>
|
||||
<TabItem Header="Main">
|
||||
<ScrollViewer>
|
||||
<StackPanel x:Name="StpProperties">
|
||||
<Expander Header="Common properties" IsExpanded="True">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Name"/>
|
||||
<TextBlock Grid.Row="1" Text="Name of material"/>
|
||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||
<TextBlock Grid.Row="4" Text="Triangulate"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Grid.Column="0" Margin="3">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<CheckBox Grid.Row="4" Grid.Column="1" IsChecked="{Binding Triangulate}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
<Expander Header="Prestrain" IsExpanded="False">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="User's / Auto" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="1" Text="k_x"/>
|
||||
<TextBlock Grid.Row="3" Text="k_y"/>
|
||||
<TextBlock Grid.Row="5" Text="epsilon_z"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding PrestrainKx, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding PrestrainKy, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Margin="1" Text="{Binding PrestrainEpsZ, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" IsEnabled="False" Text="{Binding AutoPrestrainKx, Converter={StaticResource Curvature}, Mode=OneWay}"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Margin="1" IsEnabled="False" Text="{Binding AutoPrestrainKy, Converter={StaticResource Curvature}, Mode=OneWay}"/>
|
||||
<TextBox Grid.Row="6" Grid.Column="1" Margin="1" IsEnabled="False" Text="{Binding AutoPrestrainEpsZ, Converter={StaticResource PlainDouble}, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="Visual">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Visible"/>
|
||||
<TextBlock Grid.Row="1" Text="Material color"/>
|
||||
<TextBlock Grid.Row="2" Text="Z-index (integer)"/>
|
||||
<TextBlock Grid.Row="3" Text="Opacity"/>
|
||||
<CheckBox Grid.Column="1" IsChecked="{Binding IsVisible}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<CheckBox IsChecked="{Binding SetMaterialColor}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,20,0"/>
|
||||
<Rectangle Width="50" Margin="5,0,10,0">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Button Width="50" Content="..." Command="{Binding EditColorCommand}"/>
|
||||
</StackPanel>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding ZIndex}"/>
|
||||
<Grid Grid.Row="3" Grid.Column="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl>
|
||||
<TabItem Header="Main">
|
||||
<ScrollViewer>
|
||||
<StackPanel x:Name="StpProperties">
|
||||
<Expander Header="Common properties" IsExpanded="True">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Name"/>
|
||||
<TextBlock Grid.Row="1" Text="Name of material"/>
|
||||
<TextBlock Grid.Row="2" Text="Center X"/>
|
||||
<TextBlock Grid.Row="3" Text="Center Y"/>
|
||||
<TextBlock Grid.Row="4" Text="Triangulate"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding PrimitiveMaterial}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Grid.Column="0" Margin="3">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding CenterX, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding CenterY, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<CheckBox Grid.Row="4" Grid.Column="1" IsChecked="{Binding Triangulate}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
<Expander Header="Prestrain" IsExpanded="False">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="User's / Auto" HorizontalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="1" Text="k_x"/>
|
||||
<TextBlock Grid.Row="3" Text="k_y"/>
|
||||
<TextBlock Grid.Row="5" Text="epsilon_z"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding PrestrainKx, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="1" Text="{Binding PrestrainKy, Converter={StaticResource Curvature}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Margin="1" Text="{Binding PrestrainEpsZ, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" IsEnabled="False" Text="{Binding AutoPrestrainKx, Converter={StaticResource Curvature}, Mode=OneWay}"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Margin="1" IsEnabled="False" Text="{Binding AutoPrestrainKy, Converter={StaticResource Curvature}, Mode=OneWay}"/>
|
||||
<TextBox Grid.Row="6" Grid.Column="1" Margin="1" IsEnabled="False" Text="{Binding AutoPrestrainEpsZ, Converter={StaticResource PlainDouble}, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="Visual">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Text="{Binding Opacity, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}" Margin="5"/>
|
||||
<Slider Grid.Column="1" Value="{Binding Opacity}" Maximum="100" TickPlacement="BottomRight" TickFrequency="10" IsSnapToTickEnabled="True" Margin="2"/>
|
||||
<TextBlock Grid.Row="0" Text="Visible"/>
|
||||
<TextBlock Grid.Row="1" Text="Material color"/>
|
||||
<TextBlock Grid.Row="2" Text="Z-index (integer)"/>
|
||||
<TextBlock Grid.Row="3" Text="Opacity"/>
|
||||
<CheckBox Grid.Column="1" IsChecked="{Binding IsVisible}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<CheckBox IsChecked="{Binding SetMaterialColor}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,20,0"/>
|
||||
<Rectangle Width="50" Margin="5,0,10,0">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Button Width="50" Content="..." Command="{Binding EditColorCommand}"/>
|
||||
</StackPanel>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Text="{Binding ZIndex}"/>
|
||||
<Grid Grid.Row="3" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Text="{Binding Opacity, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}" Margin="5"/>
|
||||
<Slider Grid.Column="1" Value="{Binding Opacity}" Maximum="100" TickPlacement="BottomRight" TickFrequency="10" IsSnapToTickEnabled="True" Margin="2"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</Window>
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using PointViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.PointViewPrimitive;
|
||||
using RectangleViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.RectangleViewPrimitive;
|
||||
|
||||
@@ -34,6 +23,7 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
||||
{
|
||||
this.primitive = primitive;
|
||||
viewModel = new PrimitivePropertiesViewModel(this.primitive, sectionRepository);
|
||||
viewModel.ParentWindow = this;
|
||||
this.DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
if (primitive is RectangleViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=SelectItems}" Content="{Binding Items}"/>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource CancelButton}"/>
|
||||
<Button Style="{StaticResource OkButton}" Click="Button_Click"/>
|
||||
</StackPanel>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -20,16 +20,13 @@ namespace StructureHelper.Windows.PrimitivePropertiesWindow
|
||||
/// </summary>
|
||||
public partial class SelectPrimitivesView : Window
|
||||
{
|
||||
SelectPrimitivesViewModel viewModel;
|
||||
public SelectPrimitivesView(SelectPrimitivesViewModel vm)
|
||||
{
|
||||
viewModel = vm;
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
DataContext = viewModel;
|
||||
viewModel.ParentWindow = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
public class ForceCalculatorViewModel : ViewModelBase
|
||||
public class ForceCalculatorViewModel : OkCancelViewModelBase
|
||||
{
|
||||
IEnumerable<INdmPrimitive> allowedPrimitives;
|
||||
IEnumerable<IForceAction> allowedForceCombinations;
|
||||
|
||||
@@ -26,6 +26,7 @@ using StructureHelperCommon.Services.Units;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Geometry;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmCalculations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
@@ -34,6 +35,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
@@ -57,12 +59,13 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
private RelayCommand setPrestrainCommand;
|
||||
private ICommand showAnchorageCommand;
|
||||
private ICommand showGeometryResultCommand;
|
||||
private ICommand showGraphsCommand;
|
||||
private ICommand showCrackResult;
|
||||
|
||||
public IForcesResults ForcesResults
|
||||
{
|
||||
get => forcesResults;
|
||||
}
|
||||
|
||||
public RelayCommand ShowIsoFieldCommand
|
||||
{
|
||||
get
|
||||
@@ -77,7 +80,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
}, o => (SelectedResult != null) && SelectedResult.IsValid));
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ExportToCSVCommand
|
||||
{
|
||||
get
|
||||
@@ -100,13 +102,59 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
var exportService = new ExportToFileService(inputData, logic);
|
||||
exportService.Export();
|
||||
}
|
||||
|
||||
private ICommand showGraphsCommand;
|
||||
|
||||
public ICommand ShowGraphsCommand
|
||||
{
|
||||
get => showGraphsCommand ??= new RelayCommand(o => showGraphs());
|
||||
}
|
||||
public ICommand ShowCrackResultCommand
|
||||
{
|
||||
get => showCrackResult ??= new RelayCommand(o =>
|
||||
{
|
||||
SafetyProcessor.RunSafeProcess(ShowCrackResult);
|
||||
}, o => (SelectedResult != null) && SelectedResult.IsValid);
|
||||
}
|
||||
|
||||
private void ShowCrackResult()
|
||||
{
|
||||
var limitState = SelectedResult.DesignForceTuple.LimitState;
|
||||
var calcTerm = SelectedResult.DesignForceTuple.CalcTerm;
|
||||
var calculator = new CrackForceCalculator();
|
||||
calculator.EndTuple = SelectedResult.DesignForceTuple.ForceTuple;
|
||||
calculator.NdmCollection = NdmPrimitivesService.GetNdms(ndmPrimitives, limitState, calcTerm);
|
||||
//Act
|
||||
calculator.Run();
|
||||
var result = (CrackForceResult)calculator.Result;
|
||||
if (result.IsValid)
|
||||
{
|
||||
var softLogic = new ExponentialSofteningLogic() { ForceRatio = result.ActualFactor };
|
||||
string message = string.Empty;
|
||||
if (result.IsSectionCracked)
|
||||
{
|
||||
message += $"Actual crack factor {result.ActualFactor}\n";
|
||||
message += $"Softening crack factor PsiS={softLogic.SofteningFactor()}\n";
|
||||
message += $"M{firstAxisName}={result.ActualTuple.Mx}, M{secondAxisName}={result.ActualTuple.My}, N{thirdAxisName}={result.ActualTuple.Nz}";
|
||||
}
|
||||
else
|
||||
{
|
||||
message += "Cracks are not apeared";
|
||||
}
|
||||
MessageBox.Show(
|
||||
message,
|
||||
"Crack results",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorVM = new ErrorProcessor()
|
||||
{
|
||||
ShortText = "Error apeared while crack calculate",
|
||||
DetailText = result.Description
|
||||
};
|
||||
var wnd = new ErrorMessage(errorVM);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void showGraphs()
|
||||
{
|
||||
|
||||
30
StructureHelper/Windows/ViewModels/Errors/SafetyProcessor.cs
Normal file
30
StructureHelper/Windows/ViewModels/Errors/SafetyProcessor.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Errors
|
||||
{
|
||||
internal static class SafetyProcessor
|
||||
{
|
||||
public static void RunSafeProcess(Action action, string shortText = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
action.Invoke();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var vm = new ErrorProcessor()
|
||||
{
|
||||
ShortText = shortText,
|
||||
DetailText = $"{ex}"
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -15,10 +19,11 @@ using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class AnalysisVewModelLogic : SelectedItemViewModel<INdmCalculator>
|
||||
public class AnalysisVewModelLogic : SelectedItemViewModel<ICalculator>
|
||||
{
|
||||
private ICrossSectionRepository repository;
|
||||
private RelayCommand runCommand;
|
||||
static readonly CalculatorUpdateStrategy calculatorUpdateStrategy = new();
|
||||
|
||||
public override void AddMethod(object parameter)
|
||||
{
|
||||
@@ -30,10 +35,19 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
if (SelectedItem is ForceCalculator)
|
||||
{
|
||||
var calculator = SelectedItem as ForceCalculator;
|
||||
var calculatorCopy = (ICalculator)calculator.Clone();
|
||||
var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceActions, calculator);
|
||||
|
||||
var wnd = new ForceCalculatorView(vm);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
// to do: update in repository
|
||||
}
|
||||
else
|
||||
{
|
||||
calculatorUpdateStrategy.Update(calculator, calculatorCopy);
|
||||
}
|
||||
}
|
||||
base.EditMethod(parameter);
|
||||
}
|
||||
@@ -53,30 +67,28 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
(
|
||||
runCommand = new RelayCommand(o =>
|
||||
{
|
||||
try
|
||||
{
|
||||
SelectedItem.Run();
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
var calculator = SelectedItem as IForceCalculator;
|
||||
var vm = new ForcesResultsViewModel(calculator);
|
||||
var wnd = new ForceResultsView(vm);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"{ex}", "There are some errors during solution", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
SafetyProcessor.RunSafeProcess(RunCalculator);
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
|
||||
private void RunCalculator()
|
||||
{
|
||||
SelectedItem.Run();
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
var calculator = SelectedItem as IForceCalculator;
|
||||
var vm = new ForcesResultsViewModel(calculator);
|
||||
var wnd = new ForceResultsView(vm);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
public AnalysisVewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||
{
|
||||
repository = sectionRepository;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public interface ICalculatorsViewModelLogic : ICRUDViewModel<INdmCalculator>
|
||||
public interface ICalculatorsViewModelLogic : ICRUDViewModel<ICalculator>
|
||||
{
|
||||
RelayCommand Run { get; }
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
}
|
||||
else if (primitiveType == PrimitiveType.Reinforcement)
|
||||
{
|
||||
var primitive = new ReinforcementPrimitive
|
||||
var primitive = new RebarPrimitive
|
||||
{
|
||||
Area = 0.0005d
|
||||
};
|
||||
@@ -162,8 +162,21 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
|
||||
private void EditSelectedItem()
|
||||
{
|
||||
var ndmPrimitive = SelectedItem.GetNdmPrimitive();
|
||||
var primitiveCopy = ndmPrimitive.Clone() as INdmPrimitive;
|
||||
var wnd = new PrimitivePropertiesView(SelectedItem, repository);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
// to do save into repository
|
||||
}
|
||||
else
|
||||
{
|
||||
var updateStrategy = new NdmPrimitiveUpdateStrategy();
|
||||
updateStrategy.Update(ndmPrimitive, primitiveCopy);
|
||||
SelectedItem.Refresh();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ICommand Copy
|
||||
@@ -183,15 +196,16 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
var oldPrimitive = SelectedItem.GetNdmPrimitive();
|
||||
var newPrimitive = oldPrimitive.Clone() as INdmPrimitive;
|
||||
newPrimitive.Name += " copy";
|
||||
repository.Primitives.Add(newPrimitive);
|
||||
PrimitiveBase primitiveBase;
|
||||
if (newPrimitive is IRectanglePrimitive) { primitiveBase = new RectangleViewPrimitive(newPrimitive as IRectanglePrimitive); }
|
||||
else if (newPrimitive is ICirclePrimitive) { primitiveBase = new CircleViewPrimitive(newPrimitive as ICirclePrimitive); }
|
||||
else if (newPrimitive is IPointPrimitive)
|
||||
{
|
||||
if (newPrimitive is ReinforcementPrimitive)
|
||||
if (newPrimitive is RebarPrimitive)
|
||||
{
|
||||
primitiveBase = new ReinforcementViewPrimitive(newPrimitive as ReinforcementPrimitive);
|
||||
primitiveBase = new ReinforcementViewPrimitive(newPrimitive as RebarPrimitive);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ using RectangleViewPrimitive = StructureHelper.Infrastructure.UI.DataContexts.Re
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
{
|
||||
public class PrimitivePropertiesViewModel : ViewModelBase, IDataErrorInfo
|
||||
public class PrimitivePropertiesViewModel : OkCancelViewModelBase, IDataErrorInfo
|
||||
{
|
||||
private PrimitiveBase primitive;
|
||||
private ICrossSectionRepository sectionRepository;
|
||||
@@ -316,11 +316,11 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
private void CheckHost(PrimitiveBase primitive, INdmPrimitive item)
|
||||
{
|
||||
var ndm = primitive.GetNdmPrimitive();
|
||||
if (ndm is ReinforcementPrimitive)
|
||||
if (ndm is RebarPrimitive)
|
||||
{
|
||||
var host = item as IHasDivisionSize;
|
||||
var reinforcement = ndm as ReinforcementPrimitive;
|
||||
if (host.IsPointInside(new Point2D() { X = reinforcement.CenterX, Y = reinforcement.CenterY })
|
||||
var reinforcement = ndm as RebarPrimitive;
|
||||
if (host.IsPointInside(new Point2D() { X = reinforcement.Center.X, Y = reinforcement.Center.Y })
|
||||
&& reinforcement.HostPrimitive is null)
|
||||
{
|
||||
var dialogResult = MessageBox.Show($"Primitive {reinforcement.Name} is inside primitive {item.Name}",
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
{
|
||||
public class SelectPrimitivesViewModel
|
||||
public class SelectPrimitivesViewModel : OkCancelViewModelBase
|
||||
{
|
||||
public SelectItemsViewModel<PrimitiveBase> Items { get; }
|
||||
|
||||
|
||||
@@ -18,5 +18,6 @@
|
||||
public static string LongitudinalForceMustBeLessThanCriticalForce => "#0013: Absolute value of longitudinal force must be greater than critical force";
|
||||
public static string SizeMustBeGreaterThanZero => "#0014: Size must be greater than zero";
|
||||
public static string ParameterIsNull => "#0015: Parameter is null";
|
||||
public static string ResultIsNotValid => "#0016: Result is not valid";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Calculators
|
||||
{
|
||||
public class FindParameterCalculator : ICalculator
|
||||
{
|
||||
FindParameterResult result;
|
||||
public string Name { get; set; }
|
||||
public double StartValue { get; set; }
|
||||
public double EndValue { get; set; }
|
||||
public Predicate<double> Predicate { get; set; }
|
||||
public IAccuracy Accuracy {get;set;}
|
||||
public IResult Result => result;
|
||||
|
||||
public FindParameterCalculator()
|
||||
{
|
||||
StartValue = 0d;
|
||||
EndValue = 1d;
|
||||
Accuracy = new Accuracy() { IterationAccuracy = 0.001, MaxIterationCount = 1000 };
|
||||
}
|
||||
public void Run()
|
||||
{
|
||||
result = new() { IsValid = true};
|
||||
try
|
||||
{
|
||||
result.Parameter = FindMinimumValue(StartValue, EndValue, Predicate);
|
||||
result.Description = "Parameter was found succefully";
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += ex;
|
||||
}
|
||||
}
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private double FindMinimumValue(double start, double end, Predicate<double> predicate)
|
||||
{
|
||||
if (predicate(end) == false)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": pridicate for end value must be true");
|
||||
|
||||
}
|
||||
double precision = Accuracy.IterationAccuracy;
|
||||
int maxIterationCount = Accuracy.MaxIterationCount;
|
||||
double current = start;
|
||||
double step = (end - start) / 2;
|
||||
int iterationNum = 0;
|
||||
while (step > precision)
|
||||
{
|
||||
if (predicate(current))
|
||||
{
|
||||
end = current;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = current;
|
||||
}
|
||||
|
||||
current = (start + end) / 2;
|
||||
step = (end - start) / 2;
|
||||
iterationNum++;
|
||||
if (iterationNum > maxIterationCount)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": violation of iteration count");
|
||||
}
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Calculators
|
||||
{
|
||||
public class FindParameterResult : IResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string Description { get; set; }
|
||||
public double Parameter { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -7,9 +6,9 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using TaskManager;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
namespace StructureHelperCommon.Models.Calculators
|
||||
{
|
||||
public interface INdmCalculator : ICloneable
|
||||
public interface ICalculator : ICloneable
|
||||
{
|
||||
string Name { get; set; }
|
||||
/// <summary>
|
||||
@@ -19,6 +18,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
/// <summary>
|
||||
/// Result of Calculations
|
||||
/// </summary>
|
||||
INdmResult Result { get; }
|
||||
IResult Result { get; }
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
namespace StructureHelperCommon.Models.Calculators
|
||||
{
|
||||
public interface INdmResult
|
||||
public interface IResult
|
||||
{
|
||||
/// <summary>
|
||||
/// True if result of calculation is valid
|
||||
@@ -0,0 +1,18 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Calculators
|
||||
{
|
||||
public class AccuracyUpdateStrategy : IUpdateStrategy<IAccuracy>
|
||||
{
|
||||
public void Update(IAccuracy targetObject, IAccuracy sourceObject)
|
||||
{
|
||||
targetObject.IterationAccuracy = sourceObject.IterationAccuracy;
|
||||
targetObject.MaxIterationCount = sourceObject.MaxIterationCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint2D> pointStrategy = new PointUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IPoint2D> pointStrategy = new PointShapeUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy = new ForcePairUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy = new FactorCombinationUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy = new ForceCombinationListUpdateStrategy();
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
internal class ForceTupleUpdateStrategy : IUpdateStrategy<IForceTuple>
|
||||
public class ForceTupleUpdateStrategy : IUpdateStrategy<IForceTuple>
|
||||
{
|
||||
public void Update(IForceTuple targetObject, IForceTuple sourceObject)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using StructureHelperCommon.Services.Sections;
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections
|
||||
namespace StructureHelperCommon.Models.Sections
|
||||
{
|
||||
public class CompressedMember : ICompressedMember
|
||||
{
|
||||
static readonly CompressedMemberUpdateStrategy updateStrategy = new();
|
||||
public bool Buckling { get; set; }
|
||||
public double GeometryLength { get; set; }
|
||||
public double LengthFactorX { get; set; }
|
||||
@@ -24,9 +23,9 @@ namespace StructureHelperCommon.Models.Sections
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var target = new CompressedMember();
|
||||
CompressedMemberServices.CopyProperties(this, target);
|
||||
return target;
|
||||
var newItem = new CompressedMember();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections
|
||||
{
|
||||
public class CompressedMemberUpdateStrategy : IUpdateStrategy<ICompressedMember>
|
||||
{
|
||||
public void Update(ICompressedMember targetObject, ICompressedMember sourceObject)
|
||||
{
|
||||
targetObject.Buckling = sourceObject.Buckling;
|
||||
targetObject.GeometryLength = sourceObject.GeometryLength;
|
||||
targetObject.LengthFactorX = sourceObject.LengthFactorX;
|
||||
targetObject.DiagramFactorX = sourceObject.DiagramFactorX;
|
||||
targetObject.LengthFactorY = sourceObject.LengthFactorY;
|
||||
targetObject.DiagramFactorY = sourceObject.DiagramFactorY;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class CircleShapeUpdateStrategy : IUpdateStrategy<ICircleShape>
|
||||
{
|
||||
public void Update(ICircleShape targetObject, ICircleShape sourceObject)
|
||||
{
|
||||
targetObject.Diameter = sourceObject.Diameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class LineShapeUpdateStrategy : IUpdateStrategy<ILineShape>
|
||||
{
|
||||
readonly PointShapeUpdateStrategy pointUpdateStrategy = new();
|
||||
public void Update(ILineShape targetObject, ILineShape sourceObject)
|
||||
{
|
||||
pointUpdateStrategy.Update(targetObject.StartPoint, sourceObject.StartPoint);
|
||||
pointUpdateStrategy.Update(targetObject.EndPoint, sourceObject.EndPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
namespace StructureHelperCommon.Models.Shapes.Logics
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class PointUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||
public class PointShapeUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Update(IPoint2D targetObject, IPoint2D sourceObject)
|
||||
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class RectangleShapeUpdateStrategy : IUpdateStrategy<IRectangleShape>
|
||||
{
|
||||
public void Update(IRectangleShape targetObject, IRectangleShape sourceObject)
|
||||
{
|
||||
targetObject.Width = sourceObject.Width;
|
||||
targetObject.Height = sourceObject.Height;
|
||||
targetObject.Angle = sourceObject.Angle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace StructureHelperCommon.Models.Shapes
|
||||
/// <inheritdoc />
|
||||
public class Point2D : IPoint2D
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint2D> updateStrategy = new PointUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IPoint2D> updateStrategy = new PointShapeUpdateStrategy();
|
||||
/// <inheritdoc />
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
|
||||
namespace StructureHelperCommon.Services.Calculations
|
||||
{
|
||||
public static class AccuracyService
|
||||
{
|
||||
public static void CopyProperties(IAccuracy source, IAccuracy target)
|
||||
{
|
||||
target.IterationAccuracy = source.IterationAccuracy;
|
||||
target.MaxIterationCount = source.MaxIterationCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
|
||||
namespace StructureHelperCommon.Services.Sections
|
||||
{
|
||||
public static class CompressedMemberServices
|
||||
{
|
||||
public static void CopyProperties(ICompressedMember source, ICompressedMember target)
|
||||
{
|
||||
target.Buckling = source.Buckling;
|
||||
target.GeometryLength = source.GeometryLength;
|
||||
target.LengthFactorX = source.LengthFactorX;
|
||||
target.DiagramFactorX = source.DiagramFactorX;
|
||||
target.LengthFactorY = source.LengthFactorY;
|
||||
target.DiagramFactorY = source.DiagramFactorY;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Services.ShapeServices
|
||||
{
|
||||
public static class ShapeService
|
||||
{
|
||||
public static void CopyLineProperties(ILineShape source, ILineShape target)
|
||||
{
|
||||
target.StartPoint.X = source.StartPoint.X;
|
||||
target.StartPoint.Y = source.StartPoint.Y;
|
||||
target.EndPoint.X = source.EndPoint.X;
|
||||
target.EndPoint.Y = source.EndPoint.Y;
|
||||
}
|
||||
|
||||
public static void CopyRectangleProperties(IRectangleShape source, IRectangleShape target)
|
||||
{
|
||||
target.Width = source.Width;
|
||||
target.Height = source.Height;
|
||||
target.Angle = source.Angle;
|
||||
}
|
||||
|
||||
public static void CopyCircleProperties(ICircleShape source, ICircleShape target)
|
||||
{
|
||||
target.Diameter = source.Diameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.MaterialBuilders
|
||||
{
|
||||
internal interface IDecoratorOption : IMaterialOption
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.MaterialBuilders.Decorators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.MaterialBuilders
|
||||
{
|
||||
internal class RestrictStrainDecorator : IMaterialBuilder
|
||||
{
|
||||
IMaterialBuilder builder;
|
||||
public IMaterialOption MaterialOption { get; set; }
|
||||
|
||||
public RestrictStrainDecorator(IMaterialBuilder builder)
|
||||
{
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
public IMaterial GetMaterial()
|
||||
{
|
||||
CheckOptions();
|
||||
var option = (RestrictStrainOption)MaterialOption;
|
||||
var material = new Material();
|
||||
material.InitModulus = builder.GetMaterial().InitModulus;
|
||||
material.DiagramParameters = new List<double>()
|
||||
{
|
||||
option.MaxTensileStrain,
|
||||
option.MaxCompessionStrain
|
||||
};
|
||||
material.Diagram = GetStressDiagram;
|
||||
return material;
|
||||
}
|
||||
|
||||
private void CheckOptions()
|
||||
{
|
||||
CheckObject.CompareTypes(typeof(RestrictStrainOption), MaterialOption.GetType());
|
||||
}
|
||||
|
||||
private double GetStressDiagram(IEnumerable<double> parameters, double strain)
|
||||
{
|
||||
var maxTensileStrain = parameters.ToList()[0];
|
||||
var maxCompressionStrain = parameters.ToList()[1];
|
||||
if (strain > maxTensileStrain || strain < maxCompressionStrain)
|
||||
{
|
||||
return 0d;
|
||||
}
|
||||
else
|
||||
{
|
||||
var material = builder.GetMaterial();
|
||||
return material.Diagram.Invoke(parameters, strain);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.MaterialBuilders.Decorators
|
||||
{
|
||||
internal class RestrictStrainOption : IDecoratorOption
|
||||
{
|
||||
private double maxTensileStrain;
|
||||
private double maxCompessionStrain;
|
||||
|
||||
public double MaxTensileStrain
|
||||
{
|
||||
get => maxTensileStrain;
|
||||
set
|
||||
{
|
||||
if (value < 0d)
|
||||
{
|
||||
//to do exception
|
||||
}
|
||||
maxTensileStrain = value;
|
||||
}
|
||||
}
|
||||
public double MaxCompessionStrain { get => maxCompessionStrain; set => maxCompessionStrain = value; }
|
||||
}
|
||||
}
|
||||
19
StructureHelperLogics/MaterialBuilders/IBearingOption.cs
Normal file
19
StructureHelperLogics/MaterialBuilders/IBearingOption.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.MaterialBuilders
|
||||
{
|
||||
internal interface IBearingOption : IMaterialOption
|
||||
{
|
||||
double InitModulus { get; set; }
|
||||
double Strength { get; set; }
|
||||
LimitStates LimitState { get; set; }
|
||||
bool IsShortTerm { get; set; }
|
||||
CodesType CodesType { get; set; }
|
||||
IPartialFactor ExternalFactor { get; }
|
||||
}
|
||||
}
|
||||
15
StructureHelperLogics/MaterialBuilders/IMaterialBuilder.cs
Normal file
15
StructureHelperLogics/MaterialBuilders/IMaterialBuilder.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.MaterialBuilders
|
||||
{
|
||||
internal interface IMaterialBuilder
|
||||
{
|
||||
IMaterialOption MaterialOption { get; set; }
|
||||
IMaterial GetMaterial();
|
||||
}
|
||||
}
|
||||
12
StructureHelperLogics/MaterialBuilders/IMaterialOption.cs
Normal file
12
StructureHelperLogics/MaterialBuilders/IMaterialOption.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.MaterialBuilders
|
||||
{
|
||||
internal interface IMaterialOption
|
||||
{
|
||||
}
|
||||
}
|
||||
15
StructureHelperLogics/MaterialBuilders/IPartialFactor.cs
Normal file
15
StructureHelperLogics/MaterialBuilders/IPartialFactor.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.MaterialBuilders
|
||||
{
|
||||
internal interface IPartialFactor
|
||||
{
|
||||
double YoungsModulus { get; set; }
|
||||
double Compressive { get; set; }
|
||||
double Tensile { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
@@ -16,14 +17,14 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
public List<IForceAction> ForceActions { get; private set; }
|
||||
public List<IHeadMaterial> HeadMaterials { get; private set; }
|
||||
public List<INdmPrimitive> Primitives { get; }
|
||||
public List<INdmCalculator> CalculatorsList { get; private set; }
|
||||
public List<ICalculator> CalculatorsList { get; private set; }
|
||||
|
||||
public CrossSectionRepository()
|
||||
{
|
||||
ForceActions = new List<IForceAction>();
|
||||
HeadMaterials = new List<IHeadMaterial>();
|
||||
Primitives = new List<INdmPrimitive>();
|
||||
CalculatorsList = new List<INdmCalculator>();
|
||||
CalculatorsList = new List<ICalculator>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
@@ -15,6 +16,6 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives
|
||||
{
|
||||
List<IForceAction> ForceActions { get; }
|
||||
List<INdmCalculator> CalculatorsList { get; }
|
||||
List<ICalculator> CalculatorsList { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,9 +11,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal class CalculatorLogic : ICalculatorLogic
|
||||
{
|
||||
public IEnumerable<INdmCalculator> GetNdmCalculators()
|
||||
public IEnumerable<ICalculator> GetNdmCalculators()
|
||||
{
|
||||
var calculators = new List<INdmCalculator>();
|
||||
var calculators = new List<ICalculator>();
|
||||
calculators.Add(new ForceCalculator() { Name = "New Force Calculator"});
|
||||
return calculators;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal interface ICalculatorLogic
|
||||
{
|
||||
IEnumerable<INdmCalculator> GetNdmCalculators();
|
||||
IEnumerable<ICalculator> GetNdmCalculators();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,13 +52,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
var angle = i * dAngle;
|
||||
var x = radius * Math.Sin(angle);
|
||||
var y = radius * Math.Cos(angle);
|
||||
var point = new ReinforcementPrimitive()
|
||||
{ CenterX = x,
|
||||
CenterY = y,
|
||||
var point = new RebarPrimitive()
|
||||
{
|
||||
Area = barArea,
|
||||
Name = "Left bottom point",
|
||||
HeadMaterial = reinforcementMaterial,
|
||||
HostPrimitive=concreteBlock };
|
||||
point.Center.X = x;
|
||||
point.Center.Y = y;
|
||||
primitives.Add(point);
|
||||
}
|
||||
return primitives;
|
||||
|
||||
@@ -59,13 +59,45 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||
|
||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||
var point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0], Area = area1, Name = "Left bottom point", HeadMaterial = reinforcement, HostPrimitive=concreteBlock };
|
||||
var point = new RebarPrimitive()
|
||||
{
|
||||
Area = area1,
|
||||
Name = "Left bottom point",
|
||||
HeadMaterial = reinforcement,
|
||||
HostPrimitive=concreteBlock
|
||||
};
|
||||
point.Center.X = xs[0];
|
||||
point.Center.Y = ys[0];
|
||||
primitives.Add(point);
|
||||
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0], Area = area1, Name = "Right bottom point", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||
point = new RebarPrimitive()
|
||||
{
|
||||
Area = area1,
|
||||
Name = "Right bottom point",
|
||||
HeadMaterial = reinforcement,
|
||||
HostPrimitive = concreteBlock
|
||||
};
|
||||
point.Center.X = xs[1];
|
||||
point.Center.Y = ys[0];
|
||||
primitives.Add(point);
|
||||
point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[1], Area = area2, Name = "Left top point", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||
point = new RebarPrimitive()
|
||||
{
|
||||
Area = area2,
|
||||
Name = "Left top point",
|
||||
HeadMaterial = reinforcement,
|
||||
HostPrimitive = concreteBlock
|
||||
};
|
||||
point.Center.X = xs[0];
|
||||
point.Center.Y = ys[1];
|
||||
primitives.Add(point);
|
||||
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[1], Area = area2, Name = "Right top point", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||
point = new RebarPrimitive()
|
||||
{
|
||||
Area = area2,
|
||||
Name = "Right top point",
|
||||
HeadMaterial = reinforcement,
|
||||
HostPrimitive = concreteBlock
|
||||
};
|
||||
point.Center.X = xs[1];
|
||||
point.Center.Y = ys[1];
|
||||
primitives.Add(point);
|
||||
return primitives;
|
||||
}
|
||||
@@ -83,10 +115,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
double dist = (xs[1] - xs[0]) / count;
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1, Name = $"Bottom point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||
primitives.Add(point);
|
||||
point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2, Name = $"Top point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||
point = new RebarPrimitive() { Area = area1, Name = $"Bottom point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||
point.Center.X = xs[0] + dist * i;
|
||||
point.Center.Y = ys[0];
|
||||
primitives.Add(point);
|
||||
point = new RebarPrimitive() {Area = area2, Name = $"Top point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||
point.Center.X = xs[0] + dist * i;
|
||||
point.Center.Y = ys[1];
|
||||
primitives.Add(point);
|
||||
}
|
||||
}
|
||||
if (template.HeightCount > 2)
|
||||
@@ -95,9 +131,25 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
double dist = (ys[1] - ys[0]) / count;
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1, Name = $"Left point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||
point = new RebarPrimitive()
|
||||
{
|
||||
Area = area1,
|
||||
Name = $"Left point {i}",
|
||||
HeadMaterial = reinforcement,
|
||||
HostPrimitive = concreteBlock
|
||||
};
|
||||
point.Center.X = xs[0];
|
||||
point.Center.Y = ys[0] + dist * i;
|
||||
primitives.Add(point);
|
||||
point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1, Name = $"Right point {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
|
||||
point = new RebarPrimitive()
|
||||
{
|
||||
Area = area1,
|
||||
Name = $"Right point {i}",
|
||||
HeadMaterial = reinforcement,
|
||||
HostPrimitive = concreteBlock
|
||||
};
|
||||
point.Center.X = xs[1];
|
||||
point.Center.Y = ys[0] + dist * i;
|
||||
primitives.Add(point);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
@@ -20,7 +21,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
ICalculatorLogic calculatorLogic;
|
||||
IEnumerable<INdmPrimitive> primitives;
|
||||
IEnumerable<IForceAction> combinations;
|
||||
IEnumerable<INdmCalculator> calculators;
|
||||
IEnumerable<ICalculator> calculators;
|
||||
|
||||
public SectionTemplate(IRCGeometryLogic geometryLogic)
|
||||
{
|
||||
|
||||
@@ -1,33 +1,26 @@
|
||||
using LoaderCalculator;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Calculations;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperCommon.Services.Sections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Buckling;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceCalculator : IForceCalculator
|
||||
{
|
||||
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
||||
public string Name { get; set; }
|
||||
public List<LimitStates> LimitStatesList { get; }
|
||||
public List<CalcTerms> CalcTermsList { get; }
|
||||
public List<IForceAction> ForceActions { get; }
|
||||
public List<INdmPrimitive> Primitives { get; }
|
||||
public INdmResult Result { get; private set; }
|
||||
public IResult Result { get; private set; }
|
||||
public ICompressedMember CompressedMember { get; }
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
||||
@@ -184,16 +177,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
IForceCalculator target = new ForceCalculator { Name = Name + " copy"};
|
||||
target.LimitStatesList.Clear();
|
||||
target.LimitStatesList.AddRange(LimitStatesList);
|
||||
target.CalcTermsList.Clear();
|
||||
target.CalcTermsList.AddRange(CalcTermsList);
|
||||
AccuracyService.CopyProperties(Accuracy, target.Accuracy);
|
||||
CompressedMemberServices.CopyProperties(CompressedMember, target.CompressedMember);
|
||||
target.Primitives.AddRange(Primitives);
|
||||
target.ForceActions.AddRange(ForceActions);
|
||||
return target;
|
||||
var newCalculator = new ForceCalculator();
|
||||
updateStrategy.Update(newCalculator, this);
|
||||
return newCalculator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public class ForceTupleCalculator : IForceTupleCalculator
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public INdmResult Result { get; private set; }
|
||||
public IResult Result { get; private set; }
|
||||
|
||||
private IForceTupleInputData inputData;
|
||||
|
||||
|
||||
@@ -4,12 +4,10 @@ using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceCalculator : INdmCalculator, IHasPrimitives, IHasForceCombinations
|
||||
public interface IForceCalculator : ICalculator, IHasPrimitives, IHasForceCombinations
|
||||
{
|
||||
List<CalcTerms> CalcTermsList { get; }
|
||||
List<LimitStates> LimitStatesList { get; }
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceTupleCalculator : INdmCalculator
|
||||
public interface IForceTupleCalculator : ICalculator
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForcesResults : INdmResult
|
||||
public interface IForcesResults : IResult
|
||||
{
|
||||
string Description { get; set; }
|
||||
List<IForcesTupleResult> ForcesResultList { get; }
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForcesTupleResult : INdmResult
|
||||
public interface IForcesTupleResult : IResult
|
||||
{
|
||||
IDesignForceTuple DesignForceTuple { get; set; }
|
||||
ILoaderResults LoaderResults { get; set; }
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
{
|
||||
public class ForceCalculatorUpdateStrategy : IUpdateStrategy<IForceCalculator>
|
||||
{
|
||||
static readonly AccuracyUpdateStrategy accuracyUpdateStrategy = new();
|
||||
static readonly CompressedMemberUpdateStrategy compressedMemberUpdateStrategy = new();
|
||||
public void Update(IForceCalculator targetObject, IForceCalculator sourceObject)
|
||||
{
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.LimitStatesList.Clear();
|
||||
targetObject.LimitStatesList.AddRange(sourceObject.LimitStatesList);
|
||||
targetObject.CalcTermsList.Clear();
|
||||
targetObject.CalcTermsList.AddRange(sourceObject.CalcTermsList);
|
||||
accuracyUpdateStrategy.Update(targetObject.Accuracy, sourceObject.Accuracy);
|
||||
compressedMemberUpdateStrategy.Update(targetObject.CompressedMember, sourceObject.CompressedMember);
|
||||
targetObject.Primitives.Clear();
|
||||
targetObject.Primitives.AddRange(sourceObject.Primitives);
|
||||
targetObject.ForceActions.Clear();
|
||||
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -15,7 +16,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
IGeometryResult geometryResult;
|
||||
public string Name { get; set; }
|
||||
|
||||
public INdmResult Result => geometryResult;
|
||||
public IResult Result => geometryResult;
|
||||
|
||||
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public interface IGeometryCalculator : INdmCalculator
|
||||
public interface IGeometryCalculator : ICalculator
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
||||
{
|
||||
public interface IGeometryResult : INdmResult
|
||||
public interface IGeometryResult : IResult
|
||||
{
|
||||
List<IValueParameter<string>> TextParameters { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Logics
|
||||
{
|
||||
public class CalculatorUpdateStrategy : IUpdateStrategy<ICalculator>
|
||||
{
|
||||
public void Update(ICalculator targetObject, ICalculator sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
if (targetObject is IForceCalculator force)
|
||||
{
|
||||
new ForceCalculatorUpdateStrategy().Update(force, (IForceCalculator)sourceObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(INdmPrimitive), sourceObject.GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
||||
public static class InputDataFactory
|
||||
{
|
||||
private static IStressLogic stressLogic => new StressLogic();
|
||||
public static IAnchorageInputData GetInputData(ReinforcementPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
|
||||
public static IAnchorageInputData GetInputData(RebarPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
|
||||
{
|
||||
var inputData = new AnchorageInputData();
|
||||
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive);
|
||||
@@ -43,7 +43,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
||||
return inputData;
|
||||
}
|
||||
|
||||
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive)
|
||||
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
|
||||
{
|
||||
if (primitive.HostPrimitive is not null)
|
||||
{
|
||||
@@ -59,7 +59,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host material is incorrect or null");
|
||||
}
|
||||
|
||||
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive)
|
||||
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
|
||||
{
|
||||
if (primitive.HeadMaterial.HelperMaterial is IReinforcementLibMaterial)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public INdmResult Result { get; private set; }
|
||||
public IResult Result { get; private set; }
|
||||
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
{
|
||||
internal interface IConcreteBucklingCalculator : INdmCalculator
|
||||
internal interface IConcreteBucklingCalculator : ICalculator
|
||||
{
|
||||
IAccuracy Accuracy { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -10,7 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
/// <summary>
|
||||
/// Results of calculation of buckling of reinforced concrete section
|
||||
/// </summary>
|
||||
public interface IConcreteBucklingResult : INdmResult
|
||||
public interface IConcreteBucklingResult : IResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Factor of increasing of bending moment (p-delta effect) in the plain XOZ
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class CrackForceCalculator : ICalculator
|
||||
{
|
||||
static readonly CrackedLogic crackedLogic = new();
|
||||
private CrackForceResult result;
|
||||
|
||||
public string Name { get; set; }
|
||||
public IForceTuple StartTuple { get; set; }
|
||||
public IForceTuple EndTuple { get; set; }
|
||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||
public Accuracy Accuracy {get;set; }
|
||||
public IResult Result => result;
|
||||
public CrackForceCalculator()
|
||||
{
|
||||
StartTuple ??= new ForceTuple();
|
||||
Accuracy ??= new Accuracy() { IterationAccuracy = 0.0001d, MaxIterationCount = 10000 };
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
result = new CrackForceResult();
|
||||
crackedLogic.StartTuple = StartTuple;
|
||||
crackedLogic.EndTuple = EndTuple;
|
||||
crackedLogic.NdmCollection = NdmCollection;
|
||||
try
|
||||
{
|
||||
Check();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += ex;
|
||||
return;
|
||||
}
|
||||
if (crackedLogic.IsSectionCracked(0d) == true)
|
||||
{
|
||||
result.IsValid = true;
|
||||
result.ActualFactor = 0d;
|
||||
result.ActualTuple = (IForceTuple)StartTuple.Clone();
|
||||
result.IsSectionCracked = true;
|
||||
result.Description += "Section cracked in start tuple";
|
||||
return;
|
||||
}
|
||||
if (crackedLogic.IsSectionCracked(1d) == false)
|
||||
{
|
||||
result.IsValid = true;
|
||||
result.IsSectionCracked = false;
|
||||
result.Description = "Section is not cracked";
|
||||
return;
|
||||
}
|
||||
var parameterCalculator = new FindParameterCalculator()
|
||||
{
|
||||
Accuracy = Accuracy,
|
||||
Predicate = crackedLogic.IsSectionCracked
|
||||
};
|
||||
parameterCalculator.Run();
|
||||
var paramResult = parameterCalculator.Result as FindParameterResult;
|
||||
if (paramResult.IsValid == true)
|
||||
{
|
||||
result.IsValid = true;
|
||||
result.IsSectionCracked = true;
|
||||
result.Description += paramResult.Description;
|
||||
result.ActualFactor = paramResult.Parameter;
|
||||
result.ActualTuple = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, paramResult.Parameter);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += paramResult.Description;
|
||||
}
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
CheckObject.IsNull(EndTuple);
|
||||
if (StartTuple == EndTuple)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Section is not cracked");
|
||||
}
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class CrackForceResult : IResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool IsSectionCracked { get; set; }
|
||||
public double ActualFactor { get; set; }
|
||||
public IForceTuple ActualTuple { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
internal class CrackedLogic : ICrackedLogic
|
||||
{
|
||||
ISectionCrackedLogic sectionCrackedLogic;
|
||||
public IForceTuple StartTuple { get; set; }
|
||||
public IForceTuple EndTuple { get; set; }
|
||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||
public CrackedLogic(ISectionCrackedLogic sectionLogic)
|
||||
{
|
||||
sectionCrackedLogic = sectionLogic;
|
||||
}
|
||||
public CrackedLogic() : this (new HoleSectionCrackedLogic())
|
||||
{
|
||||
|
||||
}
|
||||
public bool IsSectionCracked(double factor)
|
||||
{
|
||||
var actualTuple = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, factor);
|
||||
sectionCrackedLogic.Tuple = actualTuple;
|
||||
sectionCrackedLogic.NdmCollection = NdmCollection;
|
||||
return sectionCrackedLogic.IsSectionCracked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class ExponentialSofteningLogic : ICrackSofteningLogic
|
||||
{
|
||||
private double forceRatio;
|
||||
private double powerFactor;
|
||||
|
||||
public double PowerFactor
|
||||
{
|
||||
get => powerFactor;
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Power Factor must not be less than zero");
|
||||
}
|
||||
powerFactor = value;
|
||||
}
|
||||
}
|
||||
public double BettaFactor { get; set; }
|
||||
public double ForceRatio
|
||||
{
|
||||
get => forceRatio;
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Force Ratio must not be less than zero");
|
||||
}
|
||||
else if (value > 1)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Force Ratio must not be greater than 1.0");
|
||||
}
|
||||
forceRatio = value;
|
||||
}
|
||||
}
|
||||
public double FiMin {get;set;}
|
||||
public ExponentialSofteningLogic()
|
||||
{
|
||||
FiMin = 0.2d;
|
||||
PowerFactor = 2d;
|
||||
BettaFactor = 0.8;
|
||||
}
|
||||
public double SofteningFactor()
|
||||
{
|
||||
double fi;
|
||||
fi = 1 - BettaFactor * Math.Pow(ForceRatio, PowerFactor);
|
||||
fi = Math.Max(fi, FiMin);
|
||||
return fi;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Logics;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
internal class HoleSectionCrackedLogic : ISectionCrackedLogic
|
||||
{
|
||||
static readonly IStressLogic stressLogic = new StressLogic();
|
||||
public IForceTuple Tuple { get; set; }
|
||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||
public Accuracy Accuracy { get; set; }
|
||||
public HoleSectionCrackedLogic()
|
||||
{
|
||||
if (Accuracy is null)
|
||||
{
|
||||
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 10000 };
|
||||
}
|
||||
}
|
||||
public bool IsSectionCracked()
|
||||
{
|
||||
var inputData = new ForceTupleInputData()
|
||||
{
|
||||
Accuracy = Accuracy,
|
||||
Tuple = Tuple,
|
||||
NdmCollection = NdmCollection
|
||||
};
|
||||
var calculator = new ForceTupleCalculator(inputData);
|
||||
calculator.Run();
|
||||
var calcResult = calculator.Result as ForcesTupleResult;
|
||||
if (calcResult.IsValid == false)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ResultIsNotValid + ": Result of Section Calculation is not valid");
|
||||
}
|
||||
var strainMatrix = calcResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
return stressLogic.IsSectionCracked(strainMatrix, NdmCollection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public interface ICrackSofteningLogic
|
||||
{
|
||||
double SofteningFactor();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
internal interface ICrackedLogic
|
||||
{
|
||||
IForceTuple StartTuple { get; set; }
|
||||
IForceTuple EndTuple { get; set; }
|
||||
IEnumerable<INdm> NdmCollection { get; set; }
|
||||
bool IsSectionCracked(double factor);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
internal interface ISectionCrackedLogic
|
||||
{
|
||||
IForceTuple Tuple { get; set; }
|
||||
IEnumerable<INdm> NdmCollection { get; set; }
|
||||
bool IsSectionCracked();
|
||||
}
|
||||
}
|
||||
@@ -3,24 +3,20 @@ using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ShapeServices;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class CirclePrimitive : ICirclePrimitive
|
||||
{
|
||||
static readonly CircleUpdateStrategy updateStrategy = new();
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IPoint2D Center { get; private set; }
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
public StrainTuple UsersPrestrain { get; }
|
||||
public StrainTuple AutoPrestrain { get; }
|
||||
@@ -32,12 +28,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public bool Triangulate { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
|
||||
public CirclePrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Circle";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
Center = new Point2D();
|
||||
VisualProperty = new VisualProperty { Opacity = 0.8d };
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
@@ -46,16 +44,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
}
|
||||
public CirclePrimitive() : this (Guid.NewGuid())
|
||||
{}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new CirclePrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||
ShapeService.CopyCircleProperties(this, primitive);
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
{
|
||||
var ndms = new List<INdm>();
|
||||
@@ -64,24 +60,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
ndms.AddRange(logic.GetNdmCollection(material));
|
||||
return ndms;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsPointInside(IPoint2D point)
|
||||
{
|
||||
var dX = CenterX - point.X;
|
||||
var dY = CenterY - point.Y;
|
||||
var dX = Center.X - point.X;
|
||||
var dY = Center.Y - point.Y;
|
||||
var distance = Math.Sqrt(dX * dX + dY * dY);
|
||||
if (distance > Diameter / 2) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public interface INdmPrimitive : ISaveable, ICloneable
|
||||
{
|
||||
string? Name { get; set; }
|
||||
double CenterX { get; set; }
|
||||
double CenterY { get; set; }
|
||||
IPoint2D Center { get; }
|
||||
ICrossSection? CrossSection { get; set; }
|
||||
IHeadMaterial? HeadMaterial { get; set; }
|
||||
/// <summary>
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ShapeServices;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
@@ -54,8 +46,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new LinePrimitive();
|
||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||
ShapeService.CopyLineProperties(this, primitive);
|
||||
throw new NotImplementedException();
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class BaseUpdateStrategy : IUpdateStrategy<INdmPrimitive>
|
||||
{
|
||||
static readonly PointShapeUpdateStrategy pointShapeUpdateStrategy = new();
|
||||
readonly ForceTupleUpdateStrategy tupleUpdateStrategy = new();
|
||||
readonly VisualPropsUpdateStrategy visualPropsUpdateStrategy = new();
|
||||
|
||||
public void Update(INdmPrimitive target, INdmPrimitive source)
|
||||
{
|
||||
target.Name = source.Name;
|
||||
if (source.HeadMaterial != null) target.HeadMaterial = source.HeadMaterial;
|
||||
target.Triangulate = source.Triangulate;
|
||||
pointShapeUpdateStrategy.Update(target.Center, source.Center);
|
||||
visualPropsUpdateStrategy.Update(target.VisualProperty, source.VisualProperty);
|
||||
tupleUpdateStrategy.Update(target.UsersPrestrain, source.UsersPrestrain);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class CircleUpdateStrategy : IUpdateStrategy<CirclePrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
static readonly DivisionPropsUpdateStrategy divisionPropsUpdateStrategy = new();
|
||||
static readonly CircleShapeUpdateStrategy shapeUpdateStrategy = new();
|
||||
|
||||
public void Update(CirclePrimitive targetObject, CirclePrimitive sourceObject)
|
||||
{
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
divisionPropsUpdateStrategy.Update(targetObject, sourceObject);
|
||||
shapeUpdateStrategy.Update(targetObject, sourceObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class DivisionPropsUpdateStrategy : IUpdateStrategy<IHasDivisionSize>
|
||||
{
|
||||
public void Update(IHasDivisionSize targetObject, IHasDivisionSize sourceObject)
|
||||
{
|
||||
targetObject.NdmMaxSize = sourceObject.NdmMaxSize;
|
||||
targetObject.NdmMinDivision = sourceObject.NdmMinDivision;
|
||||
targetObject.ClearUnderlying = sourceObject.ClearUnderlying;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class NdmPrimitiveUpdateStrategy : IUpdateStrategy<INdmPrimitive>
|
||||
{
|
||||
public void Update(INdmPrimitive targetObject, INdmPrimitive sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
if (targetObject is PointPrimitive point)
|
||||
{
|
||||
new PointUpdateStrategy().Update(point, (PointPrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is RebarPrimitive rebar)
|
||||
{
|
||||
new RebarUpdateStrategy().Update(rebar, (RebarPrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is RectanglePrimitive rectangle)
|
||||
{
|
||||
new RectangleUpdateStrategy().Update(rectangle, (RectanglePrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is CirclePrimitive circle)
|
||||
{
|
||||
new CircleUpdateStrategy().Update(circle, (CirclePrimitive)sourceObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorCommonProcessor.ObjectTypeIsUnknown(typeof(INdmPrimitive), sourceObject.GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class PointUpdateStrategy : IUpdateStrategy<PointPrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
public void Update(PointPrimitive targetObject, PointPrimitive sourceObject)
|
||||
{
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.Area = sourceObject.Area;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class RebarUpdateStrategy : IUpdateStrategy<RebarPrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
public void Update(RebarPrimitive targetObject, RebarPrimitive sourceObject)
|
||||
{
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.Area = sourceObject.Area;
|
||||
targetObject.HostPrimitive = sourceObject.HostPrimitive;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class RectangleUpdateStrategy : IUpdateStrategy<RectanglePrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
static readonly DivisionPropsUpdateStrategy divisionPropsUpdateStrategy = new();
|
||||
static readonly RectangleShapeUpdateStrategy shapeUpdateStrategy = new();
|
||||
public void Update(RectanglePrimitive targetObject, RectanglePrimitive sourceObject)
|
||||
{
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
divisionPropsUpdateStrategy.Update(targetObject, sourceObject);
|
||||
shapeUpdateStrategy.Update(targetObject, sourceObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class VisualPropsUpdateStrategy : IUpdateStrategy<IVisualProperty>
|
||||
{
|
||||
public void Update(IVisualProperty targetObject, IVisualProperty sourceObject)
|
||||
{
|
||||
targetObject.IsVisible = sourceObject.IsVisible;
|
||||
targetObject.Color = sourceObject.Color;
|
||||
targetObject.SetMaterialColor = sourceObject.SetMaterialColor;
|
||||
targetObject.Opacity = sourceObject.Opacity;
|
||||
targetObject.ZIndex = sourceObject.ZIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,10 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class PointPrimitive : IPointPrimitive
|
||||
{
|
||||
static readonly PointUpdateStrategy updateStrategy = new();
|
||||
public Guid Id { get; }
|
||||
public string? Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public IPoint2D Center { get; private set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
//public double NdmMaxSize { get; set; }
|
||||
//public int NdmMinDivision { get; set; }
|
||||
@@ -31,11 +31,13 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
public bool Triangulate { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
|
||||
public PointPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Point";
|
||||
Area = 0.0005d;
|
||||
Center = new Point2D();
|
||||
VisualProperty = new VisualProperty();
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
@@ -52,16 +54,10 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
return logic.GetNdmCollection(material);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new PointPrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
primitive.Area = Area;
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
@@ -17,15 +19,14 @@ using System.Windows.Media.Media3D;
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class ReinforcementPrimitive : IPointPrimitive, IHasHostPrimitive
|
||||
public class RebarPrimitive : IPointPrimitive, IHasHostPrimitive
|
||||
{
|
||||
IDataRepository<ReinforcementPrimitive> repository;
|
||||
static readonly RebarUpdateStrategy updateStrategy = new();
|
||||
IDataRepository<RebarPrimitive> repository;
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double CenterX { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double CenterY { get; set; }
|
||||
public IPoint2D Center { get; private set; }
|
||||
/// <inheritdoc/>
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
public bool Triangulate { get; set; }
|
||||
@@ -41,27 +42,27 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public INdmPrimitive HostPrimitive { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public ReinforcementPrimitive(Guid id)
|
||||
|
||||
public RebarPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Reinforcement";
|
||||
Area = 0.0005d;
|
||||
Center = new Point2D();
|
||||
VisualProperty = new VisualProperty();
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
Triangulate = true;
|
||||
}
|
||||
public ReinforcementPrimitive() : this(Guid.NewGuid())
|
||||
public RebarPrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new ReinforcementPrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
primitive.Area = Area;
|
||||
primitive.HostPrimitive = HostPrimitive;
|
||||
var primitive = new RebarPrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
|
||||
@@ -1,28 +1,18 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ShapeServices;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class RectanglePrimitive : IRectanglePrimitive
|
||||
{
|
||||
readonly RectangleUpdateStrategy updateStrategy = new();
|
||||
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 StrainTuple UsersPrestrain { get; private set; }
|
||||
public StrainTuple AutoPrestrain { get; private set; }
|
||||
@@ -36,12 +26,15 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public IPoint2D Center { get; private set; }
|
||||
|
||||
public RectanglePrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Rectangle";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
Center = new Point2D();
|
||||
VisualProperty = new VisualProperty { Opacity = 0.8d};
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
@@ -58,9 +51,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new RectanglePrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||
ShapeService.CopyRectangleProperties(this, primitive);
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
|
||||
@@ -73,17 +64,12 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
return ndms;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsPointInside(IPoint2D point)
|
||||
{
|
||||
var xMax = CenterX + Width / 2;
|
||||
var xMin = CenterX - Width / 2;
|
||||
var yMax = CenterY + Height / 2;
|
||||
var yMin = CenterY - Height / 2;
|
||||
var xMax = Center.X + Width / 2;
|
||||
var xMin = Center.X - Width / 2;
|
||||
var yMax = Center.Y + Height / 2;
|
||||
var yMin = Center.Y - Height / 2;
|
||||
if (point.X > xMax ||
|
||||
point.X < xMin ||
|
||||
point.Y > yMax ||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
public CircleTriangulationLogicOptions(ICirclePrimitive primitive)
|
||||
{
|
||||
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
|
||||
Center = new Point2D() { X = primitive.Center.X, Y = primitive.Center.Y };
|
||||
Circle = primitive;
|
||||
NdmMaxSize = primitive.NdmMaxSize;
|
||||
NdmMinDivision = primitive.NdmMinDivision;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
public PointTriangulationLogicOptions(IPointPrimitive primitive)
|
||||
{
|
||||
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
|
||||
Center = new Point2D() { X = primitive.Center.X, Y = primitive.Center.Y };
|
||||
Area = primitive.Area;
|
||||
Prestrain = new StrainTuple
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
|
||||
{
|
||||
Center = new Point2D() { X = primitive.CenterX, Y = primitive.CenterY };
|
||||
Center = new Point2D() {X = primitive.Center.X, Y = primitive.Center.Y };
|
||||
Rectangle = primitive;
|
||||
NdmMaxSize = primitive.NdmMaxSize;
|
||||
NdmMinDivision = primitive.NdmMinDivision;
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperCommon.Services.Sections;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Services.NdmCalculations
|
||||
{
|
||||
public static class InterpolateService
|
||||
{
|
||||
static readonly CompressedMemberUpdateStrategy compressedMemberUpdateStrategy = new();
|
||||
public static IForceCalculator InterpolateForceCalculator(IForceCalculator source, IDesignForceTuple finishDesignForce,IDesignForceTuple startDesignForce, int stepCount)
|
||||
{
|
||||
IForceCalculator calculator = new ForceCalculator();
|
||||
@@ -20,7 +15,7 @@ namespace StructureHelperLogics.Services.NdmCalculations
|
||||
calculator.LimitStatesList.Add(finishDesignForce.LimitState);
|
||||
calculator.CalcTermsList.Clear();
|
||||
calculator.CalcTermsList.Add(finishDesignForce.CalcTerm);
|
||||
CompressedMemberServices.CopyProperties(source.CompressedMember, calculator.CompressedMember);
|
||||
compressedMemberUpdateStrategy.Update(calculator.CompressedMember, source.CompressedMember);
|
||||
calculator.Accuracy = source.Accuracy;
|
||||
calculator.Primitives.AddRange(source.Primitives);
|
||||
calculator.ForceActions.Clear();
|
||||
|
||||
@@ -19,32 +19,6 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
public static class NdmPrimitivesService
|
||||
{
|
||||
public static void CopyVisualProperty(IVisualProperty source, IVisualProperty target)
|
||||
{
|
||||
target.IsVisible = source.IsVisible;
|
||||
target.Color = source.Color;
|
||||
target.SetMaterialColor = source.SetMaterialColor;
|
||||
target.Opacity = source.Opacity;
|
||||
target.ZIndex = source.ZIndex;
|
||||
}
|
||||
|
||||
public static void CopyNdmProperties (INdmPrimitive source, INdmPrimitive target)
|
||||
{
|
||||
target.Name = source.Name + " copy" ;
|
||||
if (source.HeadMaterial != null) target.HeadMaterial = source.HeadMaterial;
|
||||
CopyVisualProperty(source.VisualProperty, target.VisualProperty);
|
||||
target.CenterX = source.CenterX;
|
||||
target.CenterY = source.CenterY;
|
||||
target.Triangulate = source.Triangulate;
|
||||
ForceTupleService.CopyProperties(source.UsersPrestrain, target.UsersPrestrain);
|
||||
}
|
||||
|
||||
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
|
||||
{
|
||||
target.NdmMaxSize = source.NdmMaxSize;
|
||||
target.NdmMinDivision = source.NdmMinDivision;
|
||||
target.ClearUnderlying = source.ClearUnderlying;
|
||||
}
|
||||
public static List<INdm> GetNdms(INdmPrimitive primitive, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user