Add beam shear calculator view
This commit is contained in:
@@ -16,9 +16,9 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<IBeamShearAction> BeamShearActions { get; } = new();
|
||||
public List<IBeamShearAction> Actions { get; } = new();
|
||||
/// <inheritdoc/>
|
||||
public List<IBeamShearSection> ShearSections { get; } = new();
|
||||
public List<IBeamShearSection> Sections { get; } = new();
|
||||
/// <inheritdoc/>
|
||||
public List<IStirrup> Stirrups { get; } = new();
|
||||
public BeamShearCalculatorInputData(Guid id)
|
||||
|
||||
@@ -67,11 +67,11 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
private void GetSectionInputDatas(IBeamShearCalculatorInputData inputData)
|
||||
{
|
||||
sectionInputDatas = new();
|
||||
foreach (var beamShearSection in inputData.ShearSections)
|
||||
foreach (var beamShearSection in inputData.Sections)
|
||||
{
|
||||
foreach (var stirrup in inputData.Stirrups)
|
||||
{
|
||||
foreach (var beamShearAction in inputData.BeamShearActions)
|
||||
foreach (var beamShearAction in inputData.Actions)
|
||||
{
|
||||
BeamShearSectionCalculatorInputData newInputData = new(Guid.NewGuid())
|
||||
{
|
||||
|
||||
@@ -14,11 +14,11 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
public Guid Id { get; }
|
||||
|
||||
public List<IBeamShearAction> BeamShearActions { get; } = new();
|
||||
public List<IBeamShearAction> Actions { get; } = new();
|
||||
|
||||
public List<ICalculator> Calculators { get; } = new();
|
||||
|
||||
public List<IBeamShearSection> ShearSections { get; } = new();
|
||||
public List<IBeamShearSection> Sections { get; } = new();
|
||||
|
||||
public List<IStirrup> Stirrups { get; } = new();
|
||||
|
||||
@@ -28,65 +28,9 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public void DeleteBeamShearAction(IBeamShearAction beamShearAction)
|
||||
{
|
||||
foreach (var calculator in Calculators)
|
||||
{
|
||||
if (calculator is IBeamShearCalculator beamShearCalculator)
|
||||
{
|
||||
var inputData = beamShearCalculator.InputData;
|
||||
inputData.BeamShearActions.Remove(beamShearAction);
|
||||
}
|
||||
}
|
||||
BeamShearActions.Remove(beamShearAction);
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void DeleteSection(IBeamShearSection section)
|
||||
{
|
||||
foreach (var calculator in Calculators)
|
||||
{
|
||||
if (calculator is IBeamShearCalculator beamShearCalculator)
|
||||
{
|
||||
if (beamShearCalculator.InputData.ShearSections.Contains(section))
|
||||
{
|
||||
beamShearCalculator.InputData.DeleteSection(section);
|
||||
beamShearCalculator.InputData.ShearSections.Remove(section);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DeleteAction(IBeamShearAction action)
|
||||
{
|
||||
foreach (var calculator in Calculators)
|
||||
{
|
||||
if (calculator is IBeamShearCalculator beamShearCalculator)
|
||||
{
|
||||
if (beamShearCalculator.InputData.BeamShearActions.Contains(action))
|
||||
{
|
||||
beamShearCalculator.InputData.DeleteAction(action);
|
||||
beamShearCalculator.InputData.BeamShearActions.Remove(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DeleteStirrup(IStirrup stirrup)
|
||||
{
|
||||
foreach (var calculator in Calculators)
|
||||
{
|
||||
if (calculator is IBeamShearCalculator beamShearCalculator)
|
||||
{
|
||||
if (beamShearCalculator.InputData.Stirrups.Contains(stirrup))
|
||||
{
|
||||
beamShearCalculator.InputData.DeleteStirrup(stirrup);
|
||||
beamShearCalculator.InputData.Stirrups.Remove(stirrup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
@@ -6,24 +6,30 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class BeamShearSection : IBeamShearSection
|
||||
{
|
||||
private IUpdateStrategy<IBeamShearSection> updateStrategy;
|
||||
public Guid Id { get; }
|
||||
public string? Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IMaterialStrength MaterialStrength { get; } = new MaterialStrengthByLibMaterial(Guid.NewGuid(), new ConcreteLibMaterial(Guid.NewGuid()));
|
||||
public IConcreteLibMaterial Material { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IShape Shape { get; } = new RectangleShape(Guid.NewGuid()) { Height = 0.6, Width = 0.4};
|
||||
|
||||
public double CenterCover { get; set; }
|
||||
public double CenterCover { get; set; } = 0.05;
|
||||
|
||||
|
||||
public BeamShearSection(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Material = ConcreteLibMaterialFactory.GetConcreteLibMaterial(ConcreteLibTypes.Concrete25);
|
||||
Material.TensionForULS = true;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
BeamShearSection newItem = new(Guid.NewGuid());
|
||||
updateStrategy ??= new BeamShearSectionUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,14 +32,15 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
BeamShearRepository shearRepository = new(Guid.Empty);
|
||||
IBeamShearAction shearAction = BeamShearActionFactory.GetBeamShearAction(ShearActionTypes.DistributedLoad);
|
||||
shearAction.Name = "New shear action";
|
||||
shearRepository.BeamShearActions.Add(shearAction);
|
||||
shearRepository.Actions.Add(shearAction);
|
||||
BeamShearSection section = new(Guid.Empty) { Name = "New shear section"};
|
||||
shearRepository.ShearSections.Add(section);
|
||||
StirrupByUniformRebar stirrupByUniformRebar = new(Guid.Empty) { Name = "New uniform stirrup"};
|
||||
shearRepository.Sections.Add(section);
|
||||
StirrupByRebar stirrupByUniformRebar = new(Guid.Empty) { Name = "New uniform stirrup"};
|
||||
shearRepository.Stirrups.Add(stirrupByUniformRebar);
|
||||
BeamShearCalculator beamShearCalculator = new(Guid.Empty) { Name = "New shear calculator"};
|
||||
beamShearCalculator.InputData.ShearSections.Add(section);
|
||||
beamShearCalculator.InputData.Sections.Add(section);
|
||||
beamShearCalculator.InputData.Stirrups.Add(stirrupByUniformRebar);
|
||||
beamShearCalculator.InputData.Actions.Add(shearAction);
|
||||
shearRepository.Calculators.Add(beamShearCalculator);
|
||||
return shearRepository;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
/// <summary>
|
||||
/// Concrete of cross-section
|
||||
/// </summary>
|
||||
IMaterialStrength MaterialStrength { get;}
|
||||
IConcreteLibMaterial Material { get; set; }
|
||||
/// <summary>
|
||||
/// Shape of cross-section
|
||||
/// </summary>
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IHasBeamShearSections
|
||||
{
|
||||
List<IBeamShearSection> ShearSections { get; }
|
||||
void DeleteSection(IBeamShearSection section);
|
||||
List<IBeamShearSection> Sections { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,5 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
public interface IHasStirrups
|
||||
{
|
||||
List<IStirrup> Stirrups { get; }
|
||||
void DeleteStirrup(IStirrup stirrup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
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 StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
/// <summary>
|
||||
/// Implement properties for uniformly distributed stirrups
|
||||
/// </summary>
|
||||
public interface IStirrupByUniformRebar : IStirrup
|
||||
public interface IStirrupByRebar : IStirrup
|
||||
{
|
||||
/// <summary>
|
||||
/// Material of stirrups
|
||||
@@ -27,6 +27,6 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
/// <summary>
|
||||
/// Step of uniformly distibuted stirrup along axis of beam, m
|
||||
/// </summary>
|
||||
double Step { get; set; }
|
||||
double Spacing { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,8 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; };
|
||||
targetObject.BeamShearActions.AddRange(sourceObject.BeamShearActions);
|
||||
targetObject.ShearSections.AddRange(sourceObject.ShearSections);
|
||||
targetObject.Actions.AddRange(sourceObject.Actions);
|
||||
targetObject.Sections.AddRange(sourceObject.Sections);
|
||||
targetObject.Stirrups.AddRange(sourceObject.Stirrups);
|
||||
targetObject.Calculators.AddRange(sourceObject.Calculators);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
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;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public static class BeamShearRepositoryService
|
||||
{
|
||||
public static void DeleteAction(IBeamShearRepository repository, IBeamShearAction action)
|
||||
{
|
||||
foreach (var calculator in repository.Calculators)
|
||||
{
|
||||
if (calculator is IBeamShearCalculator beamShearCalculator)
|
||||
{
|
||||
var inputData = beamShearCalculator.InputData;
|
||||
inputData.Actions.Remove(action);
|
||||
}
|
||||
}
|
||||
repository.Actions.Remove(action);
|
||||
}
|
||||
public static void DeleteSection(IBeamShearRepository repository, IBeamShearSection section)
|
||||
{
|
||||
foreach (var calculator in repository.Calculators)
|
||||
{
|
||||
if (calculator is IBeamShearCalculator beamShearCalculator)
|
||||
{
|
||||
if (beamShearCalculator.InputData.Sections.Contains(section))
|
||||
{
|
||||
beamShearCalculator.InputData.Sections.Remove(section);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void DeleteStirrup(IBeamShearRepository repository, IStirrup stirrup)
|
||||
{
|
||||
foreach (var calculator in repository.Calculators)
|
||||
{
|
||||
if (calculator is IBeamShearCalculator beamShearCalculator)
|
||||
{
|
||||
if (beamShearCalculator.InputData.Stirrups.Contains(stirrup))
|
||||
{
|
||||
beamShearCalculator.InputData.Stirrups.Remove(stirrup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class BeamShearSectionUpdateStrategy : IUpdateStrategy<IBeamShearSection>
|
||||
{
|
||||
private IUpdateStrategy<IShape> shapeUpdateStrategy;
|
||||
private IUpdateStrategy<IConcreteLibMaterial> concreteUpdateStrategy;
|
||||
public void Update(IBeamShearSection targetObject, IBeamShearSection sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
InitializeStrategies();
|
||||
targetObject.Name = sourceObject.Name;
|
||||
shapeUpdateStrategy.Update(targetObject.Shape, sourceObject.Shape);
|
||||
targetObject.Material ??= new ConcreteLibMaterial();
|
||||
concreteUpdateStrategy.Update(targetObject.Material, sourceObject.Material);
|
||||
targetObject.CenterCover = sourceObject.CenterCover;
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
shapeUpdateStrategy ??= new ShapeUpdateStrategy();
|
||||
concreteUpdateStrategy ??= new ConcreteLibUpdateStrategy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,13 @@
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Services;
|
||||
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 StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class BeamShearStrengthByStirrupDensityLogic : IBeamShearStrenghLogic
|
||||
{
|
||||
private readonly IStirrupEffectiveness stirrupEffectiveness;
|
||||
@@ -32,7 +28,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
}
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public double GetShearStrength()
|
||||
{
|
||||
Check();
|
||||
@@ -34,13 +34,13 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
string errorString = ErrorStrings.ParameterIsNull + ": Input data";
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
if (InputData.BeamShearActions is null || ! InputData.BeamShearActions.Any())
|
||||
if (InputData.Actions is null || ! InputData.Actions.Any())
|
||||
{
|
||||
result = false;
|
||||
string errorString = "Collection of actions does not contain any action";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
if (InputData.ShearSections is null || ! InputData.ShearSections.Any())
|
||||
if (InputData.Sections is null || ! InputData.Sections.Any())
|
||||
{
|
||||
result = false;
|
||||
string errorString = "Collection of sections does not contain any section";
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupBaseUpdateStrategy : IUpdateStrategy<IStirrup>
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using StructureHelperCommon.Services;
|
||||
//Copyright (c) 2026 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupByDensityUpdateStrategy : IUpdateStrategy<IStirrupByDensity>
|
||||
{
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupByUniformRebarToDensityConvertStrategy : IConvertStrategy<IStirrupByDensity, IStirrupByUniformRebar>
|
||||
public class StirrupByRebarToDensityConvertStrategy : IConvertStrategy<IStirrupByDensity, IStirrupByRebar>
|
||||
{
|
||||
private const double stirrupStrengthFactor = 1d;
|
||||
private const double maxStirrupStrength = 3e8;
|
||||
@@ -18,30 +13,30 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public StirrupByUniformRebarToDensityConvertStrategy(IUpdateStrategy<IStirrup> updateStrategy, IShiftTraceLogger traceLogger)
|
||||
public StirrupByRebarToDensityConvertStrategy(IUpdateStrategy<IStirrup> updateStrategy, IShiftTraceLogger traceLogger)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IStirrupByDensity Convert(IStirrupByUniformRebar source)
|
||||
public IStirrupByDensity Convert(IStirrupByRebar source)
|
||||
{
|
||||
updateStrategy ??= new StirrupUpdateStrategy();
|
||||
updateStrategy ??= new StirrupBaseUpdateStrategy();
|
||||
StirrupByDensity stirrupByDensity = new(Guid.NewGuid());
|
||||
updateStrategy.Update(stirrupByDensity, source);
|
||||
stirrupByDensity.StirrupDensity = GetStirrupDensity(source);
|
||||
return stirrupByDensity;
|
||||
}
|
||||
|
||||
private double GetStirrupDensity(IStirrupByUniformRebar source)
|
||||
private double GetStirrupDensity(IStirrupByRebar source)
|
||||
{
|
||||
double area = Math.PI * source.Diameter * source.Diameter / 4d;
|
||||
TraceLogger?.AddMessage($"Area of rebar = {Math.PI} * ({source.Diameter})^2 / 4 = {area}, m^2");
|
||||
double strength = stirrupStrengthFactor * source.Material.GetStrength(LimitStates.ULS, CalcTerms.ShortTerm).Tensile;
|
||||
TraceLogger?.AddMessage($"Strength of rebar = {strength}, Pa");
|
||||
strength = Math.Min(strength, maxStirrupStrength);
|
||||
double density = strength * area * source.LegCount / source.Step;
|
||||
TraceLogger?.AddMessage($"Density of stirrups = {strength} * {area} * {source.LegCount} / {source.Step} = {density}, N/m");
|
||||
double density = strength * area * source.LegCount / source.Spacing;
|
||||
TraceLogger?.AddMessage($"Density of stirrups = {strength} * {area} * {source.LegCount} / {source.Spacing} = {density}, N/m");
|
||||
return density;
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupByUniformRebarUpdateStrategy : IUpdateStrategy<IStirrupByUniformRebar>
|
||||
public class StirrupByRebarUpdateStrategy : IUpdateStrategy<IStirrupByRebar>
|
||||
{
|
||||
private IUpdateStrategy<IStirrup>? baseUpdateStrategy;
|
||||
public void Update(IStirrupByUniformRebar targetObject, IStirrupByUniformRebar sourceObject)
|
||||
public void Update(IStirrupByRebar targetObject, IStirrupByRebar sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
@@ -23,7 +23,7 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
targetObject.Material = sourceObject.Material.Clone() as IReinforcementLibMaterial;
|
||||
targetObject.Diameter = sourceObject.Diameter;
|
||||
targetObject.LegCount = sourceObject.LegCount;
|
||||
targetObject.Step = sourceObject.Step;
|
||||
targetObject.Spacing = sourceObject.Spacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
public class StirrupUpdateStrategy : IUpdateStrategy<IStirrup>
|
||||
{
|
||||
private IUpdateStrategy<IStirrupByDensity> densityUpdateStrategy;
|
||||
private IUpdateStrategy<IStirrupByUniformRebar> uniformUpdateStrategy;
|
||||
private IUpdateStrategy<IStirrupByRebar> uniformUpdateStrategy;
|
||||
public void Update(IStirrup targetObject, IStirrup sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
@@ -22,7 +22,7 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
{
|
||||
UpdateByDensity(targetObject, density);
|
||||
}
|
||||
else if (sourceObject is IStirrupByUniformRebar stirrupByUniformRebar)
|
||||
else if (sourceObject is IStirrupByRebar stirrupByUniformRebar)
|
||||
{
|
||||
UpdateByUniformRebar(targetObject, stirrupByUniformRebar);
|
||||
}
|
||||
@@ -32,10 +32,10 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateByUniformRebar(IStirrup targetObject, IStirrupByUniformRebar stirrupByUniformRebar)
|
||||
private void UpdateByUniformRebar(IStirrup targetObject, IStirrupByRebar stirrupByUniformRebar)
|
||||
{
|
||||
uniformUpdateStrategy ??= new StirrupByUniformRebarUpdateStrategy();
|
||||
if (targetObject is IStirrupByUniformRebar targetUniformRebar)
|
||||
uniformUpdateStrategy ??= new StirrupByRebarUpdateStrategy();
|
||||
if (targetObject is IStirrupByRebar targetUniformRebar)
|
||||
{
|
||||
uniformUpdateStrategy.Update(targetUniformRebar, stirrupByUniformRebar);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupByDensity : IStirrupByDensity
|
||||
{
|
||||
private IUpdateStrategy<IStirrupByDensity> updateStrategy;
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public double StirrupDensity { get; set; }
|
||||
@@ -20,7 +17,10 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
StirrupByDensity newItem = new(Guid.NewGuid());
|
||||
updateStrategy ??= new StirrupByDensityUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
75
StructureHelperLogics/Models/BeamShears/StirrupByRebar.cs
Normal file
75
StructureHelperLogics/Models/BeamShears/StirrupByRebar.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class StirrupByRebar : IStirrupByRebar
|
||||
{
|
||||
private IUpdateStrategy<IStirrupByRebar> updateStrategy;
|
||||
private double diameter = 0.008;
|
||||
private double step = 0.1;
|
||||
private double legCount = 2;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IReinforcementLibMaterial Material { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double LegCount
|
||||
{
|
||||
get => legCount; set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new StructureHelperException("Number of legs of stirrup must be greater than zero");
|
||||
}
|
||||
legCount = value;
|
||||
}
|
||||
} /// <inheritdoc/>
|
||||
public double Diameter
|
||||
{
|
||||
get => diameter; set
|
||||
{
|
||||
if (value < 0.001)
|
||||
{
|
||||
throw new StructureHelperException("Diameter of stirrup must not be less than 1mm");
|
||||
}
|
||||
if (value > 0.050)
|
||||
{
|
||||
throw new StructureHelperException("Diameter of stirrup must be less or equal than 50mm");
|
||||
}
|
||||
diameter = value;
|
||||
}
|
||||
} /// <inheritdoc/>
|
||||
public double Spacing
|
||||
{
|
||||
get => step; set
|
||||
{
|
||||
if (value < 0.01)
|
||||
{
|
||||
throw new StructureHelperException("Spacing of stirrups must not be less than 10mm");
|
||||
}
|
||||
step = value;
|
||||
}
|
||||
} /// <inheritdoc/>
|
||||
public double CompressedGap { get; set; } = 0;
|
||||
|
||||
public StirrupByRebar(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400).HelperMaterial as IReinforcementLibMaterial;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
StirrupByRebar stirrupByRebar = new(Guid.NewGuid());
|
||||
updateStrategy ??= new StirrupByRebarUpdateStrategy();
|
||||
updateStrategy.Update(stirrupByRebar, this);
|
||||
return stirrupByRebar;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class StirrupByUniformRebar : IStirrupByUniformRebar
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IReinforcementLibMaterial Material { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double LegCount { get; set; } = 2;
|
||||
/// <inheritdoc/>
|
||||
public double Diameter { get; set; } = 0.008;
|
||||
/// <inheritdoc/>
|
||||
public double Step { get; set; } = 0.1;
|
||||
/// <inheritdoc/>
|
||||
public double CompressedGap { get; set; } = 0;
|
||||
|
||||
public StirrupByUniformRebar(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
internal class StirrupUpdateStrategy : IUpdateStrategy<IStirrup>
|
||||
{
|
||||
public void Update(IStirrup targetObject, IStirrup sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; };
|
||||
targetObject.CompressedGap = sourceObject.CompressedGap;
|
||||
targetObject.Name = sourceObject.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user