Add curvature calculator DTOs

This commit is contained in:
Evgeny Redikultsev
2025-11-23 17:19:36 +05:00
parent 7ab4909c67
commit 5daa32a954
77 changed files with 1415 additions and 165 deletions

View File

@@ -0,0 +1,37 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
namespace DataAccess.DTOs
{
public class DeflectionFactorFromDTOConvertStrategy : ConvertStrategy<DeflectionFactor, DeflectionFactorDTO>
{
private IUpdateStrategy<IDeflectionFactor> updateStrategy;
private IConvertStrategy<ForceTuple, ForceTupleDTO> forceTupleConvertStrategy;
public DeflectionFactorFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
private IUpdateStrategy<IDeflectionFactor> UpdateStrategy => updateStrategy ??= new DeflectionFactorUpdateStrategy() { UpdateChildren = false };
private IConvertStrategy<ForceTuple, ForceTupleDTO> ForceTupleConvertStrategy => forceTupleConvertStrategy ??= new ForceTupleFromDTOConvertStrategy(ReferenceDictionary, TraceLogger);
public override DeflectionFactor GetNewItem(DeflectionFactorDTO source)
{
NewItem = new(source.Id);
UpdateStrategy.Update(NewItem, source);
if (source.DeflectionFactors is not ForceTupleDTO deflectionFactor)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.DeflectionFactors) + ": deflection factor");
}
NewItem.DeflectionFactors = ForceTupleConvertStrategy.Convert(deflectionFactor);
if (source.MaxDeflections is not ForceTupleDTO maxDeflections)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.MaxDeflections) + ": maximum deflections");
}
NewItem.MaxDeflections = ForceTupleConvertStrategy.Convert(maxDeflections);
return NewItem;
}
}
}