Add value diagram calculator saving

This commit is contained in:
Evgeny Redikultsev
2025-11-16 13:56:09 +05:00
parent 43f46b83af
commit f7e60e0bb3
30 changed files with 786 additions and 80 deletions

View File

@@ -4,12 +4,8 @@ using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Loggers;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
using StructureHelperLogics.NdmCalculations.Cracking;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
@@ -65,11 +61,26 @@ namespace DataAccess.DTOs
{
TraceLogger?.AddMessage($"Current version of StructureHelper does not suppurt saving interaction diagram calculator, {limitCalculator.Name} was ignored");
}
if (source is IValueDiagramCalculator valueDiagramCalculator)
{
return ProcessValueDiagramCalcualtor(valueDiagramCalculator);
}
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
throw new StructureHelperException(errorString);
}
private ValueDiagramCalculatorDTO ProcessValueDiagramCalcualtor(IValueDiagramCalculator valueDiagramCalculator)
{
var convertStrategy = new ValueDiagramCalculatorToDTOConvertStrategy()
{
ReferenceDictionary = ReferenceDictionary,
TraceLogger = TraceLogger
};
var dictionaryConvertStrategy = new DictionaryConvertStrategy<ValueDiagramCalculatorDTO, IValueDiagramCalculator>(this, convertStrategy);
return convertStrategy.Convert(valueDiagramCalculator);
}
private CrackCalculatorDTO ProcessCrackCalculator(ICrackCalculator crackCalculator)
{
crackCalculatorStrategy.ReferenceDictionary = ReferenceDictionary;

View File

@@ -3,6 +3,7 @@ using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
using StructureHelperLogics.NdmCalculations.Cracking;
using System;
using System.Collections.Generic;
@@ -39,11 +40,26 @@ namespace DataAccess.DTOs
ICrackCalculator calculator = GetCrackCalculator(crackCalculator);
return calculator;
}
if (source is ValueDiagramCalculatorDTO valueDiagramCalculator)
{
TraceLogger?.AddMessage($"{CalculatorIs} value digram calculator");
return GetValueDiagramCalculator(valueDiagramCalculator);
}
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
TraceLogger.AddMessage(errorString, TraceLogStatuses.Error);
throw new StructureHelperException(errorString);
}
private ValueDiagramCalculator GetValueDiagramCalculator(ValueDiagramCalculatorDTO valueDiagramCalculator)
{
var convertStrategy = new ValueDiagramCalcualtorFromDTOConvertStrategy()
{
ReferenceDictionary = ReferenceDictionary,
TraceLogger = TraceLogger,
};
return convertStrategy.Convert(valueDiagramCalculator);
}
private ICrackCalculator GetCrackCalculator(ICrackCalculator crackCalculator)
{
crackConvertStrategy.ReferenceDictionary = ReferenceDictionary;

View File

@@ -0,0 +1,47 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services;
namespace DataAccess.DTOs
{
public class Point2DRangeFromDTOConvertStrategy : ConvertStrategy<Point2DRange, Point2DRangeDTO>
{
private IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy;
public Point2DRangeFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override Point2DRange GetNewItem(Point2DRangeDTO source)
{
ChildClass = this;
CheckSourceObject(source);
NewItem = new(source.Id);
InitializeStrategies();
if (source.StartPoint is not Point2DDTO startPoint)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.StartPoint) + ": start point");
}
if (source.EndPoint is not Point2DDTO endPoint)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.StartPoint) + ": end point");
}
NewItem.StartPoint = pointConvertStrategy.Convert(startPoint);
NewItem.EndPoint = pointConvertStrategy.Convert(endPoint);
return NewItem;
}
private static void CheckSourceObject(Point2DRangeDTO source)
{
CheckObject.IsNull(source, ": point range source object");
CheckObject.IsNull(source.StartPoint + ": point range start point");
CheckObject.IsNull(source.EndPoint + ": point range end point");
}
private void InitializeStrategies()
{
pointConvertStrategy ??= new Point2DFromDTOConvertStrategy(this);
}
}
}

View File

@@ -0,0 +1,25 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
namespace DataAccess.DTOs
{
public class Point2DRangeToDTOConvertStrategy : ConvertStrategy<Point2DRangeDTO, IPoint2DRange>
{
private IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy = new Point2DToDTOConvertStrategy();
public Point2DRangeToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override Point2DRangeDTO GetNewItem(IPoint2DRange source)
{
ChildClass = this;
NewItem = new(source.Id)
{
StartPoint = pointConvertStrategy.Convert(source.StartPoint),
EndPoint = pointConvertStrategy.Convert(source.EndPoint)
};
return NewItem;
}
}
}

