Merge pull request #9 from RedikultsevEvg/PrimitivePropsEdit

Primitive props edit
This commit is contained in:
Ivan Ivashkin
2024-10-08 11:30:21 +05:00
committed by GitHub
109 changed files with 1780 additions and 208 deletions

View File

@@ -0,0 +1,80 @@
using LoaderCalculator.Data.Materials;
using Newtonsoft.Json;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public class ConcreteLibMaterialDTO : IConcreteLibMaterial
{
const MaterialTypes materialType = MaterialTypes.Concrete;
[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("MaterialEntityId")]
public Guid MaterialEntityId
{
get => MaterialEntity.Id;
set
{
MaterialEntity = ProgramSetting.MaterialRepository.Repository.Single(x => x.Id == value);
}
}
[JsonIgnore]
public ILibMaterialEntity MaterialEntity { get; set; }
[JsonProperty("SafetyFactors")]
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
[JsonProperty("TensionForULS")]
public bool TensionForULS { get; set; }
[JsonProperty("TensionForSLS")]
public bool TensionForSLS { get; set; }
[JsonProperty("MaterialLogicId")]
public Guid MaterialLogicId
{
get => MaterialLogic.Id;
set
{
MaterialLogic = MaterialLogics.Single(x => x.Id == value);
}
}
[JsonIgnore]
public IMaterialLogic MaterialLogic { get; set; }
[JsonIgnore]
public List<IMaterialLogic> MaterialLogics { get; } = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
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();
}
}
}

View 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();
}
}
}

View File

@@ -0,0 +1,24 @@
using StructureHelperCommon.Infrastructures.Interfaces;
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 ConcreteLibMaterialToDTOConvertStrategy : LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial>
{
public override IUpdateStrategy<IConcreteLibMaterial> UpdateStrategy { get; } = new ConcreteLibUpdateStrategy();
public override ConcreteLibMaterialDTO GetMaterialDTO(IConcreteLibMaterial source)
{
ConcreteLibMaterialDTO newItem = new()
{
Id = source.Id
};
return newItem;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -0,0 +1,55 @@
using StructureHelper.Models.Materials;
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 HeadMaterialToDTOConvertStrategy : IConvertStrategy<HeadMaterialDTO, IHeadMaterial>
{
private IUpdateStrategy<IHeadMaterial> updateStrategy;
private IConvertStrategy<IHelperMaterial, IHelperMaterial> convertStrategy;
public HeadMaterialToDTOConvertStrategy(IUpdateStrategy<IHeadMaterial> updateStrategy,
IConvertStrategy<IHelperMaterial, IHelperMaterial> convertStrategy)
{
this.updateStrategy = updateStrategy;
this.convertStrategy = convertStrategy;
}
public HeadMaterialToDTOConvertStrategy() : this (
new HeadMaterialUpdateStrategy(),
new HelperMaterialToDTOConvertStrategy())
{
}
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
public IShiftTraceLogger TraceLogger { get; set; }
public HeadMaterialDTO Convert(IHeadMaterial source)
{
TraceLogger?.AddMessage($"Convert material Id={source.Id}, name is {source.Name}");
HeadMaterialDTO newItem = new()
{
Id = source.Id
};
updateStrategy.Update(newItem, source);
convertStrategy.ReferenceDictionary = ReferenceDictionary;
var convertLogic = new DictionaryConvertStrategy<IHelperMaterial, IHelperMaterial>()
{
ReferenceDictionary = ReferenceDictionary,
ConvertStrategy = convertStrategy,
TraceLogger = TraceLogger
};
newItem.HelperMaterial = convertLogic.Convert(source.HelperMaterial);
return newItem;
}
}
}

View File

@@ -0,0 +1,65 @@
using StructureHelperCommon.Infrastructures.Exceptions;
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
{
internal class HelperMaterialToDTOConvertStrategy : IConvertStrategy<IHelperMaterial, IHelperMaterial>
{
private LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy;
private LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> reinforcementConvertStrategy;
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
public IShiftTraceLogger TraceLogger { get; set; }
public HelperMaterialToDTOConvertStrategy(
LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy,
LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> reinforcementConvertStrategy)
{
this.concreteConvertStrategy = concreteConvertStrategy;
this.reinforcementConvertStrategy = reinforcementConvertStrategy;
}
public HelperMaterialToDTOConvertStrategy() : this (
new ConcreteLibMaterialToDTOConvertStrategy(),
new ReinforcementLibMaterialToDTOConvertStrategy())
{
}
public IHelperMaterial Convert(IHelperMaterial source)
{
Check();
if (source is IConcreteLibMaterial concreteLibMaterial)
{
concreteConvertStrategy.ReferenceDictionary = ReferenceDictionary;
concreteConvertStrategy.TraceLogger = TraceLogger;
return concreteConvertStrategy.Convert(concreteLibMaterial);
}
if (source is IReinforcementLibMaterial reinforcementMaterial)
{
reinforcementConvertStrategy.ReferenceDictionary = ReferenceDictionary;
reinforcementConvertStrategy.TraceLogger = TraceLogger;
return reinforcementConvertStrategy.Convert(reinforcementMaterial);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source));
}
}
private void Check()
{
var checkLogic = new CheckConvertLogic<IHelperMaterial, IHelperMaterial>();
checkLogic.ConvertStrategy = this;
checkLogic.TraceLogger = TraceLogger;
checkLogic.Check();
}
}
}

View File

@@ -0,0 +1,75 @@
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
{
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/>
public void Update(ILibMaterial targetObject, ILibMaterial 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;
}
}
}

View File

@@ -0,0 +1,53 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public abstract class LibMaterialToDTOConvertStrategy<T,V> : IConvertStrategy<T, V>
where T : V
where V : ILibMaterial
{
public abstract IUpdateStrategy<V> UpdateStrategy { get; }
public abstract T GetMaterialDTO(V source);
private IUpdateStrategy<ILibMaterial> libMaterialUpdateStrategy = new LibMaterialDTOUpdateStrategy();
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
public IShiftTraceLogger TraceLogger { get; set; }
public T Convert(V source)
{
Check();
T newItem = GetMaterialDTO(source);
try
{
UpdateStrategy.Update(newItem, source);
libMaterialUpdateStrategy.Update(newItem, source);
}
catch (Exception ex)
{
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
throw;
}
return newItem;
}
private void Check()
{
var checkLogic = new CheckConvertLogic<T, V>();
checkLogic.ConvertStrategy = this;
checkLogic.TraceLogger = TraceLogger;
checkLogic.Check();
}
}
}

View File

@@ -0,0 +1,28 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public class MaterialSafetyFactorToDTOConvertStrategy : IConvertStrategy<MaterialSafetyFactorDTO, IMaterialSafetyFactor>
{
private IUpdateStrategy<IMaterialSafetyFactor> updateStrategy;
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
public IShiftTraceLogger TraceLogger { get; set; }
public MaterialSafetyFactorToDTOConvertStrategy(IUpdateStrategy<IMaterialSafetyFactor> updateStrategy)
{
this.updateStrategy = updateStrategy;
}
public MaterialSafetyFactorDTO Convert(IMaterialSafetyFactor source)
{
throw new NotImplementedException();
}
}
}

View File

