Merge pull request #9 from RedikultsevEvg/PrimitivePropsEdit
Primitive props edit
This commit is contained in:
@@ -4,7 +4,7 @@ using StructureHelperLogics.Models.CrossSections;
|
||||
|
||||
namespace StructureHelperLogic.Models.Analyses
|
||||
{
|
||||
public class CrossSectionNdmAnalysis : IAnalysis
|
||||
public class CrossSectionNdmAnalysis : ICrossSectionNdmAnalysis
|
||||
{
|
||||
private CrossSectionNdmAnalysisUpdateStrategy updateStrategy = new();
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Analyses
|
||||
{
|
||||
public class CrossSectionNdmAnalysisUpdateStrategy : IUpdateStrategy<CrossSectionNdmAnalysis>
|
||||
public class CrossSectionNdmAnalysisUpdateStrategy : IUpdateStrategy<ICrossSectionNdmAnalysis>
|
||||
{
|
||||
private IUpdateStrategy<IAnalysis> analysisUpdateStrategy;
|
||||
private IUpdateStrategy<ICrossSection> crossSectionUpdateStrategy;
|
||||
@@ -35,7 +35,7 @@ namespace StructureHelperLogics.Models.Analyses
|
||||
|
||||
}
|
||||
|
||||
public void Update(CrossSectionNdmAnalysis targetObject, CrossSectionNdmAnalysis sourceObject)
|
||||
public void Update(ICrossSectionNdmAnalysis targetObject, ICrossSectionNdmAnalysis sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||
@@ -44,24 +44,24 @@ namespace StructureHelperLogics.Models.Analyses
|
||||
targetObject.VersionProcessor.Versions.Clear();
|
||||
foreach (var version in sourceObject.VersionProcessor.Versions)
|
||||
{
|
||||
if (version.Item is ICrossSection crossSection)
|
||||
if (version.AnalysisVersion is ICrossSection crossSection)
|
||||
{
|
||||
updateVersion(targetObject, version, crossSection);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(version.Item));
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(version.AnalysisVersion));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateVersion(CrossSectionNdmAnalysis targetObject, IDateVersion version, ICrossSection crossSection)
|
||||
private void updateVersion(ICrossSectionNdmAnalysis targetObject, IDateVersion version, ICrossSection crossSection)
|
||||
{
|
||||
DateVersion newVersion = new();
|
||||
dateUpdateStrategy.Update(newVersion, version);
|
||||
CrossSection newCrossection = new();
|
||||
crossSectionUpdateStrategy.Update(newCrossection, crossSection);
|
||||
newVersion.Item = newCrossection;
|
||||
newVersion.AnalysisVersion = newCrossection;
|
||||
targetObject.VersionProcessor.Versions.Add(newVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
|
||||
namespace StructureHelperLogic.Models.Analyses
|
||||
{
|
||||
public interface ICrossSectionNdmAnalysis : IAnalysis
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,18 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSection : ICrossSection
|
||||
{
|
||||
public ICrossSectionRepository SectionRepository { get; private set; }
|
||||
public ICrossSectionRepository SectionRepository { get; private set; } = new CrossSectionRepository();
|
||||
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
public CrossSection()
|
||||
public CrossSection(Guid id)
|
||||
{
|
||||
SectionRepository = new CrossSectionRepository();
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public CrossSection() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
|
||||
@@ -14,17 +14,19 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSectionRepository : ICrossSectionRepository
|
||||
{
|
||||
public List<IForceAction> ForceActions { get; private set; }
|
||||
public List<IHeadMaterial> HeadMaterials { get; private set; }
|
||||
public List<INdmPrimitive> Primitives { get; }
|
||||
public List<ICalculator> CalculatorsList { get; private set; }
|
||||
public Guid Id { get; }
|
||||
public List<IForceAction> ForceActions { get; private set; } = new();
|
||||
public List<IHeadMaterial> HeadMaterials { get; private set; } = new();
|
||||
public List<INdmPrimitive> Primitives { get; } = new();
|
||||
public List<ICalculator> Calculators { get; private set; } = new();
|
||||
|
||||
public CrossSectionRepository()
|
||||
public CrossSectionRepository(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public CrossSectionRepository() : this(Guid.NewGuid())
|
||||
{
|
||||
ForceActions = new List<IForceAction>();
|
||||
HeadMaterials = new List<IHeadMaterial>();
|
||||
Primitives = new List<INdmPrimitive>();
|
||||
CalculatorsList = new List<ICalculator>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -11,18 +12,29 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSectionUpdateStrategy : IUpdateStrategy<ICrossSection>
|
||||
{
|
||||
private IUpdateStrategy<ICrossSectionRepository> repositoryUpdateStrategy;
|
||||
|
||||
public CrossSectionUpdateStrategy()
|
||||
public CrossSectionUpdateStrategy(IUpdateStrategy<ICrossSectionRepository> repositoryUpdateStrategy)
|
||||
{
|
||||
this.repositoryUpdateStrategy = repositoryUpdateStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionUpdateStrategy() : this (
|
||||
new CrossSectionRepositoryUpdateStrategy()
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Update(ICrossSection targetObject, ICrossSection sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
|
||||
|
||||
targetObject.SectionRepository.Calculators.Clear();
|
||||
targetObject.SectionRepository.Primitives.Clear();
|
||||
targetObject.SectionRepository.ForceActions.Clear();
|
||||
targetObject.SectionRepository.HeadMaterials.Clear();
|
||||
repositoryUpdateStrategy.Update(targetObject.SectionRepository, sourceObject.SectionRepository);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,13 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives, IHasForceCombinations
|
||||
public interface ICrossSectionRepository : ISaveable, IHasHeadMaterials, IHasPrimitives, IHasForceCombinations, IHasCalculators
|
||||
{
|
||||
List<IForceAction> ForceActions { get; }
|
||||
List<ICalculator> CalculatorsList { get; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
@@ -18,6 +19,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private IFactorLogic factorLogic => new FactorLogic(SafetyFactors);
|
||||
private LMLogic.ITrueStrengthLogic strengthLogic;
|
||||
private IUpdateStrategy<IConcreteLibMaterial> updateStrategy = new ConcreteLibUpdateStrategy();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
/// <inheritdoc/>
|
||||
@@ -38,8 +43,9 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public List<IMaterialLogic> MaterialLogics => materialLogics;
|
||||
|
||||
|
||||
public ConcreteLibMaterial()
|
||||
public ConcreteLibMaterial(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
|
||||
MaterialLogic = materialLogics.First();
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
@@ -50,12 +56,16 @@ namespace StructureHelperLogics.Models.Materials
|
||||
RelativeHumidity = 0.55d;
|
||||
MinAge = 0d;
|
||||
MaxAge = maxAge;
|
||||
}
|
||||
}
|
||||
|
||||
public ConcreteLibMaterial() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new ConcreteLibMaterial();
|
||||
var updateStrategy = new ConcreteLibUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,18 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public double Modulus { get; set; }
|
||||
public double CompressiveStrength { get; set; }
|
||||
public double TensileStrength { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
||||
|
||||
public ElasticMaterial()
|
||||
public Guid Id { get; }
|
||||
|
||||
public ElasticMaterial(Guid id)
|
||||
{
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public ElasticMaterial() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
|
||||
@@ -15,43 +15,34 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
private IElasticMaterialLogic elasticMaterialLogic => new ElasticMaterialLogic();
|
||||
private MaterialTypes materialType;
|
||||
IUpdateStrategy<IFRMaterial> fRUpdateStrategy = new FRUpdateStrategy();
|
||||
IUpdateStrategy<IFRMaterial> updateStrategy = new FRUpdateStrategy();
|
||||
public Guid Id { get; }
|
||||
public double Modulus{ get; set; }
|
||||
public double CompressiveStrength { get; set; }
|
||||
public double TensileStrength { get; set; }
|
||||
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
||||
public double ULSConcreteStrength { get; set; }
|
||||
public double SumThickness { get; set; }
|
||||
public double GammaF2 => GetGammaF2();
|
||||
|
||||
private double GetGammaF2()
|
||||
public FRMaterial(MaterialTypes materialType, Guid id)
|
||||
{
|
||||
const double gammaF2Max = 0.9d;
|
||||
double gammaF2;
|
||||
IFactorLogic factorLogic = new FactorLogic(SafetyFactors);
|
||||
var factors = factorLogic.GetTotalFactor(LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
var rf = TensileStrength * factors.Tensile;
|
||||
var epsUlt = rf / Modulus;
|
||||
gammaF2 = 0.4d / epsUlt * Math.Sqrt(ULSConcreteStrength / (Modulus * SumThickness * 1e3d));
|
||||
gammaF2 = Math.Min(gammaF2, gammaF2Max);
|
||||
return gammaF2;
|
||||
}
|
||||
|
||||
public FRMaterial(MaterialTypes materialType)
|
||||
{
|
||||
|
||||
Id = id;
|
||||
ULSConcreteStrength = 14e6d;
|
||||
SumThickness = 0.175e-3d;
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
this.materialType = materialType;
|
||||
SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultFRSafetyFactors(ProgramSetting.FRCodeType, this.materialType));
|
||||
}
|
||||
|
||||
public FRMaterial(MaterialTypes materialType) : this (materialType, Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new FRMaterial(this.materialType);
|
||||
var updateStrategy = fRUpdateStrategy;
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
@@ -71,5 +62,17 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
return GetLoaderMaterial(limitState, calcTerm);
|
||||
}
|
||||
private double GetGammaF2()
|
||||
{
|
||||
const double gammaF2Max = 0.9d;
|
||||
double gammaF2;
|
||||
IFactorLogic factorLogic = new FactorLogic(SafetyFactors);
|
||||
var factors = factorLogic.GetTotalFactor(LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
var rf = TensileStrength * factors.Tensile;
|
||||
var epsUlt = rf / Modulus;
|
||||
gammaF2 = 0.4d / epsUlt * Math.Sqrt(ULSConcreteStrength / (Modulus * SumThickness * 1e3d));
|
||||
gammaF2 = Math.Min(gammaF2, gammaF2Max);
|
||||
return gammaF2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace StructureHelper.Models.Materials
|
||||
{
|
||||
public class HeadMaterial : IHeadMaterial, INotifyPropertyChanged
|
||||
{
|
||||
private HeadMaterialUpdateStrategy updateStrategy = new HeadMaterialUpdateStrategy();
|
||||
private Color color;
|
||||
|
||||
public Guid Id { get; }
|
||||
@@ -31,6 +32,7 @@ namespace StructureHelper.Models.Materials
|
||||
}
|
||||
public IHelperMaterial HelperMaterial {get; set;}
|
||||
|
||||
|
||||
public HeadMaterial(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
@@ -51,8 +53,7 @@ namespace StructureHelper.Models.Materials
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new HeadMaterial();
|
||||
newItem.HelperMaterial = this.HelperMaterial.Clone() as IHelperMaterial;
|
||||
var updateStrategy = new MaterialUpdateStrategy();
|
||||
newItem.HelperMaterial = HelperMaterial.Clone() as IHelperMaterial;
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelper.Models.Materials
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,7 +8,7 @@ using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public interface IHelperMaterial : ICloneable
|
||||
public interface IHelperMaterial : ISaveable, ICloneable
|
||||
{
|
||||
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public List<IMaterialLogic> MaterialLogics => throw new NotImplementedException();
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
|
||||
{
|
||||
this.MaterialType = materialType;
|
||||
|
||||
@@ -21,12 +21,15 @@ namespace StructureHelperLogics.Models.Materials
|
||||
}
|
||||
public void Update(IConcreteLibMaterial targetObject, IConcreteLibMaterial sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
libUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.TensionForULS = sourceObject.TensionForULS;
|
||||
targetObject.TensionForSLS = sourceObject.TensionForSLS;
|
||||
targetObject.RelativeHumidity = sourceObject.RelativeHumidity;
|
||||
targetObject.MinAge = sourceObject.MinAge;
|
||||
targetObject.MaxAge = sourceObject.MaxAge;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class HeadMaterialUpdateStrategy : IUpdateStrategy<IHeadMaterial>
|
||||
{
|
||||
private IUpdateStrategy<IHelperMaterial> helperMaterialUpdateStrategy;
|
||||
|
||||
public HeadMaterialUpdateStrategy(IUpdateStrategy<IHelperMaterial> helperMaterialUpdateStrategy)
|
||||
{
|
||||
this.helperMaterialUpdateStrategy = helperMaterialUpdateStrategy;
|
||||
}
|
||||
public HeadMaterialUpdateStrategy() : this(new HelperMaterialUpdateStrategy()) { }
|
||||
|
||||
public void Update(IHeadMaterial targetObject, IHeadMaterial sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.Color = sourceObject.Color;
|
||||
targetObject.HelperMaterial = sourceObject.HelperMaterial.Clone() as IHelperMaterial;
|
||||
helperMaterialUpdateStrategy.Update(targetObject.HelperMaterial, sourceObject.HelperMaterial);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,21 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
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.Materials
|
||||
{
|
||||
public class MaterialUpdateStrategy : IUpdateStrategy<IHeadMaterial>
|
||||
public class HelperMaterialUpdateStrategy : IUpdateStrategy<IHelperMaterial>
|
||||
{
|
||||
private IUpdateStrategy<IElasticMaterial> elasticStrategy;
|
||||
private IUpdateStrategy<IFRMaterial> frStrategy;
|
||||
private IUpdateStrategy<IConcreteLibMaterial> concreteStrategy;
|
||||
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy;
|
||||
public MaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
|
||||
public HelperMaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
|
||||
IUpdateStrategy<IFRMaterial> frStrategy,
|
||||
IUpdateStrategy<IConcreteLibMaterial> concreteStrategy,
|
||||
IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy
|
||||
@@ -20,28 +24,20 @@ namespace StructureHelperLogics.Models.Materials
|
||||
this.elasticStrategy = elasticStrategy;
|
||||
this.frStrategy = frStrategy;
|
||||
this.concreteStrategy = concreteStrategy;
|
||||
this.reinforcementStrategy= reinforcementStrategy;
|
||||
this.reinforcementStrategy = reinforcementStrategy;
|
||||
}
|
||||
public MaterialUpdateStrategy() : this(
|
||||
public HelperMaterialUpdateStrategy() : this(
|
||||
new ElasticUpdateStrategy(),
|
||||
new FRUpdateStrategy(),
|
||||
new ConcreteLibUpdateStrategy(),
|
||||
new ReinforcementLibUpdateStrategy()
|
||||
) { }
|
||||
)
|
||||
{ }
|
||||
|
||||
public void Update(IHeadMaterial targetObject, IHeadMaterial sourceObject)
|
||||
public void Update(IHelperMaterial targetObject, IHelperMaterial sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.Color = sourceObject.Color;
|
||||
targetObject.HelperMaterial = sourceObject.HelperMaterial.Clone() as IHelperMaterial;
|
||||
UpdateHelperMaterial(targetObject.HelperMaterial, sourceObject.HelperMaterial);
|
||||
}
|
||||
|
||||
private void UpdateHelperMaterial(IHelperMaterial targetObject, IHelperMaterial sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (sourceObject is ILibMaterial)
|
||||
{
|
||||
UpdateLibMaterial(targetObject, sourceObject);
|
||||
@@ -13,11 +13,16 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public void Update(ILibMaterial targetObject, ILibMaterial sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.MaterialEntity = sourceObject.MaterialEntity;
|
||||
if (targetObject.SafetyFactors is not null & sourceObject.SafetyFactors is not null)
|
||||
if (sourceObject.SafetyFactors is not null)
|
||||
{
|
||||
if (targetObject.SafetyFactors is null)
|
||||
{
|
||||
targetObject.SafetyFactors = new();
|
||||
}
|
||||
targetObject.SafetyFactors.Clear();
|
||||
foreach (var item in sourceObject.SafetyFactors)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,8 @@ namespace StructureHelperLogics.Models.Materials
|
||||
}
|
||||
public void Update(IReinforcementLibMaterial targetObject, IReinforcementLibMaterial sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
libUpdateStrategy.Update(targetObject, sourceObject);
|
||||
}
|
||||
|
||||
@@ -22,16 +22,23 @@ namespace StructureHelperLogics.Models.Materials
|
||||
private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
|
||||
private readonly List<IMaterialLogic> materialLogics;
|
||||
|
||||
public Guid Id { get; }
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
|
||||
public IMaterialLogic MaterialLogic { get; set; }
|
||||
|
||||
public List<IMaterialLogic> MaterialLogics => materialLogics;
|
||||
public ReinforcementLibMaterial()
|
||||
|
||||
|
||||
public ReinforcementLibMaterial(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
|
||||
MaterialLogic = materialLogics.First();
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
}
|
||||
|
||||
public ReinforcementLibMaterial() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
calculators = calculatorLogic.GetNdmCalculators();
|
||||
AddAllForcesToCalculators();
|
||||
AddAllPrimitivesToCalculator();
|
||||
repository.CalculatorsList.AddRange(calculators);
|
||||
repository.Calculators.AddRange(calculators);
|
||||
return section;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user