View File

@@ -0,0 +1,30 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
using System;
using System.Collections.Generic;
using System.Text;
namespace DataAccess.DTOs
{
public class ValueDiagramCalcualtorFromDTOConvertStrategy : ConvertStrategy<ValueDiagramCalculator, ValueDiagramCalculatorDTO>
{
private IUpdateStrategy<IValueDiagramCalculator> updateStrategy;
private IConvertStrategy<ValueDiagramCalculatorInputData, ValueDiagramCalculatorInputDataDTO> inputDataConvertStrategy;
public override ValueDiagramCalculator GetNewItem(ValueDiagramCalculatorDTO source)
{
ChildClass = this;
NewItem = new(source.Id);
InitializeStrategies();
updateStrategy.Update(NewItem, source);
NewItem.InputData = inputDataConvertStrategy.Convert(source.InputData as ValueDiagramCalculatorInputDataDTO);
return NewItem;
}
private void InitializeStrategies()
{
updateStrategy ??= new ValueDiagramCalculatorUpdateStrategy() { UpdateChildren = false };
inputDataConvertStrategy ??= new ValueDiagramCalculatorInputDataFromDTOConvertStrategy(this);
}
}
}

View File

@@ -0,0 +1,68 @@
using DataAccess.DTOs.Converters;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace DataAccess.DTOs
{
public class ValueDiagramCalculatorInputDataFromDTOConvertStrategy : ConvertStrategy<ValueDiagramCalculatorInputData, ValueDiagramCalculatorInputDataDTO>
{
private IUpdateStrategy<IValueDiagramCalculatorInputData> updateStrategy;
private IConvertStrategy<ValueDiagramEntity, ValueDiagramEntityDTO> diagramConvertStrategy;
private IHasPrimitivesProcessLogic primitivesProcessLogic;
private IHasForceActionsProcessLogic actionsProcessLogic;
private IConvertStrategy<Accuracy, AccuracyDTO> accuracyConvertStrategy;
public ValueDiagramCalculatorInputDataFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override ValueDiagramCalculatorInputData GetNewItem(ValueDiagramCalculatorInputDataDTO source)
{
ChildClass = this;
NewItem = new(source.Id);
InitializeStrategies();
updateStrategy.Update(NewItem, source);
ProcessPrimitives(source);
ProcessActions(source);
NewItem.Digrams.Clear();
foreach (var diagram in source.Digrams)
{
if (diagram is not ValueDiagramEntityDTO diagramDTO)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(diagram));
}
NewItem.Digrams.Add(diagramConvertStrategy.Convert(diagramDTO));
}
return NewItem;
}
private void ProcessPrimitives(IHasPrimitives source)
{
primitivesProcessLogic.Source = source;
primitivesProcessLogic.Target = NewItem;
primitivesProcessLogic.ReferenceDictionary = ReferenceDictionary;
primitivesProcessLogic.TraceLogger = TraceLogger;
primitivesProcessLogic.Process();
}
private void ProcessActions(IHasForceActions source)
{
actionsProcessLogic.Source = source;
actionsProcessLogic.Target = NewItem;
actionsProcessLogic.ReferenceDictionary = ReferenceDictionary;
actionsProcessLogic.TraceLogger = TraceLogger;
actionsProcessLogic.Process();
}
private void InitializeStrategies()
{
updateStrategy ??= new ValueDiagramCalculatorInputDataUpdateStrategy() { UpdateChildren = false };
diagramConvertStrategy ??= new ValueDiagramEntityFromDTOConvertStrategy(this);
primitivesProcessLogic ??= new HasPrimitivesProcessLogic(ConvertDirection.FromDTO) { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
actionsProcessLogic ??= new HasForceActionsProcessLogic(ConvertDirection.FromDTO) { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
accuracyConvertStrategy ??= new AccuracyFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
}
}
}

View File