@@ -31,21 +31,35 @@ namespace DataAccess.DTOs
public ProjectDTO Convert(IProject source) public ProjectDTO Convert(IProject source)
{ {
ProjectDTO projectDTO = new(source.Id); Check();
updateStrategy.Update(projectDTO, source); ProjectDTO newItem = new()
{
Id = source.Id
};
updateStrategy.Update(newItem, source);
convertStrategy.ReferenceDictionary = ReferenceDictionary; convertStrategy.ReferenceDictionary = ReferenceDictionary;
convertStrategy.TraceLogger = TraceLogger;
var convertLogic = new DictionaryConvertStrategy<VisualAnalysisDTO, IVisualAnalysis>() var convertLogic = new DictionaryConvertStrategy<VisualAnalysisDTO, IVisualAnalysis>()
{ {
ReferenceDictionary = ReferenceDictionary, ReferenceDictionary = ReferenceDictionary,
ConvertStrategy = convertStrategy, ConvertStrategy = convertStrategy,
TraceLogger = TraceLogger TraceLogger = TraceLogger
}; };
newItem.VisualAnalyses.Clear();
foreach (var item in source.VisualAnalyses) foreach (var item in source.VisualAnalyses)
{ {
var newVisualAnalysis = convertLogic.Convert(item); 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();
} }
} }
} }

View File

@@ -0,0 +1,24 @@
using StructureHelperCommon.Infrastructures.Interfaces;
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 ReinforcementLibMaterialToDTOConvertStrategy : LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial>
{
public override IUpdateStrategy<IReinforcementLibMaterial> UpdateStrategy { get; } = new ReinforcementLibUpdateStrategy();
public override ReinforcementLibMaterialDTO GetMaterialDTO(IReinforcementLibMaterial source)
{
ReinforcementLibMaterialDTO newItem = new()
{
Id = source.Id
};
return newItem;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -1,9 +1,13 @@
using StructureHelperCommon.Infrastructures.Interfaces; using DataAccess.DTOs.Converters;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models; using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Analyses; using StructureHelperCommon.Models.Analyses;
using StructureHelperCommon.Models.Projects;
using StructureHelperLogic.Models.Analyses;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -11,16 +15,45 @@ namespace DataAccess.DTOs
{ {
internal class VisualAnalysisToDTOConvertStrategy : IConvertStrategy<VisualAnalysisDTO, IVisualAnalysis> internal class VisualAnalysisToDTOConvertStrategy : IConvertStrategy<VisualAnalysisDTO, IVisualAnalysis>
{ {
private IConvertStrategy<IAnalysis, IAnalysis> convertStrategy;
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 VisualAnalysisToDTOConvertStrategy(IConvertStrategy<IAnalysis, IAnalysis> convertStrategy)
{
this.convertStrategy = convertStrategy;
}
public VisualAnalysisToDTOConvertStrategy() : this(new AnalysisToDTOConvertStrategy())
{
}
public VisualAnalysisDTO Convert(IVisualAnalysis source) public VisualAnalysisDTO Convert(IVisualAnalysis source)
{ {
Check();
VisualAnalysisDTO visualAnalysisDTO = new() VisualAnalysisDTO visualAnalysisDTO = new()
{ {
Id = source.Id 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; return visualAnalysisDTO;
} }
private void Check()
{
var checkLogic = new CheckConvertLogic<VisualAnalysisDTO, IVisualAnalysis>();
checkLogic.ConvertStrategy = this;
checkLogic.TraceLogger = TraceLogger;
checkLogic.Check();
}
} }
} }

View File

@@ -1,4 +1,5 @@
using StructureHelperLogics.Models.CrossSections; using Newtonsoft.Json;
using StructureHelperLogics.Models.CrossSections;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -9,9 +10,11 @@ namespace DataAccess.DTOs
{ {
public class CrossSectionDTO : ICrossSection public class CrossSectionDTO : ICrossSection
{ {
public ICrossSectionRepository SectionRepository { get; } [JsonProperty("Id")]
public Guid Id { get; set; } public Guid Id { get; set; }
[JsonProperty("SectionRepository")]
public ICrossSectionRepository SectionRepository { get; set; }
public object Clone() public object Clone()
{ {

View 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();
}
}
}

View 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();
}
}

View 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; }
}
}

View File

@@ -0,0 +1,43 @@
using LoaderCalculator.Data.Materials;
using Newtonsoft.Json;
using StructureHelperCommon.Infrastructures.Enums;
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 ElasticMaterialDTO : IElasticMaterial
{
[JsonProperty("Id")]
public Guid Id { get; set; }
[JsonProperty("Modulus")]
public double Modulus { get; set; }
[JsonProperty("CompressiveStrength")]
public double CompressiveStrength { get; set; }
[JsonProperty("TensileStrength")]
public double TensileStrength { get; set; }
[JsonProperty("SafetyFactors")]
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
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();
}
}
}

View File

@@ -0,0 +1,49 @@
using LoaderCalculator.Data.Materials;
using Newtonsoft.Json;
using StructureHelperCommon.Infrastructures.Enums;
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 FRMaterialDTO : IFRMaterial
{
[JsonProperty("Id")]
public Guid Id { get; set; }
[JsonProperty("ULSConcreteStrength")]
public double ULSConcreteStrength { get; set; }
[JsonProperty("SunThickness")]
public double SumThickness { get; set; }
[JsonIgnore]
public double GammaF2 { get; }
[JsonProperty("Modulus")]
public double Modulus { get; set; }
[JsonProperty("CompressiveStrength")]
public double CompressiveStrength { get; set; }
[JsonProperty("TensileStrength")]
public double TensileStrength { get; set; }
[JsonProperty("SafetyFactors")]
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
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();
}
}
}

View 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();
}
}
}

View File

@@ -0,0 +1,24 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public class MaterialPartialFactorDTO : IMaterialPartialFactor
{
public Guid Id { get; set; }
public double FactorValue { get; set; }
public StressStates StressState { get; set; }
public CalcTerms CalcTerm { get; set; }
public LimitStates LimitState { get; set; }
public object Clone()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,36 @@
using Newtonsoft.Json;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public class MaterialSafetyFactorDTO : IMaterialSafetyFactor
{
[JsonProperty("Id")]
public Guid Id { get; set; }
[JsonProperty("Name")]
public string Name { get; set; } = string.Empty;
[JsonProperty("Take")]
public bool Take { get; set; }
[JsonProperty("Description")]
public string Description { get; set; } = string.Empty;
[JsonProperty("PartialFactors")]
public List<IMaterialPartialFactor> PartialFactors { get; } = new();
public object Clone()
{
throw new NotImplementedException();
}
public double GetFactor(StressStates stressState, CalcTerms calcTerm, LimitStates limitStates)
{
throw new NotImplementedException();
}
}
}

View File

@@ -25,16 +25,5 @@ namespace DataAccess.DTOs
[JsonIgnore] [JsonIgnore]
public string FileName { get; set; } public string FileName { get; set; }
public ProjectDTO(Guid id)
{
Id = id;
}
public ProjectDTO() : this (Guid.NewGuid())
{
}
} }
} }

View File

@@ -0,0 +1,70 @@
using LoaderCalculator.Data.Materials;
using Newtonsoft.Json;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Settings;
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 ReinforcementLibMaterialDTO : IReinforcementLibMaterial
{
const MaterialTypes materialType = MaterialTypes.Reinforcement;
[JsonProperty("Id")]
public Guid Id { get; set; }
[JsonProperty("MaterialEntityId")]
public Guid MaterialEntityId
{
get => MaterialEntity.Id;
set
{
MaterialEntity = ProgramSetting.MaterialRepository.Repository.Single(x => x.Id == value);
}
}
[JsonIgnore]
public ILibMaterialEntity MaterialEntity { get; set; }
[JsonProperty("SafetyFactors")]
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
[JsonProperty("MaterialLogicId")]
public Guid MaterialLogicId
{
get => MaterialLogic.Id;
set
{
MaterialLogic = MaterialLogics.Single(x => x.Id == value);
}
}
[JsonIgnore]
public IMaterialLogic MaterialLogic { get; set; }
[JsonIgnore]
public List<IMaterialLogic> MaterialLogics { get; } = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
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();
}
}
}

View 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;
}
}
}

View File

