Temporary changeHasCalculator cloning strategy

This commit is contained in:
ear
2024-12-27 13:26:24 +05:00
parent 921ec22e8a
commit bd0175086a
16 changed files with 4529 additions and 130 deletions

View File

@@ -10,6 +10,7 @@ namespace StructureHelperLogics.Models.CrossSections
public class CrossSection : ICrossSection
{
private ICloneStrategy<ICrossSection> cloneStrategy = new CrossSectionCloneStrategy();
private IUpdateStrategy<ICrossSection> updateStrategy = new CrossSectionUpdateStrategy();
public ICrossSectionRepository SectionRepository { get; set; } = new CrossSectionRepository();
public Guid Id { get; private set; }
@@ -26,6 +27,9 @@ namespace StructureHelperLogics.Models.CrossSections
public object Clone()
{
//var newItem = new CrossSection();
//updateStrategy.Update(newItem, this);
//return newItem;
return cloneStrategy.GetClone(this);
}
}

View File

@@ -51,7 +51,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
targetObject.Calculators.Clear();
foreach (var calculator in sourceObject.Calculators)
{
var newCalculator = cloningStrategy.Clone(calculator);
//to do Change to cloning strategy
//var newCalculator = cloningStrategy.Clone(calculator);
var newCalculator = calculator.Clone() as ICalculator;
if (calculator is IForceCalculator forceCalculator)
{
forceCalculatorUpdateStrategy.Update(newCalculator as IForceCalculator, forceCalculator);