@@ -0,0 +1,64 @@
using DataAccess.DTOs.Converters;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace DataAccess.DTOs
{
public class ValueDiagramCalculatorInputDataToDTOConvertStrategy : ConvertStrategy<ValueDiagramCalculatorInputDataDTO, IValueDiagramCalculatorInputData>
{
private IUpdateStrategy<IValueDiagramCalculatorInputData> updateStrategy;
private IConvertStrategy<ValueDiagramEntityDTO, IValueDiagramEntity> diagramConvertStrategy;
private IHasPrimitivesProcessLogic primitivesProcessLogic;
private IHasForceActionsProcessLogic actionsProcessLogic;
public ValueDiagramCalculatorInputDataToDTOConvertStrategy() : base()
{
}
public ValueDiagramCalculatorInputDataToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override ValueDiagramCalculatorInputDataDTO GetNewItem(IValueDiagramCalculatorInputData source)
{
ChildClass = this;
NewItem = new(source.Id);
InitializeStrategies();
updateStrategy.Update(NewItem, source);
ProcessPrimitives(source);
ProcessActions(source);
NewItem.Digrams.Clear();
foreach (var diagram in source.Digrams)
{
NewItem.Digrams.Add(diagramConvertStrategy.Convert(diagram));
}
return NewItem;
}
private void ProcessPrimitives(IHasPrimitives source)
{
primitivesProcessLogic.Source = source;
primitivesProcessLogic.Target = NewItem;
primitivesProcessLogic.ReferenceDictionary = ReferenceDictionary;
primitivesProcessLogic.TraceLogger = TraceLogger;
primitivesProcessLogic.Process();
}
private void ProcessActions(IHasForceActions source)
{
actionsProcessLogic.Source = source;
actionsProcessLogic.Target = NewItem;
actionsProcessLogic.ReferenceDictionary = ReferenceDictionary;
actionsProcessLogic.TraceLogger = TraceLogger;
actionsProcessLogic.Process();
}
private void InitializeStrategies()
{
updateStrategy ??= new ValueDiagramCalculatorInputDataUpdateStrategy() { UpdateChildren = false};
diagramConvertStrategy ??= new ValueDiagramEntityToDTOConvertStrategy(this);
primitivesProcessLogic ??= new HasPrimitivesProcessLogic(ConvertDirection.ToDTO) { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
actionsProcessLogic ??= new HasForceActionsProcessLogic(ConvertDirection.ToDTO) { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
}
}
}

View File

@@ -0,0 +1,31 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
namespace DataAccess.DTOs
{
internal class ValueDiagramCalculatorToDTOConvertStrategy : ConvertStrategy<ValueDiagramCalculatorDTO, IValueDiagramCalculator>
{
private IUpdateStrategy<IValueDiagramCalculator> updateStrategy;
private IConvertStrategy<ValueDiagramCalculatorInputDataDTO, IValueDiagramCalculatorInputData> inputDataConvertStrategy;
public override ValueDiagramCalculatorDTO GetNewItem(IValueDiagramCalculator source)
{
ChildClass = this;
NewItem = new(source.Id);
InitializeStrategies();
updateStrategy.Update(NewItem, source);
NewItem.InputData = inputDataConvertStrategy.Convert(source.InputData);
return NewItem;
}
private void InitializeStrategies()
{
updateStrategy ??= new ValueDiagramCalculatorUpdateStrategy()
{
UpdateChildren = false
};
inputDataConvertStrategy ??= new DictionaryConvertStrategy<ValueDiagramCalculatorInputDataDTO, IValueDiagramCalculatorInputData>(
this,
new ValueDiagramCalculatorInputDataToDTOConvertStrategy(this));
}
}
}

View File

@@ -0,0 +1,36 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
namespace DataAccess.DTOs
{
public class ValueDiagramEntityFromDTOConvertStrategy : ConvertStrategy<ValueDiagramEntity, ValueDiagramEntityDTO>
{
private IUpdateStrategy<IValueDiagramEntity> updateStrategy;
private IConvertStrategy<ValueDiagram, ValueDiagramDTO> diagramConvertStrategy;
public ValueDiagramEntityFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override ValueDiagramEntity GetNewItem(ValueDiagramEntityDTO source)
{
ChildClass = this;
NewItem = new(source.Id);
InitializeStrategies();
updateStrategy.Update(NewItem, source);
if (source.ValueDigram is not ValueDiagramDTO diagramDTO)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.ValueDigram));
}
NewItem.ValueDigram = diagramConvertStrategy.Convert(diagramDTO);
return NewItem;
}
private void InitializeStrategies()
{
updateStrategy ??= new ValueDiagramEntityUpdateStrategy() { UpdateChildren = false};
diagramConvertStrategy ??= new ValueDiagramFromDTOConvertStrategy(this);
}
}
}