@@ -0,0 +1,67 @@
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Analyses;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Materials.Libraries;
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(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
{ (typeof(NdmPrimitiveDTO), "NdmPrimitive") },
{ (typeof(IVisualAnalysis), "IVisualAnalysis") },
{ (typeof(List<ICalculator>), "ListOfICalculator") },
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
{ (typeof(List<IForceAction>), "ListOfIForceAction") },
{ (typeof(List<IHeadMaterial>), "ListOfIHeadMaterial") },
{ (typeof(List<IMaterialSafetyFactor>), "ListOfMaterialSafetyFactor") },
{ (typeof(List<IMaterialPartialFactor>), "ListOfMaterialPartialFactor") },
{ (typeof(List<INdmPrimitive>), "ListOfINdmPrimitive") },
{ (typeof(List<IPartialFactor>), "ListOfPartialFactor") },
{ (typeof(List<IVisualAnalysis>), "ListOfIVisualAnalysis") },
{ (typeof(ProjectDTO), "Project") },
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
{ (typeof(MaterialPartialFactorDTO), "MaterialPartialFactor") },
{ (typeof(VersionProcessorDTO), "VersionProcessor") },
{ (typeof(VisualAnalysisDTO), "VisualAnalysis") },
};
}
}
}

View 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();
}
}
}

View File

@@ -19,4 +19,10 @@
<Folder Include="NewFolder\" /> <Folder Include="NewFolder\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="LoaderCalculator">
<HintPath>..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
</Reference>
</ItemGroup>
</Project> </Project>

View File

@@ -48,22 +48,31 @@ namespace DataAccess.Infrastructures
private void SaveToFile(IProject project) private void SaveToFile(IProject project)
{ {
version = ProgramSetting.GetCurrentFileVersion(); try
refDictinary = new Dictionary<(Guid id, Type type), ISaveable>(); {
FileVersionDTO versionDTO = GetVersionDTO(); version = ProgramSetting.GetCurrentFileVersion();
var versionString = Serialize(versionDTO, TraceLogger); refDictinary = new Dictionary<(Guid id, Type type), ISaveable>();
SaveStringToFile(project, versionString); FileVersionDTO versionDTO = GetVersionDTO();
refDictinary = new Dictionary<(Guid id, Type type), ISaveable>(); var versionString = Serialize(versionDTO, TraceLogger);
ProjectDTO projectDTO = GetProjectDTO(project); File.Delete(project.FullFileName);
var projectString = Serialize(projectDTO, TraceLogger); SaveStringToFile(project, versionString);
SaveStringToFile(project, projectString); 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) private void SaveStringToFile(IProject project, string versionString)
{ {
try try
{ {
File.WriteAllText(project.FullFileName, versionString); File.AppendAllText(project.FullFileName, versionString);
TraceLogger?.AddMessage($"File {project.FullFileName} was saved successfully", TraceLogStatuses.Service); TraceLogger?.AddMessage($"File {project.FullFileName} was saved successfully", TraceLogStatuses.Service);
} }
catch (Exception ex) catch (Exception ex)
@@ -107,14 +116,17 @@ namespace DataAccess.Infrastructures
private static string Serialize(object obj, IShiftTraceLogger logger) 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 var settings = new JsonSerializerSettings
{ {
Converters = new List<JsonConverter> Converters = new List<JsonConverter>
{ {
// Add other converters if needed // Add other converters if needed
new FileVersionDTOJsonConverter(logger), // Add the specific converter new FileVersionDTOJsonConverter(logger), // Add the specific converter
new ProjectDTOJsonConverter(logger) new ProjectDTOJsonConverter(logger)
}, },
SerializationBinder = typeBinder,
Formatting = Formatting.Indented, Formatting = Formatting.Indented,
PreserveReferencesHandling = PreserveReferencesHandling.All, PreserveReferencesHandling = PreserveReferencesHandling.All,
MissingMemberHandling = MissingMemberHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore,

View File

@@ -20,7 +20,7 @@ namespace StructureHelper.Services.Settings
{ {
get get
{ {
materials ??= new ListRepository<IHeadMaterial>(new MaterialUpdateStrategy()); materials ??= new ListRepository<IHeadMaterial>(new HeadMaterialUpdateStrategy());
return materials; return materials;
} }
} }

View File

@@ -33,7 +33,7 @@ namespace StructureHelper.Windows.MainWindow.Analyses
{ {
throw new StructureHelperException(ErrorStrings.NullReference); throw new StructureHelperException(ErrorStrings.NullReference);
} }
if (version.Item is ICrossSection crossSection) if (version.AnalysisVersion is ICrossSection crossSection)
{ {
ProcessCrossSection(crossSection); ProcessCrossSection(crossSection);
} }
@@ -60,9 +60,9 @@ namespace StructureHelper.Windows.MainWindow.Analyses
public object Clone() public object Clone()
{ {
var newAnalysis = Analysis.Clone() as IAnalysis; var newAnalysis = Analysis.Clone() as IAnalysis;
VisualAnalysis newItem = new(newAnalysis); VisualAnalysis newItem = new(newAnalysis);
return newItem; return newItem;
} }
} }
} }

View File

@@ -284,21 +284,21 @@ namespace StructureHelper.Windows.MainWindow
repository.HeadMaterials.AddRange(newRepository.HeadMaterials); repository.HeadMaterials.AddRange(newRepository.HeadMaterials);
repository.Primitives.AddRange(newRepository.Primitives); repository.Primitives.AddRange(newRepository.Primitives);
repository.ForceActions.AddRange(newRepository.ForceActions); repository.ForceActions.AddRange(newRepository.ForceActions);
repository.CalculatorsList.AddRange(newRepository.CalculatorsList); repository.Calculators.AddRange(newRepository.Calculators);
OnPropertyChanged(nameof(HeadMaterials)); OnPropertyChanged(nameof(HeadMaterials));
CombinationsLogic.AddItems(newRepository.ForceActions); CombinationsLogic.AddItems(newRepository.ForceActions);
CalculatorsLogic.AddItems(newRepository.CalculatorsList); CalculatorsLogic.AddItems(newRepository.Calculators);
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives); var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
PrimitiveLogic.Refresh(); PrimitiveLogic.Refresh();
foreach (var item in newRepository.HeadMaterials) foreach (var item in newRepository.HeadMaterials)
{ {
GlobalRepository.Materials.Create(item); GlobalRepository.Materials.Create(item);
} }
foreach (var item in newRepository.ForceActions) foreach (var item in newRepository.ForceActions)
{ {
GlobalRepository.Actions.Create(item); GlobalRepository.Actions.Create(item);
} }
return primitives; return primitives;
} }
} }

View File

@@ -92,7 +92,7 @@ namespace StructureHelper.Windows.ViewModels.Forces
private bool DeleteAction() private bool DeleteAction()
{ {
bool result = true; bool result = true;
var calcRepository = repository.CalculatorsList; var calcRepository = repository.Calculators;
foreach (var calc in calcRepository) foreach (var calc in calcRepository)
{ {
if (calc is ForceCalculator forceCalculator) if (calc is ForceCalculator forceCalculator)

View File

@@ -73,7 +73,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
} }
else else
{ {
var updateStrategy = new MaterialUpdateStrategy(); var updateStrategy = new HeadMaterialUpdateStrategy();
updateStrategy.Update(SelectedItem, copyObject); updateStrategy.Update(SelectedItem, copyObject);
} }
base.EditMethod(parameter); base.EditMethod(parameter);

View File

@@ -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; repository = sectionRepository;
} }

View File

