RemoveUnderlying property for primitives was added
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
{
|
||||
Point,
|
||||
Rectangle,
|
||||
Circle
|
||||
Circle,
|
||||
Reinforcement
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
@@ -10,7 +11,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public class CircleViewPrimitive : PrimitiveBase, IHasDivision, IHasCenter
|
||||
public class CircleViewPrimitive : PrimitiveBase, IHasCenter
|
||||
{
|
||||
ICirclePrimitive primitive;
|
||||
public double Diameter
|
||||
@@ -25,8 +26,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
RefreshPlacement();
|
||||
}
|
||||
}
|
||||
public int NdmMinDivision { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
|
||||
public double PrimitiveLeft => DeltaX - Diameter / 2d;
|
||||
public double PrimitiveTop => DeltaY - Diameter / 2d;
|
||||
@@ -37,7 +36,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $"\nExpected: {nameof(ICirclePrimitive)}, But was: {nameof(primitive)}");
|
||||
}
|
||||
this.primitive = primitive as ICirclePrimitive;
|
||||
var circle = primitive as ICirclePrimitive;
|
||||
this.primitive = circle;
|
||||
DivisionViewModel = new HasDivisionViewModel(circle);
|
||||
}
|
||||
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
internal static class ViewPrimitiveFactory
|
||||
{
|
||||
// to do public static PrimitiveBase GetViewPrimitive() { }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,7 +9,6 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
internal interface IHasDivision
|
||||
{
|
||||
int NdmMinDivision { get; set; }
|
||||
double NdmMaxSize { get; set; }
|
||||
HasDivisionViewModel HasDivisionViewModel { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
internal class LineViewPrimitive : PrimitiveBase
|
||||
{
|
||||
public LineViewPrimitive(ILinePrimitive primitive) : base(primitive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//public LineViewPrimitive(double x, double y, MainViewModel ownerVM) : base(x, y, ownerVM)
|
||||
//{
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System.Windows.Controls;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
@@ -34,6 +35,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
#endregion
|
||||
|
||||
#region Свойства
|
||||
public HasDivisionViewModel DivisionViewModel { get; set; }
|
||||
public INdmPrimitive NdmPrimitive
|
||||
{
|
||||
get => primitive;
|
||||
@@ -68,6 +70,15 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
OnPropertyChanged(nameof(InvertedCenterY));
|
||||
}
|
||||
}
|
||||
public bool Triangulate
|
||||
{
|
||||
get => primitive.Triangulate;
|
||||
set
|
||||
{
|
||||
primitive.Triangulate = value;
|
||||
OnPropertyChanged(nameof(Triangulate));
|
||||
}
|
||||
}
|
||||
public double InvertedCenterY => - CenterY;
|
||||
public double PrestrainKx
|
||||
{ get => primitive.UsersPrestrain.Kx;
|
||||
|
||||
@@ -6,10 +6,13 @@ using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
public class RectangleViewPrimitive : PrimitiveBase, IHasDivision, IHasCenter
|
||||
public class RectangleViewPrimitive : PrimitiveBase, IHasCenter
|
||||
{
|
||||
private IRectanglePrimitive primitive;
|
||||
|
||||
@@ -42,28 +45,11 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
get => DeltaY - primitive.Height / 2d;
|
||||
}
|
||||
public int NdmMinDivision
|
||||
{
|
||||
get => primitive.NdmMinDivision;
|
||||
set
|
||||
{
|
||||
primitive.NdmMinDivision = value;
|
||||
OnPropertyChanged(nameof(NdmMinDivision));
|
||||
}
|
||||
}
|
||||
public double NdmMaxSize
|
||||
{
|
||||
get => primitive.NdmMaxSize;
|
||||
set
|
||||
{
|
||||
primitive.NdmMaxSize = value;
|
||||
OnPropertyChanged(nameof(NdmMaxSize));
|
||||
}
|
||||
}
|
||||
|
||||
public RectangleViewPrimitive(IRectanglePrimitive _primitive) : base(_primitive)
|
||||
{
|
||||
primitive = _primitive;
|
||||
DivisionViewModel = new HasDivisionViewModel(primitive);
|
||||
}
|
||||
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
internal class ReinforcementViewPrimitive : PointViewPrimitive
|
||||
{
|
||||
public ReinforcementViewPrimitive(IPointPrimitive _primitive) : base(_primitive)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,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="Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
</MenuItem>
|
||||
<Button Content="Edit primitive" Command="{Binding PrimitiveLogic.Edit}"/>
|
||||
@@ -107,9 +108,10 @@
|
||||
<Expander.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Add">
|
||||
<Button Content="Add Rectangle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button Content="Add Circle" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||
<Button Content="Add Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
<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="Point" Command="{Binding Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Expander.ContextMenu>
|
||||
@@ -162,9 +164,10 @@
|
||||
<Canvas.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Add">
|
||||
<Button Content="Add Rectangle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Rectangle}"/>
|
||||
<Button Content="Add Circle" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Circle}"/>
|
||||
<Button Content="Add Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
<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="Point" Command="{Binding PrimitiveLogic.Add}" CommandParameter="{x:Static enums:PrimitiveType.Point}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Templates">
|
||||
<Button Content="Concrete beam" Command="{Binding AddBeamCase}"/>
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace StructureHelper.Windows.MainWindow
|
||||
private readonly double scaleRate = 1.1d;
|
||||
|
||||
public PrimitiveBase SelectedPrimitive { get; set; }
|
||||
public IForceCombinationList SelectedForceCombinationList { get; set; }
|
||||
//public IForceCombinationList SelectedForceCombinationList { get; set; }
|
||||
|
||||
private readonly AnalysisVewModelLogic calculatorsLogic;
|
||||
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
|
||||
|
||||
@@ -58,12 +58,44 @@
|
||||
</Grid>
|
||||
</Expander>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="ReinforcementProperties">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Inside of"/>
|
||||
<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>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="TriangulationProperties">
|
||||
<Expander Header="Triangulation" IsExpanded="False">
|
||||
<Expander Header="Triangulation" DataContext="{Binding DivisionViewModel}" IsExpanded="False">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
@@ -71,8 +103,10 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Minimum element division"/>
|
||||
<TextBlock Grid.Row="1" Text="Maximum element size"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding MinElementDivision, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding MaxElementSize, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="2" Text="Clear underlying"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding NdmMinDivision, ValidatesOnExceptions=True}"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Text="{Binding NdmMaxSize, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
|
||||
<CheckBox Grid.Row="2" Grid.Column="1" IsChecked="{Binding ClearUnderlying}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</DataTemplate>
|
||||
@@ -88,6 +122,7 @@
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
@@ -97,6 +132,7 @@
|
||||
<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>
|
||||
@@ -118,6 +154,7 @@
|
||||
</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">
|
||||
|
||||
@@ -43,10 +43,11 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
|
||||
private void AddPrimitiveProperties(PrimitiveType type)
|
||||
{
|
||||
List<string> names = new List<string>();
|
||||
if (primitive is IHasDivision) { names.Add("TriangulationProperties");}
|
||||
if (primitive.DivisionViewModel is not null) { names.Add("TriangulationProperties");}
|
||||
if (primitive is RectangleViewPrimitive) { names.Add("RectangleProperties"); }
|
||||
else if (primitive is CircleViewPrimitive) { names.Add("CircleProperties"); }
|
||||
else if (primitive is PointViewPrimitive) { names.Add("PointProperties"); }
|
||||
if (primitive is CircleViewPrimitive) { names.Add("CircleProperties"); }
|
||||
if (primitive is PointViewPrimitive) { names.Add("PointProperties"); }
|
||||
if (primitive is ReinforcementViewPrimitive) { names.Add("ReinforcementProperties"); }
|
||||
foreach (var name in names)
|
||||
{
|
||||
ContentControl contentControl = new ContentControl();
|
||||
|
||||
@@ -14,6 +14,7 @@ using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
@@ -211,7 +212,24 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
var limitState = SelectedResult.DesignForceTuple.LimitState;
|
||||
var calcTerm = SelectedResult.DesignForceTuple.CalcTerm;
|
||||
ndms = NdmPrimitivesService.GetNdms(selectedNdmPrimitives, limitState, calcTerm);
|
||||
var orderedNdmPrimitives = ndmPrimitives.OrderBy(x => x.VisualProperty.ZIndex);
|
||||
var ndmRange = new List<INdm>();
|
||||
foreach (var item in orderedNdmPrimitives)
|
||||
{
|
||||
if (item is IHasDivisionSize)
|
||||
{
|
||||
var hasDivision = item as IHasDivisionSize;
|
||||
if (hasDivision.ClearUnderlying == true)
|
||||
{
|
||||
ndmRange.RemoveAll(x => hasDivision.IsPointInside(new Point2D() { X = x.CenterX, Y = x.CenterY }) == true);
|
||||
}
|
||||
}
|
||||
if (selectedNdmPrimitives.Contains(item) & item.Triangulate == true)
|
||||
{
|
||||
ndmRange.AddRange(NdmPrimitivesService.GetNdms(item, limitState, calcTerm));
|
||||
}
|
||||
}
|
||||
ndms = ndmRange;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,19 +53,27 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
(
|
||||
runCommand = new RelayCommand(o =>
|
||||
{
|
||||
SelectedItem.Run();
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
try
|
||||
{
|
||||
MessageBox.Show(result.Desctription, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
SelectedItem.Run();
|
||||
var result = SelectedItem.Result;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
MessageBox.Show(result.Desctription, "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();
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
var calculator = SelectedItem as IForceCalculator;
|
||||
var vm = new ForcesResultsViewModel(calculator);
|
||||
var wnd = new ForceResultsView(vm);
|
||||
wnd.ShowDialog();
|
||||
MessageBox.Show($"{ex}", "There are some errors during solution", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}, o => SelectedItem != null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
public class HasDivisionViewModel : ViewModelBase, IHasDivisionSize
|
||||
{
|
||||
private IHasDivisionSize primitive;
|
||||
|
||||
public double NdmMaxSize
|
||||
{
|
||||
get { return primitive.NdmMaxSize; }
|
||||
set
|
||||
{
|
||||
primitive.NdmMaxSize = value;
|
||||
OnPropertyChanged(nameof(NdmMaxSize));
|
||||
}
|
||||
}
|
||||
public int NdmMinDivision
|
||||
{
|
||||
get { return primitive.NdmMinDivision; }
|
||||
set
|
||||
{
|
||||
primitive.NdmMinDivision = value;
|
||||
OnPropertyChanged(nameof(NdmMinDivision));
|
||||
}
|
||||
}
|
||||
public bool ClearUnderlying
|
||||
{
|
||||
get { return primitive.ClearUnderlying; }
|
||||
set
|
||||
{
|
||||
primitive.ClearUnderlying = value;
|
||||
OnPropertyChanged(nameof(ClearUnderlying));
|
||||
}
|
||||
}
|
||||
|
||||
public HasDivisionViewModel(IHasDivisionSize primitive)
|
||||
{
|
||||
this.primitive = primitive;
|
||||
}
|
||||
|
||||
public bool IsPointInside(IPoint2D point)
|
||||
{
|
||||
//not required
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,15 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
viewPrimitive = new RectangleViewPrimitive(primitive);
|
||||
|
||||
}
|
||||
else if (primitiveType == PrimitiveType.Reinforcement)
|
||||
{
|
||||
var primitive = new ReinforcementPrimitive
|
||||
{
|
||||
Area = 0.0005d
|
||||
};
|
||||
ndmPrimitive = primitive;
|
||||
viewPrimitive = new ReinforcementViewPrimitive(primitive);
|
||||
}
|
||||
else if (primitiveType == PrimitiveType.Point)
|
||||
{
|
||||
var primitive = new PointPrimitive
|
||||
|
||||
@@ -3,6 +3,7 @@ using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ColorPickerWindow;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
@@ -73,7 +74,15 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
OnPropertyChanged(nameof(CenterY));
|
||||
}
|
||||
}
|
||||
|
||||
public bool Triangulate
|
||||
{
|
||||
get { return primitive.Triangulate; }
|
||||
set
|
||||
{
|
||||
primitive.Triangulate = value;
|
||||
OnPropertyChanged(nameof(Triangulate));
|
||||
}
|
||||
}
|
||||
public double PrestrainKx
|
||||
{
|
||||
get => primitive.PrestrainKx;
|
||||
@@ -94,25 +103,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
||||
public double AutoPrestrainKy => primitive.AutoPrestrainKy;
|
||||
public double AutoPrestrainEpsZ => primitive.AutoPrestrainEpsZ;
|
||||
|
||||
public int MinElementDivision
|
||||
{
|
||||
get => (primitive as IHasDivision).NdmMinDivision;
|
||||
set
|
||||
{
|
||||
(primitive as IHasDivision).NdmMinDivision = value;
|
||||
OnPropertyChanged(nameof(MinElementDivision));
|
||||
}
|
||||
}
|
||||
|
||||
public double MaxElementSize
|
||||
{
|
||||
get => (primitive as IHasDivision).NdmMaxSize;
|
||||
set
|
||||
{
|
||||
(primitive as IHasDivision).NdmMaxSize = value;
|
||||
OnPropertyChanged(nameof(MaxElementSize));
|
||||
}
|
||||
}
|
||||
public HasDivisionViewModel DivisionViewModel => primitive.DivisionViewModel;
|
||||
|
||||
public double Width
|
||||
{
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class ForceCombinationByFactor : IForceCombinationByFactor
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
public bool SetInGravityCenter { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IPoint2D ForcePoint { get; private set; }
|
||||
/// <inheritdoc/>
|
||||
public IForceTuple FullSLSForces { get; private set; }
|
||||
/// <inheritdoc/>
|
||||
public double ULSFactor { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double LongTermFactor { get; set; }
|
||||
public ForceCombinationByFactor()
|
||||
{
|
||||
Name = "New Factored Load";
|
||||
SetInGravityCenter = true;
|
||||
ForcePoint = new Point2D();
|
||||
FullSLSForces = new ForceTuple();
|
||||
}
|
||||
public List<IDesignForceTuple> GetCombination()
|
||||
{
|
||||
var result = new List<IDesignForceTuple>();
|
||||
var limitStates = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
||||
var calcTerms = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
foreach (var limitState in limitStates)
|
||||
{
|
||||
var stateFactor = limitState is LimitStates.SLS ? 1d : ULSFactor;
|
||||
foreach (var calcTerm in calcTerms)
|
||||
{
|
||||
var termFactor = calcTerm is CalcTerms.ShortTerm ? 1d : LongTermFactor;
|
||||
var designForceTuple = new DesignForceTuple() { LimitState = limitState, CalcTerm = calcTerm };
|
||||
designForceTuple.ForceTuple = ForceTupleService.MultiplyTuples(designForceTuple.ForceTuple, stateFactor * termFactor);
|
||||
result.Add(designForceTuple);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class ForceCombinationList : IForceCombinationList
|
||||
{
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public bool SetInGravityCenter { get; set; }
|
||||
public Point2D ForcePoint { get; private set; }
|
||||
/// <inheritdoc/>
|
||||
public IPoint2D ForcePoint { get; private set; }
|
||||
/// <inheritdoc/>
|
||||
public List<IDesignForceTuple> DesignForces { get; private set; }
|
||||
|
||||
|
||||
public ForceCombinationList()
|
||||
{
|
||||
SetInGravityCenter = true;
|
||||
ForcePoint = new Point2D() { X = 0, Y = 0 };
|
||||
DesignForces = new List<IDesignForceTuple>();
|
||||
DesignForces.Add(new DesignForceTuple(LimitStates.ULS, CalcTerms.ShortTerm));
|
||||
DesignForces.Add(new DesignForceTuple(LimitStates.ULS, CalcTerms.LongTerm));
|
||||
DesignForces.Add(new DesignForceTuple(LimitStates.SLS, CalcTerms.ShortTerm));
|
||||
DesignForces.Add(new DesignForceTuple(LimitStates.SLS, CalcTerms.LongTerm));
|
||||
DesignForces = new List<IDesignForceTuple>
|
||||
{
|
||||
new DesignForceTuple(LimitStates.ULS, CalcTerms.ShortTerm),
|
||||
new DesignForceTuple(LimitStates.ULS, CalcTerms.LongTerm),
|
||||
new DesignForceTuple(LimitStates.SLS, CalcTerms.ShortTerm),
|
||||
new DesignForceTuple(LimitStates.SLS, CalcTerms.LongTerm)
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new ForceCombinationList();
|
||||
@@ -39,5 +47,26 @@ namespace StructureHelperCommon.Models.Forces
|
||||
}
|
||||
return newItem;
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public List<IDesignForceTuple> GetCombination()
|
||||
{
|
||||
var result = new List<IDesignForceTuple>();
|
||||
var limitStates = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
||||
var calcTerms = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
foreach (var limitState in limitStates)
|
||||
{
|
||||
foreach (var calcTerm in calcTerms)
|
||||
{
|
||||
var designForceTuple = new DesignForceTuple() { LimitState = limitState, CalcTerm = calcTerm };
|
||||
var forceTupleList = DesignForces.Where(x => x.LimitState == limitState & x.CalcTerm == calcTerm);
|
||||
foreach (var item in forceTupleList)
|
||||
{
|
||||
designForceTuple.ForceTuple = ForceTupleService.SumTuples(designForceTuple.ForceTuple, item.ForceTuple);
|
||||
}
|
||||
result.Add(designForceTuple);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class ForceTuple : IForceTuple
|
||||
@@ -22,5 +24,17 @@
|
||||
IForceTuple forceTuple = new ForceTuple() { Mx = Mx, My = My, Nz = Nz, Qx = Qx, Qy = Qy, Mz = Mz};
|
||||
return forceTuple;
|
||||
}
|
||||
public static ForceTuple operator +(ForceTuple first) => first;
|
||||
public static ForceTuple operator +(ForceTuple first, ForceTuple second)
|
||||
{
|
||||
var result = new ForceTuple();
|
||||
result.Mx += first.Mx + second.Mx;
|
||||
result.My += first.My + second.My;
|
||||
result.Mz += first.Mz + second.Mz;
|
||||
result.Qx += first.Qx + second.Qx;
|
||||
result.Qy += first.Qy + second.Qy;
|
||||
result.Nz += first.Nz + second.Nz;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
StructureHelperCommon/Models/Forces/IAction.cs
Normal file
13
StructureHelperCommon/Models/Forces/IAction.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public interface IAction
|
||||
{
|
||||
string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
@@ -8,5 +9,6 @@ namespace StructureHelperCommon.Models.Forces
|
||||
LimitStates LimitState { get; set; }
|
||||
CalcTerms CalcTerm { get; set; }
|
||||
IForceTuple ForceTuple { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
16
StructureHelperCommon/Models/Forces/IForceAction.cs
Normal file
16
StructureHelperCommon/Models/Forces/IForceAction.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public interface IForceAction : IAction
|
||||
{
|
||||
bool SetInGravityCenter { get; set; }
|
||||
IPoint2D ForcePoint { get; }
|
||||
List<IDesignForceTuple> GetCombination();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public interface IForceCombinationByFactor : IForceAction
|
||||
{
|
||||
IForceTuple FullSLSForces { get; }
|
||||
double ULSFactor { get; set; }
|
||||
double LongTermFactor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,8 @@ using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public interface IForceCombinationList : ICloneable
|
||||
public interface IForceCombinationList : IForceAction, ICloneable
|
||||
{
|
||||
string Name { get; set; }
|
||||
bool SetInGravityCenter { get; set; }
|
||||
Point2D ForcePoint {get ;}
|
||||
List<IDesignForceTuple> DesignForces { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,28 @@ namespace StructureHelperCommon.Services.Forces
|
||||
newTuple.My -= newTuple.Nz * point2D.X;
|
||||
return newTuple;
|
||||
}
|
||||
|
||||
public static IForceTuple SumTuples(IForceTuple first, IForceTuple second)
|
||||
{
|
||||
var result = new ForceTuple();
|
||||
result.Mx += first.Mx + second.Mx;
|
||||
result.My += first.My + second.My;
|
||||
result.Mz += first.Mz + second.Mz;
|
||||
result.Qx += first.Qx + second.Qx;
|
||||
result.Qy += first.Qy + second.Qy;
|
||||
result.Nz += first.Nz + second.Nz;
|
||||
return result;
|
||||
}
|
||||
public static IForceTuple MultiplyTuples(IForceTuple first, double factor)
|
||||
{
|
||||
var result = new ForceTuple();
|
||||
result.Mx += first.Mx * factor;
|
||||
result.My += first.My * factor;
|
||||
result.Mz += first.Mz * factor;
|
||||
result.Qx += first.Qx * factor;
|
||||
result.Qy += first.Qy * factor;
|
||||
result.Nz += first.Nz * factor;
|
||||
return result;
|
||||
}
|
||||
public static IForceTuple InterpolateTuples(IForceTuple endTuple, IForceTuple startTuple = null, double coefficient = 0.5d)
|
||||
{
|
||||
if (startTuple == null) startTuple = new ForceTuple();
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
private string CheckInputData()
|
||||
{
|
||||
string result = "";
|
||||
if (Primitives.Count == 0) { result += "Calculator does not contain any primitives \n"; }
|
||||
NdmPrimitivesService.CheckPrimitives(Primitives);
|
||||
if (ForceCombinationLists.Count == 0) { result += "Calculator does not contain any forces \n"; }
|
||||
if (LimitStatesList.Count == 0) { result += "Calculator does not contain any limit states \n"; }
|
||||
if (CalcTermsList.Count == 0) { result += "Calculator does not contain any duration \n"; }
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Logics;
|
||||
using LoaderCalculator.Logics.Geometry;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ShapeServices;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
@@ -20,16 +21,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
|
||||
public IStrainTuple UsersPrestrain { get; }
|
||||
|
||||
public IStrainTuple AutoPrestrain { get; }
|
||||
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
|
||||
public double Diameter { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public bool ClearUnderlying { get; set; }
|
||||
public bool Triangulate { get; set; }
|
||||
|
||||
public CirclePrimitive()
|
||||
{
|
||||
@@ -39,11 +38,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
VisualProperty = new VisualProperty { Opacity = 0.8d };
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
ClearUnderlying = false;
|
||||
Triangulate = true;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new CirclePrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||
ShapeService.CopyCircleProperties(this, primitive);
|
||||
return primitive;
|
||||
@@ -62,5 +64,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsPointInside(IPoint2D point)
|
||||
{
|
||||
var dX = CenterX - point.X;
|
||||
var dY = CenterY - point.Y;
|
||||
var distance = Math.Sqrt(dX * dX + dY * dY);
|
||||
if (distance > Diameter / 2) { return false; }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface ICirclePrimitive : IHasDivisionSize, ICircleShape
|
||||
public interface ICirclePrimitive : INdmPrimitive, IHasDivisionSize, ICircleShape
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,9 +8,28 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IHasDivisionSize : INdmPrimitive
|
||||
/// <summary>
|
||||
/// Include parameters of triangulation for shapes
|
||||
/// </summary>
|
||||
public interface IHasDivisionSize
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum size of Ndm part
|
||||
/// </summary>
|
||||
double NdmMaxSize { get; set; }
|
||||
/// <summary>
|
||||
/// Mimimum division for sides of shape
|
||||
/// </summary>
|
||||
int NdmMinDivision { get; set; }
|
||||
/// <summary>
|
||||
/// Flag of removing ndm part which located inside shape
|
||||
/// </summary>
|
||||
bool ClearUnderlying { get; set; }
|
||||
/// <summary>
|
||||
/// Shows if point is located inside shape
|
||||
/// </summary>
|
||||
/// <param name=""></param>
|
||||
/// <returns></returns>
|
||||
bool IsPointInside(IPoint2D point);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IHasSorroundingPrimitive
|
||||
{
|
||||
INdmPrimitive SorroundingPrimitive { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -13,15 +13,16 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface INdmPrimitive : ISaveable, ICloneable
|
||||
{
|
||||
string Name { get; set; }
|
||||
string? Name { get; set; }
|
||||
double CenterX { get; set; }
|
||||
double CenterY { get; set; }
|
||||
IHeadMaterial? HeadMaterial { get; set; }
|
||||
/// <summary>
|
||||
/// Flag of triangulation
|
||||
/// </summary>
|
||||
bool Triangulate { get; set; }
|
||||
IStrainTuple UsersPrestrain { get; }
|
||||
IStrainTuple AutoPrestrain { get; }
|
||||
//double PrestrainKx { get; set; }
|
||||
//double PrestrainKy { get; set; }
|
||||
//double PrestrainEpsZ { get; set; }
|
||||
IVisualProperty VisualProperty {get; }
|
||||
|
||||
IEnumerable<INdm> GetNdms(IMaterial material);
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IRectanglePrimitive : IHasDivisionSize, IRectangleShape
|
||||
public interface IRectanglePrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public IStrainTuple AutoPrestrain => throw new NotImplementedException();
|
||||
|
||||
public bool ClearUnderlying { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public bool Triangulate { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public LinePrimitive()
|
||||
{
|
||||
StartPoint = new Point2D();
|
||||
@@ -65,5 +68,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsPointInside(IPoint2D point)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
public class PointPrimitive : IPointPrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
@@ -27,8 +27,7 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
public double Area { get; set; }
|
||||
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
|
||||
|
||||
public bool Triangulate { get; set; }
|
||||
|
||||
public PointPrimitive()
|
||||
{
|
||||
@@ -37,6 +36,7 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
VisualProperty = new VisualProperty();
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
Triangulate = true;
|
||||
}
|
||||
|
||||
public PointPrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
|
||||
@@ -30,9 +30,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public double Width { get; set; }
|
||||
public double Height { get; set; }
|
||||
public double Angle { get; set; }
|
||||
|
||||
public bool ClearUnderlying { get; set; }
|
||||
public bool Triangulate { get; set; }
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
|
||||
|
||||
public RectanglePrimitive()
|
||||
{
|
||||
Name = "New Rectangle";
|
||||
@@ -41,6 +43,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
VisualProperty = new VisualProperty { Opacity = 0.8d};
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
ClearUnderlying = false;
|
||||
Triangulate = true;
|
||||
}
|
||||
|
||||
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
@@ -48,6 +52,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new RectanglePrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||
ShapeService.CopyRectangleProperties(this, primitive);
|
||||
return primitive;
|
||||
@@ -66,5 +71,19 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
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;
|
||||
if (point.X > xMax ||
|
||||
point.X < xMin ||
|
||||
point.Y > yMax ||
|
||||
point.Y < yMin)
|
||||
{ return false; }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
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;
|
||||
using System.Windows.Media.Media3D;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class ReinforcementPrimitive : IPointPrimitive, IHasSorroundingPrimitive
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double CenterX { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double CenterY { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
public bool Triangulate { get; set; }
|
||||
|
||||
public IStrainTuple UsersPrestrain { get; private set; }
|
||||
|
||||
public IStrainTuple AutoPrestrain { get; private set; }
|
||||
|
||||
public IVisualProperty VisualProperty { get; private set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
public double Area { get; set; }
|
||||
public INdmPrimitive SorroundingPrimitive { get; set; }
|
||||
|
||||
public ReinforcementPrimitive()
|
||||
{
|
||||
Name = "New Reinforcement";
|
||||
Area = 0.0005d;
|
||||
VisualProperty = new VisualProperty();
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
Triangulate = true;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new ReinforcementPrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
primitive.Area = Area;
|
||||
primitive.SorroundingPrimitive = this.SorroundingPrimitive;
|
||||
return primitive;
|
||||
}
|
||||
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
{
|
||||
var options = new PointTriangulationLogicOptions(this);
|
||||
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
||||
return logic.GetNdmCollection(material);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,23 +71,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
private static IEnumerable<INdm> GetNdmsByPrimitive(INdmPrimitive primitive, IMaterial material)
|
||||
{
|
||||
List<INdm> ndms = new List<INdm>();
|
||||
//ITriangulationLogicOptions options;
|
||||
//ICenter center = primitive.Center;
|
||||
//IShape shape = primitive.Shape;
|
||||
ndms.AddRange(primitive.GetNdms(material));
|
||||
//if (shape is IRectangleShape)
|
||||
//{
|
||||
// options = new RectangleTriangulationLogicOptions(primitive);
|
||||
// ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||
// ndms.AddRange(logic.GetNdmCollection(material));
|
||||
//}
|
||||
//else if (shape is IPoint)
|
||||
//{
|
||||
// options = new PointTriangulationLogicOptions(primitive);
|
||||
// IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
||||
// ndms.AddRange(logic.GetNdmCollection(material));
|
||||
//}
|
||||
//else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
|
||||
return ndms;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
@@ -8,6 +11,7 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
@@ -32,24 +36,59 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
CopyVisualProperty(source.VisualProperty, target.VisualProperty);
|
||||
target.CenterX = source.CenterX;
|
||||
target.CenterY = source.CenterY;
|
||||
target.Triangulate = source.Triangulate;
|
||||
StrainTupleService.CopyProperties(source.UsersPrestrain, target.UsersPrestrain);
|
||||
}
|
||||
|
||||
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
|
||||
{
|
||||
CopyNdmProperties(source, target);
|
||||
target.NdmMaxSize = source.NdmMaxSize;
|
||||
target.NdmMinDivision = source.NdmMinDivision;
|
||||
target.ClearUnderlying = source.ClearUnderlying;
|
||||
}
|
||||
|
||||
public static List<INdm> GetNdms(IEnumerable<INdmPrimitive> primitives, LimitStates limitState, CalcTerms calcTerm)
|
||||
public static List<INdm> GetNdms(INdmPrimitive primitive, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
//Настройки триангуляции
|
||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = limitState, CalcTerm = calcTerm };
|
||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
||||
List<INdm> ndmCollection = new List<INdm>();
|
||||
ndmCollection.AddRange(Triangulation.GetNdms(primitives, options));
|
||||
var material = primitive.HeadMaterial.GetLoaderMaterial(limitState, calcTerm);
|
||||
ndmCollection.AddRange(primitive.GetNdms(material));
|
||||
return ndmCollection;
|
||||
}
|
||||
public static List<INdm> GetNdms(IEnumerable<INdmPrimitive> primitives, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
var orderedNdmPrimitives = primitives.OrderBy(x => x.VisualProperty.ZIndex);
|
||||
var ndms = new List<INdm>();
|
||||
foreach (var item in orderedNdmPrimitives)
|
||||
{
|
||||
if (item is IHasDivisionSize)
|
||||
{
|
||||
var hasDivision = item as IHasDivisionSize;
|
||||
if (hasDivision.ClearUnderlying == true)
|
||||
{
|
||||
ndms.RemoveAll(x => hasDivision.IsPointInside(new Point2D() { X = x.CenterX, Y = x.CenterY }) == true);
|
||||
}
|
||||
}
|
||||
if (item.Triangulate == true)
|
||||
{
|
||||
ndms.AddRange(GetNdms(item, limitState, calcTerm));
|
||||
}
|
||||
}
|
||||
return ndms;
|
||||
}
|
||||
|
||||
public static bool CheckPrimitives(IEnumerable<INdmPrimitive> primitives)
|
||||
{
|
||||
if (primitives.Count() == 0) { throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Count of primitive must be greater than zero"); }
|
||||
if (primitives.Count(x => x.Triangulate == true) == 0) { throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": There are not primitives to triangulate"); }
|
||||
foreach (var item in primitives)
|
||||
{
|
||||
if (item.Triangulate == true &
|
||||
item.HeadMaterial is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Primitive: {item.Name} can't be triangulated since material is null");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,11 @@ using NUnit.Framework;
|
||||
using System.Linq;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using LoaderCalculator.Logics.Geometry;
|
||||
|
||||
namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
{
|
||||
@@ -34,5 +39,91 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
||||
Assert.AreEqual(expectedFirstCenterX, firstNdm.CenterX);
|
||||
Assert.AreEqual(expectedFirstCenterY, firstNdm.CenterY);
|
||||
}
|
||||
[TestCase(0d, 0d, 1.0d, 1.0d, true, 1d, 3020418448.8512335d, 3020418448.8512335d)]
|
||||
[TestCase(0d, 0d, 1.0d, 1.0d, false, 0.94d, 3013186843.9241991d, 3004124682.3615651d)]
|
||||
[TestCase(0.1d, 0.2d, 1.0d, 1.0d, true, 1d, 3020418448.8512335d, 3020418448.8512335d)]
|
||||
[TestCase(0.1d, 0.2d, 1.0d, 1.0d, false, 0.94d, 2920637108.8157182d, 2980987248.5842943d)]
|
||||
public void Run_Shouldpass_RectOpeningRect(double centerX, double centerY, double width, double height, bool triangOpening, double expectedArea, double expectedMomX, double expectedMomY)
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
|
||||
var mainBlock = new RectanglePrimitive() { CenterX = centerX, CenterY = centerY, Width = width, Height = height, HeadMaterial = material };
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new RectanglePrimitive()
|
||||
{ CenterX = 0d, CenterY = 0d, Width = 0.3d, Height = 0.2d,
|
||||
HeadMaterial = material, Triangulate = triangOpening,
|
||||
ClearUnderlying = true};
|
||||
opening.VisualProperty.ZIndex = 1;
|
||||
var primitives = new List<INdmPrimitive>() { mainBlock, opening };
|
||||
//Act
|
||||
var ndms = NdmPrimitivesService.GetNdms(primitives, LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
//Assert
|
||||
var area = ndms.Sum(x => x.Area);
|
||||
var moments = GeometryOperations.GetMomentsOfInertiaMod(ndms);
|
||||
Assert.AreEqual(expectedArea, area, 0.001d);
|
||||
Assert.AreEqual(expectedMomX, moments.MomentX, 0.001d);
|
||||
Assert.AreEqual(expectedMomY, moments.MomentY, 1d);
|
||||
}
|
||||
[TestCase(0d, 0d, 1.0d, 1.0d, true, 1d, 3020017308.3574591d, 3020017308.3574591d)]
|
||||
[TestCase(0d, 0d, 1.0d, 1.0d, false, 0.92839999999991407d, 3005633713.5049105d, 3005633713.5049105d)]
|
||||
[TestCase(0.1d, 0.2d, 1.0d, 1.0d, true, 1d, 3018642205.1351919d, 3019673532.5518913d)]
|
||||
[TestCase(0.1d, 0.2d, 1.0d, 1.0d, false, 0.92839999999991407d, 2893811090.8611836d, 2977678057.8439965d)]
|
||||
public void Run_Shouldpass_RectOpeningCircle(double centerX, double centerY, double width, double height, bool triangOpening, double expectedArea, double expectedMomX, double expectedMomY)
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
|
||||
var mainBlock = new RectanglePrimitive() { CenterX = centerX, CenterY = centerY, Width = width, Height = height, HeadMaterial = material };
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new CirclePrimitive()
|
||||
{
|
||||
CenterX = 0d,
|
||||
CenterY = 0d,
|
||||
Diameter = 0.3d,
|
||||
HeadMaterial = material,
|
||||
Triangulate = triangOpening,
|
||||
ClearUnderlying = true
|
||||
};
|
||||
opening.VisualProperty.ZIndex = 1;
|
||||
var primitives = new List<INdmPrimitive>() { mainBlock, opening };
|
||||
//Act
|
||||
var ndms = NdmPrimitivesService.GetNdms(primitives, LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
//Assert
|
||||
var area = ndms.Sum(x => x.Area);
|
||||
var moments = GeometryOperations.GetMomentsOfInertiaMod(ndms);
|
||||
Assert.AreEqual(expectedArea, area, 0.001d);
|
||||
Assert.AreEqual(expectedMomX, moments.MomentX, 0.001d);
|
||||
Assert.AreEqual(expectedMomY, moments.MomentY, 1d);
|
||||
}
|
||||
[TestCase(0d, 0d, 1.0d, true, 0.78079430967489682d, 1777730450.3666615d, 1776732530.5957441d)]
|
||||
[TestCase(0d, 0d, 1.0d, false, 0.72079430967490343d, 1770498845.4396176d, 1760438764.1059904d)]
|
||||
[TestCase(0.1d, 0.2d, 1.0d, true, 0.78386909642355929d, 1772956158.4523892d, 1777255335.2898147d)]
|
||||
[TestCase(0.1d, 0.2d, 1.0d, false, 0.72386909642356589d, 1670848320.3763092d, 1737334754.3254938d)]
|
||||
public void Run_Shouldpass_CircleOpeningRect(double centerX, double centerY, double diameter, bool triangOpening, double expectedArea, double expectedMomX, double expectedMomY)
|
||||
{
|
||||
//Arrange
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
|
||||
var mainBlock = new CirclePrimitive() { CenterX = centerX, CenterY = centerY, Diameter = diameter, HeadMaterial = material };
|
||||
mainBlock.VisualProperty.ZIndex = 0;
|
||||
var opening = new RectanglePrimitive()
|
||||
{
|
||||
CenterX = 0d,
|
||||
CenterY = 0d,
|
||||
Width = 0.3d,
|
||||
Height = 0.2d,
|
||||
HeadMaterial = material,
|
||||
Triangulate = triangOpening,
|
||||
ClearUnderlying = true
|
||||
};
|
||||
opening.VisualProperty.ZIndex = 1;
|
||||
var primitives = new List<INdmPrimitive>() { mainBlock, opening };
|
||||
//Act
|
||||
var ndms = NdmPrimitivesService.GetNdms(primitives, LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
//Assert
|
||||
var area = ndms.Sum(x => x.Area);
|
||||
var moments = GeometryOperations.GetMomentsOfInertiaMod(ndms);
|
||||
Assert.AreEqual(expectedArea, area, 0.001d);
|
||||
Assert.AreEqual(expectedMomX, moments.MomentX, 0.001d);
|
||||
Assert.AreEqual(expectedMomY, moments.MomentY, 1d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user