View File

@@ -0,0 +1,31 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
namespace DataAccess.DTOs
{
public class ValueDiagramEntityToDTOConvertStrategy : ConvertStrategy<ValueDiagramEntityDTO, IValueDiagramEntity>
{
private IUpdateStrategy<IValueDiagramEntity> updateStrategy;
private IConvertStrategy<ValueDiagramDTO, IValueDiagram> diagramConvertStrategy;
public ValueDiagramEntityToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override ValueDiagramEntityDTO GetNewItem(IValueDiagramEntity source)
{
ChildClass = this;
NewItem = new(source.Id);
InitializeStrategies();
updateStrategy.Update(NewItem, source);
NewItem.ValueDigram = diagramConvertStrategy.Convert(source.ValueDigram);
return NewItem;
}
private void InitializeStrategies()
{
updateStrategy ??= new ValueDiagramEntityUpdateStrategy() { UpdateChildren = false };
diagramConvertStrategy ??= new ValueDiagramToDTOConvertStrategy(this);
}
}
}

View File

@@ -0,0 +1,37 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
namespace DataAccess.DTOs
{
public class ValueDiagramFromDTOConvertStrategy : ConvertStrategy<ValueDiagram, ValueDiagramDTO>
{
private IUpdateStrategy<IValueDiagram> updateStrategy;
private IConvertStrategy<Point2DRange, Point2DRangeDTO> pointConvertStrategy;
public ValueDiagramFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override ValueDiagram GetNewItem(ValueDiagramDTO source)
{
ChildClass = this;
NewItem = new(source.Id);
InitializeStrategies();
updateStrategy.Update(NewItem, source);
if (source.Point2DRange is not Point2DRangeDTO point2DRangeDTO)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.Point2DRange));
}
NewItem.Point2DRange = pointConvertStrategy.Convert(point2DRangeDTO);
return NewItem;
}
private void InitializeStrategies()
{
updateStrategy ??= new ValueDiagramUpdateStrategy() { UpdateChildren = false };
pointConvertStrategy ??= new Point2DRangeFromDTOConvertStrategy(this);
}
}
}

View File

@@ -0,0 +1,32 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
namespace DataAccess.DTOs
{
public class ValueDiagramToDTOConvertStrategy : ConvertStrategy<ValueDiagramDTO, IValueDiagram>
{
private IUpdateStrategy<IValueDiagram> updateStrategy;
private IConvertStrategy<Point2DRangeDTO, IPoint2DRange> pointConvertStrategy;
public ValueDiagramToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override ValueDiagramDTO GetNewItem(IValueDiagram source)
{
ChildClass = this;
NewItem = new(source.Id);
InitializeStrategies();
updateStrategy.Update(NewItem, source);
NewItem.Point2DRange = pointConvertStrategy.Convert(source.Point2DRange);
return NewItem;
}
private void InitializeStrategies()
{
updateStrategy ??= new ValueDiagramUpdateStrategy() { UpdateChildren = false };
pointConvertStrategy ??= new Point2DRangeToDTOConvertStrategy(this);
}
}
}

View File

@@ -0,0 +1,26 @@
using Newtonsoft.Json;
using StructureHelperCommon.Models.Shapes;
namespace DataAccess.DTOs
{
public class Point2DRangeDTO : IPoint2DRange
{
[JsonProperty("Id")]
public Guid Id { get; }
[JsonProperty("StartPoint")]
public IPoint2D StartPoint { get; set; }
[JsonProperty("EndPoint")]
public IPoint2D EndPoint { get; set; }
public Point2DRangeDTO(Guid id)
{
Id = id;
}
public object Clone()
{
return this;
}
}
}

View File

@@ -0,0 +1,11 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.States;
namespace DataAccess.DTOs
{
public class StateCalcTermPairDTO : IStateCalcTermPair
{
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
}
}

View File

