Add converting strategies for beam shear actions

This commit is contained in:
Evgeny Redikultsev
2025-06-07 19:37:37 +05:00
parent 957ab62ece
commit ece04ae406
45 changed files with 965 additions and 247 deletions

View File

@@ -19,6 +19,12 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
TraceLogger = traceLogger;
}
protected ConvertStrategy(IBaseConvertStrategy baseConvertStrategy)
{
ReferenceDictionary = baseConvertStrategy.ReferenceDictionary;
TraceLogger = baseConvertStrategy.TraceLogger;
}
protected ConvertStrategy(IConvertStrategy<ISaveable, ISaveable> convertStrategy)
{
ReferenceDictionary = convertStrategy.ReferenceDictionary;

View File

@@ -28,6 +28,12 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
TraceLogger = baseConvertStrategy.TraceLogger;
ConvertStrategy = convertStrategy;
}
public DictionaryConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger? traceLogger, IConvertStrategy<T, V> convertStrategy)
{
ReferenceDictionary = referenceDictionary;
TraceLogger = traceLogger;
ConvertStrategy = convertStrategy;
}
public DictionaryConvertStrategy()
{

View File

@@ -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 IProcessStrategy<T>
{
void Process(T entity);
}
}

View File

@@ -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 IRepository
{
void ClearRepository();
}
}

View File

@@ -91,7 +91,7 @@ namespace StructureHelperCommon.Infrastructures.Settings
return new FileVersion()
{
VersionNumber = 1,
SubVersionNumber = 1
SubVersionNumber = 2 //Add Beam shear analysis
};
}
}

View File

@@ -15,14 +15,9 @@ namespace StructureHelperCommon.Models.Analyses
public VersionProcessor(Guid id)
{
Id = id;
Versions = new();
}
public VersionProcessor() : this (Guid.NewGuid())
{
}
private void AddVersion(IDateVersion version)
{

View File

@@ -1,15 +1,12 @@
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;
namespace StructureHelperCommon.Models.Forces.BeamShearActions
{
public class BeamShearLoadBaseUpdateStrategy : IUpdateStrategy<IBeamSpanLoad>
{
private IUpdateStrategy<IFactoredCombinationProperty> combinationUpdateStrategy;
public void Update(IBeamSpanLoad targetObject, IBeamSpanLoad sourceObject)
{
CheckObject.IsNull(targetObject);
@@ -18,6 +15,10 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions
targetObject.Name = sourceObject.Name;
targetObject.LoadRatio = sourceObject.LoadRatio;
targetObject.RelativeLoadLevel = sourceObject.RelativeLoadLevel;
CheckObject.IsNull(sourceObject.CombinationProperty);
CheckObject.IsNull(targetObject.CombinationProperty);
combinationUpdateStrategy ??= new FactoredCombinationPropertyUpdateStrategy();
combinationUpdateStrategy.Update(targetObject.CombinationProperty, sourceObject.CombinationProperty);
}
}
}

View File

@@ -26,7 +26,7 @@ namespace StructureHelperCommon.Models.Forces
public object Clone()
{
var newTuple = new DesignForceTuple();
var newTuple = new DesignForceTuple(Guid.NewGuid());
updateStrategy.Update(newTuple, this);
return newTuple;
}

View File

@@ -27,7 +27,12 @@ namespace StructureHelperCommon.Models.Forces
public ForceCombinationList(Guid id)
{
Id = id;
DesignForces = new List<IDesignForceTuple>
DesignForces = AddDefaultForces();
}
private static List<IDesignForceTuple> AddDefaultForces()
{
return new List<IDesignForceTuple>
{
new DesignForceTuple()
{
@@ -51,6 +56,7 @@ namespace StructureHelperCommon.Models.Forces
}
};
}
public ForceCombinationList() : this (Guid.NewGuid()) { }
/// <inheritdoc/>
public object Clone()

View File

@@ -1,11 +1,6 @@
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 StructureHelperCommon.Models.Forces
{

View File

@@ -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
{