Add Design range for shear
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using DataAccess.DTOs.Converters.BeamShears;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
@@ -9,6 +10,7 @@ namespace DataAccess.DTOs
|
||||
private IUpdateStrategy<IHasBeamShearActions> actionUpdateStrategy;
|
||||
private IUpdateStrategy<IHasBeamShearSections> sectionUpdateStrategy;
|
||||
private IUpdateStrategy<IHasStirrups> stirrupUpdateStrategy;
|
||||
private IConvertStrategy<BeamShearDesignRangeProperty, BeamShearDesignRangePropertyDTO> designRangeConvertStrategy;
|
||||
|
||||
public BeamShearCalculatorInputDataFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
@@ -22,6 +24,7 @@ namespace DataAccess.DTOs
|
||||
actionUpdateStrategy.Update(NewItem, source);
|
||||
sectionUpdateStrategy.Update(NewItem, source);
|
||||
stirrupUpdateStrategy.Update(NewItem, source);
|
||||
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
@@ -31,6 +34,7 @@ namespace DataAccess.DTOs
|
||||
actionUpdateStrategy ??= new HasBeamShearActionsFromDTOUpdateStrategy(ReferenceDictionary, TraceLogger);
|
||||
sectionUpdateStrategy ??= new HasBeamShearSectionsFromDTOUpdateStrategy(ReferenceDictionary, TraceLogger);
|
||||
stirrupUpdateStrategy ??= new HasStirrupsFromDTOUpdateStrategy(ReferenceDictionary, TraceLogger);
|
||||
designRangeConvertStrategy ??= new BeamShearDesignRangePropertyFromDTOConvertStrategy(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using DataAccess.DTOs.Converters.BeamShears;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
|
||||
@@ -9,6 +10,7 @@ namespace DataAccess.DTOs
|
||||
private IUpdateStrategy<IHasBeamShearActions> actionUpdateStrategy;
|
||||
private IUpdateStrategy<IHasBeamShearSections> sectionUpdateStrategy;
|
||||
private IUpdateStrategy<IHasStirrups> stirrupUpdateStrategy;
|
||||
private IConvertStrategy<BeamShearDesignRangePropertyDTO, IBeamShearDesignRangeProperty> designRangeConvertStrategy;
|
||||
|
||||
public BeamShearCalculatorInputDataToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
@@ -16,28 +18,13 @@ namespace DataAccess.DTOs
|
||||
|
||||
public override BeamShearCalculatorInputDataDTO GetNewItem(IBeamShearCalculatorInputData source)
|
||||
{
|
||||
try
|
||||
{
|
||||
GetNewInputData(source);
|
||||
return NewItem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceErrorByEntity(this, ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetNewInputData(IBeamShearCalculatorInputData source)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Input data converting Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||
InitializeStrategies();
|
||||
NewItem = new(source.Id);
|
||||
actionUpdateStrategy.Update(NewItem, source);
|
||||
sectionUpdateStrategy.Update(NewItem, source);
|
||||
stirrupUpdateStrategy.Update(NewItem, source);
|
||||
TraceLogger?.AddMessage($"Input data converting Id = {NewItem.Id} has been finished", TraceLogStatuses.Debug);
|
||||
|
||||
NewItem.DesignRangeProperty = designRangeConvertStrategy.Convert(source.DesignRangeProperty);
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
@@ -45,6 +32,7 @@ namespace DataAccess.DTOs
|
||||
actionUpdateStrategy ??= new HasBeamShearActionsToDTOUpdateStrategy(ReferenceDictionary, TraceLogger);
|
||||
sectionUpdateStrategy ??= new HasBeamShearSectionsToDTORenameStrategy(ReferenceDictionary, TraceLogger);
|
||||
stirrupUpdateStrategy ??= new HasStirrupsToDTOUpdateStrategy(ReferenceDictionary, TraceLogger);
|
||||
designRangeConvertStrategy ??= new BeamShearDesignRangePropertyToDTOConvertStrategy(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
|
||||
namespace DataAccess.DTOs.Converters.BeamShears
|
||||
{
|
||||
public class BeamShearDesignRangePropertyFromDTOConvertStrategy : ConvertStrategy<BeamShearDesignRangeProperty, BeamShearDesignRangePropertyDTO>
|
||||
{
|
||||
private IUpdateStrategy<IBeamShearDesignRangeProperty> updateStrategy;
|
||||
|
||||
public BeamShearDesignRangePropertyFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
|
||||
public override BeamShearDesignRangeProperty GetNewItem(BeamShearDesignRangePropertyDTO source)
|
||||
{
|
||||
updateStrategy ??= new BeamShearDesignRangePropertyUpdateStrategy();
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class BeamShearDesignRangePropertyToDTOConvertStrategy : ConvertStrategy<BeamShearDesignRangePropertyDTO, IBeamShearDesignRangeProperty>
|
||||
{
|
||||
IUpdateStrategy<IBeamShearDesignRangeProperty>? updateStrategy;
|
||||
|
||||
public BeamShearDesignRangePropertyToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
|
||||
public override BeamShearDesignRangePropertyDTO GetNewItem(IBeamShearDesignRangeProperty source)
|
||||
{
|
||||
updateStrategy ??= new BeamShearDesignRangePropertyUpdateStrategy();
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,14 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
newItem = ProcessDensity(density);
|
||||
}
|
||||
else if (stirrup is StirrupGroupDTO stirrupGroup)
|
||||
{
|
||||
newItem = ProcessStirrupGroup(stirrupGroup);
|
||||
}
|
||||
else if (stirrup is StirrupByInclinedRebarDTO inclinedRebar)
|
||||
{
|
||||
newItem = ProcessInclinedRebar(inclinedRebar);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(stirrup));
|
||||
@@ -59,6 +67,22 @@ namespace DataAccess.DTOs
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private IStirrup ProcessInclinedRebar(StirrupByInclinedRebarDTO inclinedRebar)
|
||||
{
|
||||
traceLogger?.AddMessage("Stirrup is stirrup by inclined rebar");
|
||||
var convertStrategy = new DictionaryConvertStrategy<StirrupByInclinedRebar, IStirrupByInclinedRebar>
|
||||
(referenceDictionary, traceLogger, new StirrupByInclinedRebarFromDTOConvertStrategy(referenceDictionary, traceLogger));
|
||||
return convertStrategy.Convert(inclinedRebar);
|
||||
}
|
||||
|
||||
private IStirrup ProcessStirrupGroup(StirrupGroupDTO stirrupGroup)
|
||||
{
|
||||
traceLogger?.AddMessage("Stirrup is stirrup group");
|
||||
var convertStrategy = new DictionaryConvertStrategy<StirrupGroup, IStirrupGroup>
|
||||
(referenceDictionary, traceLogger, new StirrupGroupFromDTOConvertStrategy(referenceDictionary, traceLogger));
|
||||
return convertStrategy.Convert(stirrupGroup);
|
||||
}
|
||||
|
||||
private StirrupByDensity ProcessDensity(StirrupByDensityDTO density)
|
||||
{
|
||||
traceLogger?.AddMessage("Stirrup is stirrup by density");
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace DataAccess.DTOs
|
||||
|
||||
private IStirrup ProcessStirrup(IStirrup stirrup)
|
||||
{
|
||||
traceLogger?.AddMessage($"Stirrup Id = {stirrup.Id} has been started", TraceLogStatuses.Debug);
|
||||
IStirrup newItem;
|
||||
if (stirrup is IStirrupByRebar rebar)
|
||||
{
|
||||
@@ -66,14 +67,20 @@ namespace DataAccess.DTOs
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private IStirrup ProcessInclinatedRebar(IStirrupByInclinedRebar inclinatedRebar)
|
||||
private IStirrup ProcessInclinatedRebar(IStirrupByInclinedRebar inclinedRebar)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
traceLogger?.AddMessage("Stirrup is inclined rebar");
|
||||
var convertStrategy = new DictionaryConvertStrategy<StirrupByInclinedRebarDTO, IStirrupByInclinedRebar>
|
||||
(referenceDictionary, traceLogger, new StirrupByInclinedRebarToDTOConvertStrategy(referenceDictionary, traceLogger));
|
||||
return convertStrategy.Convert(inclinedRebar);
|
||||
}
|
||||
|
||||
private IStirrup ProcessGroup(IStirrupGroup group)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
traceLogger?.AddMessage("Stirrup is stirrup group");
|
||||
var convertStrategy = new DictionaryConvertStrategy<StirrupGroupDTO, IStirrupGroup>
|
||||
(referenceDictionary, traceLogger, new StirrupGroupToDTOConvertStrategy(referenceDictionary, traceLogger));
|
||||
return convertStrategy.Convert(group);
|
||||
}
|
||||
|
||||
private IStirrup ProcessDensity(IStirrupByDensity density)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class StirrupByInclinedRebarFromDTOConvertStrategy : ConvertStrategy<StirrupByInclinedRebar, IStirrupByInclinedRebar>
|
||||
{
|
||||
private IUpdateStrategy<IStirrupByInclinedRebar> updateStrategy;
|
||||
private IConvertStrategy<RebarSection, IRebarSection> rebarSectionConvertStrategy;
|
||||
|
||||
public StirrupByInclinedRebarFromDTOConvertStrategy(
|
||||
Dictionary<(Guid id, Type type), ISaveable> referenceDictionary,
|
||||
IShiftTraceLogger traceLogger)
|
||||
: base(referenceDictionary, traceLogger)
|
||||
{
|
||||
}
|
||||
|
||||
public override StirrupByInclinedRebar GetNewItem(IStirrupByInclinedRebar source)
|
||||
{
|
||||
InitializeStrategies();
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
NewItem.RebarSection = rebarSectionConvertStrategy.Convert(source.RebarSection);
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new StirrupByInclinedRebarUpdateStrategy() { UpdateChildren = false};
|
||||
rebarSectionConvertStrategy ??= new RebarSectionFromDTOConvertStrategy(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class StirrupByInclinedRebarToDTOConvertStrategy : ConvertStrategy<StirrupByInclinedRebarDTO, IStirrupByInclinedRebar>
|
||||
{
|
||||
private IUpdateStrategy<IStirrupByInclinedRebar> updateStrategy;
|
||||
private IConvertStrategy<RebarSectionDTO, IRebarSection> rebarConvertStrategy;
|
||||
|
||||
public StirrupByInclinedRebarToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger) : base(referenceDictionary, traceLogger)
|
||||
{
|
||||
}
|
||||
|
||||
public override StirrupByInclinedRebarDTO GetNewItem(IStirrupByInclinedRebar source)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Stirrup by inclinated rebar converting Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||
updateStrategy ??= new StirrupByInclinedRebarUpdateStrategy();
|
||||
rebarConvertStrategy ??= new RebarSectionToDTOConvertStrategy(this);
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
NewItem.RebarSection = rebarConvertStrategy.Convert(source.RebarSection);
|
||||
TraceLogger?.AddMessage($"Stirrup by inclinated rebar converting Id = {NewItem.Id} has been finished succesfully", TraceLogStatuses.Debug);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,13 +31,13 @@ namespace DataAccess.DTOs
|
||||
|
||||
private void GetNewStirrup(IStirrupByRebar source)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Stirrup by density converting Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage($"Stirrup by rebar converting Id = {source.Id} has been started", TraceLogStatuses.Debug);
|
||||
InitializeStrategies();
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
NewItem.Material = reinforcementConvertStrategy.Convert(source.Material);
|
||||
safetyFactorUpdateStrategy.Update(NewItem.Material, source.Material);
|
||||
TraceLogger?.AddMessage($"Stirrup by density converting Id = {NewItem.Id} has been finished succesfully", TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage($"Stirrup by rebar converting Id = {NewItem.Id} has been finished succesfully", TraceLogStatuses.Debug);
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class StirrupGroupFromDTOConvertStrategy : ConvertStrategy<StirrupGroup, IStirrupGroup>
|
||||
{
|
||||
private IUpdateStrategy<IStirrupGroup> updateStrategy;
|
||||
private IUpdateStrategy<IHasStirrups> hasStirrupsUpdateStrategy;
|
||||
|
||||
public StirrupGroupFromDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger) : base(referenceDictionary, traceLogger)
|
||||
{
|
||||
}
|
||||
|
||||
public override StirrupGroup GetNewItem(IStirrupGroup source)
|
||||
{
|
||||
InitializeStrategies();
|
||||
ChildClass = this;
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
hasStirrupsUpdateStrategy.Update(NewItem, source);
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new StirrupGroupUpdateStrategy() { UpdateChildren = false};
|
||||
hasStirrupsUpdateStrategy ??= new HasStirrupsFromDTOUpdateStrategy(ReferenceDictionary, TraceLogger);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
using StructureHelperLogics.Models.BeamShears.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -10,10 +12,30 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
internal class StirrupGroupToDTOConvertStrategy : ConvertStrategy<StirrupGroupDTO, IStirrupGroup>
|
||||
{
|
||||
private IUpdateStrategy<IStirrupGroup> updateStrategy;
|
||||
private IUpdateStrategy<IHasStirrups> stirrupUpdateStrategy;
|
||||
|
||||
public StirrupGroupToDTOConvertStrategy(
|
||||
Dictionary<(Guid id, Type type), ISaveable> referenceDictionary,
|
||||
IShiftTraceLogger traceLogger)
|
||||
: base(referenceDictionary, traceLogger)
|
||||
{
|
||||
}
|
||||
|
||||
public override StirrupGroupDTO GetNewItem(IStirrupGroup source)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
InitializeStrategies();
|
||||
ChildClass = this;
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
stirrupUpdateStrategy.Update(NewItem, source);
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new StirrupGroupUpdateStrategy();
|
||||
stirrupUpdateStrategy ??= new HasStirrupsToDTOUpdateStrategy(ReferenceDictionary, TraceLogger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class RebarSectionFromDTOConvertStrategy : ConvertStrategy<RebarSection, IRebarSection>
|
||||
{
|
||||
private IUpdateStrategy<IRebarSection> updateStrategy;
|
||||
private IConvertStrategy<ReinforcementLibMaterial, ReinforcementLibMaterialDTO> reinforcementConvertStrategy;
|
||||
private HelperMaterialDTOSafetyFactorUpdateStrategy safetyFactorUpdateStrategy;
|
||||
|
||||
public RebarSectionFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
|
||||
public override RebarSection GetNewItem(IRebarSection source)
|
||||
{
|
||||
InitializeStrategies();
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
if (source.Material is not ReinforcementLibMaterialDTO reinforcement)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.Material));
|
||||
}
|
||||
NewItem.Material = reinforcementConvertStrategy.Convert(reinforcement);
|
||||
safetyFactorUpdateStrategy.Update(NewItem.Material, source.Material);
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new RebarSectionUpdateStrategy() { UpdateChildren = false};
|
||||
reinforcementConvertStrategy = new ReinforcementLibMaterialFromDTOConvertStrategy()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
safetyFactorUpdateStrategy = new HelperMaterialDTOSafetyFactorUpdateStrategy(new MaterialSafetyFactorsFromDTOLogic());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class RebarSectionToDTOConvertStrategy : ConvertStrategy<RebarSectionDTO, IRebarSection>
|
||||
{
|
||||
private IUpdateStrategy<IRebarSection> updateStrategy;
|
||||
private ReinforcementLibMaterialToDTOConvertStrategy reinforcementConvertStrategy;
|
||||
private HelperMaterialDTOSafetyFactorUpdateStrategy safetyFactorUpdateStrategy;
|
||||
|
||||
public RebarSectionToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
|
||||
public override RebarSectionDTO GetNewItem(IRebarSection source)
|
||||
{
|
||||
InitializeStrategies();
|
||||
ChildClass = this;
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
NewItem.Material = reinforcementConvertStrategy.Convert(source.Material);
|
||||
safetyFactorUpdateStrategy.Update(NewItem.Material, source.Material);
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new RebarSectionUpdateStrategy();
|
||||
reinforcementConvertStrategy = new ReinforcementLibMaterialToDTOConvertStrategy()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
safetyFactorUpdateStrategy = new HelperMaterialDTOSafetyFactorUpdateStrategy(new MaterialSafetyFactorToDTOLogic());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ namespace DataAccess.DTOs
|
||||
public List<IBeamShearSection> Sections { get; } = new();
|
||||
[JsonProperty("Stirrups")]
|
||||
public List<IStirrup> Stirrups { get; } = new();
|
||||
public IBeamShearDesignRangeProperty DesignRangeProperty { get; set; }
|
||||
|
||||
public BeamShearCalculatorInputDataDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class BeamShearDesignRangePropertyDTO : IBeamShearDesignRangeProperty
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("AbsoluteRangeValue")]
|
||||
public double AbsoluteRangeValue { get; set; } = 0.0;
|
||||
[JsonProperty("RelativeEffectiveDepthRangeValue")]
|
||||
public double RelativeEffectiveDepthRangeValue { get; set; } = 3.0;
|
||||
[JsonProperty("StepCount")]
|
||||
public int StepCount { get; set; } = 50;
|
||||
|
||||
public BeamShearDesignRangePropertyDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,6 +75,7 @@ namespace DataAccess.DTOs
|
||||
{ (typeof(PointNdmPrimitiveDTO), "PointNdmPrimitive") },
|
||||
{ (typeof(ProjectDTO), "Project") },
|
||||
{ (typeof(RebarNdmPrimitiveDTO), "RebarNdmPrimitive") },
|
||||
{ (typeof(RebarSectionDTO), "RebarSection") },
|
||||
{ (typeof(RectangleNdmPrimitiveDTO), "RectangleNdmPrimitive") },
|
||||
{ (typeof(RectangleShapeDTO), "RectangleShape") },
|
||||
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
|
||||
@@ -125,6 +126,8 @@ namespace DataAccess.DTOs
|
||||
{ (typeof(List<IBeamSpanLoad>), "ListOfSpanLoads") },
|
||||
{ (typeof(List<IStirrup>), "ListOfStirrups") },
|
||||
{ (typeof(StirrupByDensityDTO), "StirrupByDensity") },
|
||||
{ (typeof(StirrupGroupDTO), "StirrupGroup") },
|
||||
{ (typeof(StirrupByInclinedRebarDTO), "StirrupByInclinedRebar") },
|
||||
{ (typeof(StirrupByRebarDTO), "StirrupByRebar") },
|
||||
};
|
||||
return newList;
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace StructureHelper.Windows.BeamShears
|
||||
public SourceTargetVM<IBeamShearAction> ActionSourceTarget { get; } = new();
|
||||
public SourceTargetVM<IStirrup> StirrupSourceTarget { get; } = new();
|
||||
public SourceTargetVM<IBeamShearSection> SectionSourceTarget { get; } = new();
|
||||
public BeamShearDesignRangePropertyViewModel DesignRangePropertyViewModel { get; private set; }
|
||||
|
||||
public BeamShearCalculatorInputDataViewModel(IBeamShearRepository shearRepository, IBeamShearCalculatorInputData inputData)
|
||||
{
|
||||
@@ -35,6 +36,7 @@ namespace StructureHelper.Windows.BeamShears
|
||||
SectionSourceTarget.SetTargetItems(inputData.Sections);
|
||||
SectionSourceTarget.SetSourceItems(shearRepository.Sections);
|
||||
SectionSourceTarget.ItemDataTemplate = SourceTargetFactory.GetSimpleTemplate();
|
||||
DesignRangePropertyViewModel = new(inputData.DesignRangeProperty);
|
||||
}
|
||||
|
||||
internal void Refresh()
|
||||
|
||||
@@ -35,6 +35,26 @@
|
||||
<TabItem Header="Actions">
|
||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding ActionSourceTarget}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="Design range" DataContext="{Binding DesignRangePropertyViewModel}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Minimum absolute range"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding AbsoluteRangeValue, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="1" Text="Minimum relative range"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding RelativeEffectiveDepthRangeValue, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
|
||||
<TextBlock Grid.Row="2" Text="Number of step"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding StepCount, ValidatesOnDataErrors=True}"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.BeamShears
|
||||
{
|
||||
public class BeamShearDesignRangePropertyViewModel : ViewModelBase
|
||||
{
|
||||
private const double minRelativeValue = 0.5;
|
||||
private const int minAbsoluteValue = 0;
|
||||
private const int minStepCount = 10;
|
||||
private const int maxStepCount = 1000;
|
||||
private readonly IBeamShearDesignRangeProperty designRangeProperty;
|
||||
|
||||
public double AbsoluteRangeValue
|
||||
{
|
||||
get => designRangeProperty.AbsoluteRangeValue;
|
||||
set
|
||||
{
|
||||
value = Math.Max(value, minAbsoluteValue);
|
||||
designRangeProperty.AbsoluteRangeValue = value;
|
||||
OnPropertyChanged(nameof(AbsoluteRangeValue));
|
||||
}
|
||||
}
|
||||
public double RelativeEffectiveDepthRangeValue
|
||||
{
|
||||
get => designRangeProperty.RelativeEffectiveDepthRangeValue;
|
||||
set
|
||||
{
|
||||
value = Math.Max(value, minRelativeValue);
|
||||
designRangeProperty.RelativeEffectiveDepthRangeValue = value;
|
||||
}
|
||||
}
|
||||
public int StepCount
|
||||
{
|
||||
get => designRangeProperty.StepCount;
|
||||
set
|
||||
{
|
||||
value = Math.Max(value, minStepCount);
|
||||
value = Math.Min(value, maxStepCount);
|
||||
designRangeProperty.StepCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public BeamShearDesignRangePropertyViewModel(IBeamShearDesignRangeProperty designRangeProperty)
|
||||
{
|
||||
this.designRangeProperty = designRangeProperty;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface IParentUpdateStrategy<T> : IUpdateStrategy<T>
|
||||
{
|
||||
bool UpdateChildren { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
public List<IBeamShearSection> Sections { get; } = new();
|
||||
/// <inheritdoc/>
|
||||
public List<IStirrup> Stirrups { get; } = new();
|
||||
public IBeamShearDesignRangeProperty DesignRangeProperty { get; set; } = new BeamShearDesignRangeProperty(Guid.NewGuid());
|
||||
|
||||
public BeamShearCalculatorInputData(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <inheritdoc>
|
||||
public class BeamShearDesignRangeProperty : IBeamShearDesignRangeProperty
|
||||
{
|
||||
private const int minStepCount = 0;
|
||||
private const int maxStepCount = 1000;
|
||||
private double absoluteRangeValue = 0.0;
|
||||
private double relativeEffectiveDepthRangeValue = 3.0;
|
||||
private int stepCount = 50;
|
||||
|
||||
/// <inheritdoc>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc>
|
||||
public double AbsoluteRangeValue
|
||||
{
|
||||
get => absoluteRangeValue;
|
||||
set
|
||||
{
|
||||
if (value < 0.0)
|
||||
{
|
||||
throw new StructureHelperException($"Absolute value of beam shear design range must be positive, but was {value}");
|
||||
}
|
||||
absoluteRangeValue = value;
|
||||
}
|
||||
}
|
||||
/// <inheritdoc>
|
||||
public double RelativeEffectiveDepthRangeValue
|
||||
{
|
||||
get => relativeEffectiveDepthRangeValue;
|
||||
set
|
||||
{
|
||||
if (value < 0.0)
|
||||
{
|
||||
throw new StructureHelperException($"Relative value of beam shear design range must be positive, but was {value}");
|
||||
}
|
||||
relativeEffectiveDepthRangeValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int StepCount
|
||||
{
|
||||
get => stepCount;
|
||||
set
|
||||
{
|
||||
if (value < minStepCount)
|
||||
{
|
||||
throw new StructureHelperException($"Number of step design range must be greater or equal {minStepCount}, but was {value}");
|
||||
}
|
||||
if (value > maxStepCount)
|
||||
{
|
||||
throw new StructureHelperException($"Number of step design range must be less or equal {maxStepCount}, but was {value}");
|
||||
}
|
||||
stepCount = value;
|
||||
}
|
||||
}
|
||||
public BeamShearDesignRangeProperty(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <inheritdoc>
|
||||
public object Clone()
|
||||
{
|
||||
var updateStrategy = new BeamShearDesignRangePropertyUpdateStrategy();
|
||||
BeamShearDesignRangeProperty newitem = new(Guid.NewGuid());
|
||||
updateStrategy.Update(newitem, this);
|
||||
return newitem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,6 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IBeamShearCalculatorInputData : ISaveable, IInputData, IHasBeamShearActions, IHasBeamShearSections, IHasStirrups
|
||||
{
|
||||
|
||||
IBeamShearDesignRangeProperty DesignRangeProperty { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements properties for calculting maximum range for considering of inclined sections
|
||||
/// </summary>
|
||||
public interface IBeamShearDesignRangeProperty : ISaveable, ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Absolute value of range in metres
|
||||
/// </summary>
|
||||
double AbsoluteRangeValue { get; set; }
|
||||
/// <summary>
|
||||
/// Relative value of range as factor of effective depth of cross-section
|
||||
/// </summary>
|
||||
double RelativeEffectiveDepthRangeValue { get; set; }
|
||||
/// <summary>
|
||||
/// Number of step of solvation
|
||||
/// </summary>
|
||||
int StepCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
private List<IInclinedSection> GetInclinedSections(IBeamShearSection beamShearSection)
|
||||
{
|
||||
IGetInclinedSectionListInputData inclinedSectionInputDataLogic = new GetInclinedSectionListInputData(beamShearSection);
|
||||
IGetInclinedSectionListInputData inclinedSectionInputDataLogic = new GetInclinedSectionListInputData(inputData.DesignRangeProperty, beamShearSection);
|
||||
//IGetInclinedSectionListLogic getInclinedSectionListLogic = new GetInclinedSectionListLogic(inclinedSectionInputDataLogic, TraceLogger);
|
||||
IGetInclinedSectionListLogic getInclinedSectionListLogic = new GetInclinedSectionListLogic(inclinedSectionInputDataLogic, null);
|
||||
return getInclinedSectionListLogic.GetInclinedSections();
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IBeamShearAction> checkActionsLogic;
|
||||
private ICheckEntityLogic<IBeamShearSection> checkSectionLogic;
|
||||
private ICheckEntityLogic<IStirrup> checkStirrupLogic;
|
||||
private ICheckEntityLogic<IHasStirrups> StirrupCheckLogic;
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
public IBeamShearCalculatorInputData InputData { get; set; }
|
||||
@@ -65,23 +65,12 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
private void CheckStirrups()
|
||||
{
|
||||
if (InputData.Stirrups is null)
|
||||
StirrupCheckLogic ??= new HasStirrupsCheckLogic(TraceLogger);
|
||||
StirrupCheckLogic.Entity = InputData;
|
||||
if (StirrupCheckLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage("\nCollection of stirrups is null");
|
||||
}
|
||||
else
|
||||
{
|
||||
checkStirrupLogic ??= new CheckStirrupsLogic(TraceLogger);
|
||||
foreach (var stirrup in InputData.Stirrups)
|
||||
{
|
||||
checkStirrupLogic.Entity = stirrup;
|
||||
if (checkStirrupLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkStirrupLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
checkResult += StirrupCheckLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class CheckStirrupsLogic : ICheckEntityLogic<IStirrup>
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IStirrupByDensity> checkDensityLogic;
|
||||
private ICheckEntityLogic<IStirrupByRebar> checkRebarLogic;
|
||||
|
||||
public CheckStirrupsLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IStirrup Entity { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nStirrup is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity is IStirrupByDensity density)
|
||||
{
|
||||
checkDensityLogic ??= new CheckStirrupsByDensityLogic(TraceLogger);
|
||||
checkDensityLogic.Entity = density;
|
||||
if (checkDensityLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkDensityLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
else if (Entity is IStirrupByRebar rebar)
|
||||
{
|
||||
checkRebarLogic ??= new CheckStirrupsByRebarLogic(TraceLogger);
|
||||
checkRebarLogic.Entity = rebar;
|
||||
if (checkRebarLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkRebarLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
else if (Entity is IStirrupGroup stirrupGroup)
|
||||
{
|
||||
|
||||
}
|
||||
else if (Entity is IStirrupByInclinedRebar inclinedRebar)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(Entity) + $": name = {Entity.Name}, id = {Entity.Id}";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class HasStirrupsCheckLogic : ICheckEntityLogic<IHasStirrups>
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IStirrup> checkStirrupLogic;
|
||||
|
||||
public IHasStirrups Entity { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public HasStirrupsCheckLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nHasSturrup element is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity.Stirrups is null)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage("\nCollection of stirrups is null");
|
||||
}
|
||||
checkStirrupLogic ??= new StirrupsCheckLogic(TraceLogger);
|
||||
foreach (var stirrup in Entity.Stirrups)
|
||||
{
|
||||
checkStirrupLogic.Entity = stirrup;
|
||||
if (checkStirrupLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkStirrupLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
internal class CheckStirrupsByDensityLogic : ICheckEntityLogic<IStirrupByDensity>
|
||||
internal class StirrupByDensityCheckLogic : ICheckEntityLogic<IStirrupByDensity>
|
||||
{
|
||||
private const int minDensity = 0;
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
|
||||
public CheckStirrupsByDensityLogic(IShiftTraceLogger? traceLogger)
|
||||
public StirrupByDensityCheckLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupByInclinedRebarCheckLogic : ICheckEntityLogic<IStirrupByInclinedRebar>
|
||||
{
|
||||
private const int minLegCount = 0;
|
||||
private const double minTransferLength = 0.010;
|
||||
private const double minStartCoordinate = 0.0;
|
||||
private const int minAngleOfInclination = 30;
|
||||
private const int maxAngleOfInclination = 60;
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IRebarSection> checkRebarSectionLogic;
|
||||
|
||||
public IStirrupByInclinedRebar Entity { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public StirrupByInclinedRebarCheckLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
result = true;
|
||||
checkResult = string.Empty;
|
||||
if (Entity is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nInclined rebar is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckRebarSection();
|
||||
CheckEntityProperties();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CheckEntityProperties()
|
||||
{
|
||||
if (Entity.StartCoordinate < minStartCoordinate)
|
||||
{
|
||||
result = false;
|
||||
checkResult += $"\nInclined rebar Name = {Entity.Name} start coordinate must be greater than {minStartCoordinate}, but was {Entity.StartCoordinate}";
|
||||
}
|
||||
if (Entity.AngleOfInclination < minAngleOfInclination)
|
||||
{
|
||||
result = false;
|
||||
checkResult += $"\nInclined rebar Name = {Entity.Name} angle of inclination must be greater than {minAngleOfInclination}, but was {Entity.AngleOfInclination}";
|
||||
}
|
||||
if (Entity.AngleOfInclination > maxAngleOfInclination)
|
||||
{
|
||||
result = false;
|
||||
checkResult += $"\nInclined rebar Name = {Entity.Name} angle of inclination must be less than {maxAngleOfInclination}, but was {Entity.AngleOfInclination}";
|
||||
}
|
||||
if (Entity.LegCount < minLegCount)
|
||||
{
|
||||
result = false;
|
||||
checkResult += $"\nInclined rebar Name = {Entity.Name} leg count n = {Entity.LegCount} is less than minimum leg count nmin = {minLegCount}";
|
||||
}
|
||||
if (Entity.TransferLength < minTransferLength)
|
||||
{
|
||||
result = false;
|
||||
checkResult += $"\nInclined rebar Name = {Entity.Name} transfer length Ltr = {Entity.TransferLength} is less than minimum trancfer length Ltr,min = {minTransferLength}";
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckRebarSection()
|
||||
{
|
||||
if (Entity.RebarSection is null)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"Inclined rebar Name = {Entity.Name} does not have rebar section");
|
||||
}
|
||||
else
|
||||
{
|
||||
checkRebarSectionLogic ??= new CheckRebarSectionLogic(TraceLogger)
|
||||
{
|
||||
Entity = Entity.RebarSection,
|
||||
MinDiameter = 0.003,
|
||||
MaxDiameter = 0.036
|
||||
};
|
||||
if (checkRebarSectionLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkRebarSectionLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
internal class CheckStirrupsByRebarLogic : ICheckEntityLogic<IStirrupByRebar>
|
||||
internal class StirrupByRebarCheckLogic : ICheckEntityLogic<IStirrupByRebar>
|
||||
{
|
||||
private const double minDiameter = 0.003;
|
||||
private const double maxDiameter = 0.025;
|
||||
@@ -18,7 +18,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
|
||||
public CheckStirrupsByRebarLogic(IShiftTraceLogger? traceLogger)
|
||||
public StirrupByRebarCheckLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupGroupCheckLogic : ICheckEntityLogic<IStirrupGroup>
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IHasStirrups> hasStirrupsCheckLogic;
|
||||
public IStirrupGroup Entity { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public StirrupGroupCheckLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nStirrup group is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
hasStirrupsCheckLogic ??= new HasStirrupsCheckLogic(TraceLogger);
|
||||
hasStirrupsCheckLogic.Entity = Entity;
|
||||
if (hasStirrupsCheckLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += "\nStirrup group has some errors";
|
||||
checkResult += hasStirrupsCheckLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupsCheckLogic : ICheckEntityLogic<IStirrup>
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IStirrupByDensity> densityCheckLogic;
|
||||
private ICheckEntityLogic<IStirrupByRebar> rebarCheckLogic;
|
||||
private ICheckEntityLogic<IStirrupGroup> stirrupGroupCheckLogic;
|
||||
private ICheckEntityLogic<IStirrupByInclinedRebar> inclinedRebarCheckLogic;
|
||||
|
||||
public StirrupsCheckLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IStirrup Entity { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nStirrup is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckStirrups();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CheckStirrups()
|
||||
{
|
||||
if (Entity is IStirrupByDensity density)
|
||||
{
|
||||
CheckStirrupByDensity(density);
|
||||
}
|
||||
else if (Entity is IStirrupByRebar rebar)
|
||||
{
|
||||
CheckStirrupByRebar(rebar);
|
||||
}
|
||||
else if (Entity is IStirrupGroup stirrupGroup)
|
||||
{
|
||||
CheckStirrupGroup(stirrupGroup);
|
||||
}
|
||||
else if (Entity is IStirrupByInclinedRebar inclinedRebar)
|
||||
{
|
||||
CheckInclinedRebar(inclinedRebar);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(Entity) + $": name = {Entity.Name}, id = {Entity.Id}";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckInclinedRebar(IStirrupByInclinedRebar inclinedRebar)
|
||||
{
|
||||
inclinedRebarCheckLogic ??= new StirrupByInclinedRebarCheckLogic(TraceLogger);
|
||||
inclinedRebarCheckLogic.Entity = inclinedRebar;
|
||||
if (inclinedRebarCheckLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += inclinedRebarCheckLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckStirrupGroup(IStirrupGroup stirrupGroup)
|
||||
{
|
||||
stirrupGroupCheckLogic ??= new StirrupGroupCheckLogic(TraceLogger);
|
||||
stirrupGroupCheckLogic.Entity = stirrupGroup;
|
||||
if (stirrupGroupCheckLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += stirrupGroupCheckLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckStirrupByRebar(IStirrupByRebar rebar)
|
||||
{
|
||||
rebarCheckLogic ??= new StirrupByRebarCheckLogic(TraceLogger);
|
||||
rebarCheckLogic.Entity = rebar;
|
||||
if (rebarCheckLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += rebarCheckLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckStirrupByDensity(IStirrupByDensity density)
|
||||
{
|
||||
densityCheckLogic ??= new StirrupByDensityCheckLogic(TraceLogger);
|
||||
densityCheckLogic.Entity = density;
|
||||
if (densityCheckLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += densityCheckLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,12 @@
|
||||
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
|
||||
{
|
||||
public class HasStirrupsUpdateCloneStrategy : IUpdateStrategy<IHasStirrups>
|
||||
{
|
||||
private readonly ICloningStrategy cloningStrategy;
|
||||
private ICloneStrategy<IStirrupGroup> groupCloneStrategy;
|
||||
|
||||
public HasStirrupsUpdateCloneStrategy(ICloningStrategy cloningStrategy)
|
||||
{
|
||||
@@ -26,7 +22,8 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
targetObject.Stirrups.Clear();
|
||||
foreach (var item in sourceObject.Stirrups)
|
||||
{
|
||||
IStirrup newStirrup = cloningStrategy.Clone(item);
|
||||
IStirrup newStirrup;
|
||||
newStirrup = cloningStrategy.Clone(item);
|
||||
targetObject.Stirrups.Add(newStirrup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupGroupCloneStrategy : ICloneStrategy<IStirrupGroup>
|
||||
{
|
||||
private IUpdateStrategy<IStirrupGroup> updateStrategy;
|
||||
private IUpdateStrategy<IHasStirrups> hasStirrupsUpdateStrategy;
|
||||
private readonly ICloningStrategy cloningStrategy;
|
||||
|
||||
public StirrupGroupCloneStrategy(ICloningStrategy cloningStrategy)
|
||||
{
|
||||
this.cloningStrategy = cloningStrategy;
|
||||
}
|
||||
|
||||
public IStirrupGroup GetClone(IStirrupGroup sourceObject)
|
||||
{
|
||||
//updateStrategy ??= new StirrupGroupUpdateStrategy() { UpdateChildren = false };
|
||||
//hasStirrupsUpdateStrategy ??= new HasStirrupsUpdateCloneStrategy(cloningStrategy);
|
||||
//StirrupGroup newItem = new(Guid.NewGuid());
|
||||
//updateStrategy.Update(newItem,sourceObject);
|
||||
//hasStirrupsUpdateStrategy.Update(newItem,sourceObject);
|
||||
//return newItem;
|
||||
return cloningStrategy.Clone(sourceObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,13 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
/// <inheritdoc/>
|
||||
public class GetInclinedSectionListInputData : IGetInclinedSectionListInputData
|
||||
{
|
||||
public int StepCount { get; set; } = 50;
|
||||
public double MaxInclinedSectionLegthFactor { get; set; } = 3d;
|
||||
public IBeamShearDesignRangeProperty DesignRangeProperty { get; }
|
||||
public IGetInclinedSectionLogic? GetInclinedSectionLogic { get; set; }
|
||||
public IBeamShearSection BeamShearSection { get; set; }
|
||||
|
||||
public GetInclinedSectionListInputData(IBeamShearSection beamShearSection)
|
||||
public GetInclinedSectionListInputData(IBeamShearDesignRangeProperty designRangeProperty, IBeamShearSection beamShearSection)
|
||||
{
|
||||
DesignRangeProperty = designRangeProperty;
|
||||
BeamShearSection = beamShearSection;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,17 +44,26 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
private void GetCoordinates()
|
||||
{
|
||||
double maxSectionLength = inputData.MaxInclinedSectionLegthFactor * effectiveDepth;
|
||||
double step = maxSectionLength / inputData.StepCount;
|
||||
double maxSectionLength = GetMaxSectionLength();
|
||||
int stepCount = inputData.DesignRangeProperty.StepCount;
|
||||
double step = maxSectionLength / stepCount;
|
||||
inclinedSections = new();
|
||||
coordinates = new();
|
||||
for (int i = 0; i < inputData.StepCount + 1; i++)
|
||||
for (int i = 0; i < stepCount + 1; i++)
|
||||
{
|
||||
double endCoord = step * i;
|
||||
double roundedEndCoord = Math.Round(endCoord, 6);
|
||||
coordinates.Add(roundedEndCoord);
|
||||
}
|
||||
}
|
||||
|
||||
private double GetMaxSectionLength()
|
||||
{
|
||||
double relativeLength = inputData.DesignRangeProperty.RelativeEffectiveDepthRangeValue * effectiveDepth;
|
||||
double length = Math.Max(relativeLength, inputData.DesignRangeProperty.AbsoluteRangeValue);
|
||||
return length;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
CheckObject.IsNull(inputData);
|
||||
|
||||
@@ -4,8 +4,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IGetInclinedSectionListInputData : IInputData
|
||||
{
|
||||
int StepCount { get; set; }
|
||||
double MaxInclinedSectionLegthFactor { get; set; }
|
||||
IBeamShearDesignRangeProperty DesignRangeProperty { get; }
|
||||
IGetInclinedSectionLogic? GetInclinedSectionLogic { get; set; }
|
||||
IBeamShearSection BeamShearSection { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupByInclinedRebarStrengthLogic : IBeamShearStrenghLogic
|
||||
{
|
||||
const double stirrupEffectivenessFactor = 0.75;
|
||||
private readonly IStirrupByInclinedRebar inclinedRebar;
|
||||
private readonly IInclinedSection inclinedSection;
|
||||
private IRebarSectionStrengthLogic rebarSectionStrengthLogic;
|
||||
@@ -57,6 +53,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
TraceLogger?.AddMessage($"Inclined section end point coordinate X = {inclinedSection.EndCoord} is in start transfer zone");
|
||||
return GetStartTransferValue();
|
||||
}
|
||||
TraceLogger?.AddMessage($"Inclined section with start point coordinate Xstart = {inclinedSection.StartCoord}(m) and end point Xend = {inclinedSection.EndCoord}(m) intersects inclined rebar in main zone with Xstart = {rebarTrueStartPoint}(m) and Xend = {rebarTrueEndPoint}(m)");
|
||||
return GetInclinedRebarStrength();
|
||||
}
|
||||
|
||||
@@ -98,9 +95,10 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
};
|
||||
rebarSectionStrengthLogic.RebarSection = inclinedRebar.RebarSection;
|
||||
double rebarStrength = rebarSectionStrengthLogic.GetRebarMaxTensileForce();
|
||||
double inclinedRebarStrength = rebarStrength * Math.Sin(angleInRad) * inclinedRebar.LegCount;
|
||||
TraceLogger?.AddMessage($"Inclinated rebar {inclinedRebar.Name}, start point {rebarStartPoint}(m), end point {rebarEndPoint}(m), angle of inclination {inclinedRebar.AngleOfInclination}(deg), number of legs {inclinedRebar.LegCount}");
|
||||
TraceLogger?.AddMessage($"Force in inclined rebar = {rebarStrength}(N) * sin({inclinedRebar.AngleOfInclination}) * {inclinedRebar.LegCount} = {inclinedRebarStrength}(N)");
|
||||
double inclinedRebarStrength = stirrupEffectivenessFactor * rebarStrength * Math.Sin(angleInRad) * inclinedRebar.LegCount;
|
||||
TraceLogger?.AddMessage($"Inclined rebar Name = {inclinedRebar.Name}, start point {rebarStartPoint}(m), end point {rebarEndPoint}(m), angle of inclination {inclinedRebar.AngleOfInclination}(deg), number of legs {inclinedRebar.LegCount}");
|
||||
TraceLogger?.AddMessage($"Inclined rebar effectiveness factor fi_sw = {stirrupEffectivenessFactor}(dimensionless)");
|
||||
TraceLogger?.AddMessage($"Force in inclined rebar = fi_sw * Fsw * sin(alpha) * n = {stirrupEffectivenessFactor} * {rebarStrength}(N) * sin({inclinedRebar.AngleOfInclination}) * {inclinedRebar.LegCount} = {inclinedRebarStrength}(N)");
|
||||
return inclinedRebarStrength;
|
||||
}
|
||||
|
||||
@@ -113,6 +111,10 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
rebarEndPoint = rebarStartPoint + rebarHeight / Math.Tan(angleInRad);
|
||||
rebarTrueStartPoint = rebarStartPoint + transferLength;
|
||||
rebarTrueEndPoint = rebarEndPoint - transferLength;
|
||||
if (rebarTrueStartPoint >= rebarTrueEndPoint)
|
||||
{
|
||||
throw new StructureHelperException("Transfer aone in inclined rebar is too big");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,20 +4,30 @@ using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class BeamShearCalculatorInputDataUpdateStrategy : IUpdateStrategy<IBeamShearCalculatorInputData>
|
||||
public class BeamShearCalculatorInputDataUpdateStrategy : IParentUpdateStrategy<IBeamShearCalculatorInputData>
|
||||
{
|
||||
private IUpdateStrategy<IHasBeamShearActions>? hasActionUpdateStrategy;
|
||||
private IUpdateStrategy<IHasStirrups>? hasStirrupsUpdateStrategy;
|
||||
private IUpdateStrategy<IHasBeamShearSections> hasSectionsUpdateStrategy;
|
||||
private IUpdateStrategy<IBeamShearDesignRangeProperty> designRangeUpdateStrategy;
|
||||
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(IBeamShearCalculatorInputData targetObject, IBeamShearCalculatorInputData sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; };
|
||||
InitializeStrategies();
|
||||
hasActionUpdateStrategy?.Update(targetObject, sourceObject);
|
||||
hasSectionsUpdateStrategy?.Update(targetObject, sourceObject);
|
||||
hasStirrupsUpdateStrategy?.Update(targetObject, sourceObject);
|
||||
if (UpdateChildren)
|
||||
{
|
||||
InitializeStrategies();
|
||||
hasActionUpdateStrategy?.Update(targetObject, sourceObject);
|
||||
hasSectionsUpdateStrategy?.Update(targetObject, sourceObject);
|
||||
hasStirrupsUpdateStrategy?.Update(targetObject, sourceObject);
|
||||
CheckObject.IsNull(sourceObject.DesignRangeProperty);
|
||||
CheckObject.IsNull(targetObject.DesignRangeProperty);
|
||||
designRangeUpdateStrategy.Update(targetObject.DesignRangeProperty, sourceObject.DesignRangeProperty);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +36,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
hasActionUpdateStrategy ??= new HasBeamShearActionUpdateStrategy();
|
||||
hasStirrupsUpdateStrategy ??= new HasStirrupsUpdateStrategy();
|
||||
hasSectionsUpdateStrategy ??= new HasBeamShearSectionUpdateStrategy();
|
||||
designRangeUpdateStrategy ??= new BeamShearDesignRangePropertyUpdateStrategy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class BeamShearDesignRangePropertyUpdateStrategy : IUpdateStrategy<IBeamShearDesignRangeProperty>
|
||||
{
|
||||
public void Update(IBeamShearDesignRangeProperty targetObject, IBeamShearDesignRangeProperty sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.AbsoluteRangeValue = sourceObject.AbsoluteRangeValue;
|
||||
targetObject.RelativeEffectiveDepthRangeValue = sourceObject.RelativeEffectiveDepthRangeValue;
|
||||
targetObject.StepCount = sourceObject.StepCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,12 @@ using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupByInclinedRebarUpdateStrategy : IUpdateStrategy<IStirrupByInclinedRebar>
|
||||
public class StirrupByInclinedRebarUpdateStrategy : IParentUpdateStrategy<IStirrupByInclinedRebar>
|
||||
{
|
||||
private IUpdateStrategy<IStirrup>? baseUpdateStrategy;
|
||||
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(IStirrupByInclinedRebar targetObject, IStirrupByInclinedRebar sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
@@ -20,8 +23,11 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
targetObject.TransferLength = sourceObject.TransferLength;
|
||||
targetObject.AngleOfInclination = sourceObject.AngleOfInclination;
|
||||
targetObject.LegCount = sourceObject.LegCount;
|
||||
CheckObject.IsNull(sourceObject.RebarSection, "Rebar section");
|
||||
targetObject.RebarSection = sourceObject.RebarSection.Clone() as IRebarSection;
|
||||
if (UpdateChildren)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject.RebarSection, "Rebar section");
|
||||
targetObject.RebarSection = sourceObject.RebarSection.Clone() as IRebarSection;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,12 @@ using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupGroupUpdateStrategy : IUpdateStrategy<IStirrupGroup>
|
||||
public class StirrupGroupUpdateStrategy : IParentUpdateStrategy<IStirrupGroup>
|
||||
{
|
||||
private StirrupBaseUpdateStrategy baseUpdateStrategy;
|
||||
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(IStirrupGroup targetObject, IStirrupGroup sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
@@ -16,6 +18,14 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
baseUpdateStrategy ??= new StirrupBaseUpdateStrategy();
|
||||
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||
if (UpdateChildren == true)
|
||||
{
|
||||
UpdateTargetChildren(targetObject, sourceObject);
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateTargetChildren(IStirrupGroup targetObject, IStirrupGroup sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject.Stirrups);
|
||||
CheckObject.IsNull(targetObject.Stirrups);
|
||||
targetObject.Stirrups.Clear();
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
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.Materials
|
||||
{
|
||||
internal class CheckRebarSectionLogic : ICheckEntityLogic<IRebarSection>
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
public IRebarSection Entity { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
public double MinDiameter { get; set; } = 0.003;
|
||||
public double MaxDiameter { get; set; } = 0.090;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public CheckRebarSectionLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nRebar section is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity.Diameter < MinDiameter)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nRebar diameter d = {Entity.Diameter} must not be less than dmin = {MinDiameter}");
|
||||
}
|
||||
if (Entity.Diameter > MaxDiameter)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nRebar diameter d = {Entity.Diameter} must be less or equal than dmax = {MaxDiameter}");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
double minimizedStrength = Math.Min(rebarStrength, MaxRebarStrength);
|
||||
TraceLogger?.AddMessage($"Strength of rebar Rs = Min({rebarStrength}, {MaxRebarStrength})= {minimizedStrength}(Pa)");
|
||||
double rebarForce = minimizedStrength * rebarArea;
|
||||
TraceLogger?.AddMessage($"Force in rebar Ns = {minimizedStrength}(Pa) * {rebarArea}(m2) = {rebarForce}");
|
||||
TraceLogger?.AddMessage($"Force in rebar Ns = {minimizedStrength}(Pa) * {rebarArea}(m2) = {rebarForce}(N)");
|
||||
return rebarForce;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,21 @@ using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class RebarSectionUpdateStrategy : IUpdateStrategy<IRebarSection>
|
||||
public class RebarSectionUpdateStrategy : IParentUpdateStrategy<IRebarSection>
|
||||
{
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(IRebarSection targetObject, IRebarSection sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
CheckObject.IsNull(sourceObject.Material);
|
||||
targetObject.Material = sourceObject.Material.Clone() as IReinforcementLibMaterial;
|
||||
targetObject.Diameter = sourceObject.Diameter;
|
||||
if (UpdateChildren)
|
||||
{
|
||||
targetObject.Material = sourceObject.Material.Clone() as IReinforcementLibMaterial;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user