@@ -7,6 +7,7 @@ using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.BeamShears;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace DataAccess.DTOs
@@ -45,6 +46,7 @@ namespace DataAccess.DTOs
{ (typeof(List<LimitStates>), "ListOfLimitState") },
{ (typeof(List<IPartialFactor>), "ListOfPartialFactor") },
{ (typeof(RebarSectionDTO), "RebarSection") },
{ (typeof(StateCalcTermPairDTO), "StateCalcTermPair") },
{ (typeof(VisualPropertyDTO), "VisualProperty") },
{ (typeof(WorkPlanePropertyDTO), "WorkPlanePropertyDTO") },
};
@@ -55,6 +57,20 @@ namespace DataAccess.DTOs
newList.AddRange(GetCalculatorList());
newList.AddRange(GetNdmPrimitiveList());
newList.AddRange(GetBeamShearList());
newList.AddRange(GetValueDiagramList());
return newList;
}
private static IEnumerable<(Type type, string name)> GetValueDiagramList()
{
List<(Type type, string name)> newList = new()
{
{ (typeof(List<IValueDiagramEntity>), "ListOfValueDiagramEntity") },
{ (typeof(ValueDiagramCalculatorDTO), "ValueDiagramCalculator") },
{ (typeof(ValueDiagramCalculatorInputDataDTO), "ValueDiagramCalculatorInputData") },
{ (typeof(ValueDiagramEntityDTO), "ValueDiagramEntity") },
{ (typeof(ValueDiagramDTO), "ValueDiagram") },
};
return newList;
}
@@ -131,6 +147,7 @@ namespace DataAccess.DTOs
{
{ (typeof(List<IVertex>), "ListOfVertex2D") },
{ (typeof(Point2DDTO), "Point2D") },
{ (typeof(Point2DRangeDTO), "Point2DRange") },
{ (typeof(VertexDTO), "Vertex2D") },
{ (typeof(RectangleShapeDTO), "RectangleShape") },
{ (typeof(CircleShapeDTO), "CircleShape") },

View File

@@ -0,0 +1,39 @@
using Newtonsoft.Json;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
namespace DataAccess.DTOs
{
public class ValueDiagramCalculatorDTO : IValueDiagramCalculator
{
[JsonProperty("Id")]
public Guid Id { get; }
[JsonProperty("Name")]
public string Name { get; set; }
[JsonProperty("InputData")]
public IValueDiagramCalculatorInputData InputData { get; set; }
[JsonProperty("ShowTraceData")]
public bool ShowTraceData { get; set; }
[JsonIgnore]
public IResult Result => throw new NotImplementedException();
[JsonIgnore]
public IShiftTraceLogger? TraceLogger { get; set; }
public ValueDiagramCalculatorDTO(Guid id)
{
Id = id;
}
public object Clone()
{
return this;
}
public void Run()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,32 @@
using Newtonsoft.Json;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.States;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace DataAccess.DTOs
{
public class ValueDiagramCalculatorInputDataDTO : IValueDiagramCalculatorInputData
{
[JsonProperty("Id")]
public Guid Id { get; }
[JsonProperty("StateTermPair")]
public IStateCalcTermPair StateTermPair { get; set; } = new StateCalcTermPairDTO();
[JsonProperty("Diagrams")]
public List<IValueDiagramEntity> Digrams { get; } = [];
[JsonProperty("CheckStrainLimits")]
public bool CheckStrainLimit { get; set; } = true;
[JsonProperty("ForceActions")]
public List<IForceAction> ForceActions { get; } = [];
[JsonProperty("Primitives")]
public List<INdmPrimitive> Primitives { get; } = [];
public ValueDiagramCalculatorInputDataDTO(Guid id)
{
Id = id;
}
}
}

View File

@@ -0,0 +1,26 @@
using Newtonsoft.Json;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
namespace DataAccess.DTOs
{
public class ValueDiagramDTO : IValueDiagram
{
[JsonProperty("Id")]
public Guid Id { get; }
[JsonProperty("Point2DRange")]
public IPoint2DRange Point2DRange { get; set; }
[JsonProperty("StepNumber")]
public int StepNumber { get; set; }
public ValueDiagramDTO(Guid id)
{
Id = id;
}
public object Clone()
{
return this;
}
}
}

View File

@@ -0,0 +1,28 @@
using Newtonsoft.Json;
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
namespace DataAccess.DTOs
{
public class ValueDiagramEntityDTO : IValueDiagramEntity
{
[JsonProperty("Id")]
public Guid Id { get; }
[JsonProperty("Name")]
public string Name { get; set; }
[JsonProperty("IsTaken")]
public bool IsTaken { get; set; }
[JsonProperty("ValueDiagram")]
public IValueDiagram ValueDigram { get; set; }
public ValueDiagramEntityDTO(Guid id)
{
Id = id;
}
public object Clone()
{
return this;
}
}
}