Add cross-section convert strategies
This commit is contained in:
59
DataAccess/DTOs/ConcreteLibMaterialDTO.cs
Normal file
59
DataAccess/DTOs/ConcreteLibMaterialDTO.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
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 ConcreteLibMaterialDTO : IConcreteLibMaterial
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("RelativeHumidity")]
|
||||
public double RelativeHumidity { get; set; }
|
||||
[JsonProperty("MinAge")]
|
||||
public double MinAge { get; set; }
|
||||
[JsonProperty("MaxAge")]
|
||||
public double MaxAge { get; set; }
|
||||
[JsonProperty("MaterialEntity")]
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
[JsonProperty("SafetyFactors")]
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||
[JsonProperty("TensionForULS")]
|
||||
public bool TensionForULS { get; set; }
|
||||
[JsonProperty("TensionForSLS")]
|
||||
public bool TensionForSLS { get; set; }
|
||||
|
||||
|
||||
public IMaterialLogic MaterialLogic { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public List<IMaterialLogic> MaterialLogics => throw new NotImplementedException();
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
66
DataAccess/DTOs/Converters/AnalysisToDTOConvertStrategy.cs
Normal file
66
DataAccess/DTOs/Converters/AnalysisToDTOConvertStrategy.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperLogic.Models.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip;
|
||||
|
||||
namespace DataAccess.DTOs.Converters
|
||||
{
|
||||
public class AnalysisToDTOConvertStrategy : IConvertStrategy<IAnalysis, IAnalysis>
|
||||
{
|
||||
private const string Message = "Analysis type is";
|
||||
private IConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis> convertCrossSectionNdmAnalysisStrategy = new CrossSectionNdmAnalysisToDTOConvertStrategy();
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public IAnalysis Convert(IAnalysis source)
|
||||
{
|
||||
Check();
|
||||
IAnalysis analysis;
|
||||
if (source is ICrossSectionNdmAnalysis crossSectionNdmAnalysis)
|
||||
{
|
||||
analysis = GetCrossSectionNdmAnalysisDTO(crossSectionNdmAnalysis);
|
||||
}
|
||||
else
|
||||
{
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
foreach (var item in source.VersionProcessor.Versions)
|
||||
{
|
||||
|
||||
}
|
||||
return analysis;
|
||||
}
|
||||
|
||||
private CrossSectionNdmAnalysisDTO GetCrossSectionNdmAnalysisDTO(ICrossSectionNdmAnalysis crossSectionNdmAnalysis)
|
||||
{
|
||||
TraceLogger?.AddMessage(Message + " Cross-Section Ndm Analysis", TraceLogStatuses.Debug);
|
||||
convertCrossSectionNdmAnalysisStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertCrossSectionNdmAnalysisStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis>()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = convertCrossSectionNdmAnalysisStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
CrossSectionNdmAnalysisDTO crossSectionNdmAnalysisDTO = convertLogic.Convert(crossSectionNdmAnalysis);
|
||||
return crossSectionNdmAnalysisDTO;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<IAnalysis, IAnalysis>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
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.Converters
|
||||
{
|
||||
public class ConcreteLibMaterialToDTOConvertStrategy : IConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial>
|
||||
{
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public ConcreteLibMaterialDTO Convert(IConcreteLibMaterial source)
|
||||
{
|
||||
Check();
|
||||
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<ConcreteLibMaterialDTO, IConcreteLibMaterial>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperLogic.Models.Analyses;
|
||||
using StructureHelperLogics.Models.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs.Converters
|
||||
{
|
||||
internal class CrossSectionNdmAnalysisToDTOConvertStrategy : IConvertStrategy<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis>
|
||||
{
|
||||
private IUpdateStrategy<ICrossSectionNdmAnalysis> updateStrategy;
|
||||
private IConvertStrategy<VersionProcessorDTO, IVersionProcessor> convertStrategy;
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public CrossSectionNdmAnalysisToDTOConvertStrategy(
|
||||
IUpdateStrategy<ICrossSectionNdmAnalysis> updateStrategy,
|
||||
IConvertStrategy<VersionProcessorDTO, IVersionProcessor> convertStrategy,
|
||||
IShiftTraceLogger traceLogger)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
this.convertStrategy = convertStrategy;
|
||||
this.TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public CrossSectionNdmAnalysisToDTOConvertStrategy() : this(new CrossSectionNdmAnalysisUpdateStrategy(),
|
||||
new VersionProcessorToDTOConvertStrategy(),
|
||||
null)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public CrossSectionNdmAnalysisDTO Convert(ICrossSectionNdmAnalysis source)
|
||||
{
|
||||
Check();
|
||||
CrossSectionNdmAnalysisDTO newItem = new();
|
||||
newItem.Id = source.Id;
|
||||
updateStrategy.Update(newItem, source);
|
||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<VersionProcessorDTO, IVersionProcessor>()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = convertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
newItem.VersionProcessor = convertLogic.Convert(source.VersionProcessor);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<CrossSectionNdmAnalysisDTO, ICrossSectionNdmAnalysis>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using DataAccess.DTOs.Converters;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
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 CrossSectionRepositoryToDTOConvertStrategy : IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository>
|
||||
{
|
||||
private IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy;
|
||||
|
||||
public CrossSectionRepositoryToDTOConvertStrategy(IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy)
|
||||
{
|
||||
this.materialConvertStrategy = materialConvertStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionRepositoryToDTOConvertStrategy() : this(
|
||||
new HeadMaterialToDTOConvertStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public CrossSectionRepositoryDTO Convert(ICrossSectionRepository source)
|
||||
{
|
||||
Check();
|
||||
CrossSectionRepositoryDTO newItem = new()
|
||||
{
|
||||
Id = source.Id
|
||||
};
|
||||
List<HeadMaterialDTO> materials = ProcessMaterials(source);
|
||||
newItem.HeadMaterials.AddRange(materials);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private List<HeadMaterialDTO> ProcessMaterials(ICrossSectionRepository source)
|
||||
{
|
||||
materialConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
materialConvertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<HeadMaterialDTO, IHeadMaterial>()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = materialConvertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
List<HeadMaterialDTO> materials = new();
|
||||
foreach (var item in source.HeadMaterials)
|
||||
{
|
||||
materials.Add(convertLogic.Convert(item));
|
||||
}
|
||||
|
||||
return materials;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<CrossSectionRepositoryDTO, ICrossSectionRepository>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
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 CrossSectionToDTOConvertStrategy : IConvertStrategy<CrossSectionDTO, ICrossSection>
|
||||
{
|
||||
private IUpdateStrategy<ICrossSection> updateStrategy;
|
||||
private IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertStrategy;
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public CrossSectionToDTOConvertStrategy(IUpdateStrategy<ICrossSection> updateStrategy,
|
||||
IConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository> convertStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
this.convertStrategy = convertStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionToDTOConvertStrategy() : this(
|
||||
new CrossSectionUpdateStrategy(),
|
||||
new CrossSectionRepositoryToDTOConvertStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public CrossSectionDTO Convert(ICrossSection source)
|
||||
{
|
||||
Check();
|
||||
CrossSectionDTO newItem = new()
|
||||
{
|
||||
Id = source.Id
|
||||
};
|
||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<CrossSectionRepositoryDTO, ICrossSectionRepository>()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = convertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
newItem.SectionRepository = convertLogic.Convert(source.SectionRepository);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<CrossSectionDTO, ICrossSection>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperLogic.Models.Analyses;
|
||||
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 DateVersionToDTOConvertStrategy : IConvertStrategy<DateVersionDTO, IDateVersion>
|
||||
{
|
||||
private IUpdateStrategy<IDateVersion> updateStrategy;
|
||||
private IConvertStrategy<ISaveable, ISaveable> convertStrategy;
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public DateVersionToDTOConvertStrategy(
|
||||
IUpdateStrategy<IDateVersion> updateStrategy,
|
||||
IConvertStrategy<ISaveable, ISaveable> convertStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
this.convertStrategy = convertStrategy;
|
||||
}
|
||||
|
||||
public DateVersionToDTOConvertStrategy() : this (
|
||||
new DateVersionUpdateStrategy(),
|
||||
new VersionItemToDTOConvertStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DateVersionDTO Convert(IDateVersion source)
|
||||
{
|
||||
Check();
|
||||
DateVersionDTO newItem = new()
|
||||
{
|
||||
Id = source.Id
|
||||
};
|
||||
updateStrategy.Update(newItem, source);
|
||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<ISaveable, ISaveable>()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = convertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
newItem.AnalysisVersion = convertLogic.Convert(source.AnalysisVersion);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<DateVersionDTO, IDateVersion>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
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 HeadMaterialToDTOConvertStrategy : IConvertStrategy<HeadMaterialDTO, IHeadMaterial>
|
||||
{
|
||||
private IUpdateStrategy<IHeadMaterial> updateStrategy;
|
||||
|
||||
public HeadMaterialToDTOConvertStrategy(IUpdateStrategy<IHeadMaterial> updateStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
}
|
||||
|
||||
public HeadMaterialToDTOConvertStrategy() : this (new HeadMaterialUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public HeadMaterialDTO Convert(IHeadMaterial source)
|
||||
{
|
||||
HeadMaterialDTO newItem = new() { Id = source.Id};
|
||||
updateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
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.Converters
|
||||
{
|
||||
internal class HelperMaterialToDTOConvertStrategy : IConvertStrategy<IHelperMaterial, IHelperMaterial>
|
||||
{
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public IHelperMaterial Convert(IHelperMaterial source)
|
||||
{
|
||||
Check();
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<IHelperMaterial, IHelperMaterial>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,21 +31,35 @@ namespace DataAccess.DTOs
|
||||
|
||||
public ProjectDTO Convert(IProject source)
|
||||
{
|
||||
ProjectDTO projectDTO = new(source.Id);
|
||||
updateStrategy.Update(projectDTO, source);
|
||||
Check();
|
||||
ProjectDTO newItem = new()
|
||||
{
|
||||
Id = source.Id
|
||||
};
|
||||
updateStrategy.Update(newItem, source);
|
||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<VisualAnalysisDTO, IVisualAnalysis>()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = convertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
newItem.VisualAnalyses.Clear();
|
||||
foreach (var item in source.VisualAnalyses)
|
||||
{
|
||||
var newVisualAnalysis = convertLogic.Convert(item);
|
||||
projectDTO.VisualAnalyses.Add(newVisualAnalysis);
|
||||
newItem.VisualAnalyses.Add(newVisualAnalysis);
|
||||
}
|
||||
return projectDTO;
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<ProjectDTO, IProject>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataAccess.DTOs.Converters
|
||||
{
|
||||
public class VersionItemToDTOConvertStrategy : IConvertStrategy<ISaveable, ISaveable>
|
||||
{
|
||||
private const string Message = "Analysis type is";
|
||||
private IConvertStrategy<CrossSectionDTO, ICrossSection> crossSectionConvertStrategy = new CrossSectionToDTOConvertStrategy();
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
|
||||
public ISaveable Convert(ISaveable source)
|
||||
{
|
||||
Check();
|
||||
ISaveable saveable;
|
||||
if (source is ICrossSection crossSection)
|
||||
{
|
||||
saveable = ProcessCrossSection(crossSection);
|
||||
}
|
||||
else
|
||||
{
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
return saveable;
|
||||
}
|
||||
|
||||
private ISaveable ProcessCrossSection(ICrossSection crossSection)
|
||||
{
|
||||
TraceLogger?.AddMessage(Message + " Cross-Section Ndm Analysis", TraceLogStatuses.Debug);
|
||||
ISaveable saveable;
|
||||
crossSectionConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
crossSectionConvertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<CrossSectionDTO, ICrossSection>()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = crossSectionConvertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
saveable = convertLogic.Convert(crossSection);
|
||||
return saveable;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<ISaveable, ISaveable>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
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 VersionProcessorToDTOConvertStrategy : IConvertStrategy<VersionProcessorDTO, IVersionProcessor>
|
||||
{
|
||||
private IConvertStrategy<DateVersionDTO, IDateVersion> convertStrategy = new DateVersionToDTOConvertStrategy();
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public VersionProcessorDTO Convert(IVersionProcessor source)
|
||||
{
|
||||
Check();
|
||||
VersionProcessorDTO newItem = new()
|
||||
{
|
||||
Id = source.Id
|
||||
};
|
||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertStrategy.TraceLogger = TraceLogger;
|
||||
foreach (var item in source.Versions)
|
||||
{
|
||||
var convertLogic = new DictionaryConvertStrategy<DateVersionDTO, IDateVersion>()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = convertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
newItem.Versions.Add(convertLogic.Convert(item));
|
||||
}
|
||||
return newItem;
|
||||
}
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<VersionProcessorDTO, IVersionProcessor>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using DataAccess.DTOs.Converters;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperCommon.Models.Projects;
|
||||
using StructureHelperLogic.Models.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -11,16 +15,45 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
internal class VisualAnalysisToDTOConvertStrategy : IConvertStrategy<VisualAnalysisDTO, IVisualAnalysis>
|
||||
{
|
||||
private IConvertStrategy<IAnalysis, IAnalysis> convertStrategy;
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public VisualAnalysisToDTOConvertStrategy(IConvertStrategy<IAnalysis, IAnalysis> convertStrategy)
|
||||
{
|
||||
this.convertStrategy = convertStrategy;
|
||||
}
|
||||
|
||||
public VisualAnalysisToDTOConvertStrategy() : this(new AnalysisToDTOConvertStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public VisualAnalysisDTO Convert(IVisualAnalysis source)
|
||||
{
|
||||
Check();
|
||||
VisualAnalysisDTO visualAnalysisDTO = new()
|
||||
{
|
||||
Id = source.Id
|
||||
};
|
||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<IAnalysis, IAnalysis>()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = convertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
visualAnalysisDTO.Analysis = convertLogic.Convert(source.Analysis);
|
||||
return visualAnalysisDTO;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<VisualAnalysisDTO, IVisualAnalysis>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,9 +10,11 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
public class CrossSectionDTO : ICrossSection
|
||||
{
|
||||
public ICrossSectionRepository SectionRepository { get; }
|
||||
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("SectionRepository")]
|
||||
public ICrossSectionRepository SectionRepository { get; set; }
|
||||
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
|
||||
28
DataAccess/DTOs/CrossSectionNdmAnalysisDTO.cs
Normal file
28
DataAccess/DTOs/CrossSectionNdmAnalysisDTO.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperLogic.Models.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CrossSectionNdmAnalysisDTO : ICrossSectionNdmAnalysis
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("Name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty("Tags")]
|
||||
public string Tags { get; set; }
|
||||
[JsonProperty("VersionProcessor")]
|
||||
public IVersionProcessor VersionProcessor { get; set; } = new VersionProcessorDTO();
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DataAccess/DTOs/CrossSectionRepositoryDTO.cs
Normal file
29
DataAccess/DTOs/CrossSectionRepositoryDTO.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CrossSectionRepositoryDTO : ICrossSectionRepository
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("HeadMaterials")]
|
||||
public List<IHeadMaterial> HeadMaterials { get; } = new();
|
||||
[JsonProperty("ForceActions")]
|
||||
public List<IForceAction> ForceActions { get; } = new();
|
||||
[JsonProperty("Primitives")]
|
||||
public List<INdmPrimitive> Primitives { get; } = new();
|
||||
[JsonProperty("Calculators")]
|
||||
public List<ICalculator> Calculators { get; } = new();
|
||||
|
||||
}
|
||||
}
|
||||
22
DataAccess/DTOs/DateVersionDTO.cs
Normal file
22
DataAccess/DTOs/DateVersionDTO.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class DateVersionDTO : IDateVersion
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("DateTime")]
|
||||
public DateTime DateTime { get; set; }
|
||||
[JsonProperty("AnalysisVersion")]
|
||||
public ISaveable AnalysisVersion { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
44
DataAccess/DTOs/HeadMaterialDTO.cs
Normal file
44
DataAccess/DTOs/HeadMaterialDTO.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class HeadMaterialDTO : IHeadMaterial
|
||||
{
|
||||
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("Name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty("Color")]
|
||||
public Color Color { get; set; }
|
||||
[JsonProperty("HelperMaterial")]
|
||||
public IHelperMaterial HelperMaterial { get; set; }
|
||||
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,16 +25,5 @@ namespace DataAccess.DTOs
|
||||
|
||||
[JsonIgnore]
|
||||
public string FileName { get; set; }
|
||||
|
||||
public ProjectDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public ProjectDTO() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
42
DataAccess/DTOs/TypeBinder.cs
Normal file
42
DataAccess/DTOs/TypeBinder.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class TypeBinder : ISerializationBinder
|
||||
{
|
||||
private List<(Type type, string name)> typesNames;
|
||||
public static IShiftTraceLogger TraceLogger;
|
||||
public TypeBinder(List<(Type type, string name)> typesNames, IShiftTraceLogger traceLogger = null)
|
||||
{
|
||||
this.typesNames = typesNames;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public void BindToName(Type serializedType, out string? assemblyName, out string? typeName)
|
||||
{
|
||||
assemblyName = null;
|
||||
if (typesNames.Any(x => x.type == serializedType))
|
||||
{
|
||||
typeName = typesNames.Single(x => x.type == serializedType).name;
|
||||
}
|
||||
else
|
||||
{
|
||||
typeName = serializedType.FullName;
|
||||
}
|
||||
}
|
||||
|
||||
public Type BindToType(string? assemblyName, string typeName)
|
||||
{
|
||||
return typesNames.SingleOrDefault(x => x.name == typeName).type;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
60
DataAccess/DTOs/TypeBinderListFactory.cs
Normal file
60
DataAccess/DTOs/TypeBinderListFactory.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
internal enum TypeFileVersion
|
||||
{
|
||||
version_v1
|
||||
}
|
||||
internal static class TypeBinderListFactory
|
||||
{
|
||||
public static List<(Type type, string name)> GetTypeNameList(TypeFileVersion fileVersion)
|
||||
{
|
||||
if (fileVersion == TypeFileVersion.version_v1)
|
||||
{
|
||||
List<(Type type, string name)> typesNames = GetVersionV1();
|
||||
return typesNames;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(fileVersion));
|
||||
}
|
||||
}
|
||||
|
||||
private static List<(Type type, string name)> GetVersionV1()
|
||||
{
|
||||
return new List<(Type type, string name)>
|
||||
{
|
||||
{ (typeof(CirclePrimitiveDTO), "CircleNdmPrimitive") },
|
||||
{ (typeof(ConcreteLibMaterialDTO), "ConcreteLibMaterial") },
|
||||
{ (typeof(CrossSectionDTO), "CrossSection") },
|
||||
{ (typeof(CrossSectionNdmAnalysisDTO), "CrossSectionNdmAnalysis") },
|
||||
{ (typeof(CrossSectionRepositoryDTO), "CrossSectionRepository") },
|
||||
{ (typeof(DateVersionDTO), "DateVersion") },
|
||||
{ (typeof(FileVersionDTO), "FileVersion") },
|
||||
{ (typeof(HeadMaterialDTO), "HeadMaterial") },
|
||||
{ (typeof(NdmPrimitiveDTO), "NdmPrimitive") },
|
||||
{ (typeof(IVisualAnalysis), "IVisualAnalysis") },
|
||||
{ (typeof(List<ICalculator>), "ListOfICalculator") },
|
||||
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
|
||||
{ (typeof(List<IForceAction>), "ListOfIForceAction") },
|
||||
{ (typeof(List<IHeadMaterial>), "ListOfIHeadMaterial") },
|
||||
{ (typeof(List<INdmPrimitive>), "ListOfINdmPrimitive") },
|
||||
{ (typeof(List<IVisualAnalysis>), "ListOfIVisualAnalysis") },
|
||||
{ (typeof(ProjectDTO), "Project") },
|
||||
{ (typeof(VersionProcessorDTO), "VersionProcessor") },
|
||||
{ (typeof(VisualAnalysisDTO), "VisualAnalysis") },
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
30
DataAccess/DTOs/VersionProcessorDTO.cs
Normal file
30
DataAccess/DTOs/VersionProcessorDTO.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
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 VersionProcessorDTO : IVersionProcessor
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("Versions")]
|
||||
public List<IDateVersion> Versions { get; } = new();
|
||||
|
||||
public void AddVersion(ISaveable newItem)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IDateVersion GetCurrentVersion()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,4 +19,10 @@
|
||||
<Folder Include="NewFolder\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="LoaderCalculator">
|
||||
<HintPath>..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -47,23 +47,32 @@ namespace DataAccess.Infrastructures
|
||||
}
|
||||
|
||||
private void SaveToFile(IProject project)
|
||||
{
|
||||
try
|
||||
{
|
||||
version = ProgramSetting.GetCurrentFileVersion();
|
||||
refDictinary = new Dictionary<(Guid id, Type type), ISaveable>();
|
||||
FileVersionDTO versionDTO = GetVersionDTO();
|
||||
var versionString = Serialize(versionDTO, TraceLogger);
|
||||
File.Delete(project.FullFileName);
|
||||
SaveStringToFile(project, versionString);
|
||||
refDictinary = new Dictionary<(Guid id, Type type), ISaveable>();
|
||||
ProjectDTO projectDTO = GetProjectDTO(project);
|
||||
var projectString = Serialize(projectDTO, TraceLogger);
|
||||
SaveStringToFile(project, projectString);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void SaveStringToFile(IProject project, string versionString)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.WriteAllText(project.FullFileName, versionString);
|
||||
File.AppendAllText(project.FullFileName, versionString);
|
||||
TraceLogger?.AddMessage($"File {project.FullFileName} was saved successfully", TraceLogStatuses.Service);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -107,6 +116,8 @@ namespace DataAccess.Infrastructures
|
||||
|
||||
private static string Serialize(object obj, IShiftTraceLogger logger)
|
||||
{
|
||||
List<(Type type, string name)> typesNames = TypeBinderListFactory.GetTypeNameList(TypeFileVersion.version_v1);
|
||||
TypeBinder typeBinder = new(typesNames);
|
||||
var settings = new JsonSerializerSettings
|
||||
{
|
||||
Converters = new List<JsonConverter>
|
||||
@@ -115,6 +126,7 @@ namespace DataAccess.Infrastructures
|
||||
new FileVersionDTOJsonConverter(logger), // Add the specific converter
|
||||
new ProjectDTOJsonConverter(logger)
|
||||
},
|
||||
SerializationBinder = typeBinder,
|
||||
Formatting = Formatting.Indented,
|
||||
PreserveReferencesHandling = PreserveReferencesHandling.All,
|
||||
MissingMemberHandling = MissingMemberHandling.Ignore,
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace StructureHelper.Services.Settings
|
||||
{
|
||||
get
|
||||
{
|
||||
materials ??= new ListRepository<IHeadMaterial>(new MaterialUpdateStrategy());
|
||||
materials ??= new ListRepository<IHeadMaterial>(new HeadMaterialUpdateStrategy());
|
||||
return materials;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace StructureHelper.Windows.MainWindow.Analyses
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.NullReference);
|
||||
}
|
||||
if (version.Item is ICrossSection crossSection)
|
||||
if (version.AnalysisVersion is ICrossSection crossSection)
|
||||
{
|
||||
ProcessCrossSection(crossSection);
|
||||
}
|
||||
|
||||
@@ -284,10 +284,10 @@ namespace StructureHelper.Windows.MainWindow
|
||||
repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
|
||||
repository.Primitives.AddRange(newRepository.Primitives);
|
||||
repository.ForceActions.AddRange(newRepository.ForceActions);
|
||||
repository.CalculatorsList.AddRange(newRepository.CalculatorsList);
|
||||
repository.Calculators.AddRange(newRepository.Calculators);
|
||||
OnPropertyChanged(nameof(HeadMaterials));
|
||||
CombinationsLogic.AddItems(newRepository.ForceActions);
|
||||
CalculatorsLogic.AddItems(newRepository.CalculatorsList);
|
||||
CalculatorsLogic.AddItems(newRepository.Calculators);
|
||||
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
|
||||
PrimitiveLogic.Refresh();
|
||||
foreach (var item in newRepository.HeadMaterials)
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
||||
private bool DeleteAction()
|
||||
{
|
||||
bool result = true;
|
||||
var calcRepository = repository.CalculatorsList;
|
||||
var calcRepository = repository.Calculators;
|
||||
foreach (var calc in calcRepository)
|
||||
{
|
||||
if (calc is ForceCalculator forceCalculator)
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
else
|
||||
{
|
||||
var updateStrategy = new MaterialUpdateStrategy();
|
||||
var updateStrategy = new HeadMaterialUpdateStrategy();
|
||||
updateStrategy.Update(SelectedItem, copyObject);
|
||||
}
|
||||
base.EditMethod(parameter);
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
}
|
||||
}
|
||||
|
||||
public AnalysisViewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.CalculatorsList)
|
||||
public AnalysisViewModelLogic(ICrossSectionRepository sectionRepository) : base(sectionRepository.Calculators)
|
||||
{
|
||||
repository = sectionRepository;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
{
|
||||
var ndmPrimitive = SelectedItem.GetNdmPrimitive();
|
||||
repository.Primitives.Remove(ndmPrimitive);
|
||||
foreach (var calc in repository.CalculatorsList)
|
||||
foreach (var calc in repository.Calculators)
|
||||
{
|
||||
if (calc is ForceCalculator forceCalculator)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public class CheckConvertLogic<T, V> : ICheckLogic
|
||||
where T : ISaveable
|
||||
where V : ISaveable
|
||||
{
|
||||
private string checkResult;
|
||||
public IConvertStrategy<T, V> ConvertStrategy { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(ConvertStrategy), TraceLogStatuses.Service);
|
||||
if (ConvertStrategy is null)
|
||||
{
|
||||
string errorString = ErrorStrings.ParameterIsNull + ": Convert Strategy";
|
||||
checkResult += "\n" + errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
if (ConvertStrategy.ReferenceDictionary is null)
|
||||
{
|
||||
string errorString = ErrorStrings.ParameterIsNull + ": Reference Dictionary";
|
||||
checkResult += "\n" + errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
TraceLogger?.AddMessage("Checking of convert strategy is ok", TraceLogStatuses.Debug);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public IConvertStrategy<T,V> ConvertStrategy { get; set; }
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
|
||||
public T Convert(V source)
|
||||
{
|
||||
ICheckInputData();
|
||||
|
||||
@@ -9,8 +9,18 @@ namespace StructureHelperCommon.Models.Analyses
|
||||
{
|
||||
public class DateVersion : IDateVersion
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public DateTime DateTime { get; set; }
|
||||
public ISaveable AnalysisVersion { get; set; }
|
||||
|
||||
public DateVersion(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public DateVersion() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
public ISaveable Item { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Analyses
|
||||
{
|
||||
public interface IDateVersion
|
||||
public interface IDateVersion : ISaveable
|
||||
{
|
||||
DateTime DateTime { get; set; }
|
||||
ISaveable Item { get; set; }
|
||||
ISaveable AnalysisVersion { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace StructureHelperCommon.Models.Analyses
|
||||
Id = id;
|
||||
Versions = new();
|
||||
}
|
||||
public VersionProcessor() : this (new Guid())
|
||||
public VersionProcessor() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace StructureHelperCommon.Models.Analyses
|
||||
var version = new DateVersion()
|
||||
{
|
||||
DateTime = DateTime.Now,
|
||||
Item = newItem
|
||||
AnalysisVersion = newItem
|
||||
};
|
||||
AddVersion(version);
|
||||
}
|
||||
|
||||
13
StructureHelperCommon/Models/Calculators/IHasCalculators.cs
Normal file
13
StructureHelperCommon/Models/Calculators/IHasCalculators.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Calculators
|
||||
{
|
||||
public interface IHasCalculators
|
||||
{
|
||||
List<ICalculator> Calculators { get; }
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,6 @@ namespace StructureHelperCommon.Models.Loggers
|
||||
public static string Summary => "Summary";
|
||||
public static string Maximum => "Maximum";
|
||||
public static string Minimum => "Minimum";
|
||||
public static string CalculatorType(object obj) => string.Format("Calculator type: {0}", obj.GetType());
|
||||
public static string LogicType(object obj) => string.Format("Logic type: {0}", obj.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace StructureHelperCommon.Models.Sections.Logics
|
||||
public (double ex, double ey) GetValue()
|
||||
{
|
||||
eccentricityLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(string.Format(accEccMessage, "x"));
|
||||
eccentricityLogic.Length = Length;
|
||||
eccentricityLogic.Size = SizeX;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace StructureHelperCommon.Models.Sections.Logics
|
||||
}
|
||||
public double GetValue()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
var lengthEccetricity = Length / lengthFactor;
|
||||
TraceLogger?.AddMessage(string.Format("Length of member = {0}(m)", Length));
|
||||
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by length e,a = {0}(m) / {1} = {2}(m)", Length, lengthFactor, lengthEccetricity));
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace StructureHelperCommon.Models.Sections
|
||||
|
||||
public IForceTuple GetValue()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
if (InputForceTuple is null)
|
||||
{
|
||||
string errorString = ErrorStrings.NullReference + $": {nameof(InputForceTuple)}";
|
||||
|
||||
@@ -4,7 +4,7 @@ using StructureHelperLogics.Models.CrossSections;
|
||||
|
||||
namespace StructureHelperLogic.Models.Analyses
|
||||
{
|
||||
public class CrossSectionNdmAnalysis : IAnalysis
|
||||
public class CrossSectionNdmAnalysis : ICrossSectionNdmAnalysis
|
||||
{
|
||||
private CrossSectionNdmAnalysisUpdateStrategy updateStrategy = new();
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Analyses
|
||||
{
|
||||
public class CrossSectionNdmAnalysisUpdateStrategy : IUpdateStrategy<CrossSectionNdmAnalysis>
|
||||
public class CrossSectionNdmAnalysisUpdateStrategy : IUpdateStrategy<ICrossSectionNdmAnalysis>
|
||||
{
|
||||
private IUpdateStrategy<IAnalysis> analysisUpdateStrategy;
|
||||
private IUpdateStrategy<ICrossSection> crossSectionUpdateStrategy;
|
||||
@@ -35,7 +35,7 @@ namespace StructureHelperLogics.Models.Analyses
|
||||
|
||||
}
|
||||
|
||||
public void Update(CrossSectionNdmAnalysis targetObject, CrossSectionNdmAnalysis sourceObject)
|
||||
public void Update(ICrossSectionNdmAnalysis targetObject, ICrossSectionNdmAnalysis sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||
@@ -44,24 +44,24 @@ namespace StructureHelperLogics.Models.Analyses
|
||||
targetObject.VersionProcessor.Versions.Clear();
|
||||
foreach (var version in sourceObject.VersionProcessor.Versions)
|
||||
{
|
||||
if (version.Item is ICrossSection crossSection)
|
||||
if (version.AnalysisVersion is ICrossSection crossSection)
|
||||
{
|
||||
updateVersion(targetObject, version, crossSection);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(version.Item));
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(version.AnalysisVersion));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateVersion(CrossSectionNdmAnalysis targetObject, IDateVersion version, ICrossSection crossSection)
|
||||
private void updateVersion(ICrossSectionNdmAnalysis targetObject, IDateVersion version, ICrossSection crossSection)
|
||||
{
|
||||
DateVersion newVersion = new();
|
||||
dateUpdateStrategy.Update(newVersion, version);
|
||||
CrossSection newCrossection = new();
|
||||
crossSectionUpdateStrategy.Update(newCrossection, crossSection);
|
||||
newVersion.Item = newCrossection;
|
||||
newVersion.AnalysisVersion = newCrossection;
|
||||
targetObject.VersionProcessor.Versions.Add(newVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
|
||||
namespace StructureHelperLogic.Models.Analyses
|
||||
{
|
||||
public interface ICrossSectionNdmAnalysis : IAnalysis
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,18 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSection : ICrossSection
|
||||
{
|
||||
public ICrossSectionRepository SectionRepository { get; private set; }
|
||||
public ICrossSectionRepository SectionRepository { get; private set; } = new CrossSectionRepository();
|
||||
|
||||
public Guid Id { get; private set; }
|
||||
|
||||
public CrossSection()
|
||||
public CrossSection(Guid id)
|
||||
{
|
||||
SectionRepository = new CrossSectionRepository();
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public CrossSection() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
|
||||
@@ -14,17 +14,19 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSectionRepository : ICrossSectionRepository
|
||||
{
|
||||
public List<IForceAction> ForceActions { get; private set; }
|
||||
public List<IHeadMaterial> HeadMaterials { get; private set; }
|
||||
public List<INdmPrimitive> Primitives { get; }
|
||||
public List<ICalculator> CalculatorsList { get; private set; }
|
||||
public Guid Id { get; }
|
||||
public List<IForceAction> ForceActions { get; private set; } = new();
|
||||
public List<IHeadMaterial> HeadMaterials { get; private set; } = new();
|
||||
public List<INdmPrimitive> Primitives { get; } = new();
|
||||
public List<ICalculator> Calculators { get; private set; } = new();
|
||||
|
||||
public CrossSectionRepository()
|
||||
public CrossSectionRepository(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public CrossSectionRepository() : this(Guid.NewGuid())
|
||||
{
|
||||
ForceActions = new List<IForceAction>();
|
||||
HeadMaterials = new List<IHeadMaterial>();
|
||||
Primitives = new List<INdmPrimitive>();
|
||||
CalculatorsList = new List<ICalculator>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -11,8 +12,16 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public class CrossSectionUpdateStrategy : IUpdateStrategy<ICrossSection>
|
||||
{
|
||||
private IUpdateStrategy<ICrossSectionRepository> repositoryUpdateStrategy;
|
||||
|
||||
public CrossSectionUpdateStrategy()
|
||||
public CrossSectionUpdateStrategy(IUpdateStrategy<ICrossSectionRepository> repositoryUpdateStrategy)
|
||||
{
|
||||
this.repositoryUpdateStrategy = repositoryUpdateStrategy;
|
||||
}
|
||||
|
||||
public CrossSectionUpdateStrategy() : this (
|
||||
new CrossSectionRepositoryUpdateStrategy()
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -21,8 +30,11 @@ namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
|
||||
|
||||
targetObject.SectionRepository.Calculators.Clear();
|
||||
targetObject.SectionRepository.Primitives.Clear();
|
||||
targetObject.SectionRepository.ForceActions.Clear();
|
||||
targetObject.SectionRepository.HeadMaterials.Clear();
|
||||
repositoryUpdateStrategy.Update(targetObject.SectionRepository, sourceObject.SectionRepository);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,13 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.CrossSections
|
||||
{
|
||||
public interface ICrossSectionRepository : IHasHeadMaterials, IHasPrimitives, IHasForceCombinations
|
||||
public interface ICrossSectionRepository : ISaveable, IHasHeadMaterials, IHasPrimitives, IHasForceCombinations, IHasCalculators
|
||||
{
|
||||
List<IForceAction> ForceActions { get; }
|
||||
List<ICalculator> CalculatorsList { get; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@ namespace StructureHelperLogics.Models.Materials
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private IFactorLogic factorLogic => new FactorLogic(SafetyFactors);
|
||||
private LMLogic.ITrueStrengthLogic strengthLogic;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
/// <inheritdoc/>
|
||||
@@ -38,8 +41,9 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public List<IMaterialLogic> MaterialLogics => materialLogics;
|
||||
|
||||
|
||||
public ConcreteLibMaterial()
|
||||
public ConcreteLibMaterial(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
|
||||
MaterialLogic = materialLogics.First();
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
@@ -52,6 +56,11 @@ namespace StructureHelperLogics.Models.Materials
|
||||
MaxAge = maxAge;
|
||||
}
|
||||
|
||||
public ConcreteLibMaterial() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new ConcreteLibMaterial();
|
||||
|
||||
@@ -16,11 +16,18 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public double Modulus { get; set; }
|
||||
public double CompressiveStrength { get; set; }
|
||||
public double TensileStrength { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
||||
|
||||
public ElasticMaterial()
|
||||
public Guid Id { get; }
|
||||
|
||||
public ElasticMaterial(Guid id)
|
||||
{
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public ElasticMaterial() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
|
||||
@@ -15,43 +15,34 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
private IElasticMaterialLogic elasticMaterialLogic => new ElasticMaterialLogic();
|
||||
private MaterialTypes materialType;
|
||||
IUpdateStrategy<IFRMaterial> fRUpdateStrategy = new FRUpdateStrategy();
|
||||
IUpdateStrategy<IFRMaterial> updateStrategy = new FRUpdateStrategy();
|
||||
public Guid Id { get; }
|
||||
public double Modulus{ get; set; }
|
||||
public double CompressiveStrength { get; set; }
|
||||
public double TensileStrength { get; set; }
|
||||
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
||||
public double ULSConcreteStrength { get; set; }
|
||||
public double SumThickness { get; set; }
|
||||
public double GammaF2 => GetGammaF2();
|
||||
|
||||
private double GetGammaF2()
|
||||
public FRMaterial(MaterialTypes materialType, Guid id)
|
||||
{
|
||||
const double gammaF2Max = 0.9d;
|
||||
double gammaF2;
|
||||
IFactorLogic factorLogic = new FactorLogic(SafetyFactors);
|
||||
var factors = factorLogic.GetTotalFactor(LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
var rf = TensileStrength * factors.Tensile;
|
||||
var epsUlt = rf / Modulus;
|
||||
gammaF2 = 0.4d / epsUlt * Math.Sqrt(ULSConcreteStrength / (Modulus * SumThickness * 1e3d));
|
||||
gammaF2 = Math.Min(gammaF2, gammaF2Max);
|
||||
return gammaF2;
|
||||
}
|
||||
|
||||
public FRMaterial(MaterialTypes materialType)
|
||||
{
|
||||
|
||||
Id = id;
|
||||
ULSConcreteStrength = 14e6d;
|
||||
SumThickness = 0.175e-3d;
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
this.materialType = materialType;
|
||||
SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultFRSafetyFactors(ProgramSetting.FRCodeType, this.materialType));
|
||||
}
|
||||
|
||||
public FRMaterial(MaterialTypes materialType) : this (materialType, Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new FRMaterial(this.materialType);
|
||||
var updateStrategy = fRUpdateStrategy;
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
@@ -71,5 +62,17 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
return GetLoaderMaterial(limitState, calcTerm);
|
||||
}
|
||||
private double GetGammaF2()
|
||||
{
|
||||
const double gammaF2Max = 0.9d;
|
||||
double gammaF2;
|
||||
IFactorLogic factorLogic = new FactorLogic(SafetyFactors);
|
||||
var factors = factorLogic.GetTotalFactor(LimitStates.ULS, CalcTerms.ShortTerm);
|
||||
var rf = TensileStrength * factors.Tensile;
|
||||
var epsUlt = rf / Modulus;
|
||||
gammaF2 = 0.4d / epsUlt * Math.Sqrt(ULSConcreteStrength / (Modulus * SumThickness * 1e3d));
|
||||
gammaF2 = Math.Min(gammaF2, gammaF2Max);
|
||||
return gammaF2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace StructureHelper.Models.Materials
|
||||
{
|
||||
public class HeadMaterial : IHeadMaterial, INotifyPropertyChanged
|
||||
{
|
||||
private HeadMaterialUpdateStrategy updateStrategy = new HeadMaterialUpdateStrategy();
|
||||
private Color color;
|
||||
|
||||
public Guid Id { get; }
|
||||
@@ -31,6 +32,7 @@ namespace StructureHelper.Models.Materials
|
||||
}
|
||||
public IHelperMaterial HelperMaterial {get; set;}
|
||||
|
||||
|
||||
public HeadMaterial(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
@@ -51,8 +53,7 @@ namespace StructureHelper.Models.Materials
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new HeadMaterial();
|
||||
newItem.HelperMaterial = this.HelperMaterial.Clone() as IHelperMaterial;
|
||||
var updateStrategy = new MaterialUpdateStrategy();
|
||||
newItem.HelperMaterial = HelperMaterial.Clone() as IHelperMaterial;
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelper.Models.Materials
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,7 +8,7 @@ using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public interface IHelperMaterial : ICloneable
|
||||
public interface IHelperMaterial : ISaveable, ICloneable
|
||||
{
|
||||
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public List<IMaterialLogic> MaterialLogics => throw new NotImplementedException();
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
|
||||
{
|
||||
this.MaterialType = materialType;
|
||||
|
||||
@@ -5,13 +5,13 @@ using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class MaterialUpdateStrategy : IUpdateStrategy<IHeadMaterial>
|
||||
public class HeadMaterialUpdateStrategy : IUpdateStrategy<IHeadMaterial>
|
||||
{
|
||||
private IUpdateStrategy<IElasticMaterial> elasticStrategy;
|
||||
private IUpdateStrategy<IFRMaterial> frStrategy;
|
||||
private IUpdateStrategy<IConcreteLibMaterial> concreteStrategy;
|
||||
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy;
|
||||
public MaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
|
||||
public HeadMaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
|
||||
IUpdateStrategy<IFRMaterial> frStrategy,
|
||||
IUpdateStrategy<IConcreteLibMaterial> concreteStrategy,
|
||||
IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy
|
||||
@@ -22,7 +22,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
this.concreteStrategy = concreteStrategy;
|
||||
this.reinforcementStrategy= reinforcementStrategy;
|
||||
}
|
||||
public MaterialUpdateStrategy() : this(
|
||||
public HeadMaterialUpdateStrategy() : this(
|
||||
new ElasticUpdateStrategy(),
|
||||
new FRUpdateStrategy(),
|
||||
new ConcreteLibUpdateStrategy(),
|
||||
@@ -31,7 +31,8 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public void Update(IHeadMaterial targetObject, IHeadMaterial sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.Color = sourceObject.Color;
|
||||
@@ -22,16 +22,23 @@ namespace StructureHelperLogics.Models.Materials
|
||||
private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
|
||||
private readonly List<IMaterialLogic> materialLogics;
|
||||
|
||||
public Guid Id { get; }
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
|
||||
public IMaterialLogic MaterialLogic { get; set; }
|
||||
|
||||
public List<IMaterialLogic> MaterialLogics => materialLogics;
|
||||
public ReinforcementLibMaterial()
|
||||
|
||||
|
||||
public ReinforcementLibMaterial(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
|
||||
MaterialLogic = materialLogics.First();
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
}
|
||||
|
||||
public ReinforcementLibMaterial() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
calculators = calculatorLogic.GetNdmCalculators();
|
||||
AddAllForcesToCalculators();
|
||||
AddAllPrimitivesToCalculator();
|
||||
repository.CalculatorsList.AddRange(calculators);
|
||||
repository.Calculators.AddRange(calculators);
|
||||
return section;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
public void Run()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
checkInputDataLogic.InputData = InputData;
|
||||
checkInputDataLogic.TraceLogger = TraceLogger;
|
||||
if (checkInputDataLogic.Check() != true)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
public ForcesResults GetForcesResults()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
GetCombinations();
|
||||
CalculateResult();
|
||||
return result;
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
|
||||
public void Run()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.MethodBasedOn + "SP63.13330.2018");
|
||||
var checkResult = CheckInputData();
|
||||
if (checkResult != "")
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
|
||||
public double GetDeltaE()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(string.Format("Eccentricity e = {0}", eccentricity));
|
||||
TraceLogger?.AddMessage(string.Format("Height h = {0}", size));
|
||||
var deltaE = Math.Abs(eccentricity) / size;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
|
||||
public double GetEtaFactor()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
if (LongitudinalForce >= 0d) return 1d;
|
||||
var Ncr = GetCriticalForce();
|
||||
if (LongitudinalForce <= Ncr)
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
|
||||
public GenericResult<IForceTuple> GetForceTupleByBuckling()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
|
||||
var tuple = bucklingInputData.ForceTuple.Clone() as IForceTuple;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
|
||||
public double GetPhil()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
var distance = Math.Sqrt(point.X * point.X + point.Y * point.Y);
|
||||
string distMessage = string.Format("Distance = Sqrt(dX ^2 + dY^2) = Sqrt(({0})^2 + ({1})^2) = {2}, m", point.X, point.Y, distance);
|
||||
TraceLogger?.AddMessage(distMessage);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
|
||||
public IForceTuple GetValue()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage("Get eccentricity taking into account accidental eccentricity");
|
||||
TraceLogger?.AddMessage(string.Format("Cross-section size along x-axis dx = {0}, along y-axis dy = {1}", sizeX, sizeY));
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
result = true;
|
||||
CheckResult = string.Empty;
|
||||
CheckPrimitives();
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
PrepareNewResult();
|
||||
CheckInputData();
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
try
|
||||
{
|
||||
ProcessCalculations();
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public void Run()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
PrepareNewResult();
|
||||
ProcessCrackWidthCalculation();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public double GetCrackWidth()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
CheckOptions();
|
||||
TraceLogger?.AddMessage("Method of crack width calculation based on SP 63.13330.2018");
|
||||
TraceInputData();
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
/// <inheritdoc/>
|
||||
public List<INdm> GetNdmCollection()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
|
||||
triangulateLogic = new TriangulatePrimitiveLogic()
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
/// <inheritdoc/>
|
||||
public List<INdm> GetCrackedNdmCollection()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
|
||||
triangulateLogic = new TriangulatePrimitiveLogic(new MeshCrackedConcreteLogic())
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
/// <inheritdoc/>
|
||||
public List<IRebarPrimitive> GetRebarPrimitives()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
|
||||
List<IRebarPrimitive> rebarPrimitives = new();
|
||||
foreach (var item in NdmPrimitives)
|
||||
@@ -90,7 +90,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
/// <inheritdoc/>
|
||||
public List<INdm> GetElasticNdmCollection()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
|
||||
triangulateLogic = new TriangulatePrimitiveLogic(new MeshElasticLogic())
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public double GetAverageDiameter()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
Check();
|
||||
var rebarArea = Rebars
|
||||
.Sum(x => x.Area);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public List<TupleCrackInputData> GetTupleInputDatas()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
|
||||
List<TupleCrackInputData> resultList = new();
|
||||
CheckInputData();
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
/// <inheritdoc/>
|
||||
public double GetLength()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
IEnumerable<RebarNdm?> rebars = GetRebars();
|
||||
double rebarArea = GetRebarArea(rebars);
|
||||
double rebarDiameter = GetAverageDiameter(rebars);
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public void Run()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage($"Rebar primitive {InputData.RebarPrimitive.Name}");
|
||||
PrepareNewResult();
|
||||
if (CheckInputData() != true)
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
/// <inheritdoc/>
|
||||
public double GetSofteningFactor()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage($"Logic of calculation of psi_s factor based on exponential softening model");
|
||||
TraceLogger?.AddMessage($"psi_s = 1 - BettaFactor * ForceRatio ^ PowerFactor");
|
||||
TraceLogger?.AddMessage($"But not less than psi_s_min = {PsiSMin}");
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public double GetSofteningFactor()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
if (IsResultActual == false)
|
||||
{
|
||||
GetRebarAndConcreteNdms();
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public double GetTensileArea()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
|
||||
var rebarCollection = NdmCollection
|
||||
.Where(x => x is RebarNdm & stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
}
|
||||
public double GetTensionRebarArea()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage("Method of obtaining of summary area of rebars in tension based on areas which are proportional by maximum strain");
|
||||
var rebars = Rebars
|
||||
.Where(x => stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
}
|
||||
public double GetTensionRebarArea()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage("Method of obtaining of summary area of rebars in tension based on ordinary summarizing of areas");
|
||||
var rebars = Rebars
|
||||
.Where(x => stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
public void Run()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
PrepareNewResult();
|
||||
|
||||
try
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
if (!Primitives.Any())
|
||||
{
|
||||
string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Count of primitive must be greater than zero");
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
|
||||
List<INdm> IMeshPrimitiveLogic.MeshPrimitive()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
CheckPrimitive();
|
||||
List<INdm> ndmCollection = new();
|
||||
if (Primitive.NdmElement.HeadMaterial.HelperMaterial is ICrackedMaterial)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
|
||||
public List<INdm> MeshPrimitive()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
CheckInputData();
|
||||
List<INdm> ndms = new();
|
||||
regularMeshLogic = new MeshPrimitiveLogic()
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
|
||||
public void MeshHasDivision()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
CheckInputData();
|
||||
if (Primitive is IHasDivisionSize hasDivision)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
|
||||
public List<INdm> MeshPrimitive()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
List<INdm> ndmCollection = new();
|
||||
var itemNdms = Primitive.GetNdms(TriangulationOptions);
|
||||
ndmCollection.AddRange(itemNdms);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
|
||||
public List<INdm> GetNdms()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
CheckPrimitives();
|
||||
ndmCollection = new List<INdm>();
|
||||
SetLogics();
|
||||
|
||||
@@ -16,4 +16,8 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\Materials\DTOs\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
|
||||
HeightCount = heightCount
|
||||
};
|
||||
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
||||
var calculator = newSection.SectionRepository.CalculatorsList[0] as ForceCalculator;
|
||||
var calculator = newSection.SectionRepository.Calculators[0] as ForceCalculator;
|
||||
calculator.InputData.CompressedMember.Buckling = isBuckling;
|
||||
//Act
|
||||
calculator.Run();
|
||||
@@ -48,7 +48,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
|
||||
//Arrange
|
||||
var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount };
|
||||
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
||||
var calculator = newSection.SectionRepository.CalculatorsList[0] as ForceCalculator;
|
||||
var calculator = newSection.SectionRepository.Calculators[0] as ForceCalculator;
|
||||
calculator.InputData.CompressedMember.Buckling = isBuckling;
|
||||
//Act
|
||||
calculator.Run();
|
||||
@@ -65,7 +65,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
|
||||
//Arrange
|
||||
var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount };
|
||||
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
||||
var calculator = newSection.SectionRepository.CalculatorsList[0] as ForceCalculator;
|
||||
var calculator = newSection.SectionRepository.Calculators[0] as ForceCalculator;
|
||||
calculator.InputData.CompressedMember.Buckling = false;
|
||||
calculator.Run();
|
||||
var ndmPrimitives = newSection.SectionRepository.Primitives;
|
||||
|
||||
Reference in New Issue
Block a user