Material diagram window was changed
This commit is contained in:
50
StructureHelperCommon/Models/Materials/ConcreteCurveLogic.cs
Normal file
50
StructureHelperCommon/Models/Materials/ConcreteCurveLogic.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public class ConcreteCurveLogic : IMaterialLogic
|
||||
{
|
||||
private ConcreteOptions concreteOptions;
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private ConcreteLogicOptions options;
|
||||
|
||||
|
||||
public string Name { get; set; }
|
||||
public IMaterialLogicOptions Options
|
||||
{
|
||||
get => options;
|
||||
set
|
||||
{
|
||||
if (value is not ConcreteLogicOptions)
|
||||
{
|
||||
throw new StructureHelperException($"{ErrorStrings.ExpectedWas(typeof(ConcreteLogicOptions), value)}");
|
||||
}
|
||||
options = (ConcreteLogicOptions)value;
|
||||
}
|
||||
}
|
||||
|
||||
public IMaterial GetLoaderMaterial()
|
||||
{
|
||||
GetLoaderOptions();
|
||||
IBuilderDirector director = GetMaterialDirector();
|
||||
var material = director.BuildMaterial();
|
||||
return material;
|
||||
}
|
||||
|
||||
private IBuilderDirector GetMaterialDirector()
|
||||
{
|
||||
IMaterialBuilder builder = new ConcreteBuilder(concreteOptions);
|
||||
IBuilderDirector director = new BuilderDirector(builder);
|
||||
return director;
|
||||
}
|
||||
|
||||
private void GetLoaderOptions()
|
||||
{
|
||||
concreteOptions = new ConcreteOptions();
|
||||
optionLogic = new ConcreteMaterialOptionLogic(options);
|
||||
optionLogic.SetMaterialOptions(concreteOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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 StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public class ConcreteLogicOptions : IMaterialLogicOptions
|
||||
{
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||
public LimitStates LimitState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
public bool WorkInCompression { get; set; }
|
||||
public bool WorkInTension { get; set; }
|
||||
public double RelativeHumidity { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.Design.AxImporter;
|
||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
internal class ConcreteMaterialOptionLogic : IMaterialOptionLogic
|
||||
{
|
||||
private ConcreteLogicOptions options;
|
||||
private MaterialCommonOptionLogic optionLogic;
|
||||
private FactorLogic factorLogic;
|
||||
|
||||
public ConcreteMaterialOptionLogic(ConcreteLogicOptions options)
|
||||
{
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public void SetMaterialOptions(IMaterialOptions materialOptions)
|
||||
{
|
||||
if (materialOptions is not ConcreteOptions)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(ConcreteOptions), materialOptions.GetType()));
|
||||
}
|
||||
var concreteOptions = materialOptions as ConcreteOptions;
|
||||
optionLogic = new MaterialCommonOptionLogic(options);
|
||||
optionLogic.SetMaterialOptions(concreteOptions);
|
||||
factorLogic = new FactorLogic(options.SafetyFactors);
|
||||
var strength = factorLogic.GetTotalFactor(options.LimitState, options.CalcTerm);
|
||||
concreteOptions.ExternalFactor.Compressive = strength.Compressive;
|
||||
concreteOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||
concreteOptions.WorkInTension = options.WorkInTension;
|
||||
concreteOptions.RelativeHumidity = options.RelativeHumidity;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
StructureHelperCommon/Models/Materials/IMaterialLogic.cs
Normal file
17
StructureHelperCommon/Models/Materials/IMaterialLogic.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public interface IMaterialLogic
|
||||
{
|
||||
string Name { get; set; }
|
||||
IMaterialLogicOptions Options { get; set; }
|
||||
IMaterial GetLoaderMaterial();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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 StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public interface IMaterialLogicOptions
|
||||
{
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
LimitStates LimitState { get; set; }
|
||||
CalcTerms CalcTerm { get; set; }
|
||||
bool WorkInCompression { get; set; }
|
||||
bool WorkInTension { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using LCM = LoaderCalculator.Data.Materials;
|
||||
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public interface IMaterialOptionLogic
|
||||
{
|
||||
void SetMaterialOptions(LCMB.IMaterialOptions materialOptions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public class MaterialCommonOptionLogic : IMaterialOptionLogic
|
||||
{
|
||||
private IMaterialLogicOptions options;
|
||||
|
||||
public MaterialCommonOptionLogic(IMaterialLogicOptions options)
|
||||
{
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
|
||||
{
|
||||
materialOptions.Strength = options.MaterialEntity.MainStrength;
|
||||
if (options.MaterialEntity.CodeType == CodeTypes.EuroCode_2_1990)
|
||||
{
|
||||
materialOptions.CodesType = LCMB.CodesType.EC2_1990;
|
||||
}
|
||||
else if (options.MaterialEntity.CodeType == CodeTypes.SP63_2018)
|
||||
{
|
||||
materialOptions.CodesType = LCMB.CodesType.SP63_2018;
|
||||
}
|
||||
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {materialOptions.CodesType}"); }
|
||||
if (options.LimitState == LimitStates.ULS)
|
||||
{
|
||||
materialOptions.LimitState = LCMB.LimitStates.Collapse;
|
||||
}
|
||||
else if (options.LimitState == LimitStates.SLS)
|
||||
{
|
||||
materialOptions.LimitState = LCMB.LimitStates.ServiceAbility;
|
||||
}
|
||||
else if (options.LimitState == LimitStates.Special)
|
||||
{
|
||||
materialOptions.LimitState = LCMB.LimitStates.Special;
|
||||
}
|
||||
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
|
||||
if (options.CalcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
|
||||
else if (options.CalcTerm == CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
|
||||
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public class ReinforcementBiLinearLogic : IMaterialLogic
|
||||
{
|
||||
private ReinforcementOptions materialOptions;
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private ReinforcementLogicOptions options;
|
||||
private IMaterialLogicOptions options1;
|
||||
|
||||
public string Name { get; set; }
|
||||
public IMaterialLogicOptions Options
|
||||
{
|
||||
get => options;
|
||||
set
|
||||
{
|
||||
if (value is not ReinforcementLogicOptions)
|
||||
{
|
||||
throw new StructureHelperException($"{ErrorStrings.ExpectedWas(typeof(ReinforcementLogicOptions), value)}");
|
||||
}
|
||||
options = (ReinforcementLogicOptions)value;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
optionLogic = new MaterialCommonOptionLogic(options);
|
||||
optionLogic.SetMaterialOptions(materialOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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 StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public class ReinforcementLogicOptions : IMaterialLogicOptions
|
||||
{
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
public LimitStates LimitState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public bool WorkInCompression { get; set; }
|
||||
public bool WorkInTension { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user