Add Safety FactorConverter

This commit is contained in:
Evgeny Redikultsev
2024-10-06 17:53:49 +05:00
parent 58b6e0eb8b
commit 018a989ba6
21 changed files with 387 additions and 86 deletions

View File

@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using System;
namespace StructureHelperCommon.Models.Materials
{
@@ -12,6 +13,7 @@ namespace StructureHelperCommon.Models.Materials
private ConcreteLogicOptions options;
public Guid Id { get; private set; }
public string Name { get; set; }
public IMaterialLogicOptions Options
{
@@ -29,6 +31,11 @@ namespace StructureHelperCommon.Models.Materials
public MaterialTypes MaterialType { get; set; }
public DiagramType DiagramType { get; set; }
public ConcreteCurveLogic(Guid id)
{
Id = id;
}
public IMaterial GetLoaderMaterial()
{
GetLoaderOptions();

View File

@@ -15,9 +15,24 @@ namespace StructureHelperCommon.Models.Materials
{
var items = new List<IMaterialLogic>()
{
new ReinforcementByBuilderLogic() { MaterialType = MaterialTypes.Reinforcement, Name="Bilinear", DiagramType = DiagramType.Bilinear},
new ReinforcementByBuilderLogic() { MaterialType = MaterialTypes.Reinforcement, Name="Triplelinear", DiagramType = DiagramType.TripleLinear},
new ConcreteCurveLogic() { MaterialType = MaterialTypes.Concrete, Name = "Curve", DiagramType = DiagramType.Curve},
new ReinforcementByBuilderLogic(Guid.Parse("54c4fe40-8f82-4995-8930-81e65e97edb9"))
{
MaterialType = MaterialTypes.Reinforcement,
Name="Bilinear",
DiagramType = DiagramType.Bilinear
},
new ReinforcementByBuilderLogic(Guid.Parse("c658b71d-13b1-458c-a1b0-c93d1324acad"))
{
MaterialType = MaterialTypes.Reinforcement,
Name="Triplelinear",
DiagramType = DiagramType.TripleLinear
},
new ConcreteCurveLogic(Guid.Parse("b97e8168-76a1-4e24-ae98-9aa38edd1e9a"))
{
MaterialType = MaterialTypes.Concrete,
Name = "Curve",
DiagramType = DiagramType.Curve
},
};
return items;
}

View File

@@ -1,6 +1,7 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,7 +10,7 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials
{
public interface IMaterialLogic
public interface IMaterialLogic : ISaveable
{
string Name { get; set; }
IMaterialLogicOptions Options { get; set; }

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,10 +8,12 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials.Libraries
{
internal class MaterialPartialFactorUpdateStrategy : IUpdateStrategy<IMaterialPartialFactor>
public class MaterialPartialFactorUpdateStrategy : IUpdateStrategy<IMaterialPartialFactor>
{
public void Update(IMaterialPartialFactor targetObject, IMaterialPartialFactor sourceObject)
{
CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.LimitState = sourceObject.LimitState;
targetObject.StressState = sourceObject.StressState;

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,10 +8,12 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials.Libraries
{
internal class MaterialSafetyFactorUpdateStrategy : IUpdateStrategy<IMaterialSafetyFactor>
public class MaterialSafetyFactorUpdateStrategy : IUpdateStrategy<IMaterialSafetyFactor>
{
public void Update(IMaterialSafetyFactor targetObject, IMaterialSafetyFactor sourceObject)
{
CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Name = sourceObject.Name;
targetObject.Take = sourceObject.Take;

View File

@@ -1,5 +1,6 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
namespace StructureHelperCommon.Models.Materials.Libraries
@@ -7,16 +8,18 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public class MaterialPartialFactor : IMaterialPartialFactor
{
private double factorValue;
private IUpdateStrategy<IMaterialPartialFactor> updateStrategy = new MaterialPartialFactorUpdateStrategy();
public Guid Id { get; }
public StressStates StressState { get; set; }
public CalcTerms CalcTerm { get; set; }
public LimitStates LimitState { get; set; }
public StressStates StressState { get; set; } = StressStates.Compression;
public CalcTerms CalcTerm { get; set; } = CalcTerms.LongTerm;
public LimitStates LimitState { get; set; } = LimitStates.ULS;
public double FactorValue
{
get => factorValue;
set
{
if (value < 0 )
if (value < 0)
{
throw new StructureHelperException(ErrorStrings.FactorMustBeGraterThanZero);
}
@@ -28,9 +31,6 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public MaterialPartialFactor(Guid id)
{
Id = id;
StressState = StressStates.Compression;
LimitState = LimitStates.ULS;
CalcTerm = CalcTerms.LongTerm;
FactorValue = 1d;
}
@@ -40,7 +40,6 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public object Clone()
{
var newItem = new MaterialPartialFactor();
var updateStrategy = new MaterialPartialFactorUpdateStrategy();
updateStrategy.Update(newItem, this);
return newItem;
}

View File

@@ -3,6 +3,7 @@ using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Services;
using System;
namespace StructureHelperCommon.Models.Materials
{
@@ -12,6 +13,7 @@ namespace StructureHelperCommon.Models.Materials
private ReinforcementOptions materialOptions;
private IMaterialOptionLogic optionLogic;
public Guid Id { get; private set; }
public string Name { get; set; }
public DiagramType DiagramType { get; set; }
public IMaterialLogicOptions Options
@@ -26,6 +28,10 @@ namespace StructureHelperCommon.Models.Materials
public MaterialTypes MaterialType { get; set; }
public ReinforcementByBuilderLogic(Guid id)
{
Id = id;
}
public IMaterial GetLoaderMaterial()
{
GetLoaderOptions();