Add calculators saving
This commit is contained in:
85
DataAccess/DTOs/Converters/CalculatorToDTOConvertStrategy.cs
Normal file
85
DataAccess/DTOs/Converters/CalculatorToDTOConvertStrategy.cs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class CalculatorToDTOConvertStrategy : IConvertStrategy<ICalculator, ICalculator>
|
||||||
|
{
|
||||||
|
private readonly IConvertStrategy<ForceCalculatorDTO, IForceCalculator> forceCalculatorStrategy;
|
||||||
|
private readonly IConvertStrategy<CrackCalculatorDTO, ICrackCalculator> crackCalculatorStrategy;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
public CalculatorToDTOConvertStrategy(
|
||||||
|
IConvertStrategy<ForceCalculatorDTO, IForceCalculator> forceCalculatorStrategy,
|
||||||
|
IConvertStrategy<CrackCalculatorDTO, ICrackCalculator> crackCalculatorStrategy)
|
||||||
|
{
|
||||||
|
this.forceCalculatorStrategy = forceCalculatorStrategy;
|
||||||
|
this.crackCalculatorStrategy = crackCalculatorStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CalculatorToDTOConvertStrategy() : this (
|
||||||
|
new ForceCalculatorToDTOConvertStrategy(),
|
||||||
|
new CrackCalculatorToDTOConvertStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICalculator Convert(ICalculator source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ProcessCalculators(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICalculator ProcessCalculators(ICalculator source)
|
||||||
|
{
|
||||||
|
if (source is IForceCalculator forceCalculator)
|
||||||
|
{
|
||||||
|
return ProcessForceCalculator(forceCalculator);
|
||||||
|
}
|
||||||
|
if (source is ICrackCalculator crackCalculator)
|
||||||
|
{
|
||||||
|
return ProcessCrackCalculator(crackCalculator);
|
||||||
|
}
|
||||||
|
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||||
|
TraceLogger.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
throw new StructureHelperException(errorString);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CrackCalculatorDTO ProcessCrackCalculator(ICrackCalculator crackCalculator)
|
||||||
|
{
|
||||||
|
crackCalculatorStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
crackCalculatorStrategy.TraceLogger = TraceLogger;
|
||||||
|
var logic = new DictionaryConvertStrategy<CrackCalculatorDTO, ICrackCalculator>(this, crackCalculatorStrategy);
|
||||||
|
return logic.Convert(crackCalculator);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ForceCalculatorDTO ProcessForceCalculator(IForceCalculator forceCalculator)
|
||||||
|
{
|
||||||
|
forceCalculatorStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
forceCalculatorStrategy.TraceLogger = TraceLogger;
|
||||||
|
var logic = new DictionaryConvertStrategy<ForceCalculatorDTO, IForceCalculator>(this, forceCalculatorStrategy);
|
||||||
|
return logic.Convert(forceCalculator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
using DataAccess.DTOs.Converters;
|
||||||
|
using DataAccess.DTOs.DTOEntities;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class CrackCalculatorToDTOConvertStrategy : IConvertStrategy<CrackCalculatorDTO, ICrackCalculator>
|
||||||
|
{
|
||||||
|
private readonly IUpdateStrategy<ICrackCalculator> updateStrategy;
|
||||||
|
|
||||||
|
public CrackCalculatorToDTOConvertStrategy(IUpdateStrategy<ICrackCalculator> updateStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrackCalculatorToDTOConvertStrategy() : this (new CrackCalculatorUpdateStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public CrackCalculatorDTO Convert(ICrackCalculator source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
return GetNewItem(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CrackCalculatorDTO GetNewItem(ICrackCalculator source)
|
||||||
|
{
|
||||||
|
CrackCalculatorDTO newItem = new() { Id = source.Id};
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
ProcessForceActions(newItem.InputData, source.InputData);
|
||||||
|
ProcessPrimitives(newItem.InputData, source.InputData);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessPrimitives(IHasPrimitives target, IHasPrimitives source)
|
||||||
|
{
|
||||||
|
HasPrimitivesToDTOUpdateStrategy updateStrategy = new()
|
||||||
|
{
|
||||||
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
updateStrategy.Update(target, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessForceActions(IHasForceCombinations target, IHasForceCombinations source)
|
||||||
|
{
|
||||||
|
HasForceActionToDTOUpdateStrategy updateStrategy = new()
|
||||||
|
{
|
||||||
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
updateStrategy.Update(target, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<CrackCalculatorDTO, ICrackCalculator>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
using DataAccess.DTOs.Converters;
|
using DataAccess.DTOs.Converters;
|
||||||
|
using NLog.Targets;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Analyses;
|
using StructureHelperCommon.Models.Analyses;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
@@ -20,23 +22,15 @@ namespace DataAccess.DTOs
|
|||||||
public class CrossSectionRepositoryToDTOConvertStrategy : IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository>
|
public class CrossSectionRepositoryToDTOConvertStrategy : IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository>
|
||||||
{
|
{
|
||||||
private IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy;
|
private IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy;
|
||||||
private IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor> forceCombinationByFactorConvertStrategy;
|
|
||||||
private IConvertStrategy<ForceCombinationListDTO, IForceCombinationList> forceCombinationListConvertStrategy;
|
|
||||||
private IConvertStrategy<EllipseNdmPrimitiveDTO, IEllipsePrimitive> ellipseConvertStrategy = new EllipsePrimitiveDTOConvertStrategy();
|
|
||||||
|
|
||||||
public CrossSectionRepositoryToDTOConvertStrategy(IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy,
|
|
||||||
IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor> forceCombinationByFactorConvertStrategy,
|
public CrossSectionRepositoryToDTOConvertStrategy(IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy)
|
||||||
IConvertStrategy<ForceCombinationListDTO, IForceCombinationList> forceCombinationListConvertStrategy)
|
|
||||||
{
|
{
|
||||||
this.materialConvertStrategy = materialConvertStrategy;
|
this.materialConvertStrategy = materialConvertStrategy;
|
||||||
this.forceCombinationByFactorConvertStrategy = forceCombinationByFactorConvertStrategy;
|
|
||||||
this.forceCombinationListConvertStrategy = forceCombinationListConvertStrategy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrossSectionRepositoryToDTOConvertStrategy() : this(
|
public CrossSectionRepositoryToDTOConvertStrategy() : this(
|
||||||
new HeadMaterialToDTOConvertStrategy(),
|
new HeadMaterialToDTOConvertStrategy())
|
||||||
new ForceCombinationByFactorToDTOConvertStrategy(),
|
|
||||||
new ForceCombinationListToDTOConvertStrategy())
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -54,11 +48,10 @@ namespace DataAccess.DTOs
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CrossSectionRepositoryDTO GetNewRepository(ICrossSectionRepository source)
|
private CrossSectionRepositoryDTO GetNewRepository(ICrossSectionRepository source)
|
||||||
@@ -67,71 +60,42 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
Id = source.Id
|
Id = source.Id
|
||||||
};
|
};
|
||||||
List<IForceAction> forceActions = ProcessForceActions(source);
|
ProcessForceActions(newItem, source);
|
||||||
newItem.ForceActions.AddRange(forceActions);
|
|
||||||
List<IHeadMaterial> materials = ProcessMaterials(source);
|
List<IHeadMaterial> materials = ProcessMaterials(source);
|
||||||
newItem.HeadMaterials.AddRange(materials);
|
newItem.HeadMaterials.AddRange(materials);
|
||||||
List<INdmPrimitive> primitives = ProcessPrimitives(source);
|
ProcessPrimitives(newItem, source);
|
||||||
newItem.Primitives.AddRange(primitives);
|
ProcessCalculators(newItem, source);
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<INdmPrimitive> ProcessPrimitives(ICrossSectionRepository source)
|
private void ProcessCalculators(IHasCalculators target, IHasCalculators source)
|
||||||
{
|
{
|
||||||
List<INdmPrimitive> primitives = new();
|
HasCalculatorsToDTOUpdateStrategy updateStrategy = new()
|
||||||
foreach (var item in source.Primitives)
|
|
||||||
{
|
{
|
||||||
if (item is IEllipsePrimitive ellipse)
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
{
|
TraceLogger = TraceLogger
|
||||||
ellipseConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
};
|
||||||
ellipseConvertStrategy.TraceLogger = TraceLogger;
|
updateStrategy.Update(target, source);
|
||||||
INdmPrimitive ndmPrimitive;
|
|
||||||
ndmPrimitive = ellipseConvertStrategy.Convert(ellipse);
|
|
||||||
primitives.Add(ndmPrimitive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return primitives;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<IForceAction> ProcessForceActions(ICrossSectionRepository source)
|
private void ProcessPrimitives(IHasPrimitives target, IHasPrimitives source)
|
||||||
{
|
{
|
||||||
List<IForceAction> forceActions = new();
|
HasPrimitivesToDTOUpdateStrategy updateStrategy = new()
|
||||||
foreach (var item in source.ForceActions)
|
|
||||||
{
|
{
|
||||||
if (item is IForceCombinationByFactor forceCombinationByFactor)
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
{
|
TraceLogger = TraceLogger
|
||||||
ForceCombinationByFactorDTO forceCombination = GetForceCombinationByFactor(forceCombinationByFactor);
|
};
|
||||||
forceActions.Add(forceCombination);
|
updateStrategy.Update(target, source);
|
||||||
}
|
|
||||||
else if (item is IForceCombinationList forceCombinationList)
|
|
||||||
{
|
|
||||||
ForceCombinationListDTO forceCombination = GetForceCombinationList(forceCombinationList);
|
|
||||||
forceActions.Add(forceCombination);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(item));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return forceActions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ForceCombinationListDTO GetForceCombinationList(IForceCombinationList forceCombinationList)
|
private void ProcessForceActions(IHasForceCombinations target, IHasForceCombinations source)
|
||||||
{
|
{
|
||||||
forceCombinationListConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
HasForceActionToDTOUpdateStrategy updateStrategy = new()
|
||||||
forceCombinationListConvertStrategy.TraceLogger = TraceLogger;
|
|
||||||
var convertLogic = new DictionaryConvertStrategy<ForceCombinationListDTO, IForceCombinationList>(this, forceCombinationListConvertStrategy);
|
|
||||||
var forceCombination = convertLogic.Convert(forceCombinationList);
|
|
||||||
return forceCombination;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ForceCombinationByFactorDTO GetForceCombinationByFactor(IForceCombinationByFactor forceCombinationByFactor)
|
|
||||||
{
|
{
|
||||||
forceCombinationByFactorConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
forceCombinationByFactorConvertStrategy.TraceLogger = TraceLogger;
|
TraceLogger = TraceLogger
|
||||||
var convertLogic = new DictionaryConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor>(this, forceCombinationByFactorConvertStrategy);
|
};
|
||||||
var forceCombination = convertLogic.Convert(forceCombinationByFactor);
|
updateStrategy.Update(target, source);
|
||||||
return forceCombination;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<IHeadMaterial> ProcessMaterials(ICrossSectionRepository source)
|
private List<IHeadMaterial> ProcessMaterials(ICrossSectionRepository source)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace DataAccess.DTOs.Converters
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,17 +12,17 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class EllipsePrimitiveDTOConvertStrategy : IConvertStrategy<EllipseNdmPrimitiveDTO, IEllipsePrimitive>
|
public class EllipseNdmPrimitiveToDTOConvertStrategy : IConvertStrategy<EllipseNdmPrimitiveDTO, IEllipseNdmPrimitive>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<IEllipsePrimitive> updateStrategy;
|
private IUpdateStrategy<IEllipseNdmPrimitive> updateStrategy;
|
||||||
private IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleShapeConvertStrategy;
|
private IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleShapeConvertStrategy;
|
||||||
private IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy;
|
private IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy;
|
||||||
private IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy;
|
private IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy;
|
||||||
private IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy;
|
private IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy;
|
||||||
private IConvertStrategy<DivisionSizeDTO, IDivisionSize> divisionConvertStrategy;
|
private IConvertStrategy<DivisionSizeDTO, IDivisionSize> divisionConvertStrategy;
|
||||||
|
|
||||||
public EllipsePrimitiveDTOConvertStrategy(
|
public EllipseNdmPrimitiveToDTOConvertStrategy(
|
||||||
IUpdateStrategy<IEllipsePrimitive> updateStrategy,
|
IUpdateStrategy<IEllipseNdmPrimitive> updateStrategy,
|
||||||
IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleShapeConvertStrategy,
|
IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleShapeConvertStrategy,
|
||||||
IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy,
|
IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy,
|
||||||
IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy,
|
IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy,
|
||||||
@@ -37,7 +37,7 @@ namespace DataAccess.DTOs
|
|||||||
this.divisionConvertStrategy = divisionConvertStrategy;
|
this.divisionConvertStrategy = divisionConvertStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EllipsePrimitiveDTOConvertStrategy() : this(
|
public EllipseNdmPrimitiveToDTOConvertStrategy() : this(
|
||||||
new EllipsePrimitiveUpdateStrategy(),
|
new EllipsePrimitiveUpdateStrategy(),
|
||||||
new RectangleShapeToDTOConvertStrategy(),
|
new RectangleShapeToDTOConvertStrategy(),
|
||||||
new NdmElementDTOConvertStrategy(),
|
new NdmElementDTOConvertStrategy(),
|
||||||
@@ -52,13 +52,13 @@ namespace DataAccess.DTOs
|
|||||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
public IShiftTraceLogger TraceLogger { get; set; }
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
public EllipseNdmPrimitiveDTO Convert(IEllipsePrimitive source)
|
public EllipseNdmPrimitiveDTO Convert(IEllipseNdmPrimitive source)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Check();
|
Check();
|
||||||
PrepareStrategies();
|
PrepareStrategies();
|
||||||
return GetNewEllipsePrimitive(source);
|
return GetNewPrimitive(source);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ namespace DataAccess.DTOs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private EllipseNdmPrimitiveDTO GetNewEllipsePrimitive(IEllipsePrimitive source)
|
private EllipseNdmPrimitiveDTO GetNewPrimitive(IEllipseNdmPrimitive source)
|
||||||
{
|
{
|
||||||
EllipseNdmPrimitiveDTO newItem = new() { Id = source.Id };
|
EllipseNdmPrimitiveDTO newItem = new() { Id = source.Id };
|
||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(newItem, source);
|
||||||
@@ -98,7 +98,7 @@ namespace DataAccess.DTOs
|
|||||||
|
|
||||||
private void Check()
|
private void Check()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<EllipseNdmPrimitiveDTO, IEllipsePrimitive>(this);
|
var checkLogic = new CheckConvertLogic<EllipseNdmPrimitiveDTO, IEllipseNdmPrimitive>(this);
|
||||||
checkLogic.Check();
|
checkLogic.Check();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class ForceActionToDTOConvertStrategy : IConvertStrategy<IForceAction, IForceAction>
|
||||||
|
{
|
||||||
|
private IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor> forceCombinationByFactorConvertStrategy;
|
||||||
|
private IConvertStrategy<ForceCombinationListDTO, IForceCombinationList> forceCombinationListConvertStrategy;
|
||||||
|
|
||||||
|
public ForceActionToDTOConvertStrategy(
|
||||||
|
IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor> forceCombinationByFactorConvertStrategy,
|
||||||
|
IConvertStrategy<ForceCombinationListDTO, IForceCombinationList> forceCombinationListConvertStrategy)
|
||||||
|
{
|
||||||
|
this.forceCombinationByFactorConvertStrategy = forceCombinationByFactorConvertStrategy;
|
||||||
|
this.forceCombinationListConvertStrategy = forceCombinationListConvertStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceActionToDTOConvertStrategy() : this(
|
||||||
|
new ForceCombinationByFactorToDTOConvertStrategy(),
|
||||||
|
new ForceCombinationListToDTOConvertStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public IForceAction Convert(IForceAction source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ProcessForceAction(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IForceAction ProcessForceAction(IForceAction source)
|
||||||
|
{
|
||||||
|
if (source is IForceCombinationByFactor forceCombinationByFactor)
|
||||||
|
{
|
||||||
|
return GetForceCombinationByFactor(forceCombinationByFactor);
|
||||||
|
}
|
||||||
|
else if (source is IForceCombinationList forceCombinationList)
|
||||||
|
{
|
||||||
|
return GetForceCombinationList(forceCombinationList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||||
|
TraceLogger.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
throw new StructureHelperException(errorString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ForceCombinationListDTO GetForceCombinationList(IForceCombinationList forceCombinationList)
|
||||||
|
{
|
||||||
|
forceCombinationListConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
forceCombinationListConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<ForceCombinationListDTO, IForceCombinationList>(this, forceCombinationListConvertStrategy);
|
||||||
|
var forceCombination = convertLogic.Convert(forceCombinationList);
|
||||||
|
return forceCombination;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ForceCombinationByFactorDTO GetForceCombinationByFactor(IForceCombinationByFactor forceCombinationByFactor)
|
||||||
|
{
|
||||||
|
forceCombinationByFactorConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
forceCombinationByFactorConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor>(this, forceCombinationByFactorConvertStrategy);
|
||||||
|
var forceCombination = convertLogic.Convert(forceCombinationByFactor);
|
||||||
|
return forceCombination;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
using DataAccess.DTOs.Converters;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ForceCalculatorToDTOConvertStrategy : IConvertStrategy<ForceCalculatorDTO, IForceCalculator>
|
||||||
|
{
|
||||||
|
private readonly IUpdateStrategy<IForceCalculator> updateStrategy;
|
||||||
|
|
||||||
|
public ForceCalculatorToDTOConvertStrategy(IUpdateStrategy<IForceCalculator> updateStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCalculatorToDTOConvertStrategy() : this (
|
||||||
|
new ForceCalculatorUpdateStrategy()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public ForceCalculatorDTO Convert(IForceCalculator source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
return GetNewItem(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ForceCalculatorDTO GetNewItem(IForceCalculator source)
|
||||||
|
{
|
||||||
|
ForceCalculatorDTO newItem = new() { Id = source.Id};
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
ProcessForceActions(newItem.InputData, source.InputData);
|
||||||
|
ProcessPrimitives(newItem.InputData, source.InputData);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessPrimitives(IHasPrimitives target, IHasPrimitives source)
|
||||||
|
{
|
||||||
|
HasPrimitivesToDTOUpdateStrategy updateStrategy = new()
|
||||||
|
{
|
||||||
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
updateStrategy.Update(target, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessForceActions(IHasForceCombinations target, IHasForceCombinations source)
|
||||||
|
{
|
||||||
|
HasForceActionToDTOUpdateStrategy updateStrategy = new()
|
||||||
|
{
|
||||||
|
ReferenceDictionary = ReferenceDictionary,
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
updateStrategy.Update(target, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<ForceCalculatorDTO, IForceCalculator>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,7 +54,7 @@ namespace DataAccess.DTOs.Converters
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -15,18 +17,26 @@ namespace DataAccess.DTOs.Converters
|
|||||||
{
|
{
|
||||||
private IUpdateStrategy<IForceCombinationList> updateStrategy;
|
private IUpdateStrategy<IForceCombinationList> updateStrategy;
|
||||||
private IConvertStrategy<DesignForceTupleDTO, IDesignForceTuple> convertStrategy;
|
private IConvertStrategy<DesignForceTupleDTO, IDesignForceTuple> convertStrategy;
|
||||||
|
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
|
||||||
|
private IConvertStrategy<Point2DDTO, IPoint2D> pointUpdateStrategy;
|
||||||
|
|
||||||
public ForceCombinationListToDTOConvertStrategy(
|
public ForceCombinationListToDTOConvertStrategy(
|
||||||
IUpdateStrategy<IForceCombinationList> updateStrategy,
|
IUpdateStrategy<IForceCombinationList> updateStrategy,
|
||||||
IConvertStrategy<DesignForceTupleDTO, IDesignForceTuple> convertStrategy)
|
IConvertStrategy<DesignForceTupleDTO, IDesignForceTuple> convertStrategy,
|
||||||
|
IUpdateStrategy<IForceAction> baseUpdateStrategy,
|
||||||
|
IConvertStrategy<Point2DDTO, IPoint2D> pointUpdateStrategy)
|
||||||
{
|
{
|
||||||
this.updateStrategy = updateStrategy;
|
this.updateStrategy = updateStrategy;
|
||||||
this.convertStrategy = convertStrategy;
|
this.convertStrategy = convertStrategy;
|
||||||
|
this.baseUpdateStrategy = baseUpdateStrategy;
|
||||||
|
this.pointUpdateStrategy = pointUpdateStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForceCombinationListToDTOConvertStrategy() : this (
|
public ForceCombinationListToDTOConvertStrategy() : this (
|
||||||
new ForceCombinationListUpdateStrategy(),
|
new ForceCombinationListUpdateStrategy(),
|
||||||
new DesignForceTupleToDTOConvertStrategy())
|
new DesignForceTupleToDTOConvertStrategy(),
|
||||||
|
new ForceActionBaseUpdateStrategy(),
|
||||||
|
new Point2DToDTOConvertStrategy())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -44,7 +54,7 @@ namespace DataAccess.DTOs.Converters
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@@ -54,10 +64,12 @@ namespace DataAccess.DTOs.Converters
|
|||||||
{
|
{
|
||||||
|
|
||||||
ForceCombinationListDTO newItem = new() { Id = source.Id};
|
ForceCombinationListDTO newItem = new() { Id = source.Id};
|
||||||
|
baseUpdateStrategy.Update(newItem, source);
|
||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(newItem, source);
|
||||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
convertStrategy.TraceLogger = TraceLogger;
|
convertStrategy.TraceLogger = TraceLogger;
|
||||||
var convertLogic = new DictionaryConvertStrategy<DesignForceTupleDTO, IDesignForceTuple>(this, convertStrategy);
|
var convertLogic = new DictionaryConvertStrategy<DesignForceTupleDTO, IDesignForceTuple>(this, convertStrategy);
|
||||||
|
GetNewForcePoint(newItem, source);
|
||||||
newItem.DesignForces.Clear();
|
newItem.DesignForces.Clear();
|
||||||
foreach (var item in source.DesignForces)
|
foreach (var item in source.DesignForces)
|
||||||
{
|
{
|
||||||
@@ -66,6 +78,17 @@ namespace DataAccess.DTOs.Converters
|
|||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GetNewForcePoint(ForceCombinationListDTO newItem, IForceCombinationList source)
|
||||||
|
{
|
||||||
|
if (source.ForcePoint is not null)
|
||||||
|
{
|
||||||
|
pointUpdateStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
pointUpdateStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<Point2DDTO, IPoint2D>(this, pointUpdateStrategy);
|
||||||
|
newItem.ForcePoint = convertLogic.Convert(source.ForcePoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Check()
|
private void Check()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<ForceCombinationListDTO, IForceCombinationList>(this);
|
var checkLogic = new CheckConvertLogic<ForceCombinationListDTO, IForceCombinationList>(this);
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class HasCalculatorsToDTOUpdateStrategy : IUpdateStrategy<IHasCalculators>
|
||||||
|
{
|
||||||
|
private IConvertStrategy<ICalculator, ICalculator> convertStrategy;
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public HasCalculatorsToDTOUpdateStrategy(IConvertStrategy<ICalculator, ICalculator> convertStrategy)
|
||||||
|
{
|
||||||
|
this.convertStrategy = convertStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HasCalculatorsToDTOUpdateStrategy() : this(new CalculatorToDTOConvertStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(IHasCalculators targetObject, IHasCalculators sourceObject)
|
||||||
|
{
|
||||||
|
if (sourceObject.Calculators is null)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ParameterIsNull);
|
||||||
|
}
|
||||||
|
targetObject.Calculators.Clear();
|
||||||
|
ProcessCalculators(targetObject, sourceObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessCalculators(IHasCalculators targetObject, IHasCalculators sourceObject)
|
||||||
|
{
|
||||||
|
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
convertStrategy.TraceLogger = TraceLogger;
|
||||||
|
foreach (var item in sourceObject.Calculators)
|
||||||
|
{
|
||||||
|
ICalculator newItem = convertStrategy.Convert(item);
|
||||||
|
targetObject.Calculators.Add(newItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using DataAccess.DTOs.Converters;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class HasForceActionToDTOUpdateStrategy : IUpdateStrategy<IHasForceCombinations>
|
||||||
|
{
|
||||||
|
private readonly IConvertStrategy<IForceAction, IForceAction> forceActionStrategy;
|
||||||
|
|
||||||
|
public HasForceActionToDTOUpdateStrategy(IConvertStrategy<IForceAction, IForceAction> forceActionStrategy)
|
||||||
|
{
|
||||||
|
this.forceActionStrategy = forceActionStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HasForceActionToDTOUpdateStrategy() : this (new ForceActionToDTOConvertStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public void Update(IHasForceCombinations targetObject, IHasForceCombinations sourceObject)
|
||||||
|
{
|
||||||
|
if (sourceObject.ForceActions is null)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ParameterIsNull);
|
||||||
|
}
|
||||||
|
targetObject.ForceActions.Clear();
|
||||||
|
targetObject.ForceActions.AddRange(ProcessForceActions(sourceObject.ForceActions));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<IForceAction> ProcessForceActions(List<IForceAction> source)
|
||||||
|
{
|
||||||
|
List<IForceAction> forceActions = new();
|
||||||
|
forceActionStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
forceActionStrategy.TraceLogger = TraceLogger;
|
||||||
|
foreach (var item in source)
|
||||||
|
{
|
||||||
|
forceActions.Add(forceActionStrategy.Convert(item));
|
||||||
|
}
|
||||||
|
return forceActions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class HasPrimitivesToDTOUpdateStrategy : IUpdateStrategy<IHasPrimitives>
|
||||||
|
{
|
||||||
|
private IConvertStrategy<INdmPrimitive, INdmPrimitive> convertStrategy;
|
||||||
|
|
||||||
|
public HasPrimitivesToDTOUpdateStrategy(IConvertStrategy<INdmPrimitive, INdmPrimitive> primitiveConvertStrategy)
|
||||||
|
{
|
||||||
|
this.convertStrategy = primitiveConvertStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HasPrimitivesToDTOUpdateStrategy() : this(new NdmPrimitiveToDTOConvertStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public void Update(IHasPrimitives targetObject, IHasPrimitives sourceObject)
|
||||||
|
{
|
||||||
|
if (sourceObject.Primitives is null)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ParameterIsNull);
|
||||||
|
}
|
||||||
|
targetObject.Primitives.Clear();
|
||||||
|
ProcessPrimitives(targetObject, sourceObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessPrimitives(IHasPrimitives targetObject, IHasPrimitives sourceObject)
|
||||||
|
{
|
||||||
|
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
convertStrategy.TraceLogger = TraceLogger;
|
||||||
|
foreach (var item in sourceObject.Primitives)
|
||||||
|
{
|
||||||
|
INdmPrimitive primtiveDTO = convertStrategy.Convert(item);
|
||||||
|
targetObject.Primitives.Add(primtiveDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -58,7 +58,9 @@ namespace DataAccess.DTOs
|
|||||||
var headMaterial = convertLogic.Convert(source.HeadMaterial);
|
var headMaterial = convertLogic.Convert(source.HeadMaterial);
|
||||||
newItem.HeadMaterial = headMaterial;
|
newItem.HeadMaterial = headMaterial;
|
||||||
forceUpdateStrategy.Update(newItem.UsersPrestrain, source.UsersPrestrain);
|
forceUpdateStrategy.Update(newItem.UsersPrestrain, source.UsersPrestrain);
|
||||||
|
(newItem.UsersPrestrain as ForceTupleDTO).Id = source.UsersPrestrain.Id;
|
||||||
forceUpdateStrategy.Update(newItem.AutoPrestrain, source.AutoPrestrain);
|
forceUpdateStrategy.Update(newItem.AutoPrestrain, source.AutoPrestrain);
|
||||||
|
(newItem.AutoPrestrain as ForceTupleDTO).Id = source.AutoPrestrain.Id;
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
using DataAccess.DTOs.DTOEntities;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class NdmPrimitiveToDTOConvertStrategy : IConvertStrategy<INdmPrimitive, INdmPrimitive>
|
||||||
|
{
|
||||||
|
private readonly IConvertStrategy<RebarNdmPrimitiveDTO, IRebarNdmPrimitive> rebarConvertStrategy;
|
||||||
|
private readonly IConvertStrategy<PointNdmPrimitiveDTO, IPointNdmPrimitive> pointConvertStrategy;
|
||||||
|
private readonly IConvertStrategy<EllipseNdmPrimitiveDTO, IEllipseNdmPrimitive> ellipseConvertStrategy;
|
||||||
|
private readonly IConvertStrategy<RectangleNdmPrimitiveDTO, IRectangleNdmPrimitive> rectangleConvertStrategy;
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public NdmPrimitiveToDTOConvertStrategy(
|
||||||
|
IConvertStrategy<RebarNdmPrimitiveDTO,IRebarNdmPrimitive> rebarConvertStrategy,
|
||||||
|
IConvertStrategy<PointNdmPrimitiveDTO, IPointNdmPrimitive> pointConvertStrategy,
|
||||||
|
IConvertStrategy<EllipseNdmPrimitiveDTO, IEllipseNdmPrimitive> ellipseConvertStrategy,
|
||||||
|
IConvertStrategy<RectangleNdmPrimitiveDTO, IRectangleNdmPrimitive> rectangleConvertStrategy)
|
||||||
|
{
|
||||||
|
this.rebarConvertStrategy = rebarConvertStrategy;
|
||||||
|
this.pointConvertStrategy = pointConvertStrategy;
|
||||||
|
this.ellipseConvertStrategy = ellipseConvertStrategy;
|
||||||
|
this.rectangleConvertStrategy = rectangleConvertStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NdmPrimitiveToDTOConvertStrategy() : this(
|
||||||
|
new RebarNdmPrimitiveToDTOConvertStrategy(),
|
||||||
|
new PointNdmPrimitiveToDTOConvertStrategy(),
|
||||||
|
new EllipseNdmPrimitiveToDTOConvertStrategy(),
|
||||||
|
new RectangleNdmPrimitiveToDTOConvertStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public INdmPrimitive Convert(INdmPrimitive source)
|
||||||
|
{
|
||||||
|
if (source is IRebarNdmPrimitive rebar)
|
||||||
|
{
|
||||||
|
return ProcessRebar(rebar);
|
||||||
|
}
|
||||||
|
if (source is IPointNdmPrimitive point)
|
||||||
|
{
|
||||||
|
return ProcessPoint(point);
|
||||||
|
}
|
||||||
|
if (source is IEllipseNdmPrimitive ellipse)
|
||||||
|
{
|
||||||
|
return ProcessEllipse(ellipse);
|
||||||
|
}
|
||||||
|
if (source is IRectangleNdmPrimitive rectangle)
|
||||||
|
{
|
||||||
|
return ProcessRectangle(rectangle);
|
||||||
|
}
|
||||||
|
TraceLogger.AddMessage("Object type is unknown", TraceLogStatuses.Error);
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source));
|
||||||
|
}
|
||||||
|
|
||||||
|
private RebarNdmPrimitiveDTO ProcessRebar(IRebarNdmPrimitive rebar)
|
||||||
|
{
|
||||||
|
rebarConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
rebarConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<RebarNdmPrimitiveDTO, IRebarNdmPrimitive>(this, rebarConvertStrategy);
|
||||||
|
return convertLogic.Convert(rebar);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PointNdmPrimitiveDTO ProcessPoint(IPointNdmPrimitive point)
|
||||||
|
{
|
||||||
|
pointConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
pointConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<PointNdmPrimitiveDTO, IPointNdmPrimitive>(this, pointConvertStrategy);
|
||||||
|
return convertLogic.Convert(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
private EllipseNdmPrimitiveDTO ProcessEllipse(IEllipseNdmPrimitive ellipse)
|
||||||
|
{
|
||||||
|
ellipseConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
ellipseConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<EllipseNdmPrimitiveDTO, IEllipseNdmPrimitive>(this, ellipseConvertStrategy);
|
||||||
|
return convertLogic.Convert(ellipse);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RectangleNdmPrimitiveDTO ProcessRectangle(IRectangleNdmPrimitive rectangle)
|
||||||
|
{
|
||||||
|
rectangleConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
rectangleConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<RectangleNdmPrimitiveDTO, IRectangleNdmPrimitive>(this, rectangleConvertStrategy);
|
||||||
|
return convertLogic.Convert(rectangle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
using DataAccess.DTOs.Converters;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class PointNdmPrimitiveToDTOConvertStrategy : IConvertStrategy<PointNdmPrimitiveDTO, IPointNdmPrimitive>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IPointNdmPrimitive> updateStrategy;
|
||||||
|
private IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy;
|
||||||
|
private IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy;
|
||||||
|
private IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy;
|
||||||
|
|
||||||
|
public PointNdmPrimitiveToDTOConvertStrategy(
|
||||||
|
IUpdateStrategy<IPointNdmPrimitive> updateStrategy,
|
||||||
|
IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy,
|
||||||
|
IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy,
|
||||||
|
IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
this.ndmElementConvertStrategy = ndmElementConvertStrategy;
|
||||||
|
this.pointConvertStrategy = pointConvertStrategy;
|
||||||
|
this.visualPropsConvertStrategy = visualPropsConvertStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointNdmPrimitiveToDTOConvertStrategy() : this(
|
||||||
|
new PointPrimitiveUpdateStrategy(),
|
||||||
|
new NdmElementDTOConvertStrategy(),
|
||||||
|
new Point2DToDTOConvertStrategy(),
|
||||||
|
new VisualPropertyToDTOConvertStrategy()
|
||||||
|
) { }
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public PointNdmPrimitiveDTO Convert(IPointNdmPrimitive source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
PrepareStrategies();
|
||||||
|
return GetNewPrimitive(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PointNdmPrimitiveDTO GetNewPrimitive(IPointNdmPrimitive source)
|
||||||
|
{
|
||||||
|
PointNdmPrimitiveDTO newItem = new() { Id = source.Id};
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
newItem.NdmElement = ndmElementConvertStrategy.Convert(source.NdmElement);
|
||||||
|
newItem.Center = pointConvertStrategy.Convert(source.Center);
|
||||||
|
newItem.VisualProperty = visualPropsConvertStrategy.Convert(source.VisualProperty);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrepareStrategies()
|
||||||
|
{
|
||||||
|
ndmElementConvertStrategy.ReferenceDictionary =
|
||||||
|
pointConvertStrategy.ReferenceDictionary =
|
||||||
|
visualPropsConvertStrategy.ReferenceDictionary =
|
||||||
|
ReferenceDictionary;
|
||||||
|
ndmElementConvertStrategy.TraceLogger =
|
||||||
|
pointConvertStrategy.TraceLogger =
|
||||||
|
visualPropsConvertStrategy.TraceLogger =
|
||||||
|
TraceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<PointNdmPrimitiveDTO, IPointNdmPrimitive>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
using DataAccess.DTOs.Converters;
|
||||||
|
using DataAccess.DTOs.DTOEntities;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class RebarNdmPrimitiveToDTOConvertStrategy : IConvertStrategy<RebarNdmPrimitiveDTO, IRebarNdmPrimitive>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IRebarNdmPrimitive> updateStrategy;
|
||||||
|
private IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy;
|
||||||
|
private IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy;
|
||||||
|
private IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy;
|
||||||
|
private IConvertStrategy<INdmPrimitive, INdmPrimitive> hostPrimitiveConvertStrategy;
|
||||||
|
|
||||||
|
public RebarNdmPrimitiveToDTOConvertStrategy(
|
||||||
|
IUpdateStrategy<IRebarNdmPrimitive> updateStrategy,
|
||||||
|
IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy,
|
||||||
|
IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy,
|
||||||
|
IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
this.ndmElementConvertStrategy = ndmElementConvertStrategy;
|
||||||
|
this.pointConvertStrategy = pointConvertStrategy;
|
||||||
|
this.visualPropsConvertStrategy = visualPropsConvertStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RebarNdmPrimitiveToDTOConvertStrategy() : this(
|
||||||
|
new RebarNdmPrimitiveUpdateStrategy(),
|
||||||
|
new NdmElementDTOConvertStrategy(),
|
||||||
|
new Point2DToDTOConvertStrategy(),
|
||||||
|
new VisualPropertyToDTOConvertStrategy()
|
||||||
|
) { }
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public RebarNdmPrimitiveDTO Convert(IRebarNdmPrimitive source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
PrepareStrategies();
|
||||||
|
return GetNewPrimitive(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Error);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private RebarNdmPrimitiveDTO GetNewPrimitive(IRebarNdmPrimitive source)
|
||||||
|
{
|
||||||
|
RebarNdmPrimitiveDTO newItem = new() { Id = source.Id };
|
||||||
|
//updateStrategy.Update(newItem, source);
|
||||||
|
newItem.NdmElement = ndmElementConvertStrategy.Convert(source.NdmElement);
|
||||||
|
newItem.Center = pointConvertStrategy.Convert(source.Center);
|
||||||
|
newItem.VisualProperty = visualPropsConvertStrategy.Convert(source.VisualProperty);
|
||||||
|
if (source.HostPrimitive is not null)
|
||||||
|
{
|
||||||
|
hostPrimitiveConvertStrategy = new NdmPrimitiveToDTOConvertStrategy(null, null,
|
||||||
|
new EllipseNdmPrimitiveToDTOConvertStrategy(),
|
||||||
|
new RectangleNdmPrimitiveToDTOConvertStrategy());
|
||||||
|
hostPrimitiveConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
hostPrimitiveConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
newItem.HostPrimitive = hostPrimitiveConvertStrategy.Convert(source.HostPrimitive);
|
||||||
|
}
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrepareStrategies()
|
||||||
|
{
|
||||||
|
ndmElementConvertStrategy.ReferenceDictionary =
|
||||||
|
pointConvertStrategy.ReferenceDictionary =
|
||||||
|
visualPropsConvertStrategy.ReferenceDictionary =
|
||||||
|
ReferenceDictionary;
|
||||||
|
ndmElementConvertStrategy.TraceLogger =
|
||||||
|
pointConvertStrategy.TraceLogger =
|
||||||
|
visualPropsConvertStrategy.TraceLogger =
|
||||||
|
TraceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<RebarNdmPrimitiveDTO, IRebarNdmPrimitive>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class RectangleNdmPrimitiveToDTOConvertStrategy : IConvertStrategy<RectangleNdmPrimitiveDTO, IRectangleNdmPrimitive>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IRectangleNdmPrimitive> updateStrategy;
|
||||||
|
private IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleShapeConvertStrategy;
|
||||||
|
private IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy;
|
||||||
|
private IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy;
|
||||||
|
private IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy;
|
||||||
|
private IConvertStrategy<DivisionSizeDTO, IDivisionSize> divisionConvertStrategy;
|
||||||
|
|
||||||
|
public RectangleNdmPrimitiveToDTOConvertStrategy(
|
||||||
|
IUpdateStrategy<IRectangleNdmPrimitive> updateStrategy,
|
||||||
|
IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleShapeConvertStrategy,
|
||||||
|
IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy,
|
||||||
|
IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy,
|
||||||
|
IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy,
|
||||||
|
IConvertStrategy<DivisionSizeDTO, IDivisionSize> divisionConvertStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
this.rectangleShapeConvertStrategy = rectangleShapeConvertStrategy;
|
||||||
|
this.ndmElementConvertStrategy = ndmElementConvertStrategy;
|
||||||
|
this.pointConvertStrategy = pointConvertStrategy;
|
||||||
|
this.visualPropsConvertStrategy = visualPropsConvertStrategy;
|
||||||
|
this.divisionConvertStrategy = divisionConvertStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RectangleNdmPrimitiveToDTOConvertStrategy() : this(
|
||||||
|
new RectanglePrimitiveUpdateStrategy(),
|
||||||
|
new RectangleShapeToDTOConvertStrategy(),
|
||||||
|
new NdmElementDTOConvertStrategy(),
|
||||||
|
new Point2DToDTOConvertStrategy(),
|
||||||
|
new VisualPropertyToDTOConvertStrategy(),
|
||||||
|
new DivisionSizeToDTOConvertStrategy()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public RectangleNdmPrimitiveDTO Convert(IRectangleNdmPrimitive source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
PrepareStrategies();
|
||||||
|
return GetNewPrimitive(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private RectangleNdmPrimitiveDTO GetNewPrimitive(IRectangleNdmPrimitive source)
|
||||||
|
{
|
||||||
|
RectangleNdmPrimitiveDTO newItem = new() { Id = source.Id };
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
newItem.NdmElement = ndmElementConvertStrategy.Convert(source.NdmElement);
|
||||||
|
newItem.RectangleShape = rectangleShapeConvertStrategy.Convert(source.Shape as IRectangleShape);
|
||||||
|
newItem.Center = pointConvertStrategy.Convert(source.Center);
|
||||||
|
newItem.VisualProperty = visualPropsConvertStrategy.Convert(source.VisualProperty);
|
||||||
|
newItem.DivisionSize = divisionConvertStrategy.Convert(source.DivisionSize);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrepareStrategies()
|
||||||
|
{
|
||||||
|
rectangleShapeConvertStrategy.ReferenceDictionary =
|
||||||
|
ndmElementConvertStrategy.ReferenceDictionary =
|
||||||
|
pointConvertStrategy.ReferenceDictionary =
|
||||||
|
visualPropsConvertStrategy.ReferenceDictionary =
|
||||||
|
divisionConvertStrategy.ReferenceDictionary =
|
||||||
|
ReferenceDictionary;
|
||||||
|
rectangleShapeConvertStrategy.TraceLogger =
|
||||||
|
ndmElementConvertStrategy.TraceLogger =
|
||||||
|
pointConvertStrategy.TraceLogger =
|
||||||
|
visualPropsConvertStrategy.TraceLogger =
|
||||||
|
divisionConvertStrategy.TraceLogger =
|
||||||
|
TraceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<RectangleNdmPrimitiveDTO, IRectangleNdmPrimitive>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
DataAccess/DTOs/DTOEntities/AccuracyDTO.cs
Normal file
21
DataAccess/DTOs/DTOEntities/AccuracyDTO.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.DTOEntities
|
||||||
|
{
|
||||||
|
public class AccuracyDTO : IAccuracy
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("IterationAccuracy")]
|
||||||
|
public double IterationAccuracy { get; set; }
|
||||||
|
[JsonProperty("MaxIterationCount")]
|
||||||
|
public int MaxIterationCount { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
34
DataAccess/DTOs/DTOEntities/CompressedMemberDTO.cs
Normal file
34
DataAccess/DTOs/DTOEntities/CompressedMemberDTO.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Sections;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class CompressedMemberDTO : ICompressedMember
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("Bucling")]
|
||||||
|
public bool Buckling { get; set; }
|
||||||
|
[JsonProperty("GeometryLength")]
|
||||||
|
public double GeometryLength { get; set; }
|
||||||
|
[JsonProperty("LengthFactorX")]
|
||||||
|
public double LengthFactorX { get; set; }
|
||||||
|
[JsonProperty("DiagramFactorX")]
|
||||||
|
public double DiagramFactorX { get; set; }
|
||||||
|
[JsonProperty("LengthFactorY")]
|
||||||
|
public double LengthFactorY { get; set; }
|
||||||
|
[JsonProperty("DiagramFactorY")]
|
||||||
|
public double DiagramFactorY { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
37
DataAccess/DTOs/DTOEntities/CrackCalculatorDTO.cs
Normal file
37
DataAccess/DTOs/DTOEntities/CrackCalculatorDTO.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class CrackCalculatorDTO : ICrackCalculator
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("Name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[JsonProperty("InputData")]
|
||||||
|
public ICrackCalculatorInputData InputData { get; set; } = new CrackCalculatorInputDataDTO();
|
||||||
|
[JsonIgnore]
|
||||||
|
public IResult Result { get; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
DataAccess/DTOs/DTOEntities/CrackCalculatorInputDataDTO.cs
Normal file
20
DataAccess/DTOs/DTOEntities/CrackCalculatorInputDataDTO.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class CrackCalculatorInputDataDTO : ICrackCalculatorInputData
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("ForceActions")]
|
||||||
|
public List<IForceAction> ForceActions { get; set; } = new();
|
||||||
|
[JsonProperty("ForcePrimitives")]
|
||||||
|
public List<INdmPrimitive> Primitives { get; set; } = new();
|
||||||
|
[JsonProperty("UserCrackInputData")]
|
||||||
|
public IUserCrackInputData UserCrackInputData { get; set; } = new UserCrackInputDataDTO();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class EllipseNdmPrimitiveDTO : IEllipsePrimitive
|
public class EllipseNdmPrimitiveDTO : IEllipseNdmPrimitive
|
||||||
{
|
{
|
||||||
private IRectangleShape shape = new RectangleShapeDTO();
|
private IRectangleShape shape = new RectangleShapeDTO();
|
||||||
|
|
||||||
@@ -36,14 +36,15 @@ namespace DataAccess.DTOs
|
|||||||
public IPoint2D Center { get; set; } = new Point2DDTO();
|
public IPoint2D Center { get; set; } = new Point2DDTO();
|
||||||
[JsonProperty("DivisionSize")]
|
[JsonProperty("DivisionSize")]
|
||||||
public IDivisionSize DivisionSize { get; set; } = new DivisionSizeDTO();
|
public IDivisionSize DivisionSize { get; set; } = new DivisionSizeDTO();
|
||||||
|
[JsonProperty("RotationAngle")]
|
||||||
|
public double RotationAngle { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public double Width { get; set; }
|
public double Width { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public double Height {get; set; }
|
public double Height {get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public double Angle { get; set; }
|
|
||||||
[JsonIgnore]
|
|
||||||
public ICrossSection? CrossSection { get; set; }
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
38
DataAccess/DTOs/DTOEntities/ForceCalculatorDTO.cs
Normal file
38
DataAccess/DTOs/DTOEntities/ForceCalculatorDTO.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ForceCalculatorDTO : IForceCalculator
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("Name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[JsonProperty("InputData")]
|
||||||
|
public IForceCalculatorInputData InputData { get; set; } = new ForceCalculatorInputDataDTO();
|
||||||
|
[JsonIgnore]
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public IResult Result => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
37
DataAccess/DTOs/DTOEntities/ForceCalculatorInputDataDTO.cs
Normal file
37
DataAccess/DTOs/DTOEntities/ForceCalculatorInputDataDTO.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using DataAccess.DTOs.DTOEntities;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Sections;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ForceCalculatorInputDataDTO : IForceCalculatorInputData
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("ForceActions")]
|
||||||
|
public List<IForceAction> ForceActions { get; set; } = new();
|
||||||
|
[JsonProperty("Primitives")]
|
||||||
|
public List<INdmPrimitive> Primitives { get; set; } = new();
|
||||||
|
[JsonProperty("LimitStatesList")]
|
||||||
|
public List<LimitStates> LimitStatesList { get; set; } = new();
|
||||||
|
[JsonProperty("CalcTermList")]
|
||||||
|
public List<CalcTerms> CalcTermsList { get; set; } = new();
|
||||||
|
[JsonProperty("Accuracy")]
|
||||||
|
public IAccuracy Accuracy { get; set; } = new AccuracyDTO();
|
||||||
|
[JsonProperty("CompressedMember")]
|
||||||
|
public ICompressedMember CompressedMember { get; set; } = new CompressedMemberDTO();
|
||||||
|
[JsonIgnore]
|
||||||
|
public List<IForceCombinationList> ForceCombinationLists { get; set; } = new();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ namespace DataAccess.DTOs
|
|||||||
[JsonProperty("SetInGravityCenter")]
|
[JsonProperty("SetInGravityCenter")]
|
||||||
public bool SetInGravityCenter { get; set; }
|
public bool SetInGravityCenter { get; set; }
|
||||||
[JsonProperty("ForcePoint")]
|
[JsonProperty("ForcePoint")]
|
||||||
public IPoint2D ForcePoint { get; set; }
|
public IPoint2D ForcePoint { get; set; } = new Point2DDTO();
|
||||||
[JsonProperty("DesignForces")]
|
[JsonProperty("DesignForces")]
|
||||||
public List<IDesignForceTuple> DesignForces { get; set; } = new();
|
public List<IDesignForceTuple> DesignForces { get; set; } = new();
|
||||||
|
|
||||||
|
|||||||
53
DataAccess/DTOs/DTOEntities/PointNdmPrimitiveDTO.cs
Normal file
53
DataAccess/DTOs/DTOEntities/PointNdmPrimitiveDTO.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class PointNdmPrimitiveDTO : IPointNdmPrimitive
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("Name")]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
[JsonProperty("NdmElement")]
|
||||||
|
public INdmElement NdmElement { get; set; } = new NdmElementDTO();
|
||||||
|
[JsonProperty("VisualProperty")]
|
||||||
|
public IVisualProperty VisualProperty { get; set; } = new VisualPropertyDTO();
|
||||||
|
[JsonProperty("Center")]
|
||||||
|
public IPoint2D Center { get; set; } = new Point2DDTO();
|
||||||
|
[JsonProperty("RotationAngle")]
|
||||||
|
public double RotationAngle { get; set; } = 0d;
|
||||||
|
[JsonProperty("Area")]
|
||||||
|
public double Area { get; set; } = 0d;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public IShape Shape { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<INamedAreaPoint> GetValuePoints()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
64
DataAccess/DTOs/DTOEntities/RebarNdmPrimitiveDTO.cs
Normal file
64
DataAccess/DTOs/DTOEntities/RebarNdmPrimitiveDTO.cs
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.DTOEntities
|
||||||
|
{
|
||||||
|
public class RebarNdmPrimitiveDTO : IRebarNdmPrimitive
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("Name")]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public IShape Shape { get; set; }
|
||||||
|
[JsonProperty("NdmElement")]
|
||||||
|
public INdmElement NdmElement { get; set; } = new NdmElementDTO();
|
||||||
|
[JsonIgnore]
|
||||||
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
[JsonProperty("VisualProperty")]
|
||||||
|
public IVisualProperty VisualProperty { get; set; } = new VisualPropertyDTO();
|
||||||
|
[JsonProperty("Center")]
|
||||||
|
public IPoint2D Center { get; set; } = new Point2DDTO();
|
||||||
|
[JsonProperty("RotationAngle")]
|
||||||
|
public double RotationAngle { get; set; } = 0d;
|
||||||
|
[JsonProperty("Area")]
|
||||||
|
public double Area { get; set; } = 0d;
|
||||||
|
|
||||||
|
|
||||||
|
public INdmPrimitive? HostPrimitive { get; set; }
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ndm GetConcreteNdm(ITriangulationOptions triangulationOptions)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RebarNdm GetRebarNdm(ITriangulationOptions triangulationOptions)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<INamedAreaPoint> GetValuePoints()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
68
DataAccess/DTOs/DTOEntities/RectangleNdmPrimitiveDTO.cs
Normal file
68
DataAccess/DTOs/DTOEntities/RectangleNdmPrimitiveDTO.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class RectangleNdmPrimitiveDTO : IRectangleNdmPrimitive
|
||||||
|
{
|
||||||
|
private IRectangleShape shape = new RectangleShapeDTO();
|
||||||
|
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("Name")]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
[JsonProperty("RectangleShape")]
|
||||||
|
public IRectangleShape RectangleShape
|
||||||
|
{
|
||||||
|
get => shape;
|
||||||
|
set => shape = value;
|
||||||
|
}
|
||||||
|
[JsonIgnore]
|
||||||
|
public IShape Shape => shape;
|
||||||
|
[JsonProperty("NdmElement")]
|
||||||
|
public INdmElement NdmElement { get; set; } = new NdmElementDTO();
|
||||||
|
[JsonProperty("VisualProperty")]
|
||||||
|
public IVisualProperty VisualProperty { get; set; } = new VisualPropertyDTO();
|
||||||
|
[JsonProperty("Center")]
|
||||||
|
public IPoint2D Center { get; set; } = new Point2DDTO();
|
||||||
|
[JsonProperty("DivisionSize")]
|
||||||
|
public IDivisionSize DivisionSize { get; set; } = new DivisionSizeDTO();
|
||||||
|
[JsonProperty("RotationAngle")]
|
||||||
|
public double RotationAngle { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public double Width { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public double Height { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public ICrossSection? CrossSection { get; set; }
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<INamedAreaPoint> GetValuePoints()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsPointInside(IPoint2D point)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,8 +16,6 @@ namespace DataAccess.DTOs
|
|||||||
public double Width { get; set; }
|
public double Width { get; set; }
|
||||||
[JsonProperty("Height")]
|
[JsonProperty("Height")]
|
||||||
public double Height { get; set; }
|
public double Height { get; set; }
|
||||||
[JsonProperty("Angle")]
|
|
||||||
public double Angle { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using StructureHelper.Models.Materials;
|
using DataAccess.DTOs.DTOEntities;
|
||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Models.Analyses;
|
using StructureHelperCommon.Models.Analyses;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
@@ -34,18 +36,24 @@ namespace DataAccess.DTOs
|
|||||||
|
|
||||||
private static List<(Type type, string name)> GetVersionV1()
|
private static List<(Type type, string name)> GetVersionV1()
|
||||||
{
|
{
|
||||||
return new List<(Type type, string name)>
|
List<(Type type, string name)> newList = new List<(Type type, string name)>
|
||||||
{
|
{
|
||||||
|
{ (typeof(AccuracyDTO), "Accuracy") },
|
||||||
{ (typeof(ConcreteLibMaterialDTO), "ConcreteLibMaterial") },
|
{ (typeof(ConcreteLibMaterialDTO), "ConcreteLibMaterial") },
|
||||||
|
{ (typeof(CompressedMemberDTO), "CompressedMember") },
|
||||||
|
{ (typeof(CrackCalculatorDTO), "CrackCalculator") },
|
||||||
|
{ (typeof(CrackCalculatorInputDataDTO), "CrackCalculatorInputData") },
|
||||||
{ (typeof(CrossSectionDTO), "CrossSection") },
|
{ (typeof(CrossSectionDTO), "CrossSection") },
|
||||||
{ (typeof(CrossSectionNdmAnalysisDTO), "CrossSectionNdmAnalysis") },
|
{ (typeof(CrossSectionNdmAnalysisDTO), "CrossSectionNdmAnalysis") },
|
||||||
{ (typeof(CrossSectionRepositoryDTO), "CrossSectionRepository") },
|
{ (typeof(CrossSectionRepositoryDTO), "CrossSectionRepository") },
|
||||||
{ (typeof(DateVersionDTO), "DateVersion") },
|
{ (typeof(DateVersionDTO), "DateVersion") },
|
||||||
{ (typeof(EllipseNdmPrimitiveDTO), "EllipseNdmPrimitive") },
|
|
||||||
{ (typeof(DesignForceTupleDTO), "DesignForceTuple") },
|
{ (typeof(DesignForceTupleDTO), "DesignForceTuple") },
|
||||||
{ (typeof(DivisionSizeDTO), "DivisionSize") },
|
{ (typeof(DivisionSizeDTO), "DivisionSize") },
|
||||||
{ (typeof(ElasticMaterialDTO), "ElasticMaterial") },
|
{ (typeof(ElasticMaterialDTO), "ElasticMaterial") },
|
||||||
|
{ (typeof(EllipseNdmPrimitiveDTO), "EllipseNdmPrimitive") },
|
||||||
{ (typeof(FileVersionDTO), "FileVersion") },
|
{ (typeof(FileVersionDTO), "FileVersion") },
|
||||||
|
{ (typeof(ForceCalculatorDTO), "ForceCalculator") },
|
||||||
|
{ (typeof(ForceCalculatorInputDataDTO), "ForceCalculatorInputData") },
|
||||||
{ (typeof(ForceCombinationByFactorDTO), "ForceCombinationByFactor") },
|
{ (typeof(ForceCombinationByFactorDTO), "ForceCombinationByFactor") },
|
||||||
{ (typeof(ForceCombinationListDTO), "ForceCombinationList") },
|
{ (typeof(ForceCombinationListDTO), "ForceCombinationList") },
|
||||||
{ (typeof(ForceTupleDTO), "ForceTuple") },
|
{ (typeof(ForceTupleDTO), "ForceTuple") },
|
||||||
@@ -54,25 +62,32 @@ namespace DataAccess.DTOs
|
|||||||
{ (typeof(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
|
{ (typeof(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
|
||||||
{ (typeof(NdmElementDTO), "NdmElement") },
|
{ (typeof(NdmElementDTO), "NdmElement") },
|
||||||
{ (typeof(IVisualAnalysis), "IVisualAnalysis") },
|
{ (typeof(IVisualAnalysis), "IVisualAnalysis") },
|
||||||
|
{ (typeof(List<CalcTerms>), "ListOfCalcTerms") },
|
||||||
{ (typeof(List<ICalculator>), "ListOfICalculator") },
|
{ (typeof(List<ICalculator>), "ListOfICalculator") },
|
||||||
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
|
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
|
||||||
{ (typeof(List<IDesignForceTuple>), "ListOfIDesignForceTuple") },
|
{ (typeof(List<IDesignForceTuple>), "ListOfIDesignForceTuple") },
|
||||||
{ (typeof(List<IForceAction>), "ListOfIForceAction") },
|
{ (typeof(List<IForceAction>), "ListOfIForceAction") },
|
||||||
{ (typeof(List<IHeadMaterial>), "ListOfIHeadMaterial") },
|
{ (typeof(List<IHeadMaterial>), "ListOfIHeadMaterial") },
|
||||||
|
{ (typeof(List<LimitStates>), "ListOfLimitState") },
|
||||||
{ (typeof(List<IMaterialSafetyFactor>), "ListOfMaterialSafetyFactor") },
|
{ (typeof(List<IMaterialSafetyFactor>), "ListOfMaterialSafetyFactor") },
|
||||||
{ (typeof(List<IMaterialPartialFactor>), "ListOfMaterialPartialFactor") },
|
{ (typeof(List<IMaterialPartialFactor>), "ListOfMaterialPartialFactor") },
|
||||||
{ (typeof(List<INdmPrimitive>), "ListOfINdmPrimitive") },
|
{ (typeof(List<INdmPrimitive>), "ListOfINdmPrimitive") },
|
||||||
{ (typeof(List<IPartialFactor>), "ListOfPartialFactor") },
|
{ (typeof(List<IPartialFactor>), "ListOfPartialFactor") },
|
||||||
{ (typeof(List<IVisualAnalysis>), "ListOfIVisualAnalysis") },
|
{ (typeof(List<IVisualAnalysis>), "ListOfIVisualAnalysis") },
|
||||||
{ (typeof(Point2DDTO), "Point2D") },
|
{ (typeof(Point2DDTO), "Point2D") },
|
||||||
|
{ (typeof(PointNdmPrimitiveDTO), "PointNdmPrimitive") },
|
||||||
{ (typeof(ProjectDTO), "Project") },
|
{ (typeof(ProjectDTO), "Project") },
|
||||||
|
{ (typeof(RebarNdmPrimitiveDTO), "RebarNdmPrimitive") },
|
||||||
|
{ (typeof(RectangleNdmPrimitiveDTO), "RectangleNdmPrimitive") },
|
||||||
{ (typeof(RectangleShapeDTO), "RectangleShape") },
|
{ (typeof(RectangleShapeDTO), "RectangleShape") },
|
||||||
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
|
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
|
||||||
{ (typeof(MaterialPartialFactorDTO), "MaterialPartialFactor") },
|
{ (typeof(MaterialPartialFactorDTO), "MaterialPartialFactor") },
|
||||||
{ (typeof(VersionProcessorDTO), "VersionProcessor") },
|
{ (typeof(VersionProcessorDTO), "VersionProcessor") },
|
||||||
{ (typeof(VisualAnalysisDTO), "VisualAnalysis") },
|
{ (typeof(VisualAnalysisDTO), "VisualAnalysis") },
|
||||||
{ (typeof(VisualPropertyDTO), "VisualProperty") },
|
{ (typeof(VisualPropertyDTO), "VisualProperty") },
|
||||||
|
{ (typeof(UserCrackInputDataDTO), "UserCrackInputData") },
|
||||||
};
|
};
|
||||||
|
return newList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
29
DataAccess/DTOs/DTOEntities/UserCrackInputDataDTO.cs
Normal file
29
DataAccess/DTOs/DTOEntities/UserCrackInputDataDTO.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class UserCrackInputDataDTO : IUserCrackInputData
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("LengthBetweenCracks")]
|
||||||
|
public double LengthBetweenCracks { get; set; }
|
||||||
|
[JsonProperty("SetLengthBetweenCracks")]
|
||||||
|
public bool SetLengthBetweenCracks { get; set; }
|
||||||
|
[JsonProperty("SetSofteningFactors")]
|
||||||
|
public bool SetSofteningFactor { get; set; }
|
||||||
|
[JsonProperty("SofteningFactors")]
|
||||||
|
public double SofteningFactor { get; set; }
|
||||||
|
[JsonProperty("UltimateLongCrackWidths")]
|
||||||
|
public double UltimateLongCrackWidth { get; set; }
|
||||||
|
[JsonProperty("UltimateShortCrackWidths")]
|
||||||
|
public double UltimateShortCrackWidth { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
public class CircleViewPrimitive : PrimitiveBase, IHasCenter
|
public class CircleViewPrimitive : PrimitiveBase, IHasCenter
|
||||||
{
|
{
|
||||||
IEllipsePrimitive primitive;
|
IEllipseNdmPrimitive primitive;
|
||||||
public double Diameter
|
public double Diameter
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -31,11 +31,11 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
|
|
||||||
public CircleViewPrimitive(INdmPrimitive primitive) : base(primitive)
|
public CircleViewPrimitive(INdmPrimitive primitive) : base(primitive)
|
||||||
{
|
{
|
||||||
if (primitive is not IEllipsePrimitive)
|
if (primitive is not IEllipseNdmPrimitive)
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $"\nExpected: {nameof(IEllipsePrimitive)}, But was: {nameof(primitive)}");
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $"\nExpected: {nameof(IEllipseNdmPrimitive)}, But was: {nameof(primitive)}");
|
||||||
}
|
}
|
||||||
var circle = primitive as IEllipsePrimitive;
|
var circle = primitive as IEllipseNdmPrimitive;
|
||||||
this.primitive = circle;
|
this.primitive = circle;
|
||||||
DivisionViewModel = new HasDivisionViewModel(circle.DivisionSize);
|
DivisionViewModel = new HasDivisionViewModel(circle.DivisionSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
public class PointViewPrimitive : PrimitiveBase, IHasCenter
|
public class PointViewPrimitive : PrimitiveBase, IHasCenter
|
||||||
{
|
{
|
||||||
IPointPrimitive primitive;
|
IPointNdmPrimitive primitive;
|
||||||
|
|
||||||
public double Area
|
public double Area
|
||||||
{ get => primitive.Area;
|
{ get => primitive.Area;
|
||||||
@@ -31,7 +31,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
get => DeltaY - Diameter / 2d;
|
get => DeltaY - Diameter / 2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointViewPrimitive(IPointPrimitive _primitive) : base(_primitive)
|
public PointViewPrimitive(IPointNdmPrimitive _primitive) : base(_primitive)
|
||||||
{
|
{
|
||||||
primitive = _primitive;
|
primitive = _primitive;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,24 +25,24 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
public static PrimitiveBase ConvertNdmPrimitiveToPrimitiveBase(INdmPrimitive primitive)
|
public static PrimitiveBase ConvertNdmPrimitiveToPrimitiveBase(INdmPrimitive primitive)
|
||||||
{
|
{
|
||||||
PrimitiveBase viewItem;
|
PrimitiveBase viewItem;
|
||||||
if (primitive is IRectanglePrimitive)
|
if (primitive is IRectangleNdmPrimitive)
|
||||||
{
|
{
|
||||||
var rect = primitive as IRectanglePrimitive;
|
var rect = primitive as IRectangleNdmPrimitive;
|
||||||
viewItem = new RectangleViewPrimitive(rect);
|
viewItem = new RectangleViewPrimitive(rect);
|
||||||
}
|
}
|
||||||
else if (primitive is IEllipsePrimitive)
|
else if (primitive is IEllipseNdmPrimitive)
|
||||||
{
|
{
|
||||||
var circle = primitive as IEllipsePrimitive;
|
var circle = primitive as IEllipseNdmPrimitive;
|
||||||
viewItem = new CircleViewPrimitive(circle);
|
viewItem = new CircleViewPrimitive(circle);
|
||||||
}
|
}
|
||||||
else if (primitive is IPointPrimitive & primitive is not RebarPrimitive)
|
else if (primitive is IPointNdmPrimitive & primitive is not RebarNdmPrimitive)
|
||||||
{
|
{
|
||||||
var point = primitive as IPointPrimitive;
|
var point = primitive as IPointNdmPrimitive;
|
||||||
viewItem = new PointViewPrimitive(point);
|
viewItem = new PointViewPrimitive(point);
|
||||||
}
|
}
|
||||||
else if (primitive is RebarPrimitive)
|
else if (primitive is RebarNdmPrimitive)
|
||||||
{
|
{
|
||||||
var point = primitive as RebarPrimitive;
|
var point = primitive as RebarNdmPrimitive;
|
||||||
viewItem = new ReinforcementViewPrimitive(point);
|
viewItem = new ReinforcementViewPrimitive(point);
|
||||||
}
|
}
|
||||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Actual type: {primitive.GetType()}");
|
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Actual type: {primitive.GetType()}");
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
public class RectangleViewPrimitive : PrimitiveBase, IHasCenter
|
public class RectangleViewPrimitive : PrimitiveBase, IHasCenter
|
||||||
{
|
{
|
||||||
private IRectanglePrimitive primitive;
|
private IRectangleNdmPrimitive primitive;
|
||||||
|
|
||||||
public override double PrimitiveWidth
|
public override double PrimitiveWidth
|
||||||
{
|
{
|
||||||
@@ -37,7 +37,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
get => DeltaY - primitive.Height / 2d;
|
get => DeltaY - primitive.Height / 2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RectangleViewPrimitive(IRectanglePrimitive _primitive) : base(_primitive)
|
public RectangleViewPrimitive(IRectangleNdmPrimitive _primitive) : base(_primitive)
|
||||||
{
|
{
|
||||||
primitive = _primitive;
|
primitive = _primitive;
|
||||||
DivisionViewModel = new HasDivisionViewModel(primitive.DivisionSize);
|
DivisionViewModel = new HasDivisionViewModel(primitive.DivisionSize);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
public class ReinforcementViewPrimitive : PointViewPrimitive, IHasHostPrimitive
|
public class ReinforcementViewPrimitive : PointViewPrimitive, IHasHostPrimitive
|
||||||
{
|
{
|
||||||
RebarPrimitive primitive;
|
RebarNdmPrimitive primitive;
|
||||||
|
|
||||||
public INdmPrimitive HostPrimitive
|
public INdmPrimitive HostPrimitive
|
||||||
{
|
{
|
||||||
@@ -21,7 +21,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReinforcementViewPrimitive(RebarPrimitive _primitive) : base(_primitive)
|
public ReinforcementViewPrimitive(RebarNdmPrimitive _primitive) : base(_primitive)
|
||||||
{
|
{
|
||||||
primitive = _primitive;
|
primitive = _primitive;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (var item in ndmPrimitives)
|
foreach (var item in ndmPrimitives)
|
||||||
{
|
{
|
||||||
if (item is RebarPrimitive)
|
if (item is RebarNdmPrimitive)
|
||||||
{
|
{
|
||||||
var primitive = item as RebarPrimitive;
|
var primitive = item as RebarNdmPrimitive;
|
||||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||||
if (fullStrength == true)
|
if (fullStrength == true)
|
||||||
{
|
{
|
||||||
@@ -73,9 +73,9 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (var item in ndmPrimitives)
|
foreach (var item in ndmPrimitives)
|
||||||
{
|
{
|
||||||
if (item is RebarPrimitive)
|
if (item is RebarNdmPrimitive)
|
||||||
{
|
{
|
||||||
var primitive = item as RebarPrimitive;
|
var primitive = item as RebarNdmPrimitive;
|
||||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||||
var calculator = new AnchorageCalculator(inputData);
|
var calculator = new AnchorageCalculator(inputData);
|
||||||
var val = calculator.GetBaseDevLength() * UnitConstants.Length;
|
var val = calculator.GetBaseDevLength() * UnitConstants.Length;
|
||||||
@@ -92,9 +92,9 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (var item in ndmPrimitives)
|
foreach (var item in ndmPrimitives)
|
||||||
{
|
{
|
||||||
if (item is RebarPrimitive)
|
if (item is RebarNdmPrimitive)
|
||||||
{
|
{
|
||||||
var primitive = item as RebarPrimitive;
|
var primitive = item as RebarNdmPrimitive;
|
||||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
|
||||||
if (fullStrength == true)
|
if (fullStrength == true)
|
||||||
{
|
{
|
||||||
@@ -116,9 +116,9 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
|
||||||
foreach (var item in ndmPrimitives)
|
foreach (var item in ndmPrimitives)
|
||||||
{
|
{
|
||||||
if (item is RebarPrimitive)
|
if (item is RebarNdmPrimitive)
|
||||||
{
|
{
|
||||||
var primitive = item as RebarPrimitive;
|
var primitive = item as RebarNdmPrimitive;
|
||||||
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, lapperdCountRate);
|
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, lapperdCountRate);
|
||||||
if (fullStrength == true)
|
if (fullStrength == true)
|
||||||
{
|
{
|
||||||
@@ -134,7 +134,7 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
return primitiveSet;
|
return primitiveSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FieldVisualizer.Entities.Values.Primitives.CirclePrimitive GetValuePrimitive(IPointPrimitive primitive, double val)
|
private static FieldVisualizer.Entities.Values.Primitives.CirclePrimitive GetValuePrimitive(IPointNdmPrimitive primitive, double val)
|
||||||
{
|
{
|
||||||
var valuePrimitive = new FieldVisualizer.Entities.Values.Primitives.CirclePrimitive()
|
var valuePrimitive = new FieldVisualizer.Entities.Values.Primitives.CirclePrimitive()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ namespace StructureHelper.Windows.MainWindow
|
|||||||
}
|
}
|
||||||
private void ShowEntries()
|
private void ShowEntries()
|
||||||
{
|
{
|
||||||
var filteredEntries = traceLogger.TraceLoggerEntries.Where(x => x.Priority <= 300);
|
var filteredEntries = traceLogger.TraceLoggerEntries.Where(x => x.Priority < 300);
|
||||||
if (filteredEntries.Any())
|
if (filteredEntries.Any())
|
||||||
{
|
{
|
||||||
var wnd = new TraceDocumentView(traceLogger);
|
var wnd = new TraceDocumentView(traceLogger);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
{
|
{
|
||||||
public class ForceCalculatorInputDataVM : ViewModelBase
|
public class ForceCalculatorInputDataVM : ViewModelBase
|
||||||
{
|
{
|
||||||
private ForceInputData inputData;
|
private IForceCalculatorInputData inputData;
|
||||||
SecondOrderViewModel secondOrderViewModel;
|
SecondOrderViewModel secondOrderViewModel;
|
||||||
|
|
||||||
public double IterationAccuracy
|
public double IterationAccuracy
|
||||||
@@ -41,7 +41,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; private set; }
|
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public ForceCalculatorInputDataVM(ForceInputData inputData, IEnumerable<INdmPrimitive> allowedPrimitives, IEnumerable<IForceAction> allowedCombinations)
|
public ForceCalculatorInputDataVM(IForceCalculatorInputData inputData, IEnumerable<INdmPrimitive> allowedPrimitives, IEnumerable<IForceAction> allowedCombinations)
|
||||||
{
|
{
|
||||||
this.inputData = inputData;
|
this.inputData = inputData;
|
||||||
secondOrderViewModel = new SecondOrderViewModel(this.inputData.CompressedMember);
|
secondOrderViewModel = new SecondOrderViewModel(this.inputData.CompressedMember);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
{
|
{
|
||||||
public class ForceCalculatorViewModel : OkCancelViewModelBase
|
public class ForceCalculatorViewModel : OkCancelViewModelBase
|
||||||
{
|
{
|
||||||
ForceCalculator forcesCalculator;
|
IForceCalculator forcesCalculator;
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
@@ -26,7 +26,10 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
|||||||
|
|
||||||
public ForceCalculatorInputDataVM InputData { get; }
|
public ForceCalculatorInputDataVM InputData { get; }
|
||||||
|
|
||||||
public ForceCalculatorViewModel(IEnumerable<INdmPrimitive> allowedPrimitives, IEnumerable<IForceAction> allowedCombinations, ForceCalculator forcesCalculator)
|
public ForceCalculatorViewModel(
|
||||||
|
IEnumerable<INdmPrimitive> allowedPrimitives,
|
||||||
|
IEnumerable<IForceAction> allowedCombinations,
|
||||||
|
IForceCalculator forcesCalculator)
|
||||||
{
|
{
|
||||||
this.forcesCalculator = forcesCalculator;
|
this.forcesCalculator = forcesCalculator;
|
||||||
InputData = new ForceCalculatorInputDataVM(this.forcesCalculator.InputData, allowedPrimitives, allowedCombinations);
|
InputData = new ForceCalculatorInputDataVM(this.forcesCalculator.InputData, allowedPrimitives, allowedCombinations);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
INdmPrimitive ndmPrimitive;
|
INdmPrimitive ndmPrimitive;
|
||||||
if (primitiveType == PrimitiveType.Rectangle)
|
if (primitiveType == PrimitiveType.Rectangle)
|
||||||
{
|
{
|
||||||
var primitive = new RectanglePrimitive
|
var primitive = new RectangleNdmPrimitive
|
||||||
{
|
{
|
||||||
Width = 0.4d,
|
Width = 0.4d,
|
||||||
Height = 0.6d
|
Height = 0.6d
|
||||||
@@ -80,7 +80,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
else if (primitiveType == PrimitiveType.Reinforcement)
|
else if (primitiveType == PrimitiveType.Reinforcement)
|
||||||
{
|
{
|
||||||
var primitive = new RebarPrimitive
|
var primitive = new RebarNdmPrimitive
|
||||||
{
|
{
|
||||||
Area = 0.0005d
|
Area = 0.0005d
|
||||||
};
|
};
|
||||||
@@ -89,7 +89,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
else if (primitiveType == PrimitiveType.Point)
|
else if (primitiveType == PrimitiveType.Point)
|
||||||
{
|
{
|
||||||
var primitive = new PointPrimitive
|
var primitive = new PointNdmPrimitive
|
||||||
{
|
{
|
||||||
Area = 0.0005d
|
Area = 0.0005d
|
||||||
};
|
};
|
||||||
@@ -98,7 +98,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
}
|
}
|
||||||
else if (primitiveType == PrimitiveType.Circle)
|
else if (primitiveType == PrimitiveType.Circle)
|
||||||
{
|
{
|
||||||
var primitive = new EllipsePrimitive
|
var primitive = new EllipseNdmPrimitive
|
||||||
{
|
{
|
||||||
Width = 0.5d
|
Width = 0.5d
|
||||||
};
|
};
|
||||||
@@ -247,23 +247,23 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
newPrimitive.Name += " copy";
|
newPrimitive.Name += " copy";
|
||||||
repository.Primitives.Add(newPrimitive);
|
repository.Primitives.Add(newPrimitive);
|
||||||
PrimitiveBase primitiveBase;
|
PrimitiveBase primitiveBase;
|
||||||
if (newPrimitive is IRectanglePrimitive)
|
if (newPrimitive is IRectangleNdmPrimitive)
|
||||||
{
|
{
|
||||||
primitiveBase = new RectangleViewPrimitive(newPrimitive as IRectanglePrimitive);
|
primitiveBase = new RectangleViewPrimitive(newPrimitive as IRectangleNdmPrimitive);
|
||||||
}
|
}
|
||||||
else if (newPrimitive is IEllipsePrimitive)
|
else if (newPrimitive is IEllipseNdmPrimitive)
|
||||||
{
|
{
|
||||||
primitiveBase = new CircleViewPrimitive(newPrimitive as IEllipsePrimitive);
|
primitiveBase = new CircleViewPrimitive(newPrimitive as IEllipseNdmPrimitive);
|
||||||
}
|
}
|
||||||
else if (newPrimitive is IPointPrimitive)
|
else if (newPrimitive is IPointNdmPrimitive)
|
||||||
{
|
{
|
||||||
if (newPrimitive is RebarPrimitive)
|
if (newPrimitive is RebarNdmPrimitive)
|
||||||
{
|
{
|
||||||
primitiveBase = new ReinforcementViewPrimitive(newPrimitive as RebarPrimitive);
|
primitiveBase = new ReinforcementViewPrimitive(newPrimitive as RebarNdmPrimitive);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
primitiveBase = new PointViewPrimitive(newPrimitive as IPointPrimitive);
|
primitiveBase = new PointViewPrimitive(newPrimitive as IPointNdmPrimitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
HostPrimitives = new ObservableCollection<PrimitiveBase>();
|
HostPrimitives = new ObservableCollection<PrimitiveBase>();
|
||||||
foreach (var item in sectionRepository.Primitives)
|
foreach (var item in sectionRepository.Primitives)
|
||||||
{
|
{
|
||||||
if (item is RectanglePrimitive || item is EllipsePrimitive)
|
if (item is RectangleNdmPrimitive || item is EllipseNdmPrimitive)
|
||||||
{
|
{
|
||||||
CheckHost(primitive, item);
|
CheckHost(primitive, item);
|
||||||
HostPrimitives.Add(PrimitiveOperations.ConvertNdmPrimitiveToPrimitiveBase(item));
|
HostPrimitives.Add(PrimitiveOperations.ConvertNdmPrimitiveToPrimitiveBase(item));
|
||||||
@@ -316,10 +316,10 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
|
|||||||
private void CheckHost(PrimitiveBase primitive, INdmPrimitive item)
|
private void CheckHost(PrimitiveBase primitive, INdmPrimitive item)
|
||||||
{
|
{
|
||||||
var ndm = primitive.GetNdmPrimitive();
|
var ndm = primitive.GetNdmPrimitive();
|
||||||
if (ndm is RebarPrimitive)
|
if (ndm is RebarNdmPrimitive)
|
||||||
{
|
{
|
||||||
var host = item as IHasDivisionSize;
|
var host = item as IHasDivisionSize;
|
||||||
var reinforcement = ndm as RebarPrimitive;
|
var reinforcement = ndm as RebarNdmPrimitive;
|
||||||
bool checkWhenPointLocatedInsideOfItsHost = host.IsPointInside(reinforcement.Center.Clone() as IPoint2D);
|
bool checkWhenPointLocatedInsideOfItsHost = host.IsPointInside(reinforcement.Center.Clone() as IPoint2D);
|
||||||
if (checkWhenPointLocatedInsideOfItsHost
|
if (checkWhenPointLocatedInsideOfItsHost
|
||||||
&& reinforcement.HostPrimitive is null)
|
&& reinforcement.HostPrimitive is null)
|
||||||
|
|||||||
@@ -16,5 +16,9 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
/// 2D point of center
|
/// 2D point of center
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IPoint2D Center {get;set;}
|
IPoint2D Center {get;set;}
|
||||||
|
/// <summary>
|
||||||
|
/// Angle of rotation orbitrary center
|
||||||
|
/// </summary>
|
||||||
|
double RotationAngle { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
namespace StructureHelperCommon.Models.Calculators
|
using System;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
public class Accuracy : IAccuracy
|
public class Accuracy : IAccuracy
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public Guid Id { get; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double IterationAccuracy { get; set; }
|
public double IterationAccuracy { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public int MaxIterationCount { get; set; }
|
public int MaxIterationCount { get; set; }
|
||||||
|
public Accuracy(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Accuracy() : this (Guid.NewGuid())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ namespace StructureHelperCommon.Models.Calculators
|
|||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public FindParameterCalculator()
|
public FindParameterCalculator()
|
||||||
{
|
{
|
||||||
InputData = new FindParameterCalculatorInputData();
|
InputData = new FindParameterCalculatorInputData();
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
namespace StructureHelperCommon.Models.Calculators
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rate of calculation which based on iteration of finished accuracy
|
/// Rate of calculation which based on iteration of finished accuracy
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IAccuracy
|
public interface IAccuracy : ISaveable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Max accuracy of iteration
|
/// Max accuracy of iteration
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Calculators
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
public interface ICalculator : ILogic, ICloneable
|
public interface ICalculator : ILogic, ISaveable, ICloneable
|
||||||
{
|
{
|
||||||
string Name { get; set; }
|
string Name { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace StructureHelperCommon.Models.Sections
|
using System;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Sections
|
||||||
{
|
{
|
||||||
|
|
||||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||||
@@ -9,29 +11,30 @@
|
|||||||
{
|
{
|
||||||
static readonly CompressedMemberUpdateStrategy updateStrategy = new();
|
static readonly CompressedMemberUpdateStrategy updateStrategy = new();
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool Buckling { get; set; }
|
public Guid Id { get;}
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double GeometryLength { get; set; }
|
public bool Buckling { get; set; } = true;
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double LengthFactorX { get; set; }
|
public double GeometryLength { get; set; } = 3d;
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double DiagramFactorX { get; set; }
|
public double LengthFactorX { get; set; } = 1d;
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double LengthFactorY { get; set; }
|
public double DiagramFactorX { get; set; } = 1d;
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double DiagramFactorY { get; set; }
|
public double LengthFactorY { get; set; } = 1d;
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public double DiagramFactorY { get; set; } = 1d;
|
||||||
|
|
||||||
|
public CompressedMember(Guid id)
|
||||||
public CompressedMember()
|
|
||||||
{
|
{
|
||||||
Buckling = true;
|
Id = id;
|
||||||
GeometryLength = 3d;
|
|
||||||
LengthFactorX = 1d;
|
|
||||||
DiagramFactorX = 1d;
|
|
||||||
LengthFactorY = 1d;
|
|
||||||
DiagramFactorY = 1d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CompressedMember() : this(Guid.NewGuid())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var newItem = new CompressedMember();
|
var newItem = new CompressedMember();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Sections
|
namespace StructureHelperCommon.Models.Sections
|
||||||
{
|
{
|
||||||
@@ -9,7 +10,7 @@ namespace StructureHelperCommon.Models.Sections
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface of properties for compressed strucrue members
|
/// Interface of properties for compressed strucrue members
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ICompressedMember : ICloneable
|
public interface ICompressedMember : ISaveable, ICloneable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flag of considering of buckling
|
/// Flag of considering of buckling
|
||||||
|
|||||||
@@ -10,9 +10,5 @@
|
|||||||
/// Height of rectangle, m
|
/// Height of rectangle, m
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double Height { get; set; }
|
double Height { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// Angle of rotating rectangle, rad
|
|
||||||
/// </summary>
|
|
||||||
double Angle { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ namespace StructureHelperCommon.Models.Shapes
|
|||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
targetObject.Width = sourceObject.Width;
|
targetObject.Width = sourceObject.Width;
|
||||||
targetObject.Height = sourceObject.Height;
|
targetObject.Height = sourceObject.Height;
|
||||||
targetObject.Angle = sourceObject.Angle;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ namespace StructureHelperCommon.Models.Shapes
|
|||||||
public double Width { get; set; }
|
public double Width { get; set; }
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public double Height { get; set; }
|
public double Height { get; set; }
|
||||||
/// <inheritdoc />
|
|
||||||
public double Angle { get; set; }
|
|
||||||
|
|
||||||
public RectangleShape(Guid id)
|
public RectangleShape(Guid id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ namespace StructureHelperCommon.Models.Soils
|
|||||||
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||||
public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public AnchorCalculator(SoilAnchor soilAnchor, IAnchorSoilProperties anchorSoilProperties)
|
public AnchorCalculator(SoilAnchor soilAnchor, IAnchorSoilProperties anchorSoilProperties)
|
||||||
{
|
{
|
||||||
Anchor = soilAnchor;
|
Anchor = soilAnchor;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
public class CircleGeometryLogic : IRCGeometryLogic
|
public class CircleGeometryLogic : IRCGeometryLogic
|
||||||
{
|
{
|
||||||
ICircleTemplate template;
|
ICircleTemplate template;
|
||||||
EllipsePrimitive concreteBlock;
|
EllipseNdmPrimitive concreteBlock;
|
||||||
|
|
||||||
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
var diameter = template.Shape.Diameter;
|
var diameter = template.Shape.Diameter;
|
||||||
var concreteMaterial = HeadMaterials.ToList()[0];
|
var concreteMaterial = HeadMaterials.ToList()[0];
|
||||||
var primitives = new List<INdmPrimitive>();
|
var primitives = new List<INdmPrimitive>();
|
||||||
concreteBlock = new EllipsePrimitive() { Width = diameter, Name = "Concrete block"};
|
concreteBlock = new EllipseNdmPrimitive() { Width = diameter, Name = "Concrete block"};
|
||||||
concreteBlock.NdmElement.HeadMaterial = concreteMaterial;
|
concreteBlock.NdmElement.HeadMaterial = concreteMaterial;
|
||||||
primitives.Add(concreteBlock);
|
primitives.Add(concreteBlock);
|
||||||
return primitives;
|
return primitives;
|
||||||
@@ -53,7 +53,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
var angle = i * dAngle;
|
var angle = i * dAngle;
|
||||||
var x = radius * Math.Sin(angle);
|
var x = radius * Math.Sin(angle);
|
||||||
var y = radius * Math.Cos(angle);
|
var y = radius * Math.Cos(angle);
|
||||||
var point = new RebarPrimitive()
|
var point = new RebarNdmPrimitive()
|
||||||
{
|
{
|
||||||
Area = barArea,
|
Area = barArea,
|
||||||
Name = "Left bottom point",
|
Name = "Left bottom point",
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
IRectangleBeamTemplate template;
|
IRectangleBeamTemplate template;
|
||||||
IHeadMaterial concrete => HeadMaterials.ToList()[0];
|
IHeadMaterial concrete => HeadMaterials.ToList()[0];
|
||||||
IHeadMaterial reinforcement => HeadMaterials.ToList()[1];
|
IHeadMaterial reinforcement => HeadMaterials.ToList()[1];
|
||||||
RectanglePrimitive concreteBlock;
|
RectangleNdmPrimitive concreteBlock;
|
||||||
|
|
||||||
RectangleShape rect => template.Shape as RectangleShape;
|
RectangleShape rect => template.Shape as RectangleShape;
|
||||||
double width => rect.Width;
|
double width => rect.Width;
|
||||||
@@ -48,7 +48,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
|
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
|
||||||
{
|
{
|
||||||
var primitives = new List<INdmPrimitive>();
|
var primitives = new List<INdmPrimitive>();
|
||||||
concreteBlock = new RectanglePrimitive() { Width = width, Height = height, Name = "Concrete block" };
|
concreteBlock = new RectangleNdmPrimitive() { Width = width, Height = height, Name = "Concrete block" };
|
||||||
concreteBlock.NdmElement.HeadMaterial = concrete;
|
concreteBlock.NdmElement.HeadMaterial = concrete;
|
||||||
primitives.Add(concreteBlock);
|
primitives.Add(concreteBlock);
|
||||||
return primitives;
|
return primitives;
|
||||||
@@ -60,7 +60,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||||
|
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
var point = new RebarPrimitive()
|
var point = new RebarNdmPrimitive()
|
||||||
{
|
{
|
||||||
Area = area1,
|
Area = area1,
|
||||||
Name = "Left bottom rebar",
|
Name = "Left bottom rebar",
|
||||||
@@ -71,7 +71,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
point.Center.X = xs[0];
|
point.Center.X = xs[0];
|
||||||
point.Center.Y = ys[0];
|
point.Center.Y = ys[0];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new RebarPrimitive()
|
point = new RebarNdmPrimitive()
|
||||||
{
|
{
|
||||||
Area = area1,
|
Area = area1,
|
||||||
Name = "Right bottom rebar",
|
Name = "Right bottom rebar",
|
||||||
@@ -81,7 +81,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
point.Center.X = xs[1];
|
point.Center.X = xs[1];
|
||||||
point.Center.Y = ys[0];
|
point.Center.Y = ys[0];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new RebarPrimitive()
|
point = new RebarNdmPrimitive()
|
||||||
{
|
{
|
||||||
Area = area2,
|
Area = area2,
|
||||||
Name = "Left top rebar",
|
Name = "Left top rebar",
|
||||||
@@ -91,7 +91,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
point.Center.X = xs[0];
|
point.Center.X = xs[0];
|
||||||
point.Center.Y = ys[1];
|
point.Center.Y = ys[1];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new RebarPrimitive()
|
point = new RebarNdmPrimitive()
|
||||||
{
|
{
|
||||||
Area = area2,
|
Area = area2,
|
||||||
Name = "Right top rebar",
|
Name = "Right top rebar",
|
||||||
@@ -110,14 +110,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
double[] ys = new double[] { -height / 2 + gap, height / 2 - gap };
|
||||||
|
|
||||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||||
IPointPrimitive point;
|
IPointNdmPrimitive point;
|
||||||
if (template.WidthCount > 2)
|
if (template.WidthCount > 2)
|
||||||
{
|
{
|
||||||
int count = template.WidthCount - 1;
|
int count = template.WidthCount - 1;
|
||||||
double dist = (xs[1] - xs[0]) / count;
|
double dist = (xs[1] - xs[0]) / count;
|
||||||
for (int i = 1; i < count; i++)
|
for (int i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
point = new RebarPrimitive()
|
point = new RebarNdmPrimitive()
|
||||||
{
|
{
|
||||||
Area = area1,
|
Area = area1,
|
||||||
Name = $"Bottom rebar {i}",
|
Name = $"Bottom rebar {i}",
|
||||||
@@ -127,7 +127,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
point.Center.X = xs[0] + dist * i;
|
point.Center.X = xs[0] + dist * i;
|
||||||
point.Center.Y = ys[0];
|
point.Center.Y = ys[0];
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new RebarPrimitive()
|
point = new RebarNdmPrimitive()
|
||||||
{
|
{
|
||||||
Area = area2,
|
Area = area2,
|
||||||
Name = $"Top rebar {i}",
|
Name = $"Top rebar {i}",
|
||||||
@@ -145,7 +145,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
double dist = (ys[1] - ys[0]) / count;
|
double dist = (ys[1] - ys[0]) / count;
|
||||||
for (int i = 1; i < count; i++)
|
for (int i = 1; i < count; i++)
|
||||||
{
|
{
|
||||||
point = new RebarPrimitive()
|
point = new RebarNdmPrimitive()
|
||||||
{
|
{
|
||||||
Area = area1,
|
Area = area1,
|
||||||
Name = $"Left point {i}",
|
Name = $"Left point {i}",
|
||||||
@@ -155,7 +155,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
|||||||
point.Center.X = xs[0];
|
point.Center.X = xs[0];
|
||||||
point.Center.Y = ys[0] + dist * i;
|
point.Center.Y = ys[0] + dist * i;
|
||||||
primitives.Add(point);
|
primitives.Add(point);
|
||||||
point = new RebarPrimitive()
|
point = new RebarNdmPrimitive()
|
||||||
{
|
{
|
||||||
Area = area1,
|
Area = area1,
|
||||||
Name = $"Right point {i}",
|
Name = $"Right point {i}",
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
internal class CheckForceCalculatorInputData : ICheckInputDataLogic<IForceInputData>
|
internal class CheckForceCalculatorInputData : ICheckInputDataLogic<IForceCalculatorInputData>
|
||||||
{
|
{
|
||||||
private bool result;
|
private bool result;
|
||||||
private string checkResult;
|
private string checkResult;
|
||||||
private ICheckEntityLogic<IAccuracy> checkAccuracyLogic;
|
private ICheckEntityLogic<IAccuracy> checkAccuracyLogic;
|
||||||
|
|
||||||
public IForceInputData InputData { get; set; }
|
public IForceCalculatorInputData InputData { get; set; }
|
||||||
|
|
||||||
public string CheckResult => checkResult;
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
|
|||||||
@@ -6,29 +6,35 @@ using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public class ForceCalculator : ICalculator, IHasActionByResult
|
public class ForceCalculator : IForceCalculator
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<ForceCalculator> updateStrategy;
|
private IUpdateStrategy<IForceCalculator> updateStrategy;
|
||||||
private ICheckInputDataLogic<IForceInputData> checkInputDataLogic;
|
private ICheckInputDataLogic<IForceCalculatorInputData> checkInputDataLogic;
|
||||||
private IForceCalculatorLogic forceCalculatorLogic;
|
private IForceCalculatorLogic forceCalculatorLogic;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public Guid Id { get; } = Guid.NewGuid();
|
||||||
|
/// <inheritdoc/>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public ForceInputData InputData {get;set;}
|
/// <inheritdoc/>
|
||||||
|
public IForceCalculatorInputData InputData { get; set; } = new ForceCalculatorInputData();
|
||||||
|
/// <inheritdoc/>
|
||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public IResult Result { get; private set; }
|
public IResult Result { get; private set; }
|
||||||
|
|
||||||
public ForceCalculator(ICheckInputDataLogic<IForceInputData> checkInputDataLogic,
|
|
||||||
|
public ForceCalculator(
|
||||||
|
ICheckInputDataLogic<IForceCalculatorInputData> checkInputDataLogic,
|
||||||
IForceCalculatorLogic forceCalculatorLogic,
|
IForceCalculatorLogic forceCalculatorLogic,
|
||||||
IUpdateStrategy<ForceCalculator> updateStrategy
|
IUpdateStrategy<IForceCalculator> updateStrategy
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.checkInputDataLogic = checkInputDataLogic;
|
this.checkInputDataLogic = checkInputDataLogic;
|
||||||
this.forceCalculatorLogic = forceCalculatorLogic;
|
this.forceCalculatorLogic = forceCalculatorLogic;
|
||||||
this.updateStrategy = updateStrategy;
|
this.updateStrategy = updateStrategy;
|
||||||
|
|
||||||
InputData = new ForceInputData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForceCalculator() :
|
public ForceCalculator() :
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Sections;
|
||||||
|
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
|
{
|
||||||
|
public class ForceCalculatorInputData : IForceCalculatorInputData
|
||||||
|
{
|
||||||
|
public Guid Id { get; }
|
||||||
|
public List<LimitStates> LimitStatesList { get; private set; } = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS};
|
||||||
|
public List<CalcTerms> CalcTermsList { get; private set; } = new List<CalcTerms>() {CalcTerms.ShortTerm, CalcTerms.LongTerm};
|
||||||
|
public List<IForceAction> ForceActions { get; private set; } = new();
|
||||||
|
public List<INdmPrimitive> Primitives { get; private set; } = new();
|
||||||
|
public ICompressedMember CompressedMember { get; set; } = new CompressedMember() { Buckling = false};
|
||||||
|
public IAccuracy Accuracy { get; set; } = new Accuracy() {IterationAccuracy = 0.001d, MaxIterationCount = 1000};
|
||||||
|
public List<IForceCombinationList> ForceCombinationLists { get; set; }
|
||||||
|
|
||||||
|
public ForceCalculatorInputData(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCalculatorInputData() : this (Guid.NewGuid())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public class ForceCalculatorInputDataUpdateStrategy : IUpdateStrategy<ForceInputData>
|
public class ForceCalculatorInputDataUpdateStrategy : IUpdateStrategy<IForceCalculatorInputData>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<IHasPrimitives> primitivesUpdateStrategy;
|
private IUpdateStrategy<IHasPrimitives> primitivesUpdateStrategy;
|
||||||
private IUpdateStrategy<IHasForceCombinations> forceCombinationUpdateStrategy;
|
private IUpdateStrategy<IHasForceCombinations> forceCombinationUpdateStrategy;
|
||||||
@@ -39,7 +39,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public void Update(ForceInputData targetObject, ForceInputData sourceObject)
|
public void Update(IForceCalculatorInputData targetObject, IForceCalculatorInputData sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.IsNull(targetObject, sourceObject, "Force calculator input data");
|
CheckObject.IsNull(targetObject, sourceObject, "Force calculator input data");
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
||||||
private ForceTupleBucklingLogic bucklingLogic;
|
private ForceTupleBucklingLogic bucklingLogic;
|
||||||
private ITriangulatePrimitiveLogic triangulateLogic;
|
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||||
public IForceInputData InputData { get; set; }
|
public IForceCalculatorInputData InputData { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
|
||||||
using StructureHelperCommon.Models.Calculators;
|
|
||||||
using StructureHelperCommon.Models.Forces;
|
|
||||||
using StructureHelperCommon.Models.Sections;
|
|
||||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|
||||||
{
|
|
||||||
public class ForceInputData : IForceInputData
|
|
||||||
{
|
|
||||||
public List<LimitStates> LimitStatesList { get; private set; }
|
|
||||||
public List<CalcTerms> CalcTermsList { get; private set; }
|
|
||||||
public List<IForceAction> ForceActions { get; private set; }
|
|
||||||
public List<INdmPrimitive> Primitives { get; private set; }
|
|
||||||
public ICompressedMember CompressedMember { get; set; }
|
|
||||||
public IAccuracy Accuracy { get; set; }
|
|
||||||
public List<IForceCombinationList> ForceCombinationLists { get; set; }
|
|
||||||
|
|
||||||
public ForceInputData()
|
|
||||||
{
|
|
||||||
ForceActions = new List<IForceAction>();
|
|
||||||
ForceCombinationLists = new List<IForceCombinationList>();
|
|
||||||
Primitives = new List<INdmPrimitive>();
|
|
||||||
CompressedMember = new CompressedMember()
|
|
||||||
{
|
|
||||||
Buckling = false
|
|
||||||
};
|
|
||||||
Accuracy = new Accuracy()
|
|
||||||
{
|
|
||||||
IterationAccuracy = 0.001d,
|
|
||||||
MaxIterationCount = 1000
|
|
||||||
};
|
|
||||||
LimitStatesList = new List<LimitStates>()
|
|
||||||
{
|
|
||||||
LimitStates.ULS,
|
|
||||||
LimitStates.SLS
|
|
||||||
};
|
|
||||||
CalcTermsList = new List<CalcTerms>()
|
|
||||||
{
|
|
||||||
CalcTerms.ShortTerm,
|
|
||||||
CalcTerms.LongTerm
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,6 +28,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public ForceTupleCalculator(ICheckInputDataLogic<IForceTupleInputData> checkInputDataLogic, IForceTupleCalcLogic calcLogic)
|
public ForceTupleCalculator(ICheckInputDataLogic<IForceTupleInputData> checkInputDataLogic, IForceTupleCalcLogic calcLogic)
|
||||||
{
|
{
|
||||||
this.checkInputDataLogic = checkInputDataLogic;
|
this.checkInputDataLogic = checkInputDataLogic;
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
|
{
|
||||||
|
public interface IForceCalculator : ICalculator, IHasActionByResult
|
||||||
|
{
|
||||||
|
IForceCalculatorInputData InputData { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ using StructureHelperLogics.NdmCalculations.Primitives;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public interface IForceInputData : IInputData, IHasPrimitives, IHasForceCombinations
|
public interface IForceCalculatorInputData : IInputData, ISaveable, IHasPrimitives, IHasForceCombinations
|
||||||
{
|
{
|
||||||
IAccuracy Accuracy { get; set; }
|
IAccuracy Accuracy { get; set; }
|
||||||
List<CalcTerms> CalcTermsList { get; }
|
List<CalcTerms> CalcTermsList { get; }
|
||||||
@@ -10,7 +10,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
{
|
{
|
||||||
public interface IForceCalculatorLogic : ILogic, IHasActionByResult
|
public interface IForceCalculatorLogic : ILogic, IHasActionByResult
|
||||||
{
|
{
|
||||||
IForceInputData InputData { get; set; }
|
IForceCalculatorInputData InputData { get; set; }
|
||||||
ForcesResults GetForcesResults();
|
ForcesResults GetForcesResults();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public LimitCurveCalculator(ILimitCurveLogic limitCurveLogic)
|
public LimitCurveCalculator(ILimitCurveLogic limitCurveLogic)
|
||||||
{
|
{
|
||||||
this.limitCurveLogic = limitCurveLogic;
|
this.limitCurveLogic = limitCurveLogic;
|
||||||
|
|||||||
@@ -5,20 +5,21 @@ using StructureHelperCommon.Services;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||||
{
|
{
|
||||||
public class ForceCalculatorUpdateStrategy : IUpdateStrategy<ForceCalculator>
|
public class ForceCalculatorUpdateStrategy : IUpdateStrategy<IForceCalculator>
|
||||||
{
|
{
|
||||||
private readonly IUpdateStrategy<ForceInputData> inputDataUpdateStrategy;
|
private readonly IUpdateStrategy<IForceCalculatorInputData> inputDataUpdateStrategy;
|
||||||
public ForceCalculatorUpdateStrategy(IUpdateStrategy<ForceInputData> inputDataUpdateStrategy)
|
public ForceCalculatorUpdateStrategy(IUpdateStrategy<IForceCalculatorInputData> inputDataUpdateStrategy)
|
||||||
{
|
{
|
||||||
this.inputDataUpdateStrategy = inputDataUpdateStrategy;
|
this.inputDataUpdateStrategy = inputDataUpdateStrategy;
|
||||||
}
|
}
|
||||||
public ForceCalculatorUpdateStrategy() : this(new ForceCalculatorInputDataUpdateStrategy()) { }
|
public ForceCalculatorUpdateStrategy() : this(new ForceCalculatorInputDataUpdateStrategy()) { }
|
||||||
public void Update(ForceCalculator targetObject, ForceCalculator sourceObject)
|
public void Update(IForceCalculator targetObject, IForceCalculator sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.IsNull(targetObject, sourceObject);
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
targetObject.Name = sourceObject.Name;
|
targetObject.Name = sourceObject.Name;
|
||||||
targetObject.InputData ??= new ForceInputData();
|
targetObject.InputData ??= new ForceCalculatorInputData();
|
||||||
inputDataUpdateStrategy.Update(targetObject.InputData, sourceObject.InputData);
|
inputDataUpdateStrategy.Update(targetObject.InputData, sourceObject.InputData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
|
|||||||
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||||
public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
|
||||||
{
|
{
|
||||||
parametersLogic = new TextParametersLogic(ndms, strainMatrix);
|
parametersLogic = new TextParametersLogic(ndms, strainMatrix);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
|||||||
public static class InputDataFactory
|
public static class InputDataFactory
|
||||||
{
|
{
|
||||||
private static IStressLogic stressLogic => new StressLogic();
|
private static IStressLogic stressLogic => new StressLogic();
|
||||||
public static IAnchorageInputData GetInputData(RebarPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
|
public static IAnchorageInputData GetInputData(RebarNdmPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
|
||||||
{
|
{
|
||||||
var inputData = new AnchorageInputData();
|
var inputData = new AnchorageInputData();
|
||||||
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive);
|
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive);
|
||||||
@@ -47,7 +47,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
|||||||
return inputData;
|
return inputData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
|
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, RebarNdmPrimitive primitive)
|
||||||
{
|
{
|
||||||
if (primitive.HostPrimitive is not null)
|
if (primitive.HostPrimitive is not null)
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
|
|||||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host material is incorrect or null");
|
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host material is incorrect or null");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, RebarPrimitive primitive)
|
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, RebarNdmPrimitive primitive)
|
||||||
{
|
{
|
||||||
if (primitive.NdmElement.HeadMaterial.HelperMaterial is IReinforcementLibMaterial)
|
if (primitive.NdmElement.HeadMaterial.HelperMaterial is IReinforcementLibMaterial)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
|||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
private (double EtaAlongX, double EtaAlongY) GetBucklingCoefficients()
|
private (double EtaAlongX, double EtaAlongY) GetBucklingCoefficients()
|
||||||
{
|
{
|
||||||
var (DX, DY) = GetStiffness();
|
var (DX, DY) = GetStiffness();
|
||||||
|
|||||||
@@ -25,11 +25,15 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
private IUpdateStrategy<ICrackCalculator> updateStrategy;
|
private IUpdateStrategy<ICrackCalculator> updateStrategy;
|
||||||
private ICheckInputDataLogic<ICrackCalculatorInputData> checkInputDataLogic;
|
private ICheckInputDataLogic<ICrackCalculatorInputData> checkInputDataLogic;
|
||||||
|
|
||||||
|
public Guid Id { get; } = Guid.NewGuid();
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public ICrackCalculatorInputData InputData { get; set; }
|
public ICrackCalculatorInputData InputData { get; set; }
|
||||||
public IResult Result => result;
|
public IResult Result => result;
|
||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public CrackCalculator(ICheckInputDataLogic<ICrackCalculatorInputData> checkInputDataLogic,
|
public CrackCalculator(ICheckInputDataLogic<ICrackCalculatorInputData> checkInputDataLogic,
|
||||||
IUpdateStrategy<ICrackCalculator> updateStrategy,
|
IUpdateStrategy<ICrackCalculator> updateStrategy,
|
||||||
IShiftTraceLogger traceLogger
|
IShiftTraceLogger traceLogger
|
||||||
|
|||||||
@@ -12,16 +12,16 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
public class CrackCalculatorInputData : ICrackCalculatorInputData
|
public class CrackCalculatorInputData : ICrackCalculatorInputData
|
||||||
{
|
{
|
||||||
|
public Guid Id { get; } = new();
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public List<INdmPrimitive> Primitives { get; private set; }
|
public List<INdmPrimitive> Primitives { get; private set; } = new();
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public List<IForceAction> ForceActions { get; private set; }
|
public List<IForceAction> ForceActions { get; private set; } = new();
|
||||||
public IUserCrackInputData UserCrackInputData { get; set; }
|
public IUserCrackInputData UserCrackInputData { get; set; } = GetNewUserData();
|
||||||
public CrackCalculatorInputData()
|
|
||||||
|
private static UserCrackInputData GetNewUserData()
|
||||||
{
|
{
|
||||||
Primitives = new();
|
return new UserCrackInputData()
|
||||||
ForceActions = new();
|
|
||||||
UserCrackInputData = new UserCrackInputData()
|
|
||||||
{
|
{
|
||||||
SetSofteningFactor = true,
|
SetSofteningFactor = true,
|
||||||
SofteningFactor = 1d,
|
SofteningFactor = 1d,
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
public CrackCalculatorUpdateStrategy() : this(new CrackInputDataUpdateStrategy()) { }
|
public CrackCalculatorUpdateStrategy() : this(new CrackInputDataUpdateStrategy()) { }
|
||||||
public void Update(ICrackCalculator targetObject, ICrackCalculator sourceObject)
|
public void Update(ICrackCalculator targetObject, ICrackCalculator sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
|
||||||
targetObject.Name = sourceObject.Name;
|
targetObject.Name = sourceObject.Name;
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public CrackForceBynarySearchCalculator(
|
public CrackForceBynarySearchCalculator(
|
||||||
IIsSectionCrackedByFactorLogic crackedByFactorLogic,
|
IIsSectionCrackedByFactorLogic crackedByFactorLogic,
|
||||||
ICheckInputDataLogic<ICrackForceCalculatorInputData> checkInputDataLogic
|
ICheckInputDataLogic<ICrackForceCalculatorInputData> checkInputDataLogic
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
}
|
}
|
||||||
public void Update(ICrackCalculatorInputData targetObject, ICrackCalculatorInputData sourceObject)
|
public void Update(ICrackCalculatorInputData targetObject, ICrackCalculatorInputData sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
targetObject.ForceActions.Clear();
|
targetObject.ForceActions.Clear();
|
||||||
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
|
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
|
||||||
|
|||||||
@@ -70,14 +70,14 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public List<IRebarPrimitive> GetRebarPrimitives()
|
public List<IRebarNdmPrimitive> GetRebarPrimitives()
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
|
||||||
List<IRebarPrimitive> rebarPrimitives = new();
|
List<IRebarNdmPrimitive> rebarPrimitives = new();
|
||||||
foreach (var item in NdmPrimitives)
|
foreach (var item in NdmPrimitives)
|
||||||
{
|
{
|
||||||
if (item is IRebarPrimitive rebar)
|
if (item is IRebarNdmPrimitive rebar)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Primitive {rebar.Name} is rebar primitive", TraceLogStatuses.Service);
|
TraceLogger?.AddMessage($"Primitive {rebar.Name} is rebar primitive", TraceLogStatuses.Service);
|
||||||
rebarPrimitives.Add(rebar);
|
rebarPrimitives.Add(rebar);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using StructureHelperLogics.NdmCalculations.Primitives;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public interface ICrackCalculatorInputData : IInputData, IHasPrimitives, IHasForceCombinations
|
public interface ICrackCalculatorInputData : IInputData, IHasPrimitives, IHasForceCombinations, ISaveable
|
||||||
{
|
{
|
||||||
List<IForceAction> ForceActions { get; }
|
List<IForceAction> ForceActions { get; }
|
||||||
List<INdmPrimitive> Primitives { get; }
|
List<INdmPrimitive> Primitives { get; }
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// Return collection of primitives which contain only rebars
|
/// Return collection of primitives which contain only rebars
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<IRebarPrimitive> GetRebarPrimitives();
|
List<IRebarNdmPrimitive> GetRebarPrimitives();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
TupleCrackInputData InputData { get; set; }
|
TupleCrackInputData InputData { get; set; }
|
||||||
double LongLength { get; set; }
|
double LongLength { get; set; }
|
||||||
IEnumerable<IRebarPrimitive> Rebars { get; set; }
|
IEnumerable<IRebarNdmPrimitive> Rebars { get; set; }
|
||||||
double ShortLength { get; set; }
|
double ShortLength { get; set; }
|
||||||
|
|
||||||
List<IRebarCrackCalculator> GetCalculators();
|
List<IRebarCrackCalculator> GetCalculators();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rebar primitive
|
/// Rebar primitive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IRebarPrimitive RebarPrimitive { get; set; }
|
IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User settings for crack calculations
|
/// User settings for crack calculations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
public interface IRebarCrackInputDataFactory
|
public interface IRebarCrackInputDataFactory
|
||||||
{
|
{
|
||||||
IRebarPrimitive Rebar { get; set; }
|
IRebarNdmPrimitive Rebar { get; set; }
|
||||||
TupleCrackInputData InputData { get; set; }
|
TupleCrackInputData InputData { get; set; }
|
||||||
double LongLength { get; set; }
|
double LongLength { get; set; }
|
||||||
double ShortLength { get; set; }
|
double ShortLength { get; set; }
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rebar which stress and strain will be obtained for
|
/// Rebar which stress and strain will be obtained for
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IRebarPrimitive RebarPrimitive { get; set; }
|
IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
public interface IRebarStressResultLogic : ILogic
|
public interface IRebarStressResultLogic : ILogic
|
||||||
{
|
{
|
||||||
IRebarCrackInputData RebarCrackInputData { get; set; }
|
IRebarCrackInputData RebarCrackInputData { get; set; }
|
||||||
IRebarPrimitive RebarPrimitive { get; set; }
|
IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||||
|
|
||||||
IRebarStressResult GetRebarStressResult();
|
IRebarStressResult GetRebarStressResult();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
TupleCrackInputData InputData { get; set; }
|
TupleCrackInputData InputData { get; set; }
|
||||||
bool IsResultValid { get; }
|
bool IsResultValid { get; }
|
||||||
double LongLength { get; set; }
|
double LongLength { get; set; }
|
||||||
IEnumerable<IRebarPrimitive> Rebars { get; set; }
|
IEnumerable<IRebarNdmPrimitive> Rebars { get; set; }
|
||||||
List<RebarCrackResult> Result { get; }
|
List<RebarCrackResult> Result { get; }
|
||||||
double ShortLength { get; set; }
|
double ShortLength { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public interface IUserCrackInputData : IInputData
|
public interface IUserCrackInputData : IInputData, ISaveable
|
||||||
{
|
{
|
||||||
double LengthBetweenCracks { get; set; }
|
double LengthBetweenCracks { get; set; }
|
||||||
bool SetLengthBetweenCracks { get; set; }
|
bool SetLengthBetweenCracks { get; set; }
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
private IRebarCrackInputDataFactory inputFactory;
|
private IRebarCrackInputDataFactory inputFactory;
|
||||||
|
|
||||||
public IEnumerable<IRebarPrimitive> Rebars { get; set; }
|
public IEnumerable<IRebarNdmPrimitive> Rebars { get; set; }
|
||||||
public TupleCrackInputData InputData { get; set; }
|
public TupleCrackInputData InputData { get; set; }
|
||||||
public double LongLength { get; set; }
|
public double LongLength { get; set; }
|
||||||
public double ShortLength { get; set; }
|
public double ShortLength { get; set; }
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public RebarCrackCalculator(ICheckInputDataLogic<IRebarCrackCalculatorInputData> checkInputDataLogic,
|
public RebarCrackCalculator(ICheckInputDataLogic<IRebarCrackCalculatorInputData> checkInputDataLogic,
|
||||||
ICrackWidthCalculationLogic crackWidthCalculationLogic,
|
ICrackWidthCalculationLogic crackWidthCalculationLogic,
|
||||||
IShiftTraceLogger? traceLogger)
|
IShiftTraceLogger? traceLogger)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IRebarCrackInputData? ShortRebarData { get; set; }
|
public IRebarCrackInputData? ShortRebarData { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IRebarPrimitive RebarPrimitive { get; set; }
|
public IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IUserCrackInputData? UserCrackInputData { get; set; }
|
public IUserCrackInputData? UserCrackInputData { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRebarPrimitive Rebar { get; set; }
|
public IRebarNdmPrimitive Rebar { get; set; }
|
||||||
public TupleCrackInputData InputData { get; set; }
|
public TupleCrackInputData InputData { get; set; }
|
||||||
public double LongLength { get; set; }
|
public double LongLength { get; set; }
|
||||||
public double ShortLength { get; set; }
|
public double ShortLength { get; set; }
|
||||||
@@ -41,9 +41,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
IEnumerable<INdm> crackableNdmsLoc = null;
|
IEnumerable<INdm> crackableNdmsLoc = null;
|
||||||
IEnumerable<INdm> crackedNdmsLoc = null;
|
IEnumerable<INdm> crackedNdmsLoc = null;
|
||||||
INdm concreteNdmUnderRebar;
|
INdm concreteNdmUnderRebar;
|
||||||
RebarPrimitive rebarCopy = null;
|
RebarNdmPrimitive rebarCopy = null;
|
||||||
|
|
||||||
rebarCopy = Rebar.Clone() as RebarPrimitive;
|
rebarCopy = Rebar.Clone() as RebarNdmPrimitive;
|
||||||
rebarCopy.NdmElement.HeadMaterial = rebarCopy.NdmElement.HeadMaterial.Clone() as IHeadMaterial;
|
rebarCopy.NdmElement.HeadMaterial = rebarCopy.NdmElement.HeadMaterial.Clone() as IHeadMaterial;
|
||||||
triangulationLogicLoc = new CrackedSectionTriangulationLogic(InputData.Primitives);
|
triangulationLogicLoc = new CrackedSectionTriangulationLogic(InputData.Primitives);
|
||||||
crackableNdmsLoc = triangulationLogicLoc.GetNdmCollection();
|
crackableNdmsLoc = triangulationLogicLoc.GetNdmCollection();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specific rebar primitive
|
/// Specific rebar primitive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IRebarPrimitive RebarPrimitive { get; set; }
|
public IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Result of calculation of crack for long term
|
/// Result of calculation of crack for long term
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public RebarStressCalculator(IStressLogic stressLogic)
|
public RebarStressCalculator(IStressLogic stressLogic)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IRebarPrimitive RebarPrimitive { get; set; }
|
public IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
public class RebarStressResultLogic : IRebarStressResultLogic
|
public class RebarStressResultLogic : IRebarStressResultLogic
|
||||||
{
|
{
|
||||||
private IRebarStressCalculator rebarStressCalculator;
|
private IRebarStressCalculator rebarStressCalculator;
|
||||||
public IRebarPrimitive RebarPrimitive { get; set; }
|
public IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||||
public IRebarCrackInputData RebarCrackInputData { get; set; }
|
public IRebarCrackInputData RebarCrackInputData { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
private double rebarActualStress;
|
private double rebarActualStress;
|
||||||
private double softeningFactor;
|
private double softeningFactor;
|
||||||
private double minValueOfFactor = 0.2d;
|
private double minValueOfFactor = 0.2d;
|
||||||
private IRebarPrimitive rebarPrimitive;
|
private IRebarNdmPrimitive rebarPrimitive;
|
||||||
private IRebarCrackInputData inputData;
|
private IRebarCrackInputData inputData;
|
||||||
|
|
||||||
public double MinValueOfFactor
|
public double MinValueOfFactor
|
||||||
@@ -48,7 +48,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
IsResultActual = false;
|
IsResultActual = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public IRebarPrimitive RebarPrimitive
|
public IRebarNdmPrimitive RebarPrimitive
|
||||||
{
|
{
|
||||||
get => rebarPrimitive; set
|
get => rebarPrimitive; set
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
private TupleCrackResult result;
|
private TupleCrackResult result;
|
||||||
private ICrackedSectionTriangulationLogic triangulationLogic;
|
private ICrackedSectionTriangulationLogic triangulationLogic;
|
||||||
private ITupleRebarsCrackSolver solver;
|
private ITupleRebarsCrackSolver solver;
|
||||||
private List<IRebarPrimitive>? rebarPrimitives;
|
private List<IRebarNdmPrimitive>? rebarPrimitives;
|
||||||
private IEnumerable<INdm> crackableNdms;
|
private IEnumerable<INdm> crackableNdms;
|
||||||
private IEnumerable<INdm> crackedNdms;
|
private IEnumerable<INdm> crackedNdms;
|
||||||
private IEnumerable<INdm> elasticNdms;
|
private IEnumerable<INdm> elasticNdms;
|
||||||
@@ -43,6 +43,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Guid Id => throw new NotImplementedException();
|
||||||
|
|
||||||
public TupleCrackCalculator(ICheckInputDataLogic<TupleCrackInputData> checkInputDataLogic,
|
public TupleCrackCalculator(ICheckInputDataLogic<TupleCrackInputData> checkInputDataLogic,
|
||||||
ILengthBetweenCracksLogic lengthLogic, ICrackedSectionTriangulationLogic triangulationLogic, ITupleRebarsCrackSolver solver)
|
ILengthBetweenCracksLogic lengthLogic, ICrackedSectionTriangulationLogic triangulationLogic, ITupleRebarsCrackSolver solver)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
private IRebarCalulatorsFactory calculatorsFactory;
|
private IRebarCalulatorsFactory calculatorsFactory;
|
||||||
|
|
||||||
public IEnumerable<IRebarPrimitive> Rebars { get; set; }
|
public IEnumerable<IRebarNdmPrimitive> Rebars { get; set; }
|
||||||
public TupleCrackInputData InputData { get; set; }
|
public TupleCrackInputData InputData { get; set; }
|
||||||
public double LongLength { get; set; }
|
public double LongLength { get; set; }
|
||||||
public double ShortLength { get; set; }
|
public double ShortLength { get; set; }
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserCrackInputData : IUserCrackInputData
|
public class UserCrackInputData : IUserCrackInputData
|
||||||
{
|
{
|
||||||
|
public Guid Id { get; } = new();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flag of assigning of user value of softening factor
|
/// Flag of assigning of user value of softening factor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -36,5 +37,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// Ultimate short-term crack width, m
|
/// Ultimate short-term crack width, m
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double UltimateShortCrackWidth { get; set; }
|
public double UltimateShortCrackWidth { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
public void Update(IUserCrackInputData targetObject, IUserCrackInputData sourceObject)
|
public void Update(IUserCrackInputData targetObject, IUserCrackInputData sourceObject)
|
||||||
{
|
{
|
||||||
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
|
||||||
|
|
||||||
targetObject.SetSofteningFactor = sourceObject.SetSofteningFactor;
|
targetObject.SetSofteningFactor = sourceObject.SetSofteningFactor;
|
||||||
targetObject.SofteningFactor = sourceObject.SofteningFactor;
|
targetObject.SofteningFactor = sourceObject.SofteningFactor;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
public class EllipsePrimitive : IEllipsePrimitive
|
public class EllipseNdmPrimitive : IEllipseNdmPrimitive
|
||||||
{
|
{
|
||||||
private static readonly EllipsePrimitiveUpdateStrategy updateStrategy = new();
|
private static readonly EllipsePrimitiveUpdateStrategy updateStrategy = new();
|
||||||
private readonly RectangleShape rectangleShape = new();
|
private readonly RectangleShape rectangleShape = new();
|
||||||
@@ -45,19 +45,19 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public IDivisionSize DivisionSize { get; } = new DivisionSize();
|
public IDivisionSize DivisionSize { get; } = new DivisionSize();
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IShape Shape => rectangleShape;
|
public IShape Shape => rectangleShape;
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public double RotationAngle { get; set; }
|
||||||
|
|
||||||
public double Angle { get; set; }
|
public EllipseNdmPrimitive(Guid id)
|
||||||
|
|
||||||
public EllipsePrimitive(Guid id)
|
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
Name = "New Circle";
|
Name = "New Circle";
|
||||||
}
|
}
|
||||||
public EllipsePrimitive() : this (Guid.NewGuid()) {}
|
public EllipseNdmPrimitive() : this (Guid.NewGuid()) {}
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var primitive = new EllipsePrimitive();
|
var primitive = new EllipseNdmPrimitive();
|
||||||
updateStrategy.Update(primitive, this);
|
updateStrategy.Update(primitive, this);
|
||||||
return primitive;
|
return primitive;
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user