@@ -134,7 +134,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{ {
var ndmPrimitive = SelectedItem.GetNdmPrimitive(); var ndmPrimitive = SelectedItem.GetNdmPrimitive();
repository.Primitives.Remove(ndmPrimitive); repository.Primitives.Remove(ndmPrimitive);
foreach (var calc in repository.CalculatorsList) foreach (var calc in repository.Calculators)
{ {
if (calc is ForceCalculator forceCalculator) if (calc is ForceCalculator forceCalculator)
{ {

View File

@@ -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;
}
}
}

View File

@@ -17,6 +17,7 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
public IShiftTraceLogger? TraceLogger { get; set; } public IShiftTraceLogger? TraceLogger { get; set; }
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 T Convert(V source) public T Convert(V source)
{ {
ICheckInputData(); ICheckInputData();

View File

@@ -9,8 +9,18 @@ namespace StructureHelperCommon.Models.Analyses
{ {
public class DateVersion : IDateVersion public class DateVersion : IDateVersion
{ {
public Guid Id { get; }
public DateTime DateTime { get; set; } public DateTime DateTime { get; set; }
public ISaveable AnalysisVersion { get; set; }
public ISaveable Item { get; set; } public DateVersion(Guid id)
{
Id = id;
}
public DateVersion() : this (Guid.NewGuid())
{
}
} }
} }

View File

@@ -7,9 +7,9 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Analyses namespace StructureHelperCommon.Models.Analyses
{ {
public interface IDateVersion public interface IDateVersion : ISaveable
{ {
DateTime DateTime { get; set; } DateTime DateTime { get; set; }
ISaveable Item { get; set; } ISaveable AnalysisVersion { get; set; }
} }
} }

View File

@@ -19,7 +19,7 @@ namespace StructureHelperCommon.Models.Analyses
Id = id; Id = id;
Versions = new(); Versions = new();
} }
public VersionProcessor() : this (new Guid()) public VersionProcessor() : this (Guid.NewGuid())
{ {
} }
@@ -34,7 +34,7 @@ namespace StructureHelperCommon.Models.Analyses
var version = new DateVersion() var version = new DateVersion()
{ {
DateTime = DateTime.Now, DateTime = DateTime.Now,
Item = newItem AnalysisVersion = newItem
}; };
AddVersion(version); AddVersion(version);
} }

View 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; }
}
}

View File

@@ -15,6 +15,6 @@ namespace StructureHelperCommon.Models.Loggers
public static string Summary => "Summary"; public static string Summary => "Summary";
public static string Maximum => "Maximum"; public static string Maximum => "Maximum";
public static string Minimum => "Minimum"; 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());
} }
} }

View File

