Fix cloninng BeamShearAction
This commit is contained in:
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates deep copy of object by dictionary (if copy of object is not created it create copy, otherwise take copy from dictionary)
|
||||
/// Creates deep copy of object by dictionary (if copy of object is not created it creates copy, otherwise take copy from dictionary)
|
||||
/// </summary>
|
||||
public class DeepCloningStrategy : ICloningStrategy
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates deep clone of object
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for cloning objects
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IFactoredForceTuple ExternalForce { get; } = new FactoredForceTuple(Guid.NewGuid());
|
||||
public IFactoredForceTuple ExternalForce { get; set; } = new FactoredForceTuple(Guid.NewGuid());
|
||||
/// <inheritdoc/>
|
||||
public IBeamShearAxisAction SupportAction { get; } = new BeamShearAxisAction(Guid.NewGuid());
|
||||
public IBeamShearAxisAction SupportAction { get; set; } = new BeamShearAxisAction(Guid.NewGuid());
|
||||
|
||||
public BeamShearAction(Guid id)
|
||||
{
|
||||
@@ -26,10 +26,10 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
BeamShearAction beamShearAction = new(Guid.NewGuid());
|
||||
BeamShearAction newItem = new(Guid.NewGuid());
|
||||
updateStrategy ??= new BeamShearActionUpdateStrategy();
|
||||
updateStrategy.Update(beamShearAction, this);
|
||||
return beamShearAction;
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
|
||||
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
{
|
||||
internal class BeamShearActionCloneStrategy : ICloneStrategy<IBeamShearAction>
|
||||
{
|
||||
private BeamShearAction targetObject;
|
||||
|
||||
public IBeamShearAction GetClone(IBeamShearAction sourceObject)
|
||||
{
|
||||
targetObject = new(Guid.NewGuid());
|
||||
return targetObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.ExternalForce = sourceObject.ExternalForce.Clone() as IFactoredForceTuple;
|
||||
InitializeStrategies();
|
||||
CheckObject.IsNull(sourceObject.SupportAction);
|
||||
CheckObject.IsNull(targetObject.SupportAction);
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
{
|
||||
internal class BeamShearAxisActionCloneStrategy : ICloneStrategy<IBeamShearAxisAction>
|
||||
{
|
||||
private ICloningStrategy cloningStrategy;
|
||||
private IUpdateStrategy<IBeamShearAxisAction> updateStrategy;
|
||||
|
||||
public BeamShearAxisActionCloneStrategy(ICloningStrategy cloningStrategy)
|
||||
{
|
||||
this.cloningStrategy = cloningStrategy;
|
||||
}
|
||||
|
||||
private BeamShearAxisAction targetObject;
|
||||
|
||||
public IBeamShearAxisAction GetClone(IBeamShearAxisAction sourceObject)
|
||||
{
|
||||
InitializeStrategies();
|
||||
targetObject = new(Guid.NewGuid());
|
||||
updateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.ShearLoads.Clear();
|
||||
foreach (var shearLoad in sourceObject.ShearLoads)
|
||||
{
|
||||
targetObject.ShearLoads.Add(cloningStrategy.Clone(shearLoad));
|
||||
}
|
||||
return targetObject;
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new BeamShearAxisActionUpdateStrategy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces.Logics;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
{
|
||||
@@ -19,10 +17,7 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
InitializeStrategies();
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.SupportForce = sourceObject.SupportForce;
|
||||
CheckObject.IsNull(targetObject.SupportForce.CombinationProperty);
|
||||
CheckObject.IsNull(sourceObject.SupportForce.CombinationProperty);
|
||||
combinationUpdateStrategy.Update(targetObject.SupportForce.CombinationProperty, sourceObject.SupportForce.CombinationProperty);
|
||||
targetObject.SupportForce = sourceObject.SupportForce.Clone() as IFactoredForceTuple;
|
||||
CheckObject.IsNull(targetObject.ShearLoads);
|
||||
targetObject.ShearLoads.Clear();
|
||||
CheckObject.IsNull(sourceObject.ShearLoads);
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
InitializeStrategies();
|
||||
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.ForceValue = sourceObject.ForceValue;
|
||||
targetObject.ForceValue = sourceObject.ForceValue.Clone() as IForceTuple;
|
||||
targetObject.ForceCoordinate = sourceObject.ForceCoordinate;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
InitializeStrategies();
|
||||
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.LoadValue = sourceObject.LoadValue;
|
||||
targetObject.LoadValue = sourceObject.LoadValue.Clone() as IForceTuple;
|
||||
targetObject.StartCoordinate = sourceObject.StartCoordinate;
|
||||
targetObject.EndCoordinate = sourceObject.EndCoordinate;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace StructureHelperCommon.Models.Forces
|
||||
/// <summary>
|
||||
/// External force at the end of bar
|
||||
/// </summary>
|
||||
IFactoredForceTuple ExternalForce { get; }
|
||||
IFactoredForceTuple ExternalForce { get; set; }
|
||||
/// <summary>
|
||||
/// Internal loads on bar
|
||||
/// </summary>
|
||||
IBeamShearAxisAction SupportAction { get; }
|
||||
IBeamShearAxisAction SupportAction { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ namespace StructureHelperCommon.Models.Forces
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
DistributedLoad distributedLoad = new(Guid.NewGuid());
|
||||
DistributedLoad newItem = new(Guid.NewGuid());
|
||||
updateStrategy ??= new DistributedLoadUpdateStrategy();
|
||||
updateStrategy.Update(distributedLoad, this);
|
||||
return distributedLoad;
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class FactoredForceTuple : IFactoredForceTuple
|
||||
{
|
||||
private IUpdateStrategy<IFactoredForceTuple> updateStrategy;
|
||||
|
||||
public Guid Id { get; }
|
||||
public IForceTuple ForceTuple { get; set; } = new ForceTuple();
|
||||
public IFactoredCombinationProperty CombinationProperty { get; set; } = new FactoredCombinationProperty(Guid.NewGuid());
|
||||
@@ -19,7 +18,10 @@ namespace StructureHelperCommon.Models.Forces
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
updateStrategy ??= new FactoredForceTupleUpdateStrategy();
|
||||
FactoredForceTuple newItem = new(Guid.NewGuid());
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces.Logics
|
||||
{
|
||||
@@ -15,10 +10,10 @@ namespace StructureHelperCommon.Models.Forces.Logics
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.LimitState = sourceObject.LimitState;
|
||||
targetObject.ULSFactor = sourceObject.ULSFactor;
|
||||
targetObject.LongTermFactor = sourceObject.LongTermFactor;
|
||||
targetObject.CalcTerm = sourceObject.CalcTerm;
|
||||
targetObject.LimitState = sourceObject.LimitState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class FactoredForceTupleUpdateStrategy : IUpdateStrategy<IFactoredForceTuple>
|
||||
{
|
||||
public void Update(IFactoredForceTuple targetObject, IFactoredForceTuple sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
CheckObject.IsNull(sourceObject.ForceTuple);
|
||||
targetObject.ForceTuple = sourceObject.ForceTuple.Clone() as IForceTuple;
|
||||
CheckObject.IsNull(sourceObject.CombinationProperty);
|
||||
targetObject.CombinationProperty = sourceObject.CombinationProperty.Clone() as IFactoredCombinationProperty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
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;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Forces.Logics;
|
||||
|
||||
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
Reference in New Issue
Block a user