TripleLinear Material Diagram was added

This commit is contained in:
Evgeny Redikultsev
2023-11-25 20:05:49 +05:00
parent 4a8cf2d42a
commit b4b1720c70
23 changed files with 225 additions and 25 deletions

View File

@@ -0,0 +1,51 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Services;
namespace StructureHelperCommon.Models.Materials
{
public class ReinforcementByBuilderLogic : IMaterialLogic
{
private ReinforcementLogicOptions options;
private ReinforcementOptions materialOptions;
private IMaterialOptionLogic optionLogic;
public string Name { get; set; }
public DiagramType DiagramType { get; set; }
public IMaterialLogicOptions Options
{
get => options;
set
{
CheckObject.CheckType(value, typeof(ReinforcementLogicOptions));
options = (ReinforcementLogicOptions)value;
}
}
public MaterialTypes MaterialType { get; set; }
public IMaterial GetLoaderMaterial()
{
GetLoaderOptions();
IBuilderDirector director = GetMaterialDirector();
var material = director.BuildMaterial();
return material;
}
private IBuilderDirector GetMaterialDirector()
{
IMaterialBuilder builder = new ReinforcementBuilder(materialOptions);
IBuilderDirector director = new BuilderDirector(builder);
return director;
}
private void GetLoaderOptions()
{
materialOptions = new ReinforcementOptions() { DiagramType = DiagramType};
optionLogic = new MaterialCommonOptionLogic(options);
optionLogic.SetMaterialOptions(materialOptions);
}
}
}