diff --git a/StructureHelper/Infrastructure/Enums/LoadTypes.cs b/StructureHelper/Infrastructure/Enums/LoadTypes.cs new file mode 100644 index 0000000..d2a838d --- /dev/null +++ b/StructureHelper/Infrastructure/Enums/LoadTypes.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelper.Infrastructure.Enums +{ + public enum LoadTypes + { + ConcentratedForce, + DistributetLoad, + ConcentratedMoment + } +} diff --git a/StructureHelper/Infrastructure/UI/Converters/Units/DistributedLoad.cs b/StructureHelper/Infrastructure/UI/Converters/Units/DistributedLoad.cs new file mode 100644 index 0000000..cbf5a24 --- /dev/null +++ b/StructureHelper/Infrastructure/UI/Converters/Units/DistributedLoad.cs @@ -0,0 +1,17 @@ +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Services.Units; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelper.Infrastructure.UI.Converters.Units +{ + internal class DistributedLoad : UnitBase + { + public override UnitTypes UnitType { get => UnitTypes.DistributedLoad; } + public override IUnit CurrentUnit { get => UnitLogic.GetUnit(UnitType, "kN/m"); } + public override string UnitName { get => "DistributedLoad"; } + } +} diff --git a/StructureHelper/Infrastructure/UI/Resources/ButtonStyles.xaml b/StructureHelper/Infrastructure/UI/Resources/ButtonStyles.xaml index c338420..fa99944 100644 --- a/StructureHelper/Infrastructure/UI/Resources/ButtonStyles.xaml +++ b/StructureHelper/Infrastructure/UI/Resources/ButtonStyles.xaml @@ -197,6 +197,17 @@ + + + + + + + + + + + diff --git a/StructureHelper/Infrastructure/UI/Resources/Converters.xaml b/StructureHelper/Infrastructure/UI/Resources/Converters.xaml index f02301e..dad1a10 100644 --- a/StructureHelper/Infrastructure/UI/Resources/Converters.xaml +++ b/StructureHelper/Infrastructure/UI/Resources/Converters.xaml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user index 24ec385..b525da0 100644 --- a/StructureHelper/StructureHelper.csproj.user +++ b/StructureHelper/StructureHelper.csproj.user @@ -21,7 +21,7 @@ Code - + Code @@ -158,7 +158,7 @@ Designer - + Designer diff --git a/StructureHelper/Windows/BeamShears/BeamShearActionView.xaml b/StructureHelper/Windows/BeamShears/BeamShearActionView.xaml index b183f1d..9111a61 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearActionView.xaml +++ b/StructureHelper/Windows/BeamShears/BeamShearActionView.xaml @@ -4,10 +4,118 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:StructureHelper.Windows.BeamShears" + xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls" + xmlns:enums="clr-namespace:StructureHelper.Infrastructure.Enums" d:DataContext="{d:DesignInstance local:BeamShearActionViewModel}" mc:Ignorable="d" - Title="BeamShearActionView" Height="450" Width="800" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> + Title="Shear Action" Height="300" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/BeamShears/BeamShearActionView.xaml.cs b/StructureHelper/Windows/BeamShears/BeamShearActionView.xaml.cs index 802d29c..d1a597a 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearActionView.xaml.cs +++ b/StructureHelper/Windows/BeamShears/BeamShearActionView.xaml.cs @@ -1,16 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using StructureHelperCommon.Models.Forces; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; namespace StructureHelper.Windows.BeamShears { @@ -19,9 +8,17 @@ namespace StructureHelper.Windows.BeamShears /// public partial class BeamShearActionView : Window { - public BeamShearActionView() + private readonly BeamShearActionViewModel viewModel; + public BeamShearActionView(BeamShearActionViewModel viewModel) { InitializeComponent(); + this.viewModel = viewModel; + this.DataContext = this.viewModel; + this.viewModel.ParentWindow = this; + } + public BeamShearActionView(IBeamShearAction beamShearAction) : this(new BeamShearActionViewModel(beamShearAction)) + { + } } } diff --git a/StructureHelper/Windows/BeamShears/BeamShearActionViewModel.cs b/StructureHelper/Windows/BeamShears/BeamShearActionViewModel.cs index a162469..79902cb 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearActionViewModel.cs +++ b/StructureHelper/Windows/BeamShears/BeamShearActionViewModel.cs @@ -11,12 +11,22 @@ namespace StructureHelper.Windows.BeamShears public class BeamShearActionViewModel : OkCancelViewModelBase { private readonly IBeamShearAction shearAction; - public BeamShearLoadsViewModel ShearLoads { get; private set; } + private string name; + + public string Name + { + get => shearAction.Name; + set + { + shearAction.Name = value; + } + } + public BeamShearAxisActionViewModel YAxisAction { get; private set; } public BeamShearActionViewModel(IBeamShearAction shearAction) { this.shearAction = shearAction; - ShearLoads = new(this.shearAction.YAxisShearAction.ShearLoads); + YAxisAction = new(this.shearAction.YAxisShearAction); } } } diff --git a/StructureHelper/Windows/BeamShears/BeamShearActionsViewModel.cs b/StructureHelper/Windows/BeamShears/BeamShearActionsViewModel.cs index 66ec8bd..b9a9c87 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearActionsViewModel.cs +++ b/StructureHelper/Windows/BeamShears/BeamShearActionsViewModel.cs @@ -1,5 +1,7 @@ using StructureHelper.Windows.ViewModels; +using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Forces.BeamShearActions; using StructureHelperLogics.Models.BeamShears; using System.Collections.Generic; @@ -8,11 +10,30 @@ namespace StructureHelper.Windows.BeamShears public class BeamShearActionsViewModel : SelectItemVM { private readonly IBeamShearRepository shearRepository; + private IUpdateStrategy updateStrategy; public BeamShearActionsViewModel(IBeamShearRepository shearRepository) : base(shearRepository.BeamShearActions) { this.shearRepository = shearRepository; } + public override void AddMethod(object parameter) + { + NewItem = BeamShearActionFactory.GetBeamShearAction(ShearActionTypes.DistributedLoad); + base.AddMethod(parameter); + } + public override void EditMethod(object parameter) + { + if (SelectedItem is null) { return; } + IBeamShearAction temporaryShearAction = SelectedItem.Clone() as IBeamShearAction; + var window = new BeamShearActionView(SelectedItem); + window.ShowDialog(); + if (window.DialogResult != true) + { + updateStrategy ??= new BeamShearActionUpdateStrategy(); + updateStrategy.Update(SelectedItem, temporaryShearAction); + } + base.EditMethod(parameter); + } public override void DeleteMethod(object parameter) { shearRepository.DeleteAction(SelectedItem); diff --git a/StructureHelper/Windows/BeamShears/BeamShearAxisActionViewModel.cs b/StructureHelper/Windows/BeamShears/BeamShearAxisActionViewModel.cs new file mode 100644 index 0000000..4ac0af0 --- /dev/null +++ b/StructureHelper/Windows/BeamShears/BeamShearAxisActionViewModel.cs @@ -0,0 +1,34 @@ +using StructureHelper.Infrastructure; +using StructureHelper.Windows.Forces; +using StructureHelperCommon.Models.Forces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelper.Windows.BeamShears +{ + public class BeamShearAxisActionViewModel : ViewModelBase + { + private readonly IBeamShearAxisAction beamShearAxisAction; + + public double SupportShearForce + { + get => beamShearAxisAction.SupportShearForce; + set + { + beamShearAxisAction.SupportShearForce = value; + } + } + public FactoredCombinationPropertyVM CombinationProperty { get; } + public BeamShearLoadsViewModel ShearLoads { get; } + + public BeamShearAxisActionViewModel(IBeamShearAxisAction beamShearAxisAction) + { + this.beamShearAxisAction = beamShearAxisAction; + CombinationProperty = new(this.beamShearAxisAction.FactoredCombinationProperty); + ShearLoads = new(this.beamShearAxisAction.ShearLoads); + } + } +} diff --git a/StructureHelper/Windows/BeamShears/BeamShearLoadsViewModel.cs b/StructureHelper/Windows/BeamShears/BeamShearLoadsViewModel.cs index a930bf4..4baef3f 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearLoadsViewModel.cs +++ b/StructureHelper/Windows/BeamShears/BeamShearLoadsViewModel.cs @@ -1,30 +1,65 @@ -using StructureHelper.Windows.ViewModels; +using StructureHelper.Infrastructure.Enums; +using StructureHelper.Windows.ViewModels; using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Forces.BeamShearActions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; +using System.Windows.Forms; namespace StructureHelper.Windows.BeamShears { public class BeamShearLoadsViewModel : SelectItemVM { + private IUpdateStrategy updateStrategy; public BeamShearLoadsViewModel(List collection) : base(collection) { } - + public override void AddMethod(object parameter) + { + LoadTypes typedParameter = (LoadTypes)parameter; + if (typedParameter == LoadTypes.DistributetLoad) + { + NewItem = BeamShearLoadFactory.GetBeamShearLoad(ShearLoadTypes.DistributedLoad); + } + else if (typedParameter == LoadTypes.ConcentratedForce) + { + NewItem = BeamShearLoadFactory.GetBeamShearLoad(ShearLoadTypes.ConcentratedForce); + } + else + { + throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(parameter)); + } + base.AddMethod(parameter); + } public override void EditMethod(object parameter) { + if (SelectedItem is null) { return; } + Window window; + IBeamShearLoad temporaryShearLoad = SelectedItem.Clone() as IBeamShearLoad; if (SelectedItem is IDistributedLoad distributedLoad) { - + window = new DistributedLoadView(distributedLoad); + } + else if (SelectedItem is IConcentratedForce concentrated) + { + window = new ConcentratedForceView(concentrated); } else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem)); } + window.ShowDialog(); + if (window.DialogResult != true) + { + updateStrategy ??= new BeamShearLoadUpdateStrategy(); + updateStrategy.Update(SelectedItem, temporaryShearLoad); + } base.EditMethod(parameter); } } diff --git a/StructureHelper/Windows/BeamShears/BeamShearView.xaml b/StructureHelper/Windows/BeamShears/BeamShearView.xaml index acf97fe..354594e 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearView.xaml +++ b/StructureHelper/Windows/BeamShears/BeamShearView.xaml @@ -103,10 +103,31 @@ - + + + + + + + + + + + + + + - + + + + + + + + + diff --git a/StructureHelper/Windows/BeamShears/ConcentratedForceView.xaml b/StructureHelper/Windows/BeamShears/ConcentratedForceView.xaml index 639e836..dd9e297 100644 --- a/StructureHelper/Windows/BeamShears/ConcentratedForceView.xaml +++ b/StructureHelper/Windows/BeamShears/ConcentratedForceView.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:StructureHelper.Windows.BeamShears" d:DataContext="{d:DesignInstance local:ConcentratedForceViewModel}" mc:Ignorable="d" - Title="ConcentratedForceView" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterOwner"> + Title="ConcentratedForceView" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> @@ -22,16 +22,19 @@ + - - - - - - - - + + + + + + + + + + diff --git a/StructureHelper/Windows/BeamShears/ConcentratedForceViewModel.cs b/StructureHelper/Windows/BeamShears/ConcentratedForceViewModel.cs index 3a8c53c..c1edfbd 100644 --- a/StructureHelper/Windows/BeamShears/ConcentratedForceViewModel.cs +++ b/StructureHelper/Windows/BeamShears/ConcentratedForceViewModel.cs @@ -6,7 +6,14 @@ namespace StructureHelper.Windows.BeamShears public class ConcentratedForceViewModel : OkCancelViewModelBase { private readonly IConcentratedForce concenratedForce; - + public string Name + { + get => concenratedForce.Name; + set + { + concenratedForce.Name = value; + } + } public double ForceCoordinate { get => concenratedForce.ForceCoordinate; diff --git a/StructureHelper/Windows/BeamShears/UniformDistributedLoadView.xaml b/StructureHelper/Windows/BeamShears/DistributedLoadView.xaml similarity index 64% rename from StructureHelper/Windows/BeamShears/UniformDistributedLoadView.xaml rename to StructureHelper/Windows/BeamShears/DistributedLoadView.xaml index 3bcbcbb..73ba431 100644 --- a/StructureHelper/Windows/BeamShears/UniformDistributedLoadView.xaml +++ b/StructureHelper/Windows/BeamShears/DistributedLoadView.xaml @@ -1,12 +1,12 @@ - + Title="Uniformly Distributed Load" Height="250" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> @@ -23,18 +23,21 @@ + - - - - - - - - - - + + + + + + + + + + + + diff --git a/StructureHelper/Windows/BeamShears/DistributedLoadView.xaml.cs b/StructureHelper/Windows/BeamShears/DistributedLoadView.xaml.cs new file mode 100644 index 0000000..c76bd44 --- /dev/null +++ b/StructureHelper/Windows/BeamShears/DistributedLoadView.xaml.cs @@ -0,0 +1,25 @@ +using StructureHelperCommon.Models.Forces; +using System.Windows; + +namespace StructureHelper.Windows.BeamShears +{ + /// + /// Interaction logic for UniformDistributedLoadView.xaml + /// + public partial class DistributedLoadView : Window + { + private readonly DistributedLoadViewModel viewModel; + public DistributedLoadView(DistributedLoadViewModel viewModel) + { + InitializeComponent(); + this.viewModel = viewModel; + this.DataContext = this.viewModel; + this.viewModel.ParentWindow = this; + } + + public DistributedLoadView(IDistributedLoad distributedLoad) : this(new DistributedLoadViewModel(distributedLoad)) + { + + } + } +} diff --git a/StructureHelper/Windows/BeamShears/UniformDistributedLoadViewModel.cs b/StructureHelper/Windows/BeamShears/DistributedLoadViewModel.cs similarity index 79% rename from StructureHelper/Windows/BeamShears/UniformDistributedLoadViewModel.cs rename to StructureHelper/Windows/BeamShears/DistributedLoadViewModel.cs index 7761255..6646d28 100644 --- a/StructureHelper/Windows/BeamShears/UniformDistributedLoadViewModel.cs +++ b/StructureHelper/Windows/BeamShears/DistributedLoadViewModel.cs @@ -8,10 +8,18 @@ using System.Threading.Tasks; namespace StructureHelper.Windows.BeamShears { - public class UniformDistributedLoadViewModel : OkCancelViewModelBase + public class DistributedLoadViewModel : OkCancelViewModelBase { private readonly IDistributedLoad distributedLoad; + public string Name + { + get => distributedLoad.Name; + set + { + distributedLoad.Name = value; + } + } public double LoadRatio { get => distributedLoad.LoadRatio; @@ -22,10 +30,10 @@ namespace StructureHelper.Windows.BeamShears } public double LoadValue { - get => distributedLoad.LoadValue * -1; + get => distributedLoad.LoadValue; set { - distributedLoad.LoadValue = value * -1; + distributedLoad.LoadValue = value; } } public double RelativeLevel @@ -63,7 +71,7 @@ namespace StructureHelper.Windows.BeamShears } } - public UniformDistributedLoadViewModel(IDistributedLoad distributedLoad) + public DistributedLoadViewModel(IDistributedLoad distributedLoad) { this.distributedLoad = distributedLoad; } diff --git a/StructureHelper/Windows/BeamShears/UniformDistributedLoadView.xaml.cs b/StructureHelper/Windows/BeamShears/UniformDistributedLoadView.xaml.cs deleted file mode 100644 index cf4d120..0000000 --- a/StructureHelper/Windows/BeamShears/UniformDistributedLoadView.xaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -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.BeamShears -{ - /// - /// Interaction logic for UniformDistributedLoadView.xaml - /// - public partial class UniformDistributedLoadView : Window - { - private readonly UniformDistributedLoadViewModel viewModel; - public UniformDistributedLoadView(UniformDistributedLoadViewModel viewModel) - { - InitializeComponent(); - this.viewModel = viewModel; - this.DataContext = this.viewModel; - this.viewModel.ParentWindow = this; - } - - public UniformDistributedLoadView(IDistributedLoad distributedLoad) : this(new UniformDistributedLoadViewModel(distributedLoad)) - { - - } - } -} diff --git a/StructureHelperCommon/Infrastructures/Enums/UnitTypes.cs b/StructureHelperCommon/Infrastructures/Enums/UnitTypes.cs index 8df3530..ae98dd6 100644 --- a/StructureHelperCommon/Infrastructures/Enums/UnitTypes.cs +++ b/StructureHelperCommon/Infrastructures/Enums/UnitTypes.cs @@ -7,6 +7,7 @@ Stress, Force, Moment, - Curvature + Curvature, + DistributedLoad } } diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisAction.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisAction.cs index 7ad9b37..c54c6f8 100644 --- a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisAction.cs +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisAction.cs @@ -1,9 +1,9 @@ using StructureHelperCommon.Infrastructures.Interfaces; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. namespace StructureHelperCommon.Models.Forces.BeamShearActions { @@ -20,7 +20,7 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions /// public IFactoredCombinationProperty FactoredCombinationProperty { get; } = new FactoredCombinationProperty(Guid.NewGuid()); /// - public List ShearLoads { get; } + public List ShearLoads { get; } = new(); public BeamShearAxisAction(Guid id) @@ -31,6 +31,8 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions public object Clone() { BeamShearAxisAction beamShearAxisAction = new(Guid.NewGuid()); + updateStrategy ??= new BeamShearAxisActionUpdateStrategy(); + updateStrategy.Update(beamShearAxisAction, this); return beamShearAxisAction; } } diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/Factories/BeamShearActionFactory.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/Factories/BeamShearActionFactory.cs new file mode 100644 index 0000000..2a50aed --- /dev/null +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/Factories/BeamShearActionFactory.cs @@ -0,0 +1,64 @@ +using StructureHelperCommon.Infrastructures.Exceptions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + +namespace StructureHelperCommon.Models.Forces.BeamShearActions +{ + public enum ShearActionTypes + { + DistributedLoad + } + /// + /// Generates beam shear action with default settings + /// + public static class BeamShearActionFactory + { + public static IBeamShearAction GetBeamShearAction(ShearActionTypes actionType) + { + if (actionType == ShearActionTypes.DistributedLoad) + { + return GetDistributedLoad(); + } + else + { + throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(actionType)); + } + } + + private static IBeamShearAction GetDistributedLoad() + { + BeamShearAction beamShearAction = new(Guid.NewGuid()) + { + Name = "Beam shear action" + }; + SetAction(beamShearAction.XAxisShearAction, 0); + SetFactors(beamShearAction.XAxisShearAction); + beamShearAction.XAxisShearAction.ShearLoads.Clear(); + + SetAction(beamShearAction.YAxisShearAction, 1e5); + SetFactors(beamShearAction.YAxisShearAction); + return beamShearAction; + } + + private static void SetAction(IBeamShearAxisAction beamShearAxisAction, double supportForce) + { + beamShearAxisAction.SupportShearForce = 1e5; + IBeamShearLoad distributedLoad = BeamShearLoadFactory.GetBeamShearLoad(ShearLoadTypes.DistributedLoad); + beamShearAxisAction.ShearLoads.Add(distributedLoad); + } + + private static void SetFactors(IBeamShearAxisAction beamShearAxisAction) + { + beamShearAxisAction.FactoredCombinationProperty.LimitState = Infrastructures.Enums.LimitStates.ULS; + beamShearAxisAction.FactoredCombinationProperty.CalcTerm = Infrastructures.Enums.CalcTerms.ShortTerm; + beamShearAxisAction.FactoredCombinationProperty.LongTermFactor = 0.95; + beamShearAxisAction.FactoredCombinationProperty.ULSFactor = 1.2; + } + } +} diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/Factories/BeamShearLoadFactory.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/Factories/BeamShearLoadFactory.cs new file mode 100644 index 0000000..a4f618e --- /dev/null +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/Factories/BeamShearLoadFactory.cs @@ -0,0 +1,59 @@ +using StructureHelperCommon.Infrastructures.Exceptions; +using System; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + +namespace StructureHelperCommon.Models.Forces.BeamShearActions +{ + public enum ShearLoadTypes + { + DistributedLoad, + ConcentratedForce + } + public static class BeamShearLoadFactory + { + public static IBeamShearLoad GetBeamShearLoad(ShearLoadTypes loadType) + { + if (loadType == ShearLoadTypes.DistributedLoad) + { + return GetDistributedLoad(); + } + else if (loadType == ShearLoadTypes.ConcentratedForce) + { + return GetConcentratedForce(); + } + else + { + throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(loadType)); + } + } + + private static ConcentratedForce GetConcentratedForce() + { + ConcentratedForce concentratedForce = new(Guid.NewGuid()) + { + Name = "Concentrated force", + ForceValue = -5e4, + LoadRatio = 1, + RelativeLoadLevel = 0.5, + ForceCoordinate = 1 + }; + return concentratedForce; + } + + private static DistributedLoad GetDistributedLoad() + { + DistributedLoad distributedLoad = new(Guid.NewGuid()) + { + Name = "Distributed load", + LoadValue = -5e3, + LoadRatio = 1, + RelativeLoadLevel = 0.5, + StartCoordinate = 0, + EndCoordinate = 100 + }; + return distributedLoad; + } + } +} diff --git a/StructureHelperCommon/Services/Units/GetUnitLogic.cs b/StructureHelperCommon/Services/Units/GetUnitLogic.cs index ea68c44..eac8d8a 100644 --- a/StructureHelperCommon/Services/Units/GetUnitLogic.cs +++ b/StructureHelperCommon/Services/Units/GetUnitLogic.cs @@ -24,6 +24,7 @@ namespace StructureHelperCommon.Services.Units { UnitTypes.Moment, "kNm"}, { UnitTypes.Stress, "MPa"}, { UnitTypes.Curvature, "1/m"}, + { UnitTypes.DistributedLoad, "kN/m" }, }; } diff --git a/StructureHelperCommon/Services/Units/UnitsFactory.cs b/StructureHelperCommon/Services/Units/UnitsFactory.cs index 0219cba..2d7068a 100644 --- a/StructureHelperCommon/Services/Units/UnitsFactory.cs +++ b/StructureHelperCommon/Services/Units/UnitsFactory.cs @@ -38,6 +38,10 @@ namespace StructureHelperCommon.Services.Units units.Add(new Unit() { UnitType = type, Name = "1/m", Multiplyer = 1d }); units.Add(new Unit() { UnitType = type, Name = "1/mm", Multiplyer = 1e-3d }); units.Add(new Unit() { UnitType = type, Name = "1/cm", Multiplyer = 1e-2d }); + type = UnitTypes.DistributedLoad; + units.Add(new Unit() { UnitType = type, Name = "N/m", Multiplyer = 1d }); + units.Add(new Unit() { UnitType = type, Name = "kN/m", Multiplyer = 1e-3d }); + units.Add(new Unit() { UnitType = type, Name = "MN/m", Multiplyer = 1e-6d }); return units; } } diff --git a/StructureHelperLogics/Models/BeamShears/Factories/BeamShearTemplatesFactory.cs b/StructureHelperLogics/Models/BeamShears/Factories/BeamShearTemplatesFactory.cs index 24b2137..827ecb3 100644 --- a/StructureHelperLogics/Models/BeamShears/Factories/BeamShearTemplatesFactory.cs +++ b/StructureHelperLogics/Models/BeamShears/Factories/BeamShearTemplatesFactory.cs @@ -1,5 +1,6 @@ using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Forces.BeamShearActions; using System; using System.Collections.Generic; using System.Linq; @@ -29,6 +30,9 @@ namespace StructureHelperLogics.Models.BeamShears private static IBeamShearRepository GetRectangleSection() { BeamShearRepository shearRepository = new(Guid.Empty); + IBeamShearAction shearAction = BeamShearActionFactory.GetBeamShearAction(ShearActionTypes.DistributedLoad); + shearAction.Name = "New shear action"; + shearRepository.BeamShearActions.Add(shearAction); BeamShearSection section = new(Guid.Empty) { Name = "New shear section"}; shearRepository.ShearSections.Add(section); StirrupByUniformRebar stirrupByUniformRebar = new(Guid.Empty) { Name = "New uniform stirrup"};