diff --git a/StructureHelper/App.xaml b/StructureHelper/App.xaml
index 9d626e4..df63f54 100644
--- a/StructureHelper/App.xaml
+++ b/StructureHelper/App.xaml
@@ -15,6 +15,7 @@
+
diff --git a/StructureHelper/Infrastructure/Enums/ActionType.cs b/StructureHelper/Infrastructure/Enums/ActionType.cs
new file mode 100644
index 0000000..3a81918
--- /dev/null
+++ b/StructureHelper/Infrastructure/Enums/ActionType.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Infrastructure.Enums
+{
+ public enum ActionType
+ {
+ ForceCombination,
+ ForceCombinationByFactor
+ }
+}
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs
index c05f549..9017cc8 100644
--- a/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs
+++ b/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveBase.cs
@@ -263,13 +263,13 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
public virtual INdmPrimitive GetNdmPrimitive()
{
- RefreshNdmPrimitive();
+ //RefreshNdmPrimitive();
return primitive;
}
- public virtual void RefreshNdmPrimitive()
- {
- }
+ //public virtual void RefreshNdmPrimitive()
+ //{
+ //}
public void RefreshColor()
{
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveOperations.cs b/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveOperations.cs
index 719c60c..74f5b55 100644
--- a/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveOperations.cs
+++ b/StructureHelper/Infrastructure/UI/DataContexts/PrimitiveOperations.cs
@@ -17,26 +17,37 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
public static ObservableCollection ConvertNdmPrimitivesToPrimitiveBase(IEnumerable primitives)
{
ObservableCollection viewItems = new ObservableCollection();
- foreach (var item in primitives)
+ foreach (var primitive in primitives)
{
- if (item is IRectanglePrimitive)
- {
- var rect = item as IRectanglePrimitive;
- viewItems.Add(new RectangleViewPrimitive(rect));
- }
- else if (item is ICirclePrimitive)
- {
- var circle = item as ICirclePrimitive;
- viewItems.Add(new CircleViewPrimitive(circle));
- }
- else if (item is IPointPrimitive)
- {
- var point = item as IPointPrimitive;
- viewItems.Add(new PointViewPrimitive(point));
- }
- else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
+ viewItems.Add(ConvertNdmPrimitiveToPrimitiveBase(primitive));
}
return viewItems;
}
+ public static PrimitiveBase ConvertNdmPrimitiveToPrimitiveBase(INdmPrimitive primitive)
+ {
+ PrimitiveBase viewItem;
+ if (primitive is IRectanglePrimitive)
+ {
+ var rect = primitive as IRectanglePrimitive;
+ viewItem = new RectangleViewPrimitive(rect);
+ }
+ else if (primitive is ICirclePrimitive)
+ {
+ var circle = primitive as ICirclePrimitive;
+ viewItem = new CircleViewPrimitive(circle);
+ }
+ else if (primitive is IPointPrimitive & primitive is not ReinforcementPrimitive)
+ {
+ var point = primitive as IPointPrimitive;
+ viewItem = new PointViewPrimitive(point);
+ }
+ else if (primitive is ReinforcementPrimitive)
+ {
+ var point = primitive as ReinforcementPrimitive;
+ viewItem = new ReinforcementViewPrimitive(point);
+ }
+ else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Actual type: {primitive.GetType()}");
+ return viewItem;
+ }
}
}
diff --git a/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs b/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs
index 72c467b..e7b7fb2 100644
--- a/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs
+++ b/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs
@@ -7,10 +7,23 @@ using System.Threading.Tasks;
namespace StructureHelper.Infrastructure.UI.DataContexts
{
- internal class ReinforcementViewPrimitive : PointViewPrimitive
+ public class ReinforcementViewPrimitive : PointViewPrimitive, IHasSurroundingPrimitive
{
- public ReinforcementViewPrimitive(IPointPrimitive _primitive) : base(_primitive)
+ ReinforcementPrimitive primitive;
+
+ public INdmPrimitive SurroundingPrimitive
{
+ get => primitive.SurroundingPrimitive;
+ set
+ {
+ primitive.SurroundingPrimitive = value;
+ OnPropertyChanged(nameof(SurroundingPrimitive));
+ }
+ }
+
+ public ReinforcementViewPrimitive(ReinforcementPrimitive _primitive) : base(_primitive)
+ {
+ primitive = _primitive;
}
}
}
diff --git a/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml b/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml
new file mode 100644
index 0000000..39c13cf
--- /dev/null
+++ b/StructureHelper/Infrastructure/UI/Resources/ForceTemplates.xaml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user
index bb58652..3098e55 100644
--- a/StructureHelper/StructureHelper.csproj.user
+++ b/StructureHelper/StructureHelper.csproj.user
@@ -9,6 +9,9 @@
+
+ Code
+
Code
@@ -17,6 +20,12 @@
+
+ Designer
+
+
+ Designer
+
Designer
diff --git a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml
new file mode 100644
index 0000000..df27e40
--- /dev/null
+++ b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs
new file mode 100644
index 0000000..798ced7
--- /dev/null
+++ b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs
@@ -0,0 +1,32 @@
+using StructureHelper.Windows.ViewModels.Forces;
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace StructureHelper.Windows.Forces
+{
+ ///
+ /// Логика взаимодействия для ForceCombinationByFactor.xaml
+ ///
+ public partial class ForceCombinationByFactorView : Window
+ {
+ ForceCombinationByFactorVM viewModel;
+ public ForceCombinationByFactorView(IForceCombinationByFactor forceCombination)
+ {
+ InitializeComponent();
+ viewModel = new ForceCombinationByFactorVM(forceCombination);
+ DataContext = viewModel;
+ }
+ }
+}
diff --git a/StructureHelper/Windows/Forces/ForceCombinationView.xaml b/StructureHelper/Windows/Forces/ForceCombinationView.xaml
index 9a0081c..f914571 100644
--- a/StructureHelper/Windows/Forces/ForceCombinationView.xaml
+++ b/StructureHelper/Windows/Forces/ForceCombinationView.xaml
@@ -9,56 +9,14 @@
mc:Ignorable="d"
Title="Force Combination" Height="250" Width="550" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/StructureHelper/Windows/MainWindow/MainView.xaml b/StructureHelper/Windows/MainWindow/MainView.xaml
index 3c656b2..d89a968 100644
--- a/StructureHelper/Windows/MainWindow/MainView.xaml
+++ b/StructureHelper/Windows/MainWindow/MainView.xaml
@@ -75,7 +75,10 @@
-
+
diff --git a/StructureHelper/Windows/MainWindow/MainViewModel.cs b/StructureHelper/Windows/MainWindow/MainViewModel.cs
index 38b867b..6f8bb3b 100644
--- a/StructureHelper/Windows/MainWindow/MainViewModel.cs
+++ b/StructureHelper/Windows/MainWindow/MainViewModel.cs
@@ -42,7 +42,7 @@ namespace StructureHelper.Windows.MainWindow
private readonly AnalysisVewModelLogic calculatorsLogic;
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;}
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
- public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
+ public PrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
public HelpLogic HelpLogic => new HelpLogic();
private MainModel Model { get; }
@@ -214,7 +214,7 @@ namespace StructureHelper.Windows.MainWindow
private double delta = 0.0005;
private ActionsViewModel combinationsLogic;
- private IPrimitiveViewModelLogic primitiveLogic;
+ private PrimitiveViewModelLogic primitiveLogic;
private RelayCommand showVisualProperty;
private RelayCommand selectPrimitive;
@@ -225,7 +225,7 @@ namespace StructureHelper.Windows.MainWindow
section = model.Section;
combinationsLogic = new ActionsViewModel(repository);
calculatorsLogic = new AnalysisVewModelLogic(repository);
- primitiveLogic = new PrimitiveViewModelLogic(repository) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
+ primitiveLogic = new PrimitiveViewModelLogic(section) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight };
XX2 = CanvasWidth;
XY1 = CanvasHeight / 2d;
YX1 = CanvasWidth / 2d;
@@ -342,11 +342,6 @@ namespace StructureHelper.Windows.MainWindow
}
}
- private bool CheckAnalisysOptions()
- {
- if (CheckMaterials() == false) { return false; }
- return true;
- }
private bool CheckMaterials()
{
foreach (var item in primitiveLogic.Items)
@@ -405,10 +400,10 @@ namespace StructureHelper.Windows.MainWindow
var newRepository = newSection.SectionRepository;
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
repository.Primitives.AddRange(newRepository.Primitives);
- repository.ForceCombinationLists.AddRange(newRepository.ForceCombinationLists);
+ repository.ForceActions.AddRange(newRepository.ForceActions);
repository.CalculatorsList.AddRange(newRepository.CalculatorsList);
OnPropertyChanged(nameof(HeadMaterials));
- CombinationsLogic.AddItems(newRepository.ForceCombinationLists);
+ CombinationsLogic.AddItems(newRepository.ForceActions);
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
foreach (var item in primitives)
diff --git a/StructureHelper/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml b/StructureHelper/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml
index 349d26e..52bd207 100644
--- a/StructureHelper/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml
+++ b/StructureHelper/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml
@@ -68,7 +68,7 @@
-
+
diff --git a/StructureHelper/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml.cs b/StructureHelper/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml.cs
index b7181ac..8228051 100644
--- a/StructureHelper/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml.cs
+++ b/StructureHelper/Windows/PrimitivePropertiesWindow/PrimitivePropertiesView.xaml.cs
@@ -2,6 +2,7 @@
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;
@@ -29,10 +30,10 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
{
PrimitiveBase primitive;
private PrimitivePropertiesViewModel viewModel;
- public PrimitivePropertiesView(PrimitiveBase primitive, IHasHeadMaterials headMaterials)
+ public PrimitivePropertiesView(PrimitiveBase primitive, ICrossSectionRepository sectionRepository)
{
this.primitive = primitive;
- viewModel = new PrimitivePropertiesViewModel(this.primitive, headMaterials);
+ viewModel = new PrimitivePropertiesViewModel(this.primitive, sectionRepository);
this.DataContext = viewModel;
InitializeComponent();
if (primitive is RectangleViewPrimitive) { AddPrimitiveProperties(PrimitiveType.Rectangle); }
@@ -42,13 +43,13 @@ namespace StructureHelper.Windows.PrimitiveProperiesWindow
}
private void AddPrimitiveProperties(PrimitiveType type)
{
- List names = new List();
- if (primitive.DivisionViewModel is not null) { names.Add("TriangulationProperties");}
- if (primitive is RectangleViewPrimitive) { names.Add("RectangleProperties"); }
- 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)
+ List templateNames = new List();
+ if (primitive.DivisionViewModel is not null) { templateNames.Add("TriangulationProperties");}
+ if (primitive is RectangleViewPrimitive) { templateNames.Add("RectangleProperties"); }
+ if (primitive is CircleViewPrimitive) { templateNames.Add("CircleProperties"); }
+ if (primitive is PointViewPrimitive) { templateNames.Add("PointProperties"); }
+ if (primitive is ReinforcementViewPrimitive) { templateNames.Add("ReinforcementProperties"); }
+ foreach (var name in templateNames)
{
ContentControl contentControl = new ContentControl();
contentControl.SetResourceReference(ContentTemplateProperty, name);
diff --git a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceCalculatorViewModel.cs b/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceCalculatorViewModel.cs
index 6551470..9ecadf6 100644
--- a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceCalculatorViewModel.cs
+++ b/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceCalculatorViewModel.cs
@@ -24,7 +24,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
public class ForceCalculatorViewModel : ViewModelBase
{
IEnumerable allowedPrimitives;
- IEnumerable allowedForceCombinations;
+ IEnumerable allowedForceCombinations;
ForceCalculator forcesCalculator;
SecondOrderViewModel secondOrderViewModel;
@@ -53,7 +53,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
public bool ShortTerm { get; set; }
public bool LongTerm { get; set; }
- public ISourceToTargetViewModel CombinationViewModel { get; }
+ public ISourceToTargetViewModel CombinationViewModel { get; }
public ISourceToTargetViewModel PrimitivesViewModel { get; }
public PrimitiveBase SelectedAllowedPrimitive { get; set; }
@@ -146,15 +146,15 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
}
}
- public ForceCalculatorViewModel(IEnumerable _allowedPrimitives, IEnumerable _allowedForceCombinations, ForceCalculator _forcesCalculator)
+ public ForceCalculatorViewModel(IEnumerable _allowedPrimitives, IEnumerable _allowedForceCombinations, ForceCalculator _forcesCalculator)
{
allowedPrimitives = _allowedPrimitives;
allowedForceCombinations = _allowedForceCombinations;
forcesCalculator = _forcesCalculator;
secondOrderViewModel = new SecondOrderViewModel(forcesCalculator.CompressedMember);
- CombinationViewModel = new SourceToTargetViewModel();
- CombinationViewModel.SetTargetItems(forcesCalculator.ForceCombinationLists);
+ CombinationViewModel = new SourceToTargetViewModel();
+ CombinationViewModel.SetTargetItems(forcesCalculator.ForceActions);
CombinationViewModel.SetSourceItems(allowedForceCombinations);
CombinationViewModel.ItemDataDemplate = Application.Current.Resources["SimpleItemTemplate"] as DataTemplate;
@@ -180,10 +180,10 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
public void Refresh()
{
var combinations = CombinationViewModel.GetTargetItems();
- forcesCalculator.ForceCombinationLists.Clear();
+ forcesCalculator.ForceActions.Clear();
foreach (var item in combinations)
{
- forcesCalculator.ForceCombinationLists.Add(item);
+ forcesCalculator.ForceActions.Add(item);
}
forcesCalculator.Primitives.Clear();
foreach (var item in PrimitivesViewModel.GetTargetItems())
diff --git a/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs b/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs
index a6ac6f4..46dc5cf 100644
--- a/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs
+++ b/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs
@@ -1,4 +1,7 @@
-using StructureHelper.Windows.Forces;
+using StructureHelper.Infrastructure.Enums;
+using StructureHelper.Windows.Forces;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
@@ -11,14 +14,27 @@ using System.Windows.Forms;
namespace StructureHelper.Windows.ViewModels.Forces
{
- public class ActionsViewModel : CRUDViewModelBase
+ public class ActionsViewModel : CRUDViewModelBase
{
ICrossSectionRepository repository;
public override void AddMethod(object parameter)
{
- NewItem = new ForceCombinationList() { Name = "New Force Combination" };
- base.AddMethod(parameter);
+ if (parameter is not null)
+ {
+ ActionType paramType = (ActionType)parameter;
+ if (paramType == ActionType.ForceCombination)
+ {
+ NewItem = new ForceCombinationList() { Name = "New Force Combination" };
+ }
+ else if (paramType == ActionType.ForceCombinationByFactor)
+ {
+ NewItem = new ForceCombinationByFactor() { Name = "New Factored Combination" };
+ }
+ else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": Actual type: {nameof(paramType)}");
+ base.AddMethod(parameter);
+ }
+
}
public override void DeleteMethod(object parameter)
@@ -32,11 +48,11 @@ namespace StructureHelper.Windows.ViewModels.Forces
if (item is IForceCalculator)
{
var forceCalculator = item as IForceCalculator;
- var containSelected = forceCalculator.ForceCombinationLists.Contains(SelectedItem);
+ var containSelected = forceCalculator.ForceActions.Contains(SelectedItem);
if (containSelected)
{
var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
- if (dialogResultCalc == DialogResult.OK) { forceCalculator.ForceCombinationLists.Remove(SelectedItem); }
+ if (dialogResultCalc == DialogResult.OK) { forceCalculator.ForceActions.Remove(SelectedItem); }
else return;
}
}
@@ -47,12 +63,23 @@ namespace StructureHelper.Windows.ViewModels.Forces
public override void EditMethod(object parameter)
{
- var wnd = new ForceCombinationView(SelectedItem);
+ System.Windows.Window wnd;
+ if (SelectedItem is IForceCombinationList)
+ {
+ var item = (IForceCombinationList)SelectedItem;
+ wnd = new ForceCombinationView(item);
+ }
+ else if (SelectedItem is IForceCombinationByFactor)
+ {
+ var item = (IForceCombinationByFactor)SelectedItem;
+ wnd = new ForceCombinationByFactorView(item);
+ }
+ else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"actual object type: {nameof(SelectedItem)}");
wnd.ShowDialog();
base.EditMethod(parameter);
}
- public ActionsViewModel(ICrossSectionRepository repository) : base (repository.ForceCombinationLists)
+ public ActionsViewModel(ICrossSectionRepository repository) : base (repository.ForceActions)
{
this.repository = repository;
}
diff --git a/StructureHelper/Windows/ViewModels/Forces/ForceActionVMBase.cs b/StructureHelper/Windows/ViewModels/Forces/ForceActionVMBase.cs
new file mode 100644
index 0000000..a069742
--- /dev/null
+++ b/StructureHelper/Windows/ViewModels/Forces/ForceActionVMBase.cs
@@ -0,0 +1,61 @@
+using StructureHelper.Infrastructure;
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.ViewModels.Forces
+{
+ public abstract class ForceActionVMBase : ViewModelBase
+ {
+ IForceAction forceAction;
+
+ public string Name
+ {
+ get => forceAction.Name;
+ set
+ {
+ forceAction.Name = value;
+ }
+ }
+
+ public bool SetInGravityCenter
+ {
+ get => forceAction.SetInGravityCenter;
+ set
+ {
+ forceAction.SetInGravityCenter = value;
+ OnPropertyChanged(nameof(SetInGravityCenter));
+ OnPropertyChanged(nameof(CoordEnable));
+ }
+ }
+
+ public bool CoordEnable => !SetInGravityCenter;
+
+ public double CenterX
+ {
+ get => forceAction.ForcePoint.X;
+ set
+ {
+ forceAction.ForcePoint.X = value;
+ OnPropertyChanged(nameof(CenterX));
+ }
+ }
+
+ public double CenterY
+ {
+ get => forceAction.ForcePoint.Y;
+ set
+ {
+ forceAction.ForcePoint.Y = value;
+ OnPropertyChanged(nameof(CenterY));
+ }
+ }
+ public ForceActionVMBase(IForceAction forceAction)
+ {
+ this.forceAction = forceAction;
+ }
+ }
+}
diff --git a/StructureHelper/Windows/ViewModels/Forces/ForceCombinationByFactorVM.cs b/StructureHelper/Windows/ViewModels/Forces/ForceCombinationByFactorVM.cs
new file mode 100644
index 0000000..3d337e8
--- /dev/null
+++ b/StructureHelper/Windows/ViewModels/Forces/ForceCombinationByFactorVM.cs
@@ -0,0 +1,73 @@
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media.Media3D;
+
+namespace StructureHelper.Windows.ViewModels.Forces
+{
+ public class ForceCombinationByFactorVM : ForceActionVMBase, IDataErrorInfo
+ {
+ IForceCombinationByFactor forceAction;
+ ForceTupleVM forceTupleVM;
+
+ public double ULSFactor
+ {
+ get => forceAction.ULSFactor;
+ set
+ {
+ forceAction.ULSFactor = value;
+ OnPropertyChanged(nameof(ULSFactor));
+ }
+ }
+
+ public ForceTupleVM ForceTupleVM => forceTupleVM;
+
+ public double LongTermFactor
+ {
+ get => forceAction.LongTermFactor;
+ set
+ {
+ if (value <0d) { value = 0d; }
+ if (value > 1d) { value = 1d; }
+ forceAction.LongTermFactor = value;
+ OnPropertyChanged(nameof(LongTermFactor));
+ }
+ }
+
+ public string Error => throw new NotImplementedException();
+
+ public string this[string columnName]
+ {
+ get
+ {
+ string error = null;
+
+ if (columnName == nameof(ULSFactor))
+ {
+ if (ULSFactor <= 0)
+ {
+ error = "Safety factor for ULS must be greater than zero";
+ }
+ }
+ if (columnName == nameof(LongTermFactor))
+ {
+ if (LongTermFactor < 0d || LongTermFactor > 1d)
+ {
+ error = "Long term factor must be between 0.0 and 1.0";
+ }
+ }
+ return error;
+ }
+ }
+
+ public ForceCombinationByFactorVM(IForceCombinationByFactor forceAction) : base(forceAction)
+ {
+ this.forceAction = forceAction;
+ forceTupleVM = new ForceTupleVM(forceAction.FullSLSForces);
+ }
+ }
+}
diff --git a/StructureHelper/Windows/ViewModels/Forces/ForceCombinationViewModel.cs b/StructureHelper/Windows/ViewModels/Forces/ForceCombinationViewModel.cs
index 94bf3f5..18ee18e 100644
--- a/StructureHelper/Windows/ViewModels/Forces/ForceCombinationViewModel.cs
+++ b/StructureHelper/Windows/ViewModels/Forces/ForceCombinationViewModel.cs
@@ -8,61 +8,15 @@ using System.Threading.Tasks;
namespace StructureHelper.Windows.ViewModels.Forces
{
- public class ForceCombinationViewModel : ViewModelBase
+ public class ForceCombinationViewModel : ForceActionVMBase
{
- IForceCombinationList combinationList;
+ ForceTuplesViewModel designForces;
- //public IDesignForceTuple SelectedTuple { get; set; }
- public ForceTuplesViewModel DesignForces { get;}
+ public ForceTuplesViewModel DesignForces => designForces;
- public string Name
+ public ForceCombinationViewModel(IForceCombinationList combinationList) : base(combinationList)
{
- get => combinationList.Name;
- set
- {
- combinationList.Name = value;
- }
- }
-
- public bool SetInGravityCenter
- {
- get => combinationList.SetInGravityCenter;
- set
- {
- combinationList.SetInGravityCenter = value;
- OnPropertyChanged(nameof(SetInGravityCenter));
- OnPropertyChanged(nameof(CoordEnable));
- }
- }
-
- public bool CoordEnable => !SetInGravityCenter;
-
- public double CenterX
- {
- get => combinationList.ForcePoint.X;
- set
- {
- combinationList.ForcePoint.X = value;
- OnPropertyChanged(nameof(CenterX));
- }
- }
-
- public double CenterY
- {
- get => combinationList.ForcePoint.Y;
- set
- {
- combinationList.ForcePoint.Y = value;
- OnPropertyChanged(nameof(CenterY));
- }
- }
-
- //public IEnumerable ForceTuples { get => combinationList.DesignForces; }
-
- public ForceCombinationViewModel(IForceCombinationList combinationList)
- {
- this.combinationList = combinationList;
- DesignForces = new ForceTuplesViewModel(this.combinationList.DesignForces);
+ designForces = new ForceTuplesViewModel(combinationList.DesignForces);
}
}
}
diff --git a/StructureHelper/Windows/ViewModels/Forces/ForceTupleVM.cs b/StructureHelper/Windows/ViewModels/Forces/ForceTupleVM.cs
new file mode 100644
index 0000000..027e91f
--- /dev/null
+++ b/StructureHelper/Windows/ViewModels/Forces/ForceTupleVM.cs
@@ -0,0 +1,73 @@
+using StructureHelper.Infrastructure;
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.ViewModels.Forces
+{
+ public class ForceTupleVM : ViewModelBase
+ {
+ IForceTuple forceTuple;
+ public double Mx
+ {
+ get => forceTuple.Mx;
+ set
+ {
+ forceTuple.Mx = value;
+ OnPropertyChanged(nameof(Mx));
+ }
+ }
+ public double My
+ {
+ get => forceTuple.My;
+ set
+ {
+ forceTuple.My = value;
+ OnPropertyChanged(nameof(My));
+ }
+ }
+ public double Nz
+ {
+ get => forceTuple.Nz;
+ set
+ {
+ forceTuple.Nz = value;
+ OnPropertyChanged(nameof(Nz));
+ }
+ }
+ public double Qx
+ {
+ get => forceTuple.Qx;
+ set
+ {
+ forceTuple.Qx = value;
+ OnPropertyChanged(nameof(Qx));
+ }
+ }
+ public double Qy
+ {
+ get => forceTuple.Qy;
+ set
+ {
+ forceTuple.Qy = value;
+ OnPropertyChanged(nameof(Qy));
+ }
+ }
+ public double Mz
+ {
+ get => forceTuple.Mz;
+ set
+ {
+ forceTuple.Mz = value;
+ OnPropertyChanged(nameof(Mz));
+ }
+ }
+ public ForceTupleVM(IForceTuple forceTuple)
+ {
+ this.forceTuple = forceTuple;
+ }
+ }
+}
diff --git a/StructureHelper/Windows/ViewModels/NdmCrossSections/AnalysisVewModelLogic.cs b/StructureHelper/Windows/ViewModels/NdmCrossSections/AnalysisVewModelLogic.cs
index 6a56ad6..14a51b6 100644
--- a/StructureHelper/Windows/ViewModels/NdmCrossSections/AnalysisVewModelLogic.cs
+++ b/StructureHelper/Windows/ViewModels/NdmCrossSections/AnalysisVewModelLogic.cs
@@ -30,7 +30,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
if (SelectedItem is ForceCalculator)
{
var calculator = SelectedItem as ForceCalculator;
- var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceCombinationLists, calculator);
+ var vm = new ForceCalculatorViewModel(repository.Primitives, repository.ForceActions, calculator);
var wnd = new ForceCalculatorView(vm);
wnd.ShowDialog();
diff --git a/StructureHelper/Windows/ViewModels/NdmCrossSections/ForceCombinationViewModelLogic.cs b/StructureHelper/Windows/ViewModels/NdmCrossSections/ForceCombinationViewModelLogic.cs
index 31af3a2..d360122 100644
--- a/StructureHelper/Windows/ViewModels/NdmCrossSections/ForceCombinationViewModelLogic.cs
+++ b/StructureHelper/Windows/ViewModels/NdmCrossSections/ForceCombinationViewModelLogic.cs
@@ -19,9 +19,9 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{
private readonly ICrossSectionRepository repository;
- public IForceCombinationList SelectedItem { get; set; }
+ public IForceAction SelectedItem { get; set; }
- public ObservableCollection Items { get; private set; }
+ public ObservableCollection Items { get; private set; }
private RelayCommand addForceCombinationCommand;
public RelayCommand Add
@@ -41,7 +41,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{
var item = new ForceCombinationList() { Name = "New Force Combination" };
Items.Add(item);
- repository.ForceCombinationLists.Add(item);
+ repository.ForceActions.Add(item);
}
private RelayCommand deleteForceCombinationCommand;
public RelayCommand Delete
@@ -62,7 +62,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dialogResult == DialogResult.Yes)
{
- repository.ForceCombinationLists.Remove(SelectedItem);
+ repository.ForceActions.Remove(SelectedItem);
}
}
private RelayCommand editForceCombinationCommand;
@@ -78,7 +78,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{
EditForceCombination();
Items.Clear();
- AddItems(repository.ForceCombinationLists);
+ AddItems(repository.ForceActions);
OnPropertyChanged(nameof(Items));
}, o => SelectedItem != null));
}
@@ -93,7 +93,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
copyCommand = new RelayCommand(o =>
{
var item = SelectedItem.Clone() as IForceCombinationList;
- repository.ForceCombinationLists.Add(item);
+ repository.ForceActions.Add(item);
Items.Add(item);
OnPropertyChanged(nameof(Items));
}, o => SelectedItem != null));
@@ -102,11 +102,11 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
private void EditForceCombination()
{
- var wnd = new ForceCombinationView(SelectedItem);
- wnd.ShowDialog();
+ //var wnd = new ForceCombinationView(SelectedItem);
+ //wnd.ShowDialog();
}
- public void AddItems(IEnumerable items)
+ public void AddItems(IEnumerable items)
{
foreach (var item in items)
{
@@ -117,8 +117,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
public ForceCombinationViewModelLogic(ICrossSectionRepository repository)
{
this.repository = repository;
- Items = new ObservableCollection();
- AddItems(this.repository.ForceCombinationLists);
+ Items = new ObservableCollection();
+ AddItems(this.repository.ForceActions);
}
}
}
diff --git a/StructureHelper/Windows/ViewModels/NdmCrossSections/IForceCombinationViewModelLogic.cs b/StructureHelper/Windows/ViewModels/NdmCrossSections/IForceCombinationViewModelLogic.cs
index f122711..600f74c 100644
--- a/StructureHelper/Windows/ViewModels/NdmCrossSections/IForceCombinationViewModelLogic.cs
+++ b/StructureHelper/Windows/ViewModels/NdmCrossSections/IForceCombinationViewModelLogic.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{
- public interface IForceCombinationViewModelLogic : ICRUDViewModel
+ public interface IForceCombinationViewModelLogic : ICRUDViewModel
{
}
}
diff --git a/StructureHelper/Windows/ViewModels/NdmCrossSections/IPrimitiveViewModelLogic.cs b/StructureHelper/Windows/ViewModels/NdmCrossSections/IPrimitiveViewModelLogic.cs
deleted file mode 100644
index ae0638c..0000000
--- a/StructureHelper/Windows/ViewModels/NdmCrossSections/IPrimitiveViewModelLogic.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using StructureHelper.Infrastructure;
-using StructureHelper.Infrastructure.UI.DataContexts;
-
-namespace StructureHelper.Windows.ViewModels.NdmCrossSections
-{
- public interface IPrimitiveViewModelLogic : ICRUDViewModel
- {
- RelayCommand SetToFront { get; }
- RelayCommand SetToBack { get; }
- int PrimitivesCount { get; }
- void Refresh();
- }
-}
diff --git a/StructureHelper/Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs b/StructureHelper/Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs
index ba8fcdc..1e6c2fe 100644
--- a/StructureHelper/Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs
+++ b/StructureHelper/Windows/ViewModels/NdmCrossSections/PrimitiveViewModelLogic.cs
@@ -22,9 +22,10 @@ using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{
- public class PrimitiveViewModelLogic : ViewModelBase, IPrimitiveViewModelLogic
+ public class PrimitiveViewModelLogic : ViewModelBase, ICRUDViewModel
{
- private readonly ICrossSectionRepository repository;
+ private ICrossSection section;
+ private ICrossSectionRepository repository => section.SectionRepository;
private RelayCommand addCommand;
private RelayCommand deleteCommand;
private RelayCommand editCommand;
@@ -99,6 +100,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
repository.Primitives.Add(ndmPrimitive);
+ ndmPrimitive.CrossSection = section;
Items.Add(viewPrimitive);
OnPropertyChanged(nameof(Items));
OnPropertyChanged(nameof(PrimitivesCount));
@@ -132,6 +134,14 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
forceCalc.Primitives.Remove(ndmPrimitive);
}
}
+ foreach (var primitive in repository.Primitives)
+ {
+ if (primitive is IHasSurroundingPrimitive)
+ {
+ var sPrimitive = primitive as IHasSurroundingPrimitive;
+ if (sPrimitive.SurroundingPrimitive == ndmPrimitive) { sPrimitive.SurroundingPrimitive = null; }
+ }
+ }
Items.Remove(SelectedItem);
}
OnPropertyChanged(nameof(Items));
@@ -243,9 +253,9 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
OnPropertyChanged(nameof(PrimitivesCount));
}
- public PrimitiveViewModelLogic(ICrossSectionRepository repository)
+ public PrimitiveViewModelLogic(ICrossSection section)
{
- this.repository = repository;
+ this.section = section;
Items = new ObservableCollection();
AddItems(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(this.repository.Primitives));
}
diff --git a/StructureHelper/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs b/StructureHelper/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs
index c06d9c0..041d840 100644
--- a/StructureHelper/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs
+++ b/StructureHelper/Windows/ViewModels/PrimitiveProperties/PrimitivePropertiesViewModel.cs
@@ -4,14 +4,19 @@ using StructureHelper.Models.Materials;
using StructureHelper.Windows.ColorPickerWindow;
using StructureHelper.Windows.MainWindow.Materials;
using StructureHelper.Windows.ViewModels.NdmCrossSections;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ColorServices;
+using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Materials;
+using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
@@ -25,12 +30,13 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
public class PrimitivePropertiesViewModel : ViewModelBase, IDataErrorInfo
{
private PrimitiveBase primitive;
- private IHasHeadMaterials hasHeadMaterials;
+ private ICrossSectionRepository sectionRepository;
public ICommand EditColorCommand { get; private set; }
public ICommand EditMaterialCommand { get; private set; }
public ObservableCollection HeadMaterials { get; private set; }
+ public ObservableCollection SurroundingPrimitives { get; private set; }
public string Name
{
@@ -54,7 +60,42 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
}
}
}
-
+ public PrimitiveBase? SurroundingPrimitive
+ {
+ get
+ {
+ if (primitive is not IHasSurroundingPrimitive)
+ {
+ return null;
+ }
+ else
+ {
+ var sPrimitive = ((IHasSurroundingPrimitive)primitive).SurroundingPrimitive;
+ if (sPrimitive is null) { return null; }
+ foreach (var item in SurroundingPrimitives)
+ {
+ if (item.GetNdmPrimitive() == sPrimitive)
+ {
+ return item;
+ }
+ }
+ return null;
+ }
+ }
+ set
+ {
+ if (value is not null)
+ {
+ if (primitive is IHasSurroundingPrimitive)
+ {
+ var sPrimitive = value.GetNdmPrimitive();
+ ((IHasSurroundingPrimitive)primitive).SurroundingPrimitive = sPrimitive;
+ OnPropertyChanged(nameof(SurroundingPrimitive));
+ }
+ else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $", Actual type: {value.GetType()}");
+ }
+ }
+ }
public double CenterX
{
get => primitive.CenterX;
@@ -126,7 +167,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
CenterX = CenterX;
}
}
-
public double Height
{
get
@@ -148,7 +188,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
CenterY = CenterY; ;
}
}
-
public double Area
{
get
@@ -171,7 +210,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
}
}
}
-
public double Diameter
{
get
@@ -194,7 +232,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
}
}
}
-
public Color Color
{
get => primitive.Color;
@@ -204,7 +241,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
OnPropertyChanged(nameof(Color));
}
}
-
public bool SetMaterialColor
{
get => primitive.SetMaterialColor;
@@ -215,7 +251,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
OnPropertyChanged(nameof(SetMaterialColor));
}
}
-
public int ZIndex
{ get => primitive.ZIndex;
set
@@ -223,7 +258,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
primitive.ZIndex = value;
}
}
-
public bool IsVisible
{
get => primitive.IsVisible;
@@ -233,7 +267,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
OnPropertyChanged(nameof(IsVisible));
}
}
-
public double Opacity
{
get => primitive.Opacity * 100d;
@@ -245,7 +278,6 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
OnPropertyChanged(nameof(Opacity));
}
}
-
public string this[string columnName]
{
get
@@ -267,23 +299,28 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
public string Error => throw new NotImplementedException();
- public PrimitivePropertiesViewModel(PrimitiveBase primitive, IHasHeadMaterials hasHeadMaterials)
+ public PrimitivePropertiesViewModel(PrimitiveBase primitive, ICrossSectionRepository sectionRepository)
{
this.primitive = primitive;
- this.hasHeadMaterials = hasHeadMaterials;
+ this.sectionRepository = sectionRepository;
HeadMaterials = new ObservableCollection();
- foreach (var material in hasHeadMaterials.HeadMaterials)
+ foreach (var material in sectionRepository.HeadMaterials)
{
HeadMaterials.Add(material);
}
EditColorCommand = new RelayCommand(o => EditColor(), o => !SetMaterialColor);
EditMaterialCommand = new RelayCommand(o => EditMaterial());
-
+ SurroundingPrimitives = new ObservableCollection();
+ foreach (var item in sectionRepository.Primitives)
+ {
+ if (item is RectanglePrimitive || item is CirclePrimitive)
+ {SurroundingPrimitives.Add(PrimitiveOperations.ConvertNdmPrimitiveToPrimitiveBase(item));}
+ }
}
private void EditMaterial()
{
- var wnd = new HeadMaterialsView(hasHeadMaterials);
+ var wnd = new HeadMaterialsView(sectionRepository);
wnd.ShowDialog();
}
diff --git a/StructureHelperCommon/Infrastructures/Interfaces/IHasForceCombinations.cs b/StructureHelperCommon/Infrastructures/Interfaces/IHasForceCombinations.cs
index e73e49f..a9422bd 100644
--- a/StructureHelperCommon/Infrastructures/Interfaces/IHasForceCombinations.cs
+++ b/StructureHelperCommon/Infrastructures/Interfaces/IHasForceCombinations.cs
@@ -5,6 +5,6 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
{
public interface IHasForceCombinations
{
- List ForceCombinationLists { get; }
+ List ForceActions { get; }
}
}
diff --git a/StructureHelperCommon/Models/Forces/ForceCombinationByFactor.cs b/StructureHelperCommon/Models/Forces/ForceCombinationByFactor.cs
index 0946788..3d58896 100644
--- a/StructureHelperCommon/Models/Forces/ForceCombinationByFactor.cs
+++ b/StructureHelperCommon/Models/Forces/ForceCombinationByFactor.cs
@@ -16,7 +16,7 @@ namespace StructureHelperCommon.Models.Forces
public string Name { get; set; }
public bool SetInGravityCenter { get; set; }
///
- public IPoint2D ForcePoint { get; private set; }
+ public IPoint2D ForcePoint { get; set; }
///
public IForceTuple FullSLSForces { get; private set; }
///
@@ -29,10 +29,15 @@ namespace StructureHelperCommon.Models.Forces
SetInGravityCenter = true;
ForcePoint = new Point2D();
FullSLSForces = new ForceTuple();
+ LongTermFactor = 1d;
+ ULSFactor = 1.2d;
}
- public List GetCombination()
+ public IForceCombinationList GetCombinations()
{
- var result = new List();
+ var result = new ForceCombinationList();
+ result.SetInGravityCenter = this.SetInGravityCenter;
+ result.ForcePoint = this.ForcePoint;
+ result.DesignForces.Clear();
var limitStates = new List() { LimitStates.ULS, LimitStates.SLS };
var calcTerms = new List() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
foreach (var limitState in limitStates)
@@ -42,11 +47,21 @@ namespace StructureHelperCommon.Models.Forces
{
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);
+ designForceTuple.ForceTuple = ForceTupleService.MultiplyTuples(FullSLSForces, stateFactor * termFactor);
+ result.DesignForces.Add(designForceTuple);
}
}
return result;
}
+
+ public object Clone()
+ {
+ var newItem = new ForceCombinationByFactor();
+ ForceActionService.CopyActionProps(this, newItem);
+ newItem.FullSLSForces = FullSLSForces.Clone() as IForceTuple;
+ newItem.LongTermFactor = LongTermFactor;
+ newItem.ULSFactor = ULSFactor;
+ return newItem;
+ }
}
}
diff --git a/StructureHelperCommon/Models/Forces/ForceCombinationList.cs b/StructureHelperCommon/Models/Forces/ForceCombinationList.cs
index 3043b29..c633dc9 100644
--- a/StructureHelperCommon/Models/Forces/ForceCombinationList.cs
+++ b/StructureHelperCommon/Models/Forces/ForceCombinationList.cs
@@ -15,7 +15,7 @@ namespace StructureHelperCommon.Models.Forces
///
public bool SetInGravityCenter { get; set; }
///
- public IPoint2D ForcePoint { get; private set; }
+ public IPoint2D ForcePoint { get; set; }
///
public List DesignForces { get; private set; }
@@ -35,10 +35,7 @@ namespace StructureHelperCommon.Models.Forces
public object Clone()
{
var newItem = new ForceCombinationList();
- newItem.Name = Name + " copy";
- newItem.SetInGravityCenter = SetInGravityCenter;
- newItem.ForcePoint.X = ForcePoint.X;
- newItem.ForcePoint.Y = ForcePoint.Y;
+ ForceActionService.CopyActionProps(this, newItem);
newItem.DesignForces.Clear();
foreach (var item in DesignForces)
{
@@ -48,9 +45,10 @@ namespace StructureHelperCommon.Models.Forces
return newItem;
}
///
- public List GetCombination()
+ public IForceCombinationList GetCombinations()
{
- var result = new List();
+ var result = Clone() as IForceCombinationList;
+ result.DesignForces.Clear();
var limitStates = new List() { LimitStates.ULS, LimitStates.SLS };
var calcTerms = new List() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
foreach (var limitState in limitStates)
@@ -63,7 +61,7 @@ namespace StructureHelperCommon.Models.Forces
{
designForceTuple.ForceTuple = ForceTupleService.SumTuples(designForceTuple.ForceTuple, item.ForceTuple);
}
- result.Add(designForceTuple);
+ result.DesignForces.Add(designForceTuple);
}
}
return result;
diff --git a/StructureHelperCommon/Models/Forces/IForceAction.cs b/StructureHelperCommon/Models/Forces/IForceAction.cs
index 285f194..eb206dd 100644
--- a/StructureHelperCommon/Models/Forces/IForceAction.cs
+++ b/StructureHelperCommon/Models/Forces/IForceAction.cs
@@ -7,10 +7,10 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
- public interface IForceAction : IAction
+ public interface IForceAction : IAction, ICloneable
{
bool SetInGravityCenter { get; set; }
- IPoint2D ForcePoint { get; }
- List GetCombination();
+ IPoint2D ForcePoint { get; set; }
+ IForceCombinationList GetCombinations();
}
}
diff --git a/StructureHelperCommon/Models/Forces/IForceCombinationList.cs b/StructureHelperCommon/Models/Forces/IForceCombinationList.cs
index 135e084..24715eb 100644
--- a/StructureHelperCommon/Models/Forces/IForceCombinationList.cs
+++ b/StructureHelperCommon/Models/Forces/IForceCombinationList.cs
@@ -4,8 +4,8 @@ using StructureHelperCommon.Models.Shapes;
namespace StructureHelperCommon.Models.Forces
{
- public interface IForceCombinationList : IForceAction, ICloneable
+ public interface IForceCombinationList : IForceAction
{
- List DesignForces { get; }
+ List DesignForces { get;}
}
}
diff --git a/StructureHelperCommon/Services/Forces/ForceActionService.cs b/StructureHelperCommon/Services/Forces/ForceActionService.cs
new file mode 100644
index 0000000..a950718
--- /dev/null
+++ b/StructureHelperCommon/Services/Forces/ForceActionService.cs
@@ -0,0 +1,21 @@
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Linq;
+
+namespace StructureHelperCommon.Services.Forces
+{
+ internal static class ForceActionService
+ {
+ public static void CopyActionProps(IForceAction source, IForceAction target)
+ {
+ target.Name = source.Name;
+ target.SetInGravityCenter = source.SetInGravityCenter;
+ target.ForcePoint.X = source.ForcePoint.X;
+ target.ForcePoint.Y = source.ForcePoint.Y;
+ }
+ }
+}
diff --git a/StructureHelperLogics/Models/CrossSections/CrossSectionRepository.cs b/StructureHelperLogics/Models/CrossSections/CrossSectionRepository.cs
index 8a634c0..e094a63 100644
--- a/StructureHelperLogics/Models/CrossSections/CrossSectionRepository.cs
+++ b/StructureHelperLogics/Models/CrossSections/CrossSectionRepository.cs
@@ -13,14 +13,14 @@ namespace StructureHelperLogics.Models.CrossSections
{
public class CrossSectionRepository : ICrossSectionRepository
{
- public List ForceCombinationLists { get; private set; }
+ public List ForceActions { get; private set; }
public List HeadMaterials { get; private set; }
public List Primitives { get; }
public List CalculatorsList { get; private set; }
public CrossSectionRepository()
{
- ForceCombinationLists = new List();
+ ForceActions = new List();
HeadMaterials = new List();
Primitives = new List();
CalculatorsList = new List();
diff --git a/StructureHelperLogics/Models/CrossSections/ICrossSectionRepository.cs b/StructureHelperLogics/Models/CrossSections/ICrossSectionRepository.cs
index 2499617..b6059ed 100644
--- a/StructureHelperLogics/Models/CrossSections/ICrossSectionRepository.cs
+++ b/StructureHelperLogics/Models/CrossSections/ICrossSectionRepository.cs
@@ -14,7 +14,7 @@ namespace StructureHelperLogics.Models.CrossSections
{
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives
{
- List ForceCombinationLists { get; }
+ List ForceActions { get; }
List CalculatorsList { get; }
}
}
diff --git a/StructureHelperLogics/Models/Templates/CrossSections/RCs/CircleGeometryLogic.cs b/StructureHelperLogics/Models/Templates/CrossSections/RCs/CircleGeometryLogic.cs
index fd65e2f..753c699 100644
--- a/StructureHelperLogics/Models/Templates/CrossSections/RCs/CircleGeometryLogic.cs
+++ b/StructureHelperLogics/Models/Templates/CrossSections/RCs/CircleGeometryLogic.cs
@@ -13,7 +13,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
public class CircleGeometryLogic : IRCGeometryLogic
{
ICircleTemplate template;
-
+ CirclePrimitive concreteBlock;
public IEnumerable HeadMaterials { get; set; }
@@ -35,8 +35,8 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
var diameter = template.Shape.Diameter;
var concreteMaterial = HeadMaterials.ToList()[0];
var primitives = new List();
- var rectangle = new CirclePrimitive() { Diameter = diameter, Name = "Concrete block", HeadMaterial = concreteMaterial };
- primitives.Add(rectangle);
+ concreteBlock = new CirclePrimitive() { Diameter = diameter, Name = "Concrete block", HeadMaterial = concreteMaterial };
+ primitives.Add(concreteBlock);
return primitives;
}
@@ -52,7 +52,13 @@ 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 PointPrimitive() { CenterX = x, CenterY = y, Area = barArea, Name = "Left bottom point", HeadMaterial = reinforcementMaterial };
+ var point = new ReinforcementPrimitive()
+ { CenterX = x,
+ CenterY = y,
+ Area = barArea,
+ Name = "Left bottom point",
+ HeadMaterial = reinforcementMaterial,
+ SurroundingPrimitive=concreteBlock };
primitives.Add(point);
}
return primitives;
diff --git a/StructureHelperLogics/Models/Templates/CrossSections/RCs/RectGeometryLogic.cs b/StructureHelperLogics/Models/Templates/CrossSections/RCs/RectGeometryLogic.cs
index c08a64e..8976eeb 100644
--- a/StructureHelperLogics/Models/Templates/CrossSections/RCs/RectGeometryLogic.cs
+++ b/StructureHelperLogics/Models/Templates/CrossSections/RCs/RectGeometryLogic.cs
@@ -17,6 +17,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
IRectangleBeamTemplate template;
IHeadMaterial concrete => HeadMaterials.ToList()[0];
IHeadMaterial reinforcement => HeadMaterials.ToList()[1];
+ RectanglePrimitive concreteBlock;
RectangleShape rect => template.Shape as RectangleShape;
double width => rect.Width;
@@ -47,8 +48,8 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
private IEnumerable GetConcretePrimitives()
{
var primitives = new List();
- var rectangle = new RectanglePrimitive(concrete) { Width = width, Height = height, Name = "Concrete block" };
- primitives.Add(rectangle);
+ concreteBlock = new RectanglePrimitive(concrete) { Width = width, Height = height, Name = "Concrete block" };
+ primitives.Add(concreteBlock);
return primitives;
}
@@ -58,13 +59,13 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
List primitives = new List();
- var point = new PointPrimitive(reinforcement) { CenterX = xs[0], CenterY = ys[0], Area = area1, Name = "Left bottom point" };
+ var point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0], Area = area1, Name = "Left bottom point", HeadMaterial = reinforcement, SurroundingPrimitive=concreteBlock };
primitives.Add(point);
- point = new PointPrimitive(reinforcement) { CenterX = xs[1], CenterY = ys[0], Area = area1, Name = "Right bottom point" };
+ point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0], Area = area1, Name = "Right bottom point", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
primitives.Add(point);
- point = new PointPrimitive(reinforcement) { CenterX = xs[0], CenterY = ys[1], Area = area2, Name = "Left top point" };
+ point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[1], Area = area2, Name = "Left top point", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
primitives.Add(point);
- point = new PointPrimitive(reinforcement) { CenterX = xs[1], CenterY = ys[1], Area = area2, Name = "Right top point" };
+ point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[1], Area = area2, Name = "Right top point", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
primitives.Add(point);
return primitives;
}
@@ -82,9 +83,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
double dist = (xs[1] - xs[0]) / count;
for (int i = 1; i < count; i++)
{
- point = new PointPrimitive(reinforcement) { CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1, Name = $"Bottom point {i}" };
+ point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[0], Area = area1, Name = $"Bottom point {i}", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
primitives.Add(point);
- point = new PointPrimitive(reinforcement) { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2, Name = $"Top point {i}" };
+ point = new ReinforcementPrimitive() { CenterX = xs[0] + dist * i, CenterY = ys[1], Area = area2, Name = $"Top point {i}", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
primitives.Add(point);
}
}
@@ -94,9 +95,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
double dist = (ys[1] - ys[0]) / count;
for (int i = 1; i < count; i++)
{
- point = new PointPrimitive(reinforcement) { CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1, Name = $"Left point {i}" };
+ point = new ReinforcementPrimitive() { CenterX = xs[0], CenterY = ys[0] + dist * i, Area = area1, Name = $"Left point {i}", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
primitives.Add(point);
- point = new PointPrimitive(reinforcement) { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1, Name = $"Right point {i}" };
+ point = new ReinforcementPrimitive() { CenterX = xs[1], CenterY = ys[0] + dist * i, Area = area1, Name = $"Right point {i}", HeadMaterial = reinforcement, SurroundingPrimitive = concreteBlock };
primitives.Add(point);
}
}
diff --git a/StructureHelperLogics/Models/Templates/CrossSections/RCs/SectionTemplate.cs b/StructureHelperLogics/Models/Templates/CrossSections/RCs/SectionTemplate.cs
index 9553bdb..9050caa 100644
--- a/StructureHelperLogics/Models/Templates/CrossSections/RCs/SectionTemplate.cs
+++ b/StructureHelperLogics/Models/Templates/CrossSections/RCs/SectionTemplate.cs
@@ -37,10 +37,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
var materials = materialLogic.GetHeadMaterials();
geometryLogic.HeadMaterials = materials;
primitives = geometryLogic.GetNdmPrimitives();
+ foreach (var primitive in primitives)
+ {
+ primitive.CrossSection = section;
+ }
repository.HeadMaterials.AddRange(materials);
repository.Primitives.AddRange(primitives);
combinations = forceLogic.GetCombinationList();
- repository.ForceCombinationLists.AddRange(combinations);
+ repository.ForceActions.AddRange(combinations);
calculators = calculatorLogic.GetNdmCalculators();
AddAllForcesToCalculators();
AddAllPrimitivesToCalculator();
@@ -55,7 +59,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
if (calculator is IHasForceCombinations)
{
var forceCalculator = calculator as IHasForceCombinations;
- forceCalculator.ForceCombinationLists.AddRange(combinations);
+ forceCalculator.ForceActions.AddRange(combinations);
}
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs
index 64ec324..93fc3c6 100644
--- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs
+++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs
@@ -25,12 +25,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public string Name { get; set; }
public List LimitStatesList { get; }
public List CalcTermsList { get; }
- public List ForceCombinationLists { get; }
+ public List ForceActions { get; }
public List Primitives { get; }
public INdmResult Result { get; private set; }
public ICompressedMember CompressedMember { get; }
public IAccuracy Accuracy { get; set; }
-
+ public List ForceCombinationLists { get; private set; }
public void Run()
{
var checkResult = CheckInputData();
@@ -39,7 +39,11 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
Result = new ForcesResults() { IsValid = false, Desctription = checkResult };
return;
}
- else { CalculateResult(); }
+ else
+ {
+ GetCombinations();
+ CalculateResult();
+ }
}
private void CalculateResult()
@@ -103,6 +107,15 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
Result = ndmResult;
}
+ private void GetCombinations()
+ {
+ ForceCombinationLists = new List();
+ foreach (var item in ForceActions)
+ {
+ ForceCombinationLists.Add(item.GetCombinations());
+ }
+ }
+
private IForceTuple GetLongTuple(List designForces, LimitStates limitState)
{
IForceTuple longTuple;
@@ -143,7 +156,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
string result = "";
NdmPrimitivesService.CheckPrimitives(Primitives);
- if (ForceCombinationLists.Count == 0) { result += "Calculator does not contain any forces \n"; }
+ if (ForceActions.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"; }
return result;
@@ -151,7 +164,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public ForceCalculator()
{
- ForceCombinationLists = new List();
+ ForceActions = new List();
Primitives = new List();
CompressedMember = new CompressedMember() { Buckling = false };
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 1000 };
@@ -177,7 +190,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
AccuracyService.CopyProperties(Accuracy, target.Accuracy);
CompressedMemberServices.CopyProperties(CompressedMember, target.CompressedMember);
target.Primitives.AddRange(Primitives);
- target.ForceCombinationLists.AddRange(ForceCombinationLists);
+ target.ForceActions.AddRange(ForceActions);
return target;
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/IForceCalculator.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/IForceCalculator.cs
index 25d9723..a6938cc 100644
--- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/IForceCalculator.cs
+++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/IForceCalculator.cs
@@ -15,5 +15,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
List LimitStatesList { get; }
ICompressedMember CompressedMember { get; }
IAccuracy Accuracy { get; set; }
+ List ForceCombinationLists { get;}
}
}
\ No newline at end of file
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/CirclePrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/CirclePrimitive.cs
index 68c047d..fe5bf99 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/CirclePrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/CirclePrimitive.cs
@@ -4,6 +4,7 @@ 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;
@@ -29,6 +30,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public int NdmMinDivision { get; set; }
public bool ClearUnderlying { get; set; }
public bool Triangulate { get; set; }
+ public ICrossSection? CrossSection { get; set; }
public CirclePrimitive()
{
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/IHasSorroundingPrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/IHasSurroundingPrimitive.cs
similarity index 65%
rename from StructureHelperLogics/NdmCalculations/Primitives/IHasSorroundingPrimitive.cs
rename to StructureHelperLogics/NdmCalculations/Primitives/IHasSurroundingPrimitive.cs
index 3dfdf02..eca8eff 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/IHasSorroundingPrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/IHasSurroundingPrimitive.cs
@@ -6,8 +6,8 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
- public interface IHasSorroundingPrimitive
+ public interface IHasSurroundingPrimitive
{
- INdmPrimitive SorroundingPrimitive { get; set; }
+ INdmPrimitive? SurroundingPrimitive { get; set; }
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs
index 08622c3..0f96b59 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs
@@ -8,6 +8,7 @@ using System.Collections.Generic;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using StructureHelperCommon.Models.Forces;
+using StructureHelperLogics.Models.CrossSections;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
@@ -16,6 +17,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
string? Name { get; set; }
double CenterX { get; set; }
double CenterY { get; set; }
+ ICrossSection? CrossSection { get; set; }
IHeadMaterial? HeadMaterial { get; set; }
///
/// Flag of triangulation
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/PointPrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/PointPrimitive.cs
index cdbd18f..bc18da0 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/PointPrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/PointPrimitive.cs
@@ -10,6 +10,7 @@ using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
using StructureHelperCommon.Models.Forces;
+using StructureHelperLogics.Models.CrossSections;
namespace StructureHelperLogics.Models.Primitives
{
@@ -28,6 +29,7 @@ namespace StructureHelperLogics.Models.Primitives
public IVisualProperty VisualProperty { get; }
public bool Triangulate { get; set; }
+ public ICrossSection? CrossSection { get; set; }
public PointPrimitive()
{
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs
index 29dd94a..d09f56f 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs
@@ -5,6 +5,7 @@ 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;
@@ -33,7 +34,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public bool ClearUnderlying { get; set; }
public bool Triangulate { get; set; }
public IVisualProperty VisualProperty { get; }
-
+ public ICrossSection? CrossSection { get; set; }
public RectanglePrimitive()
{
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/ReinforcementPrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/ReinforcementPrimitive.cs
index 8ddbd6b..59f7f40 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/ReinforcementPrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/ReinforcementPrimitive.cs
@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Models.Forces;
+using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
@@ -15,7 +16,7 @@ using System.Windows.Media.Media3D;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
///
- public class ReinforcementPrimitive : IPointPrimitive, IHasSorroundingPrimitive
+ public class ReinforcementPrimitive : IPointPrimitive, IHasSurroundingPrimitive
{
///
public string Name { get; set; }
@@ -35,7 +36,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public int Id { get; set; }
public double Area { get; set; }
- public INdmPrimitive SorroundingPrimitive { get; set; }
+ public INdmPrimitive SurroundingPrimitive { get; set; }
+ public ICrossSection? CrossSection { get; set; }
public ReinforcementPrimitive()
{
@@ -52,7 +54,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
var primitive = new ReinforcementPrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
primitive.Area = Area;
- primitive.SorroundingPrimitive = this.SorroundingPrimitive;
+ primitive.SurroundingPrimitive = SurroundingPrimitive;
return primitive;
}
diff --git a/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs b/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs
index 5d1cd4b..64d8391 100644
--- a/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs
+++ b/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs
@@ -23,17 +23,21 @@ namespace StructureHelperLogics.Services.NdmCalculations
CompressedMemberServices.CopyProperties(source.CompressedMember, calculator.CompressedMember);
calculator.Accuracy = source.Accuracy;
calculator.Primitives.AddRange(source.Primitives);
- calculator.ForceCombinationLists.Clear();
- var combination = new ForceCombinationList()
+ calculator.ForceActions.Clear();
+ var forceTuples = ForceTupleService.InterpolateDesignTuple(finishDesignForce, startDesignForce, stepCount);
+ foreach (var forceTuple in forceTuples)
{
- Name = "New combination",
- SetInGravityCenter = false
- };
- combination.DesignForces.Clear();
- combination.DesignForces.AddRange(ForceTupleService.InterpolateDesignTuple(finishDesignForce, startDesignForce, stepCount));
- combination.ForcePoint.X = 0;
- combination.ForcePoint.Y = 0;
- calculator.ForceCombinationLists.Add(combination);
+ var combination = new ForceCombinationList()
+ {
+ Name = "New combination",
+ SetInGravityCenter = false
+ };
+ combination.DesignForces.Clear();
+ combination.DesignForces.Add(forceTuple);
+ combination.ForcePoint.X = 0;
+ combination.ForcePoint.Y = 0;
+ calculator.ForceActions.Add(combination);
+ }
return calculator;
}
}
diff --git a/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs b/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs
index a614d8d..07a87f0 100644
--- a/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs
+++ b/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs
@@ -33,6 +33,18 @@ namespace StructureHelperTests.ViewModelTests
Assert.NotNull(vm);
}
+ public void Circle_Run_ShouldPass()
+ {
+ //Arrange
+ var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
+ var primitive = new CirclePrimitive() { HeadMaterial = material};
+ var primitiveBase = new CircleViewPrimitive(primitive);
+ //Act
+ var vm = new PrimitivePropertiesViewModel(primitiveBase, new CrossSectionRepository());
+ //Assert
+ Assert.NotNull(vm);
+ }
+
[Test]
public void Point_Run_ShouldPass()
{
@@ -45,5 +57,17 @@ namespace StructureHelperTests.ViewModelTests
//Assert
Assert.NotNull(vm);
}
+
+ public void Reinforcement_Run_ShouldPass()
+ {
+ //Arrange
+ var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
+ var primitive = new ReinforcementPrimitive() { HeadMaterial = material };
+ var primitiveBase = new ReinforcementViewPrimitive(primitive);
+ //Act
+ var vm = new PrimitivePropertiesViewModel(primitiveBase, new CrossSectionRepository());
+ //Assert
+ Assert.NotNull(vm);
+ }
}
}