@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Materials.MaterialBuilders; using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using System;
namespace StructureHelperCommon.Models.Materials namespace StructureHelperCommon.Models.Materials
{ {
@@ -12,6 +13,7 @@ namespace StructureHelperCommon.Models.Materials
private ConcreteLogicOptions options; private ConcreteLogicOptions options;
public Guid Id { get; private set; }
public string Name { get; set; } public string Name { get; set; }
public IMaterialLogicOptions Options public IMaterialLogicOptions Options
{ {
@@ -29,6 +31,11 @@ namespace StructureHelperCommon.Models.Materials
public MaterialTypes MaterialType { get; set; } public MaterialTypes MaterialType { get; set; }
public DiagramType DiagramType { get; set; } public DiagramType DiagramType { get; set; }
public ConcreteCurveLogic(Guid id)
{
Id = id;
}
public IMaterial GetLoaderMaterial() public IMaterial GetLoaderMaterial()
{ {
GetLoaderOptions(); GetLoaderOptions();

View File

@@ -15,9 +15,24 @@ namespace StructureHelperCommon.Models.Materials
{ {
var items = new List<IMaterialLogic>() var items = new List<IMaterialLogic>()
{ {
new ReinforcementByBuilderLogic() { MaterialType = MaterialTypes.Reinforcement, Name="Bilinear", DiagramType = DiagramType.Bilinear}, new ReinforcementByBuilderLogic(Guid.Parse("54c4fe40-8f82-4995-8930-81e65e97edb9"))
new ReinforcementByBuilderLogic() { MaterialType = MaterialTypes.Reinforcement, Name="Triplelinear", DiagramType = DiagramType.TripleLinear}, {
new ConcreteCurveLogic() { MaterialType = MaterialTypes.Concrete, Name = "Curve", DiagramType = DiagramType.Curve}, MaterialType = MaterialTypes.Reinforcement,
Name="Bilinear",
DiagramType = DiagramType.Bilinear
},
new ReinforcementByBuilderLogic(Guid.Parse("c658b71d-13b1-458c-a1b0-c93d1324acad"))
{
MaterialType = MaterialTypes.Reinforcement,
Name="Triplelinear",
DiagramType = DiagramType.TripleLinear
},
new ConcreteCurveLogic(Guid.Parse("b97e8168-76a1-4e24-ae98-9aa38edd1e9a"))
{
MaterialType = MaterialTypes.Concrete,
Name = "Curve",
DiagramType = DiagramType.Curve
},
}; };
return items; return items;
} }

View File

@@ -1,6 +1,7 @@
using LoaderCalculator.Data.Materials; using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders; using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -9,7 +10,7 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials namespace StructureHelperCommon.Models.Materials
{ {
public interface IMaterialLogic public interface IMaterialLogic : ISaveable
{ {
string Name { get; set; } string Name { get; set; }
IMaterialLogicOptions Options { get; set; } IMaterialLogicOptions Options { get; set; }

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -7,10 +8,12 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials.Libraries namespace StructureHelperCommon.Models.Materials.Libraries
{ {
internal class MaterialPartialFactorUpdateStrategy : IUpdateStrategy<IMaterialPartialFactor> public class MaterialPartialFactorUpdateStrategy : IUpdateStrategy<IMaterialPartialFactor>
{ {
public void Update(IMaterialPartialFactor targetObject, IMaterialPartialFactor sourceObject) public void Update(IMaterialPartialFactor targetObject, IMaterialPartialFactor sourceObject)
{ {
CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; } if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.LimitState = sourceObject.LimitState; targetObject.LimitState = sourceObject.LimitState;
targetObject.StressState = sourceObject.StressState; targetObject.StressState = sourceObject.StressState;

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -7,10 +8,12 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials.Libraries namespace StructureHelperCommon.Models.Materials.Libraries
{ {
internal class MaterialSafetyFactorUpdateStrategy : IUpdateStrategy<IMaterialSafetyFactor> public class MaterialSafetyFactorUpdateStrategy : IUpdateStrategy<IMaterialSafetyFactor>
{ {
public void Update(IMaterialSafetyFactor targetObject, IMaterialSafetyFactor sourceObject) public void Update(IMaterialSafetyFactor targetObject, IMaterialSafetyFactor sourceObject)
{ {
CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; } if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Name = sourceObject.Name; targetObject.Name = sourceObject.Name;
targetObject.Take = sourceObject.Take; targetObject.Take = sourceObject.Take;

View File

@@ -1,5 +1,6 @@
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using System; using System;
namespace StructureHelperCommon.Models.Materials.Libraries namespace StructureHelperCommon.Models.Materials.Libraries
@@ -7,16 +8,18 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public class MaterialPartialFactor : IMaterialPartialFactor public class MaterialPartialFactor : IMaterialPartialFactor
{ {
private double factorValue; private double factorValue;
private IUpdateStrategy<IMaterialPartialFactor> updateStrategy = new MaterialPartialFactorUpdateStrategy();
public Guid Id { get; } public Guid Id { get; }
public StressStates StressState { get; set; } public StressStates StressState { get; set; } = StressStates.Compression;
public CalcTerms CalcTerm { get; set; } public CalcTerms CalcTerm { get; set; } = CalcTerms.LongTerm;
public LimitStates LimitState { get; set; } public LimitStates LimitState { get; set; } = LimitStates.ULS;
public double FactorValue public double FactorValue
{ {
get => factorValue; get => factorValue;
set set
{ {
if (value < 0 ) if (value < 0)
{ {
throw new StructureHelperException(ErrorStrings.FactorMustBeGraterThanZero); throw new StructureHelperException(ErrorStrings.FactorMustBeGraterThanZero);
} }
@@ -28,9 +31,6 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public MaterialPartialFactor(Guid id) public MaterialPartialFactor(Guid id)
{ {
Id = id; Id = id;
StressState = StressStates.Compression;
LimitState = LimitStates.ULS;
CalcTerm = CalcTerms.LongTerm;
FactorValue = 1d; FactorValue = 1d;
} }
@@ -40,7 +40,6 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public object Clone() public object Clone()
{ {
var newItem = new MaterialPartialFactor(); var newItem = new MaterialPartialFactor();
var updateStrategy = new MaterialPartialFactorUpdateStrategy();
updateStrategy.Update(newItem, this); updateStrategy.Update(newItem, this);
return newItem; return newItem;
} }

View File

@@ -3,6 +3,7 @@ using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Services; using StructureHelperCommon.Services;
using System;
namespace StructureHelperCommon.Models.Materials namespace StructureHelperCommon.Models.Materials
{ {
@@ -12,6 +13,7 @@ namespace StructureHelperCommon.Models.Materials
private ReinforcementOptions materialOptions; private ReinforcementOptions materialOptions;
private IMaterialOptionLogic optionLogic; private IMaterialOptionLogic optionLogic;
public Guid Id { get; private set; }
public string Name { get; set; } public string Name { get; set; }
public DiagramType DiagramType { get; set; } public DiagramType DiagramType { get; set; }
public IMaterialLogicOptions Options public IMaterialLogicOptions Options
@@ -26,6 +28,10 @@ namespace StructureHelperCommon.Models.Materials
public MaterialTypes MaterialType { get; set; } public MaterialTypes MaterialType { get; set; }
public ReinforcementByBuilderLogic(Guid id)
{
Id = id;
}
public IMaterial GetLoaderMaterial() public IMaterial GetLoaderMaterial()
{ {
GetLoaderOptions(); GetLoaderOptions();

View File

@@ -40,7 +40,7 @@ namespace StructureHelperCommon.Models.Sections.Logics
public (double ex, double ey) GetValue() public (double ex, double ey) GetValue()
{ {
eccentricityLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50); 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")); TraceLogger?.AddMessage(string.Format(accEccMessage, "x"));
eccentricityLogic.Length = Length; eccentricityLogic.Length = Length;
eccentricityLogic.Size = SizeX; eccentricityLogic.Size = SizeX;

View File

@@ -30,7 +30,7 @@ namespace StructureHelperCommon.Models.Sections.Logics
} }
public double GetValue() public double GetValue()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
var lengthEccetricity = Length / lengthFactor; var lengthEccetricity = Length / lengthFactor;
TraceLogger?.AddMessage(string.Format("Length of member = {0}(m)", Length)); 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)); TraceLogger?.AddMessage(string.Format("Accidental eccentricity by length e,a = {0}(m) / {1} = {2}(m)", Length, lengthFactor, lengthEccetricity));

View File

@@ -51,7 +51,7 @@ namespace StructureHelperCommon.Models.Sections
public IForceTuple GetValue() public IForceTuple GetValue()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
if (InputForceTuple is null) if (InputForceTuple is null)
{ {
string errorString = ErrorStrings.NullReference + $": {nameof(InputForceTuple)}"; string errorString = ErrorStrings.NullReference + $": {nameof(InputForceTuple)}";

View File

@@ -4,7 +4,7 @@ using StructureHelperLogics.Models.CrossSections;
namespace StructureHelperLogic.Models.Analyses namespace StructureHelperLogic.Models.Analyses
{ {
public class CrossSectionNdmAnalysis : IAnalysis public class CrossSectionNdmAnalysis : ICrossSectionNdmAnalysis
{ {
private CrossSectionNdmAnalysisUpdateStrategy updateStrategy = new(); private CrossSectionNdmAnalysisUpdateStrategy updateStrategy = new();
public Guid Id { get; private set; } public Guid Id { get; private set; }

View File

@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Analyses namespace StructureHelperLogics.Models.Analyses
{ {
public class CrossSectionNdmAnalysisUpdateStrategy : IUpdateStrategy<CrossSectionNdmAnalysis> public class CrossSectionNdmAnalysisUpdateStrategy : IUpdateStrategy<ICrossSectionNdmAnalysis>
{ {
private IUpdateStrategy<IAnalysis> analysisUpdateStrategy; private IUpdateStrategy<IAnalysis> analysisUpdateStrategy;
private IUpdateStrategy<ICrossSection> crossSectionUpdateStrategy; 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(sourceObject, ErrorStrings.SourceObject);
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject); CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
@@ -44,24 +44,24 @@ namespace StructureHelperLogics.Models.Analyses
targetObject.VersionProcessor.Versions.Clear(); targetObject.VersionProcessor.Versions.Clear();
foreach (var version in sourceObject.VersionProcessor.Versions) foreach (var version in sourceObject.VersionProcessor.Versions)
{ {
if (version.Item is ICrossSection crossSection) if (version.AnalysisVersion is ICrossSection crossSection)
{ {
updateVersion(targetObject, version, crossSection); updateVersion(targetObject, version, crossSection);
} }
else 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(); DateVersion newVersion = new();
dateUpdateStrategy.Update(newVersion, version); dateUpdateStrategy.Update(newVersion, version);
CrossSection newCrossection = new(); CrossSection newCrossection = new();
crossSectionUpdateStrategy.Update(newCrossection, crossSection); crossSectionUpdateStrategy.Update(newCrossection, crossSection);
newVersion.Item = newCrossection; newVersion.AnalysisVersion = newCrossection;
targetObject.VersionProcessor.Versions.Add(newVersion); targetObject.VersionProcessor.Versions.Add(newVersion);
} }
} }

View File

@@ -0,0 +1,8 @@
using StructureHelperCommon.Models.Analyses;
namespace StructureHelperLogic.Models.Analyses
{
public interface ICrossSectionNdmAnalysis : IAnalysis
{
}
}

View File

@@ -8,13 +8,18 @@ namespace StructureHelperLogics.Models.CrossSections
{ {
public class CrossSection : ICrossSection 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 Guid Id { get; private set; }
public CrossSection() public CrossSection(Guid id)
{ {
SectionRepository = new CrossSectionRepository(); Id = id;
}
public CrossSection() : this(Guid.NewGuid())
{
} }
public object Clone() public object Clone()

View File

@@ -14,17 +14,19 @@ namespace StructureHelperLogics.Models.CrossSections
{ {
public class CrossSectionRepository : ICrossSectionRepository public class CrossSectionRepository : ICrossSectionRepository
{ {
public List<IForceAction> ForceActions { get; private set; } public Guid Id { get; }
public List<IHeadMaterial> HeadMaterials { get; private set; } public List<IForceAction> ForceActions { get; private set; } = new();
public List<INdmPrimitive> Primitives { get; } public List<IHeadMaterial> HeadMaterials { get; private set; } = new();
public List<ICalculator> CalculatorsList { get; private set; } 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>();
} }
} }
} }

View File

@@ -1,6 +1,7 @@
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services; using StructureHelperCommon.Services;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -11,18 +12,29 @@ namespace StructureHelperLogics.Models.CrossSections
{ {
public class CrossSectionUpdateStrategy : IUpdateStrategy<ICrossSection> public class CrossSectionUpdateStrategy : IUpdateStrategy<ICrossSection>
{ {
private IUpdateStrategy<ICrossSectionRepository> repositoryUpdateStrategy;
public CrossSectionUpdateStrategy() public CrossSectionUpdateStrategy(IUpdateStrategy<ICrossSectionRepository> repositoryUpdateStrategy)
{ {
this.repositoryUpdateStrategy = repositoryUpdateStrategy;
}
public CrossSectionUpdateStrategy() : this (
new CrossSectionRepositoryUpdateStrategy()
)
{
} }
public void Update(ICrossSection targetObject, ICrossSection sourceObject) public void Update(ICrossSection targetObject, ICrossSection sourceObject)
{ {
CheckObject.IsNull(targetObject, sourceObject); CheckObject.IsNull(targetObject, sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; } 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);
} }
} }
} }

View File

@@ -1,22 +1,13 @@
using StructureHelper.Models.Materials; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Analyses;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.CrossSections 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; }
} }
} }

View File

@@ -1,6 +1,7 @@
using LoaderCalculator.Data.Materials; using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Settings; using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Materials; using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Materials.Libraries; using StructureHelperCommon.Models.Materials.Libraries;
@@ -18,6 +19,10 @@ namespace StructureHelperLogics.Models.Materials
private IMaterialOptionLogic optionLogic; private IMaterialOptionLogic optionLogic;
private IFactorLogic factorLogic => new FactorLogic(SafetyFactors); private IFactorLogic factorLogic => new FactorLogic(SafetyFactors);
private LMLogic.ITrueStrengthLogic strengthLogic; private LMLogic.ITrueStrengthLogic strengthLogic;
private IUpdateStrategy<IConcreteLibMaterial> updateStrategy = new ConcreteLibUpdateStrategy();
/// <inheritdoc/>
public Guid Id { get; }
/// <inheritdoc/> /// <inheritdoc/>
public ILibMaterialEntity MaterialEntity { get; set; } public ILibMaterialEntity MaterialEntity { get; set; }
/// <inheritdoc/> /// <inheritdoc/>
@@ -38,8 +43,9 @@ namespace StructureHelperLogics.Models.Materials
public List<IMaterialLogic> MaterialLogics => materialLogics; public List<IMaterialLogic> MaterialLogics => materialLogics;
public ConcreteLibMaterial() public ConcreteLibMaterial(Guid id)
{ {
Id = id;
materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList(); materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
MaterialLogic = materialLogics.First(); MaterialLogic = materialLogics.First();
SafetyFactors = new List<IMaterialSafetyFactor>(); SafetyFactors = new List<IMaterialSafetyFactor>();
@@ -50,12 +56,16 @@ namespace StructureHelperLogics.Models.Materials
RelativeHumidity = 0.55d; RelativeHumidity = 0.55d;
MinAge = 0d; MinAge = 0d;
MaxAge = maxAge; MaxAge = maxAge;
} }
public ConcreteLibMaterial() : this (Guid.NewGuid())
{
}
public object Clone() public object Clone()
{ {
var newItem = new ConcreteLibMaterial(); var newItem = new ConcreteLibMaterial();
var updateStrategy = new ConcreteLibUpdateStrategy();
updateStrategy.Update(newItem, this); updateStrategy.Update(newItem, this);
return newItem; return newItem;
} }

View File

@@ -16,11 +16,18 @@ 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; } 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) public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)

View File

@@ -15,43 +15,34 @@ namespace StructureHelperLogics.Models.Materials
{ {
private IElasticMaterialLogic elasticMaterialLogic => new ElasticMaterialLogic(); private IElasticMaterialLogic elasticMaterialLogic => new ElasticMaterialLogic();
private MaterialTypes materialType; private MaterialTypes materialType;
IUpdateStrategy<IFRMaterial> fRUpdateStrategy = new FRUpdateStrategy(); IUpdateStrategy<IFRMaterial> updateStrategy = new FRUpdateStrategy();
public Guid Id { get; }
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; } public List<IMaterialSafetyFactor> SafetyFactors { get; } = 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();
private double GetGammaF2() public FRMaterial(MaterialTypes materialType, Guid id)
{ {
const double gammaF2Max = 0.9d; Id = id;
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)
{
ULSConcreteStrength = 14e6d; ULSConcreteStrength = 14e6d;
SumThickness = 0.175e-3d; SumThickness = 0.175e-3d;
SafetyFactors = new List<IMaterialSafetyFactor>();
this.materialType = materialType; this.materialType = materialType;
SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultFRSafetyFactors(ProgramSetting.FRCodeType, this.materialType)); SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultFRSafetyFactors(ProgramSetting.FRCodeType, this.materialType));
} }
public FRMaterial(MaterialTypes materialType) : this (materialType, Guid.NewGuid())
{
}
public object Clone() public object Clone()
{ {
var newItem = new FRMaterial(this.materialType); var newItem = new FRMaterial(this.materialType);
var updateStrategy = fRUpdateStrategy;
updateStrategy.Update(newItem, this); updateStrategy.Update(newItem, this);
return newItem; return newItem;
} }
@@ -71,5 +62,17 @@ namespace StructureHelperLogics.Models.Materials
{ {
return GetLoaderMaterial(limitState, calcTerm); 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;
}
} }
} }

View File

@@ -16,6 +16,7 @@ namespace StructureHelper.Models.Materials
{ {
public class HeadMaterial : IHeadMaterial, INotifyPropertyChanged public class HeadMaterial : IHeadMaterial, INotifyPropertyChanged
{ {
private HeadMaterialUpdateStrategy updateStrategy = new HeadMaterialUpdateStrategy();
private Color color; private Color color;
public Guid Id { get; } public Guid Id { get; }
@@ -31,6 +32,7 @@ namespace StructureHelper.Models.Materials
} }
public IHelperMaterial HelperMaterial {get; set;} public IHelperMaterial HelperMaterial {get; set;}
public HeadMaterial(Guid id) public HeadMaterial(Guid id)
{ {
Id = id; Id = id;
@@ -51,8 +53,7 @@ namespace StructureHelper.Models.Materials
public object Clone() public object Clone()
{ {
var newItem = new HeadMaterial(); var newItem = new HeadMaterial();
newItem.HelperMaterial = this.HelperMaterial.Clone() as IHelperMaterial; newItem.HelperMaterial = HelperMaterial.Clone() as IHelperMaterial;
var updateStrategy = new MaterialUpdateStrategy();
updateStrategy.Update(newItem, this); updateStrategy.Update(newItem, this);
return newItem; return newItem;
} }

View File

@@ -2,11 +2,6 @@
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media; using System.Windows.Media;
namespace StructureHelper.Models.Materials namespace StructureHelper.Models.Materials

View File

@@ -1,5 +1,6 @@
using LoaderCalculator.Data.Materials; using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -7,7 +8,7 @@ using System.Text;
namespace StructureHelperLogics.Models.Materials namespace StructureHelperLogics.Models.Materials
{ {
public interface IHelperMaterial : ICloneable public interface IHelperMaterial : ISaveable, ICloneable
{ {
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm); IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm); IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);

View File

@@ -28,6 +28,8 @@ namespace StructureHelperLogics.Models.Materials
public List<IMaterialLogic> MaterialLogics => throw new NotImplementedException(); public List<IMaterialLogic> MaterialLogics => throw new NotImplementedException();
public Guid Id => throw new NotImplementedException();
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength) public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
{ {
this.MaterialType = materialType; this.MaterialType = materialType;

View File

@@ -21,12 +21,15 @@ namespace StructureHelperLogics.Models.Materials
} }
public void Update(IConcreteLibMaterial targetObject, IConcreteLibMaterial sourceObject) public void Update(IConcreteLibMaterial targetObject, IConcreteLibMaterial sourceObject)
{ {
CheckObject.CompareTypes(targetObject, sourceObject); CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; } if (ReferenceEquals(targetObject, sourceObject)) { return; }
libUpdateStrategy.Update(targetObject, sourceObject); libUpdateStrategy.Update(targetObject, sourceObject);
targetObject.TensionForULS = sourceObject.TensionForULS; targetObject.TensionForULS = sourceObject.TensionForULS;
targetObject.TensionForSLS = sourceObject.TensionForSLS; targetObject.TensionForSLS = sourceObject.TensionForSLS;
targetObject.RelativeHumidity = sourceObject.RelativeHumidity; targetObject.RelativeHumidity = sourceObject.RelativeHumidity;
targetObject.MinAge = sourceObject.MinAge;
targetObject.MaxAge = sourceObject.MaxAge;
} }
} }
} }

View File

@@ -0,0 +1,30 @@
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
namespace StructureHelperLogics.Models.Materials
{
public class HeadMaterialUpdateStrategy : IUpdateStrategy<IHeadMaterial>
{
private IUpdateStrategy<IHelperMaterial> helperMaterialUpdateStrategy;
public HeadMaterialUpdateStrategy(IUpdateStrategy<IHelperMaterial> helperMaterialUpdateStrategy)
{
this.helperMaterialUpdateStrategy = helperMaterialUpdateStrategy;
}
public HeadMaterialUpdateStrategy() : this(new HelperMaterialUpdateStrategy()) { }
public void Update(IHeadMaterial targetObject, IHeadMaterial sourceObject)
{
CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Name = sourceObject.Name;
targetObject.Color = sourceObject.Color;
targetObject.HelperMaterial = sourceObject.HelperMaterial.Clone() as IHelperMaterial;
helperMaterialUpdateStrategy.Update(targetObject.HelperMaterial, sourceObject.HelperMaterial);
}
}
}

View File

@@ -1,17 +1,21 @@
using StructureHelper.Models.Materials; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services; using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials namespace StructureHelperLogics.Models.Materials
{ {
public class MaterialUpdateStrategy : IUpdateStrategy<IHeadMaterial> public class HelperMaterialUpdateStrategy : IUpdateStrategy<IHelperMaterial>
{ {
private IUpdateStrategy<IElasticMaterial> elasticStrategy; private IUpdateStrategy<IElasticMaterial> elasticStrategy;
private IUpdateStrategy<IFRMaterial> frStrategy; private IUpdateStrategy<IFRMaterial> frStrategy;
private IUpdateStrategy<IConcreteLibMaterial> concreteStrategy; private IUpdateStrategy<IConcreteLibMaterial> concreteStrategy;
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy; private IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy;
public MaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy, public HelperMaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
IUpdateStrategy<IFRMaterial> frStrategy, IUpdateStrategy<IFRMaterial> frStrategy,
IUpdateStrategy<IConcreteLibMaterial> concreteStrategy, IUpdateStrategy<IConcreteLibMaterial> concreteStrategy,
IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy
@@ -20,28 +24,20 @@ namespace StructureHelperLogics.Models.Materials
this.elasticStrategy = elasticStrategy; this.elasticStrategy = elasticStrategy;
this.frStrategy = frStrategy; this.frStrategy = frStrategy;
this.concreteStrategy = concreteStrategy; this.concreteStrategy = concreteStrategy;
this.reinforcementStrategy= reinforcementStrategy; this.reinforcementStrategy = reinforcementStrategy;
} }
public MaterialUpdateStrategy() : this( public HelperMaterialUpdateStrategy() : this(
new ElasticUpdateStrategy(), new ElasticUpdateStrategy(),
new FRUpdateStrategy(), new FRUpdateStrategy(),
new ConcreteLibUpdateStrategy(), new ConcreteLibUpdateStrategy(),
new ReinforcementLibUpdateStrategy() new ReinforcementLibUpdateStrategy()
) { } )
{ }
public void Update(IHeadMaterial targetObject, IHeadMaterial sourceObject) public void Update(IHelperMaterial targetObject, IHelperMaterial sourceObject)
{ {
CheckObject.CompareTypes(targetObject, sourceObject); CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; } CheckObject.IsNull(targetObject);
targetObject.Name = sourceObject.Name;
targetObject.Color = sourceObject.Color;
targetObject.HelperMaterial = sourceObject.HelperMaterial.Clone() as IHelperMaterial;
UpdateHelperMaterial(targetObject.HelperMaterial, sourceObject.HelperMaterial);
}
private void UpdateHelperMaterial(IHelperMaterial targetObject, IHelperMaterial sourceObject)
{
CheckObject.CompareTypes(targetObject, sourceObject);
if (sourceObject is ILibMaterial) if (sourceObject is ILibMaterial)
{ {
UpdateLibMaterial(targetObject, sourceObject); UpdateLibMaterial(targetObject, sourceObject);

View File

@@ -13,11 +13,16 @@ namespace StructureHelperLogics.Models.Materials
{ {
public void Update(ILibMaterial targetObject, ILibMaterial sourceObject) public void Update(ILibMaterial targetObject, ILibMaterial sourceObject)
{ {
CheckObject.CompareTypes(targetObject, sourceObject); CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; } if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.MaterialEntity = sourceObject.MaterialEntity; targetObject.MaterialEntity = sourceObject.MaterialEntity;
if (targetObject.SafetyFactors is not null & sourceObject.SafetyFactors is not null) if (sourceObject.SafetyFactors is not null)
{ {
if (targetObject.SafetyFactors is null)
{
targetObject.SafetyFactors = new();
}
targetObject.SafetyFactors.Clear(); targetObject.SafetyFactors.Clear();
foreach (var item in sourceObject.SafetyFactors) foreach (var item in sourceObject.SafetyFactors)
{ {

View File

@@ -21,7 +21,8 @@ namespace StructureHelperLogics.Models.Materials
} }
public void Update(IReinforcementLibMaterial targetObject, IReinforcementLibMaterial sourceObject) public void Update(IReinforcementLibMaterial targetObject, IReinforcementLibMaterial sourceObject)
{ {
CheckObject.CompareTypes(targetObject, sourceObject); CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; } if (ReferenceEquals(targetObject, sourceObject)) { return; }
libUpdateStrategy.Update(targetObject, sourceObject); libUpdateStrategy.Update(targetObject, sourceObject);
} }

View File

@@ -22,16 +22,23 @@ namespace StructureHelperLogics.Models.Materials
private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic; private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
private readonly List<IMaterialLogic> materialLogics; private readonly List<IMaterialLogic> materialLogics;
public Guid Id { get; }
public ILibMaterialEntity MaterialEntity { get; set; } public ILibMaterialEntity MaterialEntity { get; set; }
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
public IMaterialLogic MaterialLogic { get; set; } public IMaterialLogic MaterialLogic { get; set; }
public List<IMaterialLogic> MaterialLogics => materialLogics; public List<IMaterialLogic> MaterialLogics => materialLogics;
public ReinforcementLibMaterial()
public ReinforcementLibMaterial(Guid id)
{ {
Id = id;
materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList(); materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
MaterialLogic = materialLogics.First(); MaterialLogic = materialLogics.First();
SafetyFactors = new List<IMaterialSafetyFactor>(); }
public ReinforcementLibMaterial() : this (Guid.NewGuid())
{
} }
public object Clone() public object Clone()

View File

@@ -51,7 +51,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
calculators = calculatorLogic.GetNdmCalculators(); calculators = calculatorLogic.GetNdmCalculators();
AddAllForcesToCalculators(); AddAllForcesToCalculators();
AddAllPrimitivesToCalculator(); AddAllPrimitivesToCalculator();
repository.CalculatorsList.AddRange(calculators); repository.Calculators.AddRange(calculators);
return section; return section;
} }

View File

@@ -40,7 +40,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public void Run() public void Run()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
checkInputDataLogic.InputData = InputData; checkInputDataLogic.InputData = InputData;
checkInputDataLogic.TraceLogger = TraceLogger; checkInputDataLogic.TraceLogger = TraceLogger;
if (checkInputDataLogic.Check() != true) if (checkInputDataLogic.Check() != true)

View File

@@ -25,7 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public ForcesResults GetForcesResults() public ForcesResults GetForcesResults()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
GetCombinations(); GetCombinations();
CalculateResult(); CalculateResult();
return result; return result;

View File

@@ -67,7 +67,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public void Run() public void Run()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(LoggerStrings.MethodBasedOn + "SP63.13330.2018"); TraceLogger?.AddMessage(LoggerStrings.MethodBasedOn + "SP63.13330.2018");
var checkResult = CheckInputData(); var checkResult = CheckInputData();
if (checkResult != "") if (checkResult != "")

View File

@@ -31,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public double GetDeltaE() 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("Eccentricity e = {0}", eccentricity));
TraceLogger?.AddMessage(string.Format("Height h = {0}", size)); TraceLogger?.AddMessage(string.Format("Height h = {0}", size));
var deltaE = Math.Abs(eccentricity) / size; var deltaE = Math.Abs(eccentricity) / size;

View File

@@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public double GetEtaFactor() public double GetEtaFactor()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
if (LongitudinalForce >= 0d) return 1d; if (LongitudinalForce >= 0d) return 1d;
var Ncr = GetCriticalForce(); var Ncr = GetCriticalForce();
if (LongitudinalForce <= Ncr) if (LongitudinalForce <= Ncr)

View File

@@ -31,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public GenericResult<IForceTuple> GetForceTupleByBuckling() 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; var tuple = bucklingInputData.ForceTuple.Clone() as IForceTuple;

View File

@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public double GetPhil() 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); 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); 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); TraceLogger?.AddMessage(distMessage);

View File

@@ -45,7 +45,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public IForceTuple GetValue() 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("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)); TraceLogger?.AddMessage(string.Format("Cross-section size along x-axis dx = {0}, along y-axis dy = {1}", sizeX, sizeY));

View File

@@ -42,7 +42,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public bool Check() public bool Check()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
result = true; result = true;
CheckResult = string.Empty; CheckResult = string.Empty;
CheckPrimitives(); CheckPrimitives();

View File

@@ -64,7 +64,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{ {
PrepareNewResult(); PrepareNewResult();
CheckInputData(); CheckInputData();
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
try try
{ {
ProcessCalculations(); ProcessCalculations();

View File

@@ -54,7 +54,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public void Run() public void Run()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
PrepareNewResult(); PrepareNewResult();
ProcessCrackWidthCalculation(); ProcessCrackWidthCalculation();
} }

View File

@@ -33,7 +33,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public double GetCrackWidth() public double GetCrackWidth()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
CheckOptions(); CheckOptions();
TraceLogger?.AddMessage("Method of crack width calculation based on SP 63.13330.2018"); TraceLogger?.AddMessage("Method of crack width calculation based on SP 63.13330.2018");
TraceInputData(); TraceInputData();

View File

@@ -43,7 +43,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <inheritdoc/> /// <inheritdoc/>
public List<INdm> GetNdmCollection() public List<INdm> GetNdmCollection()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug); TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
triangulateLogic = new TriangulatePrimitiveLogic() triangulateLogic = new TriangulatePrimitiveLogic()
{ {
@@ -57,7 +57,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <inheritdoc/> /// <inheritdoc/>
public List<INdm> GetCrackedNdmCollection() public List<INdm> GetCrackedNdmCollection()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug); TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
triangulateLogic = new TriangulatePrimitiveLogic(new MeshCrackedConcreteLogic()) triangulateLogic = new TriangulatePrimitiveLogic(new MeshCrackedConcreteLogic())
{ {
@@ -72,7 +72,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <inheritdoc/> /// <inheritdoc/>
public List<IRebarPrimitive> GetRebarPrimitives() public List<IRebarPrimitive> GetRebarPrimitives()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug); TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
List<IRebarPrimitive> rebarPrimitives = new(); List<IRebarPrimitive> rebarPrimitives = new();
foreach (var item in NdmPrimitives) foreach (var item in NdmPrimitives)
@@ -90,7 +90,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <inheritdoc/> /// <inheritdoc/>
public List<INdm> GetElasticNdmCollection() public List<INdm> GetElasticNdmCollection()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug); TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
triangulateLogic = new TriangulatePrimitiveLogic(new MeshElasticLogic()) triangulateLogic = new TriangulatePrimitiveLogic(new MeshElasticLogic())
{ {

View File

@@ -17,7 +17,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public double GetAverageDiameter() public double GetAverageDiameter()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
Check(); Check();
var rebarArea = Rebars var rebarArea = Rebars
.Sum(x => x.Area); .Sum(x => x.Area);

View File

@@ -33,7 +33,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public List<TupleCrackInputData> GetTupleInputDatas() public List<TupleCrackInputData> GetTupleInputDatas()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
List<TupleCrackInputData> resultList = new(); List<TupleCrackInputData> resultList = new();
CheckInputData(); CheckInputData();

View File

@@ -52,7 +52,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <inheritdoc/> /// <inheritdoc/>
public double GetLength() public double GetLength()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
IEnumerable<RebarNdm?> rebars = GetRebars(); IEnumerable<RebarNdm?> rebars = GetRebars();
double rebarArea = GetRebarArea(rebars); double rebarArea = GetRebarArea(rebars);
double rebarDiameter = GetAverageDiameter(rebars); double rebarDiameter = GetAverageDiameter(rebars);

View File

@@ -41,7 +41,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public void Run() public void Run()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
TraceLogger?.AddMessage($"Rebar primitive {InputData.RebarPrimitive.Name}"); TraceLogger?.AddMessage($"Rebar primitive {InputData.RebarPrimitive.Name}");
PrepareNewResult(); PrepareNewResult();
if (CheckInputData() != true) if (CheckInputData() != true)

View File

@@ -65,7 +65,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// <inheritdoc/> /// <inheritdoc/>
public double GetSofteningFactor() 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($"Logic of calculation of psi_s factor based on exponential softening model");
TraceLogger?.AddMessage($"psi_s = 1 - BettaFactor * ForceRatio ^ PowerFactor"); TraceLogger?.AddMessage($"psi_s = 1 - BettaFactor * ForceRatio ^ PowerFactor");
TraceLogger?.AddMessage($"But not less than psi_s_min = {PsiSMin}"); TraceLogger?.AddMessage($"But not less than psi_s_min = {PsiSMin}");

View File

@@ -69,7 +69,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public double GetSofteningFactor() public double GetSofteningFactor()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
if (IsResultActual == false) if (IsResultActual == false)
{ {
GetRebarAndConcreteNdms(); GetRebarAndConcreteNdms();

View File

@@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public double GetTensileArea() public double GetTensileArea()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service); TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
var rebarCollection = NdmCollection var rebarCollection = NdmCollection
.Where(x => x is RebarNdm & stressLogic.GetSectionStrain(StrainMatrix, x) > 0d); .Where(x => x is RebarNdm & stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);

View File

@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
} }
public double GetTensionRebarArea() 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"); TraceLogger?.AddMessage("Method of obtaining of summary area of rebars in tension based on areas which are proportional by maximum strain");
var rebars = Rebars var rebars = Rebars
.Where(x => stressLogic.GetSectionStrain(StrainMatrix, x) > 0d); .Where(x => stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);

View File

@@ -32,7 +32,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
} }
public double GetTensionRebarArea() 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"); TraceLogger?.AddMessage("Method of obtaining of summary area of rebars in tension based on ordinary summarizing of areas");
var rebars = Rebars var rebars = Rebars
.Where(x => stressLogic.GetSectionStrain(StrainMatrix, x) > 0d); .Where(x => stressLogic.GetSectionStrain(StrainMatrix, x) > 0d);

Some files were not shown because too many files have changed in this diff Show More