Add Force DTOs
This commit is contained in:
@@ -16,6 +16,8 @@ namespace DataAccess.DTOs.Converters
|
|||||||
{
|
{
|
||||||
private const string Message = "Analysis type is";
|
private const string Message = "Analysis type is";
|
||||||
private IConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis> convertCrossSectionNdmAnalysisStrategy = new CrossSectionNdmAnalysisToDTOConvertStrategy();
|
private IConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis> convertCrossSectionNdmAnalysisStrategy = new CrossSectionNdmAnalysisToDTOConvertStrategy();
|
||||||
|
private DictionaryConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis> convertLogic;
|
||||||
|
|
||||||
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; }
|
||||||
|
|
||||||
@@ -45,12 +47,7 @@ namespace DataAccess.DTOs.Converters
|
|||||||
TraceLogger?.AddMessage(Message + " Cross-Section Ndm Analysis", TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage(Message + " Cross-Section Ndm Analysis", TraceLogStatuses.Debug);
|
||||||
convertCrossSectionNdmAnalysisStrategy.ReferenceDictionary = ReferenceDictionary;
|
convertCrossSectionNdmAnalysisStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
convertCrossSectionNdmAnalysisStrategy.TraceLogger = TraceLogger;
|
convertCrossSectionNdmAnalysisStrategy.TraceLogger = TraceLogger;
|
||||||
var convertLogic = new DictionaryConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis>()
|
convertLogic = new DictionaryConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis>(this, convertCrossSectionNdmAnalysisStrategy);
|
||||||
{
|
|
||||||
ReferenceDictionary = ReferenceDictionary,
|
|
||||||
ConvertStrategy = convertCrossSectionNdmAnalysisStrategy,
|
|
||||||
TraceLogger = TraceLogger
|
|
||||||
};
|
|
||||||
CrossSectionNdmAnalysisDTO crossSectionNdmAnalysisDTO = convertLogic.Convert(crossSectionNdmAnalysis);
|
CrossSectionNdmAnalysisDTO crossSectionNdmAnalysisDTO = convertLogic.Convert(crossSectionNdmAnalysis);
|
||||||
return crossSectionNdmAnalysisDTO;
|
return crossSectionNdmAnalysisDTO;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
using DataAccess.DTOs.Converters;
|
using DataAccess.DTOs.Converters;
|
||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
|
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.Forces;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using System;
|
using System;
|
||||||
@@ -16,14 +19,22 @@ 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;
|
||||||
|
|
||||||
public CrossSectionRepositoryToDTOConvertStrategy(IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy)
|
public CrossSectionRepositoryToDTOConvertStrategy(IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy,
|
||||||
|
IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor> forceCombinationByFactorConvertStrategy,
|
||||||
|
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())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -34,15 +45,74 @@ namespace DataAccess.DTOs
|
|||||||
public CrossSectionRepositoryDTO Convert(ICrossSectionRepository source)
|
public CrossSectionRepositoryDTO Convert(ICrossSectionRepository source)
|
||||||
{
|
{
|
||||||
Check();
|
Check();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CrossSectionRepositoryDTO newItem = GetNewRepository(source);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private CrossSectionRepositoryDTO GetNewRepository(ICrossSectionRepository source)
|
||||||
|
{
|
||||||
CrossSectionRepositoryDTO newItem = new()
|
CrossSectionRepositoryDTO newItem = new()
|
||||||
{
|
{
|
||||||
Id = source.Id
|
Id = source.Id
|
||||||
};
|
};
|
||||||
|
List<IForceAction> forceActions = ProcessForceActions(source);
|
||||||
List<HeadMaterialDTO> materials = ProcessMaterials(source);
|
List<HeadMaterialDTO> materials = ProcessMaterials(source);
|
||||||
|
newItem.ForceActions.AddRange(forceActions);
|
||||||
newItem.HeadMaterials.AddRange(materials);
|
newItem.HeadMaterials.AddRange(materials);
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<IForceAction> ProcessForceActions(ICrossSectionRepository source)
|
||||||
|
{
|
||||||
|
List<IForceAction> forceActions = new();
|
||||||
|
foreach (var item in source.ForceActions)
|
||||||
|
{
|
||||||
|
if (item is IForceCombinationByFactor forceCombinationByFactor)
|
||||||
|
{
|
||||||
|
ForceCombinationByFactorDTO forceCombination = GetForceCombinationByFactor(forceCombinationByFactor);
|
||||||
|
forceActions.Add(forceCombination);
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
private List<HeadMaterialDTO> ProcessMaterials(ICrossSectionRepository source)
|
private List<HeadMaterialDTO> ProcessMaterials(ICrossSectionRepository source)
|
||||||
{
|
{
|
||||||
materialConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
materialConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
@@ -64,9 +134,7 @@ namespace DataAccess.DTOs
|
|||||||
|
|
||||||
private void Check()
|
private void Check()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<CrossSectionRepositoryDTO, ICrossSectionRepository>();
|
var checkLogic = new CheckConvertLogic<CrossSectionRepositoryDTO, ICrossSectionRepository>(this);
|
||||||
checkLogic.ConvertStrategy = this;
|
|
||||||
checkLogic.TraceLogger = TraceLogger;
|
|
||||||
checkLogic.Check();
|
checkLogic.Check();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,32 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Analyses;
|
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs.Converters
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class CrossSectionToDTOConvertStrategy : IConvertStrategy<CrossSectionDTO, ICrossSection>
|
public class CrossSectionToDTOConvertStrategy : IConvertStrategy<CrossSectionDTO, ICrossSection>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<ICrossSection> updateStrategy;
|
private IUpdateStrategy<ICrossSection> updateStrategy; //don't use since CrossSection does not have any properties
|
||||||
private IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertStrategy;
|
private IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertRepositoryStrategy;
|
||||||
|
private DictionaryConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertLogic;
|
||||||
|
private ICheckConvertLogic<CrossSectionDTO, ICrossSection> checkLogic;
|
||||||
|
|
||||||
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 CrossSectionToDTOConvertStrategy(IUpdateStrategy<ICrossSection> updateStrategy,
|
public CrossSectionToDTOConvertStrategy(IUpdateStrategy<ICrossSection> updateStrategy,
|
||||||
IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertStrategy)
|
IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertRepositoryStrategy,
|
||||||
|
ICheckConvertLogic<CrossSectionDTO, ICrossSection> checkLogic)
|
||||||
{
|
{
|
||||||
this.updateStrategy = updateStrategy;
|
this.updateStrategy = updateStrategy;
|
||||||
this.convertStrategy = convertStrategy;
|
this.convertRepositoryStrategy = convertRepositoryStrategy;
|
||||||
|
this.checkLogic = checkLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrossSectionToDTOConvertStrategy() : this(
|
public CrossSectionToDTOConvertStrategy() : this(
|
||||||
new CrossSectionUpdateStrategy(),
|
new CrossSectionUpdateStrategy(),
|
||||||
new CrossSectionRepositoryToDTOConvertStrategy())
|
new CrossSectionRepositoryToDTOConvertStrategy(),
|
||||||
|
new CheckConvertLogic<CrossSectionDTO, ICrossSection>())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -38,21 +38,15 @@ namespace DataAccess.DTOs.Converters
|
|||||||
{
|
{
|
||||||
Id = source.Id
|
Id = source.Id
|
||||||
};
|
};
|
||||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
convertRepositoryStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
convertStrategy.TraceLogger = TraceLogger;
|
convertRepositoryStrategy.TraceLogger = TraceLogger;
|
||||||
var convertLogic = new DictionaryConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository>()
|
convertLogic = new DictionaryConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository>(this, convertRepositoryStrategy);
|
||||||
{
|
|
||||||
ReferenceDictionary = ReferenceDictionary,
|
|
||||||
ConvertStrategy = convertStrategy,
|
|
||||||
TraceLogger = TraceLogger
|
|
||||||
};
|
|
||||||
newItem.SectionRepository = convertLogic.Convert(source.SectionRepository);
|
newItem.SectionRepository = convertLogic.Convert(source.SectionRepository);
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Check()
|
private void Check()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<CrossSectionDTO, ICrossSection>();
|
|
||||||
checkLogic.ConvertStrategy = this;
|
checkLogic.ConvertStrategy = this;
|
||||||
checkLogic.TraceLogger = TraceLogger;
|
checkLogic.TraceLogger = TraceLogger;
|
||||||
checkLogic.Check();
|
checkLogic.Check();
|
||||||
|
|||||||
@@ -9,12 +9,13 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace DataAccess.DTOs.Converters
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class DateVersionToDTOConvertStrategy : IConvertStrategy<DateVersionDTO, IDateVersion>
|
public class DateVersionToDTOConvertStrategy : IConvertStrategy<DateVersionDTO, IDateVersion>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<IDateVersion> updateStrategy;
|
private IUpdateStrategy<IDateVersion> updateStrategy;
|
||||||
private IConvertStrategy<ISaveable, ISaveable> convertStrategy;
|
private IConvertStrategy<ISaveable, ISaveable> convertStrategy;
|
||||||
|
private DictionaryConvertStrategy<ISaveable, ISaveable> convertLogic;
|
||||||
|
|
||||||
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; }
|
||||||
@@ -44,12 +45,7 @@ namespace DataAccess.DTOs.Converters
|
|||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(newItem, source);
|
||||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
convertStrategy.TraceLogger = TraceLogger;
|
convertStrategy.TraceLogger = TraceLogger;
|
||||||
var convertLogic = new DictionaryConvertStrategy<ISaveable, ISaveable>()
|
convertLogic = new DictionaryConvertStrategy<ISaveable, ISaveable>(this, convertStrategy);
|
||||||
{
|
|
||||||
ReferenceDictionary = ReferenceDictionary,
|
|
||||||
ConvertStrategy = convertStrategy,
|
|
||||||
TraceLogger = TraceLogger
|
|
||||||
};
|
|
||||||
newItem.AnalysisVersion = convertLogic.Convert(source.AnalysisVersion);
|
newItem.AnalysisVersion = convertLogic.Convert(source.AnalysisVersion);
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class DesignForceTupleToDTOConvertStrategy : IConvertStrategy<DesignForceTupleDTO, IDesignForceTuple>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IDesignForceTuple> updateStrategy;
|
||||||
|
private IConvertStrategy<ForceTupleDTO, IForceTuple> forceTupleConvertStrategy;
|
||||||
|
|
||||||
|
public DesignForceTupleToDTOConvertStrategy(IUpdateStrategy<IDesignForceTuple> updateStrategy,
|
||||||
|
IConvertStrategy<ForceTupleDTO, IForceTuple> forceTupleConvertStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
this.forceTupleConvertStrategy = forceTupleConvertStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DesignForceTupleToDTOConvertStrategy() : this(new DesignForceTupleUpdateStrategy(),
|
||||||
|
new ForceTupleToDTOConvertStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public DesignForceTupleDTO Convert(IDesignForceTuple source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
DesignForceTupleDTO designForceTupleDTO = GetNewDesignForceTuple(source);
|
||||||
|
return designForceTupleDTO;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DesignForceTupleDTO GetNewDesignForceTuple(IDesignForceTuple source)
|
||||||
|
{
|
||||||
|
DesignForceTupleDTO newItem = new() { Id = source.Id };
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
forceTupleConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
forceTupleConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<ForceTupleDTO, IForceTuple>(this, forceTupleConvertStrategy);
|
||||||
|
newItem.ForceTuple = convertLogic.Convert(source.ForceTuple);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<DesignForceTupleDTO, IDesignForceTuple>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Analyses;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ElasticMaterialToDTOConvertStrategy : IConvertStrategy<ElasticMaterialDTO, IElasticMaterial>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IElasticMaterial> updateStrategy;
|
||||||
|
private ICheckConvertLogic<ElasticMaterialDTO, IElasticMaterial> checkLogic;
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public ElasticMaterialToDTOConvertStrategy(
|
||||||
|
IUpdateStrategy<IElasticMaterial> updateStrategy,
|
||||||
|
ICheckConvertLogic<ElasticMaterialDTO, IElasticMaterial> checkLogic)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
this.checkLogic = checkLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElasticMaterialToDTOConvertStrategy() : this (
|
||||||
|
new ElasticUpdateStrategy(),
|
||||||
|
new CheckConvertLogic<ElasticMaterialDTO, IElasticMaterial>())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElasticMaterialDTO Convert(IElasticMaterial source)
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ElasticMaterialDTO newItem = new() { Id = source.Id };
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
checkLogic = new CheckConvertLogic<ElasticMaterialDTO, IElasticMaterial>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
48
DataAccess/DTOs/Converters/FRMaterialToDTOConvertStrategy.cs
Normal file
48
DataAccess/DTOs/Converters/FRMaterialToDTOConvertStrategy.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class FRMaterialToDTOConvertStrategy : IConvertStrategy<FRMaterialDTO, IFRMaterial>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IFRMaterial> updateStrategy;
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public FRMaterialToDTOConvertStrategy(IUpdateStrategy<IFRMaterial> updateStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FRMaterialToDTOConvertStrategy() : this (new FRUpdateStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public FRMaterialDTO Convert(IFRMaterial source)
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FRMaterialDTO newItem = new() { Id = source.Id };
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<FRMaterialDTO, IFRMaterial>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class ForceCombinationByFactorToDTOConvertStrategy : IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IForceCombinationByFactor> updateStrategy;
|
||||||
|
private IConvertStrategy<Point2DDTO, IPoint2D> pointUpdateStrategy;
|
||||||
|
|
||||||
|
private IConvertStrategy<ForceTupleDTO, IForceTuple> forceTupleConvertStrategy;
|
||||||
|
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
|
||||||
|
|
||||||
|
public ForceCombinationByFactorToDTOConvertStrategy(IUpdateStrategy<IForceCombinationByFactor> updateStrategy,
|
||||||
|
IConvertStrategy<Point2DDTO, IPoint2D> pointUpdateStrategy,
|
||||||
|
IConvertStrategy<ForceTupleDTO, IForceTuple> convertStrategy,
|
||||||
|
IUpdateStrategy<IForceAction> baseUpdateStrategy)
|
||||||
|
{
|
||||||
|
this.baseUpdateStrategy = baseUpdateStrategy;
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
this.forceTupleConvertStrategy = convertStrategy;
|
||||||
|
this.pointUpdateStrategy = pointUpdateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCombinationByFactorToDTOConvertStrategy() : this (
|
||||||
|
new ForceCombinationByFactorUpdateStrategy(),
|
||||||
|
new Point2DToDTOConvertStrategy(),
|
||||||
|
new ForceTupleToDTOConvertStrategy(),
|
||||||
|
new ForceActionBaseUpdateStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public ForceCombinationByFactorDTO Convert(IForceCombinationByFactor source)
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ForceCombinationByFactorDTO newItem = GetNewForceTuple(source);
|
||||||
|
TraceLogger.AddMessage($"Force combination by factor, name = {newItem.Name} was converted", TraceLogStatuses.Debug);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ForceCombinationByFactorDTO GetNewForceTuple(IForceCombinationByFactor source)
|
||||||
|
{
|
||||||
|
ForceCombinationByFactorDTO newItem = new() { Id = source.Id };
|
||||||
|
baseUpdateStrategy.Update(newItem, source);
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
GetNewForcePoint(source, newItem);
|
||||||
|
GetNewFullSLSForces(source, newItem);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewFullSLSForces(IForceCombinationByFactor source, ForceCombinationByFactorDTO newItem)
|
||||||
|
{
|
||||||
|
if (source.FullSLSForces is not null)
|
||||||
|
{
|
||||||
|
forceTupleConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
forceTupleConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertForceTupleLogic = new DictionaryConvertStrategy<ForceTupleDTO, IForceTuple>(this, forceTupleConvertStrategy);
|
||||||
|
newItem.FullSLSForces = convertForceTupleLogic.Convert(source.FullSLSForces);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNewForcePoint(IForceCombinationByFactor source, ForceCombinationByFactorDTO newItem)
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<ForceCombinationByFactorDTO, IForceCombinationByFactor>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class ForceCombinationListToDTOConvertStrategy : IConvertStrategy<ForceCombinationListDTO, IForceCombinationList>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IForceCombinationList> updateStrategy;
|
||||||
|
private IConvertStrategy<DesignForceTupleDTO, IDesignForceTuple> convertStrategy;
|
||||||
|
|
||||||
|
public ForceCombinationListToDTOConvertStrategy(
|
||||||
|
IUpdateStrategy<IForceCombinationList> updateStrategy,
|
||||||
|
IConvertStrategy<DesignForceTupleDTO, IDesignForceTuple> convertStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
this.convertStrategy = convertStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCombinationListToDTOConvertStrategy() : this (
|
||||||
|
new ForceCombinationListUpdateStrategy(),
|
||||||
|
new DesignForceTupleToDTOConvertStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public ForceCombinationListDTO Convert(IForceCombinationList source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
return GetNewForceCombinationList(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ForceCombinationListDTO GetNewForceCombinationList(IForceCombinationList source)
|
||||||
|
{
|
||||||
|
|
||||||
|
ForceCombinationListDTO newItem = new() { Id = source.Id};
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
convertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<DesignForceTupleDTO, IDesignForceTuple>(this, convertStrategy);
|
||||||
|
newItem.DesignForces.Clear();
|
||||||
|
foreach (var item in source.DesignForces)
|
||||||
|
{
|
||||||
|
newItem.DesignForces.Add(convertLogic.Convert(item));
|
||||||
|
}
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<ForceCombinationListDTO, IForceCombinationList>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
53
DataAccess/DTOs/Converters/ForceTupleToDTOConvertStrategy.cs
Normal file
53
DataAccess/DTOs/Converters/ForceTupleToDTOConvertStrategy.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ForceTupleToDTOConvertStrategy : IConvertStrategy<ForceTupleDTO, IForceTuple>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IForceTuple> updateStrategy;
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public ForceTupleToDTOConvertStrategy(IUpdateStrategy<IForceTuple> updateStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceTupleToDTOConvertStrategy() : this(new ForceTupleUpdateStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceTupleDTO Convert(IForceTuple source)
|
||||||
|
{
|
||||||
|
Check();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ForceTupleDTO newItem = new() { Id = source.Id};
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Check()
|
||||||
|
{
|
||||||
|
var checkLogic = new CheckConvertLogic<ForceTupleDTO, IForceTuple>(this);
|
||||||
|
checkLogic.Check();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using StructureHelper.Models.Materials;
|
using StructureHelper.Models.Materials;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using System;
|
using System;
|
||||||
@@ -34,6 +35,20 @@ namespace DataAccess.DTOs.Converters
|
|||||||
public IShiftTraceLogger TraceLogger { get; set; }
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
public HeadMaterialDTO Convert(IHeadMaterial source)
|
public HeadMaterialDTO Convert(IHeadMaterial source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return GetMaterial(source);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private HeadMaterialDTO GetMaterial(IHeadMaterial source)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Convert material Id={source.Id}, name is {source.Name}");
|
TraceLogger?.AddMessage($"Convert material Id={source.Id}, name is {source.Name}");
|
||||||
HeadMaterialDTO newItem = new()
|
HeadMaterialDTO newItem = new()
|
||||||
@@ -42,12 +57,7 @@ namespace DataAccess.DTOs.Converters
|
|||||||
};
|
};
|
||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(newItem, source);
|
||||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
var convertLogic = new DictionaryConvertStrategy<IHelperMaterial, IHelperMaterial>()
|
var convertLogic = new DictionaryConvertStrategy<IHelperMaterial, IHelperMaterial>(this, convertStrategy);
|
||||||
{
|
|
||||||
ReferenceDictionary = ReferenceDictionary,
|
|
||||||
ConvertStrategy = convertStrategy,
|
|
||||||
TraceLogger = TraceLogger
|
|
||||||
};
|
|
||||||
newItem.HelperMaterial = convertLogic.Convert(source.HelperMaterial);
|
newItem.HelperMaterial = convertLogic.Convert(source.HelperMaterial);
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class HelperMaterialDTOSafetyFactorUpdateStrategy : IUpdateStrategy<IHelperMaterial>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IMaterialSafetyFactor> safetyFactorUpdateStrategy;
|
||||||
|
private IUpdateStrategy<IMaterialPartialFactor> partialFactorUpdateStrategy;
|
||||||
|
|
||||||
|
public HelperMaterialDTOSafetyFactorUpdateStrategy(
|
||||||
|
IUpdateStrategy<IMaterialSafetyFactor> safetyFactorUpdateStrategy,
|
||||||
|
IUpdateStrategy<IMaterialPartialFactor> partialFactorUpdateStrategy)
|
||||||
|
{
|
||||||
|
this.safetyFactorUpdateStrategy = safetyFactorUpdateStrategy;
|
||||||
|
this.partialFactorUpdateStrategy = partialFactorUpdateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HelperMaterialDTOSafetyFactorUpdateStrategy() : this(
|
||||||
|
new MaterialSafetyFactorUpdateStrategy(),
|
||||||
|
new MaterialPartialFactorUpdateStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(IHelperMaterial targetObject, IHelperMaterial sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
|
CheckObject.IsNull(targetObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
if (sourceObject.SafetyFactors is not null)
|
||||||
|
{
|
||||||
|
targetObject.SafetyFactors.Clear();
|
||||||
|
foreach (var safetyFactor in sourceObject.SafetyFactors)
|
||||||
|
{
|
||||||
|
MaterialSafetyFactorDTO newSafetyFactor = GetNewSafetyFactorByOld(safetyFactor);
|
||||||
|
targetObject.SafetyFactors.Add(newSafetyFactor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private MaterialSafetyFactorDTO GetNewSafetyFactorByOld(IMaterialSafetyFactor safetyFactor)
|
||||||
|
{
|
||||||
|
MaterialSafetyFactorDTO newSafetyFactor = new()
|
||||||
|
{
|
||||||
|
Id = safetyFactor.Id
|
||||||
|
};
|
||||||
|
safetyFactorUpdateStrategy.Update(newSafetyFactor, safetyFactor);
|
||||||
|
newSafetyFactor.PartialFactors.Clear();
|
||||||
|
foreach (var partialFactor in safetyFactor.PartialFactors)
|
||||||
|
{
|
||||||
|
MaterialPartialFactorDTO newPartialFactor = GetNewPartialFactorByOld(partialFactor);
|
||||||
|
newSafetyFactor.PartialFactors.Add(newPartialFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newSafetyFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MaterialPartialFactorDTO GetNewPartialFactorByOld(IMaterialPartialFactor partialFactor)
|
||||||
|
{
|
||||||
|
MaterialPartialFactorDTO newPartialFactor = new()
|
||||||
|
{
|
||||||
|
Id = partialFactor.Id
|
||||||
|
};
|
||||||
|
partialFactorUpdateStrategy.Update(newPartialFactor, partialFactor);
|
||||||
|
return newPartialFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using DataAccess.DTOs.Converters;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using StructureHelperLogics.Models.CrossSections;
|
using StructureHelperLogics.Models.CrossSections;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
|
using StructureHelperLogics.Models.Materials.Logics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -15,20 +18,31 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
private LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy;
|
private LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy;
|
||||||
private LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> reinforcementConvertStrategy;
|
private LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> reinforcementConvertStrategy;
|
||||||
|
private IConvertStrategy<ElasticMaterialDTO, IElasticMaterial> elasticConvertStrategy;
|
||||||
|
private IConvertStrategy<FRMaterialDTO, IFRMaterial> frMaterialConvertStrategy;
|
||||||
|
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy = new HelperMaterialDTOSafetyFactorUpdateStrategy();
|
||||||
|
|
||||||
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 HelperMaterialToDTOConvertStrategy(
|
public HelperMaterialToDTOConvertStrategy(
|
||||||
LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy,
|
LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy,
|
||||||
LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> reinforcementConvertStrategy)
|
LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> reinforcementConvertStrategy,
|
||||||
|
IConvertStrategy<ElasticMaterialDTO, IElasticMaterial> elasticConvertStrategy,
|
||||||
|
IConvertStrategy<FRMaterialDTO, IFRMaterial> frMaterialConvertStrategy)
|
||||||
{
|
{
|
||||||
this.concreteConvertStrategy = concreteConvertStrategy;
|
this.concreteConvertStrategy = concreteConvertStrategy;
|
||||||
this.reinforcementConvertStrategy = reinforcementConvertStrategy;
|
this.reinforcementConvertStrategy = reinforcementConvertStrategy;
|
||||||
|
this.elasticConvertStrategy = elasticConvertStrategy;
|
||||||
|
this.frMaterialConvertStrategy = frMaterialConvertStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HelperMaterialToDTOConvertStrategy() : this (
|
public HelperMaterialToDTOConvertStrategy() : this (
|
||||||
new ConcreteLibMaterialToDTOConvertStrategy(),
|
new ConcreteLibMaterialToDTOConvertStrategy(),
|
||||||
new ReinforcementLibMaterialToDTOConvertStrategy())
|
new ReinforcementLibMaterialToDTOConvertStrategy(),
|
||||||
|
new ElasticMaterialToDTOConvertStrategy(),
|
||||||
|
new FRMaterialToDTOConvertStrategy()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -36,17 +50,37 @@ namespace DataAccess.DTOs
|
|||||||
public IHelperMaterial Convert(IHelperMaterial source)
|
public IHelperMaterial Convert(IHelperMaterial source)
|
||||||
{
|
{
|
||||||
Check();
|
Check();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IHelperMaterial helperMaterial = GetMaterial(source);
|
||||||
|
safetyFactorUpdateStrategy.Update(helperMaterial, source);
|
||||||
|
return helperMaterial;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IHelperMaterial GetMaterial(IHelperMaterial source)
|
||||||
|
{
|
||||||
if (source is IConcreteLibMaterial concreteLibMaterial)
|
if (source is IConcreteLibMaterial concreteLibMaterial)
|
||||||
{
|
{
|
||||||
concreteConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
return ProcessConcrete(concreteLibMaterial);
|
||||||
concreteConvertStrategy.TraceLogger = TraceLogger;
|
|
||||||
return concreteConvertStrategy.Convert(concreteLibMaterial);
|
|
||||||
}
|
}
|
||||||
if (source is IReinforcementLibMaterial reinforcementMaterial)
|
else if (source is IReinforcementLibMaterial reinforcementMaterial)
|
||||||
{
|
{
|
||||||
reinforcementConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
return ProcessReinforcement(reinforcementMaterial);
|
||||||
reinforcementConvertStrategy.TraceLogger = TraceLogger;
|
}
|
||||||
return reinforcementConvertStrategy.Convert(reinforcementMaterial);
|
else if (source is IFRMaterial frMaterial)
|
||||||
|
{
|
||||||
|
return ProcessFRMaterial(frMaterial);
|
||||||
|
}
|
||||||
|
else if (source is IElasticMaterial elasticMaterial)
|
||||||
|
{
|
||||||
|
return ProcessElastic(elasticMaterial);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -54,11 +88,41 @@ namespace DataAccess.DTOs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IHelperMaterial ProcessFRMaterial(IFRMaterial frMaterial)
|
||||||
|
{
|
||||||
|
frMaterialConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
frMaterialConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<FRMaterialDTO, IFRMaterial>(this, frMaterialConvertStrategy);
|
||||||
|
return convertLogic.Convert(frMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IHelperMaterial ProcessElastic(IElasticMaterial elasticMaterial)
|
||||||
|
{
|
||||||
|
elasticConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
elasticConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<ElasticMaterialDTO, IElasticMaterial>(this, elasticConvertStrategy);
|
||||||
|
return convertLogic.Convert(elasticMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IHelperMaterial ProcessReinforcement(IReinforcementLibMaterial reinforcementMaterial)
|
||||||
|
{
|
||||||
|
reinforcementConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
reinforcementConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial>(this, reinforcementConvertStrategy);
|
||||||
|
return convertLogic.Convert(reinforcementMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IHelperMaterial ProcessConcrete(IConcreteLibMaterial concreteLibMaterial)
|
||||||
|
{
|
||||||
|
concreteConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
|
concreteConvertStrategy.TraceLogger = TraceLogger;
|
||||||
|
var convertLogic = new DictionaryConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial>(this, concreteConvertStrategy);
|
||||||
|
return convertLogic.Convert(concreteLibMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
private void Check()
|
private void Check()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<IHelperMaterial, IHelperMaterial>();
|
var checkLogic = new CheckConvertLogic<IHelperMaterial, IHelperMaterial>(this);
|
||||||
checkLogic.ConvertStrategy = this;
|
|
||||||
checkLogic.TraceLogger = TraceLogger;
|
|
||||||
checkLogic.Check();
|
checkLogic.Check();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,64 +12,12 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
public class LibMaterialDTOUpdateStrategy : IUpdateStrategy<ILibMaterial>
|
public class LibMaterialDTOUpdateStrategy : IUpdateStrategy<ILibMaterial>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<IMaterialSafetyFactor> safetyFactorUpdateStrategy;
|
|
||||||
private IUpdateStrategy<IMaterialPartialFactor> partialFactorUpdateStrategy;
|
|
||||||
|
|
||||||
public LibMaterialDTOUpdateStrategy(IUpdateStrategy<IMaterialSafetyFactor> safetyFactorUpdateStrategy,
|
|
||||||
IUpdateStrategy<IMaterialPartialFactor> partialFactorUpdateStrategy)
|
|
||||||
{
|
|
||||||
this.safetyFactorUpdateStrategy = safetyFactorUpdateStrategy;
|
|
||||||
this.partialFactorUpdateStrategy = partialFactorUpdateStrategy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LibMaterialDTOUpdateStrategy() : this (new MaterialSafetyFactorUpdateStrategy(),
|
|
||||||
new MaterialPartialFactorUpdateStrategy())
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Update(ILibMaterial targetObject, ILibMaterial sourceObject)
|
public void Update(ILibMaterial targetObject, ILibMaterial sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.IsNull(sourceObject);
|
CheckObject.IsNull(sourceObject);
|
||||||
CheckObject.IsNull(targetObject);
|
CheckObject.IsNull(targetObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
if (sourceObject.SafetyFactors is not null)
|
|
||||||
{
|
|
||||||
targetObject.SafetyFactors.Clear();
|
|
||||||
foreach (var safetyFactor in sourceObject.SafetyFactors)
|
|
||||||
{
|
|
||||||
MaterialSafetyFactorDTO newSafetyFactor = GetNewSafetyFactorByOld(safetyFactor);
|
|
||||||
targetObject.SafetyFactors.Add(newSafetyFactor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private MaterialSafetyFactorDTO GetNewSafetyFactorByOld(IMaterialSafetyFactor safetyFactor)
|
|
||||||
{
|
|
||||||
MaterialSafetyFactorDTO newSafetyFactor = new()
|
|
||||||
{
|
|
||||||
Id = safetyFactor.Id
|
|
||||||
};
|
|
||||||
safetyFactorUpdateStrategy.Update(newSafetyFactor, safetyFactor);
|
|
||||||
newSafetyFactor.PartialFactors.Clear();
|
|
||||||
foreach (var partialFactor in safetyFactor.PartialFactors)
|
|
||||||
{
|
|
||||||
MaterialPartialFactorDTO newPartialFactor = GetNewPartialFactorByOld(partialFactor);
|
|
||||||
newSafetyFactor.PartialFactors.Add(newPartialFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newSafetyFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
private MaterialPartialFactorDTO GetNewPartialFactorByOld(IMaterialPartialFactor partialFactor)
|
|
||||||
{
|
|
||||||
MaterialPartialFactorDTO newPartialFactor = new()
|
|
||||||
{
|
|
||||||
Id = partialFactor.Id
|
|
||||||
};
|
|
||||||
partialFactorUpdateStrategy.Update(newPartialFactor, partialFactor);
|
|
||||||
return newPartialFactor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
public abstract IUpdateStrategy<V> UpdateStrategy { get; }
|
public abstract IUpdateStrategy<V> UpdateStrategy { get; }
|
||||||
public abstract T GetMaterialDTO(V source);
|
public abstract T GetMaterialDTO(V source);
|
||||||
private IUpdateStrategy<ILibMaterial> libMaterialUpdateStrategy = new LibMaterialDTOUpdateStrategy();
|
//private IUpdateStrategy<ILibMaterial> libMaterialUpdateStrategy = new LibMaterialDTOUpdateStrategy();
|
||||||
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; }
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ namespace DataAccess.DTOs
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
UpdateStrategy.Update(newItem, source);
|
UpdateStrategy.Update(newItem, source);
|
||||||
libMaterialUpdateStrategy.Update(newItem, source);
|
//libMaterialUpdateStrategy.Update(newItem, source);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -43,9 +43,7 @@ namespace DataAccess.DTOs
|
|||||||
|
|
||||||
private void Check()
|
private void Check()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<T, V>();
|
var checkLogic = new CheckConvertLogic<T, V>(this);
|
||||||
checkLogic.ConvertStrategy = this;
|
|
||||||
checkLogic.TraceLogger = TraceLogger;
|
|
||||||
checkLogic.Check();
|
checkLogic.Check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
47
DataAccess/DTOs/Converters/Point2DToDTOConvertStrategy.cs
Normal file
47
DataAccess/DTOs/Converters/Point2DToDTOConvertStrategy.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs.Converters
|
||||||
|
{
|
||||||
|
public class Point2DToDTOConvertStrategy : IConvertStrategy<Point2DDTO, IPoint2D>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IPoint2D> updateStrategy;
|
||||||
|
|
||||||
|
public Point2DToDTOConvertStrategy(IUpdateStrategy<IPoint2D> updateStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point2DToDTOConvertStrategy() : this (new Point2DUpdateStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary {get; set; }
|
||||||
|
public IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public Point2DDTO Convert(IPoint2D source)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Point2DDTO newItem = new() { Id = source.Id };
|
||||||
|
updateStrategy.Update(newItem, source);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||||
|
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
private IUpdateStrategy<IProject> updateStrategy;
|
private IUpdateStrategy<IProject> updateStrategy;
|
||||||
private IConvertStrategy<VisualAnalysisDTO, IVisualAnalysis> convertStrategy;
|
private IConvertStrategy<VisualAnalysisDTO, IVisualAnalysis> convertStrategy;
|
||||||
|
private DictionaryConvertStrategy<VisualAnalysisDTO, IVisualAnalysis> convertLogic;
|
||||||
|
|
||||||
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; }
|
||||||
@@ -39,12 +40,7 @@ namespace DataAccess.DTOs
|
|||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(newItem, source);
|
||||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
convertStrategy.TraceLogger = TraceLogger;
|
convertStrategy.TraceLogger = TraceLogger;
|
||||||
var convertLogic = new DictionaryConvertStrategy<VisualAnalysisDTO, IVisualAnalysis>()
|
convertLogic = new DictionaryConvertStrategy<VisualAnalysisDTO, IVisualAnalysis>(this, convertStrategy);
|
||||||
{
|
|
||||||
ReferenceDictionary = ReferenceDictionary,
|
|
||||||
ConvertStrategy = convertStrategy,
|
|
||||||
TraceLogger = TraceLogger
|
|
||||||
};
|
|
||||||
newItem.VisualAnalyses.Clear();
|
newItem.VisualAnalyses.Clear();
|
||||||
foreach (var item in source.VisualAnalyses)
|
foreach (var item in source.VisualAnalyses)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace DataAccess.DTOs.Converters
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class VersionItemToDTOConvertStrategy : IConvertStrategy<ISaveable, ISaveable>
|
public class VersionItemToDTOConvertStrategy : IConvertStrategy<ISaveable, ISaveable>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,14 +8,26 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace DataAccess.DTOs.Converters
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
public class VersionProcessorToDTOConvertStrategy : IConvertStrategy<VersionProcessorDTO, IVersionProcessor>
|
public class VersionProcessorToDTOConvertStrategy : IConvertStrategy<VersionProcessorDTO, IVersionProcessor>
|
||||||
{
|
{
|
||||||
private IConvertStrategy<DateVersionDTO, IDateVersion> convertStrategy = new DateVersionToDTOConvertStrategy();
|
private IConvertStrategy<DateVersionDTO, IDateVersion> dataVersionConvertStrategy;
|
||||||
|
private ICheckConvertLogic<VersionProcessorDTO, IVersionProcessor> checkLogic;
|
||||||
|
|
||||||
|
public VersionProcessorToDTOConvertStrategy(IConvertStrategy<DateVersionDTO, IDateVersion> dataVersionConvertStrategy)
|
||||||
|
{
|
||||||
|
this.dataVersionConvertStrategy = dataVersionConvertStrategy;
|
||||||
|
}
|
||||||
|
public VersionProcessorToDTOConvertStrategy() : this( new DateVersionToDTOConvertStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
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 VersionProcessorDTO Convert(IVersionProcessor source)
|
public VersionProcessorDTO Convert(IVersionProcessor source)
|
||||||
{
|
{
|
||||||
Check();
|
Check();
|
||||||
@@ -23,25 +35,18 @@ namespace DataAccess.DTOs.Converters
|
|||||||
{
|
{
|
||||||
Id = source.Id
|
Id = source.Id
|
||||||
};
|
};
|
||||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
dataVersionConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
convertStrategy.TraceLogger = TraceLogger;
|
dataVersionConvertStrategy.TraceLogger = TraceLogger;
|
||||||
foreach (var item in source.Versions)
|
foreach (var item in source.Versions)
|
||||||
{
|
{
|
||||||
var convertLogic = new DictionaryConvertStrategy<DateVersionDTO, IDateVersion>()
|
var convertLogic = new DictionaryConvertStrategy<DateVersionDTO, IDateVersion>(this, dataVersionConvertStrategy);
|
||||||
{
|
|
||||||
ReferenceDictionary = ReferenceDictionary,
|
|
||||||
ConvertStrategy = convertStrategy,
|
|
||||||
TraceLogger = TraceLogger
|
|
||||||
};
|
|
||||||
newItem.Versions.Add(convertLogic.Convert(item));
|
newItem.Versions.Add(convertLogic.Convert(item));
|
||||||
}
|
}
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
private void Check()
|
private void Check()
|
||||||
{
|
{
|
||||||
var checkLogic = new CheckConvertLogic<VersionProcessorDTO, IVersionProcessor>();
|
checkLogic = new CheckConvertLogic<VersionProcessorDTO, IVersionProcessor>(this);
|
||||||
checkLogic.ConvertStrategy = this;
|
|
||||||
checkLogic.TraceLogger = TraceLogger;
|
|
||||||
checkLogic.Check();
|
checkLogic.Check();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ namespace DataAccess.DTOs
|
|||||||
[JsonProperty("SectionRepository")]
|
[JsonProperty("SectionRepository")]
|
||||||
public ICrossSectionRepository SectionRepository { get; set; }
|
public ICrossSectionRepository SectionRepository { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
29
DataAccess/DTOs/DesignForceTupleDTO.cs
Normal file
29
DataAccess/DTOs/DesignForceTupleDTO.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class DesignForceTupleDTO : IDesignForceTuple
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IDesignForceTuple> updateStrategy;
|
||||||
|
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("LimitState")]
|
||||||
|
public LimitStates LimitState { get; set; }
|
||||||
|
[JsonProperty("CalcTerm")]
|
||||||
|
public CalcTerms CalcTerm { get; set; }
|
||||||
|
[JsonProperty("ForceTuple")]
|
||||||
|
public IForceTuple ForceTuple { get; set; } = new ForceTupleDTO();
|
||||||
|
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
DesignForceTupleDTO newItem = new();
|
||||||
|
updateStrategy.Update(newItem, this);
|
||||||
|
return newItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ namespace DataAccess.DTOs
|
|||||||
[JsonProperty("TensileStrength")]
|
[JsonProperty("TensileStrength")]
|
||||||
public double TensileStrength { get; set; }
|
public double TensileStrength { get; set; }
|
||||||
[JsonProperty("SafetyFactors")]
|
[JsonProperty("SafetyFactors")]
|
||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
|
||||||
|
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace DataAccess.DTOs
|
|||||||
[JsonProperty("TensileStrength")]
|
[JsonProperty("TensileStrength")]
|
||||||
public double TensileStrength { get; set; }
|
public double TensileStrength { get; set; }
|
||||||
[JsonProperty("SafetyFactors")]
|
[JsonProperty("SafetyFactors")]
|
||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
|
||||||
|
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
|
|||||||
40
DataAccess/DTOs/ForceCombinationByFactorDTO.cs
Normal file
40
DataAccess/DTOs/ForceCombinationByFactorDTO.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ForceCombinationByFactorDTO : IForceCombinationByFactor
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("Name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[JsonProperty("FullSLSForces")]
|
||||||
|
public IForceTuple FullSLSForces { get; set; } = new ForceTupleDTO();
|
||||||
|
[JsonProperty("ULSFactor")]
|
||||||
|
public double ULSFactor { get; set; }
|
||||||
|
[JsonProperty("LongTermFactor")]
|
||||||
|
public double LongTermFactor { get; set; }
|
||||||
|
[JsonProperty("SetInGravityCenter")]
|
||||||
|
public bool SetInGravityCenter { get; set; }
|
||||||
|
[JsonProperty("ForcePoint")]
|
||||||
|
public IPoint2D ForcePoint { get; set; } = new Point2DDTO();
|
||||||
|
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IForceCombinationList GetCombinations()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
DataAccess/DTOs/ForceCombinationListDTO.cs
Normal file
35
DataAccess/DTOs/ForceCombinationListDTO.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ForceCombinationListDTO : IForceCombinationList
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("Name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[JsonProperty("SetInGravityCenter")]
|
||||||
|
public bool SetInGravityCenter { get; set; }
|
||||||
|
[JsonProperty("ForcePoint")]
|
||||||
|
public IPoint2D ForcePoint { get; set; }
|
||||||
|
[JsonProperty("DesignForces")]
|
||||||
|
public List<IDesignForceTuple> DesignForces { get; set; } = new();
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IForceCombinationList GetCombinations()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
39
DataAccess/DTOs/ForceTupleDTO.cs
Normal file
39
DataAccess/DTOs/ForceTupleDTO.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ForceTupleDTO : IForceTuple
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("Mx")]
|
||||||
|
public double Mx { get; set; }
|
||||||
|
[JsonProperty("My")]
|
||||||
|
public double My { get; set; }
|
||||||
|
[JsonProperty("Nz")]
|
||||||
|
public double Nz { get; set; }
|
||||||
|
[JsonProperty("Qx")]
|
||||||
|
public double Qx { get; set; }
|
||||||
|
[JsonProperty("Qy")]
|
||||||
|
public double Qy { get; set; }
|
||||||
|
[JsonProperty("Mz")]
|
||||||
|
public double Mz { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
DataAccess/DTOs/Point2DDTO.cs
Normal file
27
DataAccess/DTOs/Point2DDTO.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class Point2DDTO : IPoint2D
|
||||||
|
{
|
||||||
|
[JsonProperty("Id")]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
[JsonProperty("X")]
|
||||||
|
public double X { get; set; }
|
||||||
|
[JsonProperty("Y")]
|
||||||
|
public double Y { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,13 +42,20 @@ namespace DataAccess.DTOs
|
|||||||
{ (typeof(CrossSectionNdmAnalysisDTO), "CrossSectionNdmAnalysis") },
|
{ (typeof(CrossSectionNdmAnalysisDTO), "CrossSectionNdmAnalysis") },
|
||||||
{ (typeof(CrossSectionRepositoryDTO), "CrossSectionRepository") },
|
{ (typeof(CrossSectionRepositoryDTO), "CrossSectionRepository") },
|
||||||
{ (typeof(DateVersionDTO), "DateVersion") },
|
{ (typeof(DateVersionDTO), "DateVersion") },
|
||||||
|
{ (typeof(DesignForceTupleDTO), "DesignForceTuple") },
|
||||||
|
{ (typeof(ElasticMaterialDTO), "ElasticMaterial") },
|
||||||
{ (typeof(FileVersionDTO), "FileVersion") },
|
{ (typeof(FileVersionDTO), "FileVersion") },
|
||||||
|
{ (typeof(ForceCombinationByFactorDTO), "ForceCombinationByFactor") },
|
||||||
|
{ (typeof(ForceCombinationListDTO), "ForceCombinationList") },
|
||||||
|
{ (typeof(ForceTupleDTO), "ForceTuple") },
|
||||||
|
{ (typeof(FRMaterialDTO), "FRMaterial") },
|
||||||
{ (typeof(HeadMaterialDTO), "HeadMaterial") },
|
{ (typeof(HeadMaterialDTO), "HeadMaterial") },
|
||||||
{ (typeof(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
|
{ (typeof(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
|
||||||
{ (typeof(NdmPrimitiveDTO), "NdmPrimitive") },
|
{ (typeof(NdmPrimitiveDTO), "NdmPrimitive") },
|
||||||
{ (typeof(IVisualAnalysis), "IVisualAnalysis") },
|
{ (typeof(IVisualAnalysis), "IVisualAnalysis") },
|
||||||
{ (typeof(List<ICalculator>), "ListOfICalculator") },
|
{ (typeof(List<ICalculator>), "ListOfICalculator") },
|
||||||
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
|
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
|
||||||
|
{ (typeof(List<IDesignForceTuple>), "ListOfIDesignForceTuple") },
|
||||||
{ (typeof(List<IForceAction>), "ListOfIForceAction") },
|
{ (typeof(List<IForceAction>), "ListOfIForceAction") },
|
||||||
{ (typeof(List<IHeadMaterial>), "ListOfIHeadMaterial") },
|
{ (typeof(List<IHeadMaterial>), "ListOfIHeadMaterial") },
|
||||||
{ (typeof(List<IMaterialSafetyFactor>), "ListOfMaterialSafetyFactor") },
|
{ (typeof(List<IMaterialSafetyFactor>), "ListOfMaterialSafetyFactor") },
|
||||||
@@ -56,6 +63,7 @@ namespace DataAccess.DTOs
|
|||||||
{ (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(ProjectDTO), "Project") },
|
{ (typeof(ProjectDTO), "Project") },
|
||||||
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
|
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
|
||||||
{ (typeof(MaterialPartialFactorDTO), "MaterialPartialFactor") },
|
{ (typeof(MaterialPartialFactorDTO), "MaterialPartialFactor") },
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return primitive.DiameterByX;
|
return primitive.Width;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
primitive.DiameterByX = value;
|
primitive.Width = value;
|
||||||
RefreshPlacement();
|
RefreshPlacement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
{
|
{
|
||||||
var primitive = new EllipsePrimitive
|
var primitive = new EllipsePrimitive
|
||||||
{
|
{
|
||||||
DiameterByX = 0.5d
|
Width = 0.5d
|
||||||
};
|
};
|
||||||
ndmPrimitive = primitive;
|
ndmPrimitive = primitive;
|
||||||
viewPrimitive = new CircleViewPrimitive(primitive);
|
viewPrimitive = new CircleViewPrimitive(primitive);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public enum CalcTerms
|
public enum CalcTerms
|
||||||
{
|
{
|
||||||
ShortTerm,
|
ShortTerm = 1,
|
||||||
LongTerm,
|
LongTerm = 2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Analyses;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -9,11 +10,22 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
{
|
{
|
||||||
public class CheckConvertLogic<T, V> : ICheckLogic
|
public class CheckConvertLogic<T, V> : ICheckConvertLogic<T, V> where T : ISaveable
|
||||||
where T : ISaveable
|
|
||||||
where V : ISaveable
|
where V : ISaveable
|
||||||
{
|
{
|
||||||
private string checkResult;
|
private string checkResult;
|
||||||
|
|
||||||
|
public CheckConvertLogic(IConvertStrategy<T, V> source)
|
||||||
|
{
|
||||||
|
ConvertStrategy = source;
|
||||||
|
TraceLogger = source.TraceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckConvertLogic()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public IConvertStrategy<T, V> ConvertStrategy { get; set; }
|
public IConvertStrategy<T, V> ConvertStrategy { get; set; }
|
||||||
|
|
||||||
public string CheckResult => checkResult;
|
public string CheckResult => checkResult;
|
||||||
|
|||||||
@@ -18,9 +18,20 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
public IConvertStrategy<T,V> ConvertStrategy { get; set; }
|
public IConvertStrategy<T,V> ConvertStrategy { get; set; }
|
||||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
|
||||||
|
public DictionaryConvertStrategy(IBaseConvertStrategy baseConvertStrategy, IConvertStrategy<T, V> convertStrategy)
|
||||||
|
{
|
||||||
|
ReferenceDictionary = baseConvertStrategy.ReferenceDictionary;
|
||||||
|
TraceLogger = baseConvertStrategy.TraceLogger;
|
||||||
|
ConvertStrategy = convertStrategy;
|
||||||
|
}
|
||||||
|
public DictionaryConvertStrategy()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public T Convert(V source)
|
public T Convert(V source)
|
||||||
{
|
{
|
||||||
ICheckInputData();
|
CheckInputData();
|
||||||
T val;
|
T val;
|
||||||
var key = (source.Id, typeof(T));
|
var key = (source.Id, typeof(T));
|
||||||
if (ReferenceDictionary.ContainsKey(key))
|
if (ReferenceDictionary.ContainsKey(key))
|
||||||
@@ -38,7 +49,7 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
private void ICheckInputData()
|
private void CheckInputData()
|
||||||
{
|
{
|
||||||
if(ReferenceDictionary is null)
|
if(ReferenceDictionary is null)
|
||||||
{
|
{
|
||||||
@@ -47,6 +58,6 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
|||||||
throw new StructureHelperException(errorString);
|
throw new StructureHelperException(errorString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
|
{
|
||||||
|
public interface IBaseConvertStrategy
|
||||||
|
{
|
||||||
|
Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||||
|
IShiftTraceLogger TraceLogger { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using StructureHelperCommon.Models;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICheckConvertLogic<T, V> : ICheckLogic
|
||||||
|
where T : ISaveable
|
||||||
|
where V : ISaveable
|
||||||
|
{
|
||||||
|
IConvertStrategy<T, V> ConvertStrategy { get; set; }
|
||||||
|
IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,12 +7,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
{
|
{
|
||||||
public interface IConvertStrategy<T,V>
|
public interface IConvertStrategy<T,V> : IBaseConvertStrategy
|
||||||
where T :ISaveable
|
where T :ISaveable
|
||||||
where V :ISaveable
|
where V :ISaveable
|
||||||
{
|
{
|
||||||
Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
|
||||||
IShiftTraceLogger TraceLogger { get; set; }
|
|
||||||
T Convert(V source);
|
T Convert(V source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,33 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public class DesignForceTuple : IDesignForceTuple
|
public class DesignForceTuple : IDesignForceTuple
|
||||||
{
|
{
|
||||||
|
private IUpdateStrategy<IDesignForceTuple> updateStrategy = new DesignForceTupleUpdateStrategy();
|
||||||
|
public Guid Id { get; }
|
||||||
|
|
||||||
|
|
||||||
public LimitStates LimitState { get; set; }
|
public LimitStates LimitState { get; set; }
|
||||||
public CalcTerms CalcTerm { get; set; }
|
public CalcTerms CalcTerm { get; set; }
|
||||||
public IForceTuple ForceTuple { get; set; }
|
public IForceTuple ForceTuple { get; set; } = new ForceTuple();
|
||||||
|
|
||||||
public DesignForceTuple(LimitStates limitState, CalcTerms calcTerm) : this()
|
public DesignForceTuple(Guid id)
|
||||||
{
|
{
|
||||||
LimitState = limitState;
|
Id = id;
|
||||||
CalcTerm = calcTerm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DesignForceTuple()
|
public DesignForceTuple() : this (Guid.NewGuid())
|
||||||
{
|
{
|
||||||
ForceTuple = new ForceTuple();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var newTuple = new DesignForceTuple(this.LimitState, this.CalcTerm);
|
var newTuple = new DesignForceTuple();
|
||||||
newTuple.ForceTuple = this.ForceTuple.Clone() as ForceTuple;
|
updateStrategy.Update(newTuple, this);
|
||||||
return newTuple;
|
return newTuple;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
if (forceType == ForceType.Force_zero)
|
if (forceType == ForceType.Force_zero)
|
||||||
{
|
{
|
||||||
return new DesignForceTuple(limitState, calcTerm);
|
return new DesignForceTuple() { LimitState = limitState, CalcTerm = calcTerm };
|
||||||
}
|
}
|
||||||
else if (forceType == ForceType.Force_Mx50My50Nz100)
|
else if (forceType == ForceType.Force_Mx50My50Nz100)
|
||||||
{
|
{
|
||||||
var tuple = new DesignForceTuple(limitState, calcTerm);
|
var tuple = new DesignForceTuple() { LimitState = limitState, CalcTerm = calcTerm };
|
||||||
var forceTuple = tuple.ForceTuple;
|
var forceTuple = tuple.ForceTuple;
|
||||||
forceTuple.Mx = -50e3d;
|
forceTuple.Mx = -50e3d;
|
||||||
forceTuple.My = -50e3d;
|
forceTuple.My = -50e3d;
|
||||||
|
|||||||
@@ -32,10 +32,26 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
ForcePoint = new Point2D() { X = 0, Y = 0 };
|
ForcePoint = new Point2D() { X = 0, Y = 0 };
|
||||||
DesignForces = new List<IDesignForceTuple>
|
DesignForces = new List<IDesignForceTuple>
|
||||||
{
|
{
|
||||||
new DesignForceTuple(LimitStates.ULS, CalcTerms.ShortTerm),
|
new DesignForceTuple()
|
||||||
new DesignForceTuple(LimitStates.ULS, CalcTerms.LongTerm),
|
{
|
||||||
new DesignForceTuple(LimitStates.SLS, CalcTerms.ShortTerm),
|
LimitState = LimitStates.ULS,
|
||||||
new DesignForceTuple(LimitStates.SLS, CalcTerms.LongTerm)
|
CalcTerm = CalcTerms.ShortTerm
|
||||||
|
},
|
||||||
|
new DesignForceTuple()
|
||||||
|
{
|
||||||
|
LimitState = LimitStates.ULS,
|
||||||
|
CalcTerm = CalcTerms.LongTerm
|
||||||
|
},
|
||||||
|
new DesignForceTuple()
|
||||||
|
{
|
||||||
|
LimitState = LimitStates.SLS,
|
||||||
|
CalcTerm = CalcTerms.ShortTerm
|
||||||
|
},
|
||||||
|
new DesignForceTuple()
|
||||||
|
{
|
||||||
|
LimitState = LimitStates.SLS,
|
||||||
|
CalcTerm = CalcTerms.LongTerm
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public ForceCombinationList() : this (Guid.NewGuid()) { }
|
public ForceCombinationList() : this (Guid.NewGuid()) { }
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Services.Forces;
|
using StructureHelperCommon.Services.Forces;
|
||||||
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
@@ -9,6 +10,8 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
private readonly IUpdateStrategy<IForceTuple> updateStrategy = new ForceTupleUpdateStrategy();
|
private readonly IUpdateStrategy<IForceTuple> updateStrategy = new ForceTupleUpdateStrategy();
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
public Guid Id { get; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double Mx { get; set; }
|
public double Mx { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double My { get; set; }
|
public double My { get; set; }
|
||||||
@@ -21,6 +24,16 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double Mz { get; set; }
|
public double Mz { get; set; }
|
||||||
|
|
||||||
|
public ForceTuple(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceTuple() : this (Guid.NewGuid())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
Mx = 0d;
|
Mx = 0d;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.CodeDom;
|
using System.CodeDom;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public interface IDesignForceTuple : ICloneable
|
public interface IDesignForceTuple : ISaveable, ICloneable
|
||||||
{
|
{
|
||||||
LimitStates LimitState { get; set; }
|
LimitStates LimitState { get; set; }
|
||||||
CalcTerms CalcTerm { get; set; }
|
CalcTerms CalcTerm { get; set; }
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using System;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface for generic force for beams
|
/// Interface for generic force for beams
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IForceTuple : ICloneable
|
public interface IForceTuple : ISaveable, ICloneable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bending moment round about x-axis
|
/// Bending moment round about x-axis
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
readonly IUpdateStrategy<IForceAction> forceUpdateStrategy = new ForceActionUpdateStrategy();
|
readonly IUpdateStrategy<IForceAction> forceUpdateStrategy = new ForceActionUpdateStrategy();
|
||||||
public void Update(IAction targetObject, IAction sourceObject)
|
public void Update(IAction targetObject, IAction sourceObject)
|
||||||
{
|
{
|
||||||
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
|
||||||
targetObject.Name = sourceObject.Name;
|
targetObject.Name = sourceObject.Name;
|
||||||
if (targetObject is IForceAction forceAction)
|
if (targetObject is IForceAction forceAction)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Forces.Logics
|
||||||
|
{
|
||||||
|
public class DesignForceTupleUpdateStrategy : IUpdateStrategy<IDesignForceTuple>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IForceTuple> forceTupleUpdateStrategy;
|
||||||
|
|
||||||
|
public DesignForceTupleUpdateStrategy(IUpdateStrategy<IForceTuple> forceTupleUpdateStrategy)
|
||||||
|
{
|
||||||
|
this.forceTupleUpdateStrategy = forceTupleUpdateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DesignForceTupleUpdateStrategy() : this (new ForceTupleUpdateStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(IDesignForceTuple targetObject, IDesignForceTuple sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
targetObject.LimitState = sourceObject.LimitState;
|
||||||
|
targetObject.CalcTerm = sourceObject.CalcTerm;
|
||||||
|
if (sourceObject.ForceTuple is not null)
|
||||||
|
{
|
||||||
|
forceTupleUpdateStrategy.Update(targetObject.ForceTuple, sourceObject.ForceTuple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Forces.Logics
|
||||||
|
{
|
||||||
|
public class ForceActionBaseUpdateStrategy : IUpdateStrategy<IForceAction>
|
||||||
|
{
|
||||||
|
private readonly IUpdateStrategy<IPoint2D> pointStrategy;
|
||||||
|
|
||||||
|
public ForceActionBaseUpdateStrategy(IUpdateStrategy<IPoint2D> pointStrategy)
|
||||||
|
{
|
||||||
|
this.pointStrategy = pointStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceActionBaseUpdateStrategy() : this(new Point2DUpdateStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(IForceAction targetObject, IForceAction sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
targetObject.Name = sourceObject.Name;
|
||||||
|
targetObject.SetInGravityCenter = sourceObject.SetInGravityCenter;
|
||||||
|
pointStrategy.Update(targetObject.ForcePoint, sourceObject.ForcePoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,21 +8,45 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
public class ForceActionUpdateStrategy : IUpdateStrategy<IForceAction>
|
||||||
{
|
{
|
||||||
private readonly IUpdateStrategy<IPoint2D> pointStrategy = new Point2DUpdateStrategy();
|
private readonly IUpdateStrategy<IForceAction> forceActionUpdateStrategy;
|
||||||
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy = new ForcePairUpdateStrategy();
|
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy;
|
||||||
private readonly IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy = new FactorCombinationUpdateStrategy();
|
private readonly IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy;
|
||||||
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy = new ForceCombinationListUpdateStrategy();
|
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy;
|
||||||
|
|
||||||
|
public ForceActionUpdateStrategy(
|
||||||
|
IUpdateStrategy<IForceAction> forceActionUpdateStrategy,
|
||||||
|
IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy,
|
||||||
|
IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy,
|
||||||
|
IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy)
|
||||||
|
{
|
||||||
|
this.forceActionUpdateStrategy = forceActionUpdateStrategy;
|
||||||
|
this.forcePairUpdateStrategy = forcePairUpdateStrategy;
|
||||||
|
this.factorUpdateStrategy = factorUpdateStrategy;
|
||||||
|
this.forceListUpdateStrategy = forceListUpdateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceActionUpdateStrategy() : this(
|
||||||
|
new ForceActionBaseUpdateStrategy(),
|
||||||
|
new ForcePairUpdateStrategy(),
|
||||||
|
new ForceCombinationByFactorUpdateStrategy(),
|
||||||
|
new ForceCombinationListUpdateStrategy()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void Update(IForceAction targetObject, IForceAction sourceObject)
|
public void Update(IForceAction targetObject, IForceAction sourceObject)
|
||||||
{
|
{
|
||||||
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
forceActionUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
targetObject.SetInGravityCenter = sourceObject.SetInGravityCenter;
|
|
||||||
pointStrategy.Update(targetObject.ForcePoint, sourceObject.ForcePoint);
|
|
||||||
UpdateChildProperties(targetObject, sourceObject);
|
UpdateChildProperties(targetObject, sourceObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,20 +8,21 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
public class FactorCombinationUpdateStrategy : IUpdateStrategy<IForceCombinationByFactor>
|
public class ForceCombinationByFactorUpdateStrategy : IUpdateStrategy<IForceCombinationByFactor>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<IForceTuple> tupleUpdateStrategy;
|
private IUpdateStrategy<IForceTuple> tupleUpdateStrategy;
|
||||||
public FactorCombinationUpdateStrategy(IUpdateStrategy<IForceTuple> tupleUpdateStrategy)
|
public ForceCombinationByFactorUpdateStrategy(IUpdateStrategy<IForceTuple> tupleUpdateStrategy)
|
||||||
{
|
{
|
||||||
this.tupleUpdateStrategy = tupleUpdateStrategy;
|
this.tupleUpdateStrategy = tupleUpdateStrategy;
|
||||||
}
|
}
|
||||||
public FactorCombinationUpdateStrategy() : this(new ForceTupleUpdateStrategy())
|
public ForceCombinationByFactorUpdateStrategy() : this(new ForceTupleUpdateStrategy())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public void Update(IForceCombinationByFactor targetObject, IForceCombinationByFactor sourceObject)
|
public void Update(IForceCombinationByFactor targetObject, IForceCombinationByFactor sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
tupleUpdateStrategy.Update(targetObject.FullSLSForces, sourceObject.FullSLSForces);
|
tupleUpdateStrategy.Update(targetObject.FullSLSForces, sourceObject.FullSLSForces);
|
||||||
targetObject.ULSFactor = sourceObject.ULSFactor;
|
targetObject.ULSFactor = sourceObject.ULSFactor;
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Forces.Logics;
|
||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -10,10 +11,22 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
public class ForceCombinationListUpdateStrategy : IUpdateStrategy<IForceCombinationList>
|
public class ForceCombinationListUpdateStrategy : IUpdateStrategy<IForceCombinationList>
|
||||||
{
|
{
|
||||||
|
private IUpdateStrategy<IDesignForceTuple> designForceTupleUpdateStrategy;
|
||||||
|
|
||||||
|
public ForceCombinationListUpdateStrategy(IUpdateStrategy<IDesignForceTuple> designForceTupleUpdateStrategy)
|
||||||
|
{
|
||||||
|
this.designForceTupleUpdateStrategy = designForceTupleUpdateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCombinationListUpdateStrategy() : this (new DesignForceTupleUpdateStrategy())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void Update(IForceCombinationList targetObject, IForceCombinationList sourceObject)
|
public void Update(IForceCombinationList targetObject, IForceCombinationList sourceObject)
|
||||||
{
|
{
|
||||||
|
CheckObject.IsNull(targetObject, sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
|
||||||
targetObject.DesignForces.Clear();
|
targetObject.DesignForces.Clear();
|
||||||
foreach (var item in sourceObject.DesignForces)
|
foreach (var item in sourceObject.DesignForces)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Services.Forces;
|
using StructureHelperCommon.Services.Forces;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Forces
|
namespace StructureHelperCommon.Models.Forces
|
||||||
{
|
{
|
||||||
@@ -8,6 +9,8 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
{
|
{
|
||||||
private readonly IUpdateStrategy<IForceTuple> updateStrategy = new ForceTupleUpdateStrategy();
|
private readonly IUpdateStrategy<IForceTuple> updateStrategy = new ForceTupleUpdateStrategy();
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
public Guid Id { get; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public double Mx { get; set; }
|
public double Mx { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double My { get; set; }
|
public double My { get; set; }
|
||||||
@@ -20,6 +23,16 @@ namespace StructureHelperCommon.Models.Forces
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double Mz { get; set; }
|
public double Mz { get; set; }
|
||||||
|
|
||||||
|
public StrainTuple(Guid id)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StrainTuple() : this (Guid.NewGuid())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
Mx = 0d;
|
Mx = 0d;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public double Modulus { get; set; }
|
public double Modulus { get; set; }
|
||||||
public double CompressiveStrength { get; set; }
|
public double CompressiveStrength { get; set; }
|
||||||
public double TensileStrength { get; set; }
|
public double TensileStrength { get; set; }
|
||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
|
||||||
|
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public double CompressiveStrength { get; set; }
|
public double CompressiveStrength { get; set; }
|
||||||
public double TensileStrength { get; set; }
|
public double TensileStrength { get; set; }
|
||||||
|
|
||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
|
||||||
public double ULSConcreteStrength { get; set; }
|
public double ULSConcreteStrength { get; set; }
|
||||||
public double SumThickness { get; set; }
|
public double SumThickness { get; set; }
|
||||||
public double GammaF2 => GetGammaF2();
|
public double GammaF2 => GetGammaF2();
|
||||||
|
|||||||
@@ -12,6 +12,5 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
double Modulus { get; set; }
|
double Modulus { get; set; }
|
||||||
double CompressiveStrength { get; set; }
|
double CompressiveStrength { get; set; }
|
||||||
double TensileStrength { get; set; }
|
double TensileStrength { get; set; }
|
||||||
List<IMaterialSafetyFactor> SafetyFactors { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using LoaderCalculator.Data.Materials;
|
using LoaderCalculator.Data.Materials;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
using StructureHelperLogics.Models.Materials;
|
using StructureHelperLogics.Models.Materials;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -12,5 +13,6 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||||
IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||||
|
List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public interface ILibMaterial : IHelperMaterial
|
public interface ILibMaterial : IHelperMaterial
|
||||||
{
|
{
|
||||||
ILibMaterialEntity MaterialEntity { get; set; }
|
ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
|
||||||
IMaterialLogic MaterialLogic { get; set; }
|
IMaterialLogic MaterialLogic { get; set; }
|
||||||
List<IMaterialLogic> MaterialLogics { get; }
|
List<IMaterialLogic> MaterialLogics { get; }
|
||||||
(double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm);
|
(double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm);
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.Models.Materials
|
namespace StructureHelperLogics.Models.Materials
|
||||||
{
|
{
|
||||||
internal class ElasticUpdateStrategy : IUpdateStrategy<IElasticMaterial>
|
public class ElasticUpdateStrategy : IUpdateStrategy<IElasticMaterial>
|
||||||
{
|
{
|
||||||
public void Update(IElasticMaterial targetObject, IElasticMaterial sourceObject)
|
public void Update(IElasticMaterial targetObject, IElasticMaterial sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
targetObject.Modulus = sourceObject.Modulus;
|
targetObject.Modulus = sourceObject.Modulus;
|
||||||
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;
|
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;
|
||||||
|
|||||||
@@ -9,11 +9,14 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.Models.Materials
|
namespace StructureHelperLogics.Models.Materials
|
||||||
{
|
{
|
||||||
internal class FRUpdateStrategy : IUpdateStrategy<IFRMaterial>
|
/// <inheritdoc/>
|
||||||
|
public class FRUpdateStrategy : IUpdateStrategy<IFRMaterial>
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
public void Update(IFRMaterial targetObject, IFRMaterial sourceObject)
|
public void Update(IFRMaterial targetObject, IFRMaterial sourceObject)
|
||||||
{
|
{
|
||||||
CheckObject.ReferenceEquals(targetObject, sourceObject);
|
CheckObject.IsNull(targetObject);
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
targetObject.Modulus = sourceObject.Modulus;
|
targetObject.Modulus = sourceObject.Modulus;
|
||||||
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;
|
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using StructureHelperCommon.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials.Logics
|
||||||
|
{
|
||||||
|
public class HelpermaterialSafetyFactorsUpdateStrategy : IUpdateStrategy<IHelperMaterial>
|
||||||
|
{
|
||||||
|
public void Update(IHelperMaterial targetObject, IHelperMaterial sourceObject)
|
||||||
|
{
|
||||||
|
CheckObject.IsNull(sourceObject);
|
||||||
|
CheckObject.IsNull(targetObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
if (sourceObject.SafetyFactors is not null)
|
||||||
|
{
|
||||||
|
if (targetObject.SafetyFactors is null)
|
||||||
|
{
|
||||||
|
targetObject.SafetyFactors = new();
|
||||||
|
}
|
||||||
|
targetObject.SafetyFactors.Clear();
|
||||||
|
foreach (var item in sourceObject.SafetyFactors)
|
||||||
|
{
|
||||||
|
targetObject.SafetyFactors.Add(item.Clone() as IMaterialSafetyFactor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
|
using StructureHelperLogics.Models.Materials.Logics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -15,6 +17,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
private IUpdateStrategy<IFRMaterial> frStrategy;
|
private IUpdateStrategy<IFRMaterial> frStrategy;
|
||||||
private IUpdateStrategy<IConcreteLibMaterial> concreteStrategy;
|
private IUpdateStrategy<IConcreteLibMaterial> concreteStrategy;
|
||||||
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy;
|
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy;
|
||||||
|
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy = new HelpermaterialSafetyFactorsUpdateStrategy();
|
||||||
public HelperMaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
|
public HelperMaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
|
||||||
IUpdateStrategy<IFRMaterial> frStrategy,
|
IUpdateStrategy<IFRMaterial> frStrategy,
|
||||||
IUpdateStrategy<IConcreteLibMaterial> concreteStrategy,
|
IUpdateStrategy<IConcreteLibMaterial> concreteStrategy,
|
||||||
@@ -38,6 +41,8 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
CheckObject.IsNull(sourceObject);
|
CheckObject.IsNull(sourceObject);
|
||||||
CheckObject.IsNull(targetObject);
|
CheckObject.IsNull(targetObject);
|
||||||
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
|
safetyFactorUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
if (sourceObject is ILibMaterial)
|
if (sourceObject is ILibMaterial)
|
||||||
{
|
{
|
||||||
UpdateLibMaterial(targetObject, sourceObject);
|
UpdateLibMaterial(targetObject, sourceObject);
|
||||||
|
|||||||
@@ -17,18 +17,6 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
CheckObject.IsNull(targetObject);
|
CheckObject.IsNull(targetObject);
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
targetObject.MaterialEntity = sourceObject.MaterialEntity;
|
targetObject.MaterialEntity = sourceObject.MaterialEntity;
|
||||||
if (sourceObject.SafetyFactors is not null)
|
|
||||||
{
|
|
||||||
if (targetObject.SafetyFactors is null)
|
|
||||||
{
|
|
||||||
targetObject.SafetyFactors = new();
|
|
||||||
}
|
|
||||||
targetObject.SafetyFactors.Clear();
|
|
||||||
foreach (var item in sourceObject.SafetyFactors)
|
|
||||||
{
|
|
||||||
targetObject.SafetyFactors.Add(item.Clone() as IMaterialSafetyFactor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
targetObject.MaterialLogic = sourceObject.MaterialLogic;
|
targetObject.MaterialLogic = sourceObject.MaterialLogic;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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() { DiameterByX = diameter, Name = "Concrete block"};
|
concreteBlock = new EllipsePrimitive() { Width = diameter, Name = "Concrete block"};
|
||||||
concreteBlock.NdmElement.HeadMaterial = concreteMaterial;
|
concreteBlock.NdmElement.HeadMaterial = concreteMaterial;
|
||||||
primitives.Add(concreteBlock);
|
primitives.Add(concreteBlock);
|
||||||
return primitives;
|
return primitives;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IVisualProperty VisualProperty { get; } = new VisualProperty { Opacity = 0.8d };
|
public IVisualProperty VisualProperty { get; } = new VisualProperty { Opacity = 0.8d };
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double DiameterByX
|
public double Width
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public double DiameterByY { get => rectangleShape.Height; set => rectangleShape.Height = value; }
|
public double Height { get => rectangleShape.Height; set => rectangleShape.Height = value; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public ICrossSection? CrossSection { get; set; }
|
public ICrossSection? CrossSection { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -46,6 +46,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IShape Shape => rectangleShape;
|
public IShape Shape => rectangleShape;
|
||||||
|
|
||||||
|
public double Angle { get; set; }
|
||||||
|
|
||||||
public EllipsePrimitive(Guid id)
|
public EllipsePrimitive(Guid id)
|
||||||
{
|
{
|
||||||
@@ -78,7 +79,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
var dX = Center.X - point.X;
|
var dX = Center.X - point.X;
|
||||||
var dY = Center.Y - point.Y;
|
var dY = Center.Y - point.Y;
|
||||||
var distance = Math.Sqrt(dX * dX + dY * dY);
|
var distance = Math.Sqrt(dX * dX + dY * dY);
|
||||||
if (distance > DiameterByX / 2) { return false; }
|
if (distance > Width / 2) { return false; }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,28 +97,28 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
newPoint = new NamedAreaPoint
|
newPoint = new NamedAreaPoint
|
||||||
{
|
{
|
||||||
Name = "Left",
|
Name = "Left",
|
||||||
Point = new Point2D() { X = Center.X - DiameterByX / 2d, Y = Center.Y},
|
Point = new Point2D() { X = Center.X - Width / 2d, Y = Center.Y},
|
||||||
Area = 0d
|
Area = 0d
|
||||||
};
|
};
|
||||||
points.Add(newPoint);
|
points.Add(newPoint);
|
||||||
newPoint = new NamedAreaPoint
|
newPoint = new NamedAreaPoint
|
||||||
{
|
{
|
||||||
Name = "Top",
|
Name = "Top",
|
||||||
Point = new Point2D() { X = Center.X, Y = Center.Y + DiameterByX / 2d },
|
Point = new Point2D() { X = Center.X, Y = Center.Y + Width / 2d },
|
||||||
Area = 0d
|
Area = 0d
|
||||||
};
|
};
|
||||||
points.Add(newPoint);
|
points.Add(newPoint);
|
||||||
newPoint = new NamedAreaPoint
|
newPoint = new NamedAreaPoint
|
||||||
{
|
{
|
||||||
Name = "Right",
|
Name = "Right",
|
||||||
Point = new Point2D() { X = Center.X + DiameterByX / 2d, Y = Center.Y },
|
Point = new Point2D() { X = Center.X + Width / 2d, Y = Center.Y },
|
||||||
Area = 0d
|
Area = 0d
|
||||||
};
|
};
|
||||||
points.Add(newPoint);
|
points.Add(newPoint);
|
||||||
newPoint = new NamedAreaPoint
|
newPoint = new NamedAreaPoint
|
||||||
{
|
{
|
||||||
Name = "Bottom",
|
Name = "Bottom",
|
||||||
Point = new Point2D() { X = Center.X, Y = Center.Y - DiameterByX / 2d },
|
Point = new Point2D() { X = Center.X, Y = Center.Y - Width / 2d },
|
||||||
Area = 0d
|
Area = 0d
|
||||||
};
|
};
|
||||||
points.Add(newPoint);
|
points.Add(newPoint);
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
public interface IEllipsePrimitive : INdmPrimitive, IHasDivisionSize
|
public interface IEllipsePrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||||
{
|
{
|
||||||
double DiameterByX { get; set; }
|
|
||||||
double DiameterByY { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
{
|
{
|
||||||
Center = primitive.Center.Clone() as Point2D;
|
Center = primitive.Center.Clone() as Point2D;
|
||||||
//to do change to ellipse
|
//to do change to ellipse
|
||||||
Circle = new CircleShape() { Diameter = primitive.DiameterByX };
|
Circle = new CircleShape() { Diameter = primitive.Width };
|
||||||
NdmMaxSize = primitive.DivisionSize.NdmMaxSize;
|
NdmMaxSize = primitive.DivisionSize.NdmMaxSize;
|
||||||
NdmMinDivision = primitive.DivisionSize.NdmMinDivision;
|
NdmMinDivision = primitive.DivisionSize.NdmMinDivision;
|
||||||
HeadMaterial = primitive.NdmElement.HeadMaterial;
|
HeadMaterial = primitive.NdmElement.HeadMaterial;
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
|||||||
mainBlock.VisualProperty.ZIndex = 0;
|
mainBlock.VisualProperty.ZIndex = 0;
|
||||||
var opening = new EllipsePrimitive()
|
var opening = new EllipsePrimitive()
|
||||||
{
|
{
|
||||||
DiameterByX = 0.3d
|
Width = 0.3d
|
||||||
};
|
};
|
||||||
opening.DivisionSize.ClearUnderlying = true;
|
opening.DivisionSize.ClearUnderlying = true;
|
||||||
opening.NdmElement.HeadMaterial = material;
|
opening.NdmElement.HeadMaterial = material;
|
||||||
@@ -155,7 +155,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
|||||||
//Arrange
|
//Arrange
|
||||||
ProgramSetting.NatSystem = NatSystems.RU;
|
ProgramSetting.NatSystem = NatSystems.RU;
|
||||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||||
var mainBlock = new EllipsePrimitive() { DiameterByX = diameter};
|
var mainBlock = new EllipsePrimitive() { Width = diameter};
|
||||||
mainBlock.NdmElement.HeadMaterial = material;
|
mainBlock.NdmElement.HeadMaterial = material;
|
||||||
mainBlock.Center.X = centerX;
|
mainBlock.Center.X = centerX;
|
||||||
mainBlock.Center.Y = centerY;
|
mainBlock.Center.Y = centerY;
|
||||||
|
|||||||
Reference in New Issue
Block a user