Materials were refactored
This commit is contained in:
@@ -1,36 +1,30 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using LoaderMaterials = LoaderCalculator.Data.Materials;
|
||||
using LoaderMaterialBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using LoaderMaterialLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LMLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||
using LM = LoaderCalculator.Data.Materials;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class ConcreteLibMaterial : IConcreteLibMaterial
|
||||
{
|
||||
private LMBuilders.ConcreteOptions lmOptions;
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private IFactorLogic factorLogic => new FactorLogic(SafetyFactors);
|
||||
private LMLogic.ITrueStrengthLogic strengthLogic;
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||
public bool TensionForULS { get ; set; }
|
||||
public bool TensionForSLS { get; set; }
|
||||
public double Humidity { get; set; }
|
||||
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private LoaderMaterialLogic.ITrueStrengthLogic strengthLogic;
|
||||
|
||||
public ConcreteLibMaterial()
|
||||
{
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
lmOptions = new LMBuilders.ConcreteOptions();
|
||||
SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultConcreteSafetyFactors(ProgramSetting.CodeType));
|
||||
optionLogic = new MaterialOptionLogic(new LoaderMaterialBuilders.ConcreteOptions());
|
||||
TensionForULS = false;
|
||||
TensionForSLS = true;
|
||||
Humidity = 0.55d;
|
||||
@@ -41,29 +35,23 @@ namespace StructureHelperLogics.Models.Materials
|
||||
return new ConcreteLibMaterial() { MaterialEntity = MaterialEntity, TensionForULS = TensionForULS, TensionForSLS = TensionForSLS };
|
||||
}
|
||||
|
||||
public LoaderMaterials.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
public LM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm) as LoaderMaterialBuilders.ConcreteOptions;
|
||||
materialOptions.WorkInTension = false;
|
||||
if (limitState == LimitStates.ULS & TensionForULS == true)
|
||||
{
|
||||
materialOptions.WorkInTension = true;
|
||||
}
|
||||
if (limitState == LimitStates.SLS & TensionForSLS == true)
|
||||
{
|
||||
materialOptions.WorkInTension = true;
|
||||
}
|
||||
optionLogic = new MaterialCommonOptionLogic(MaterialEntity, limitState, calcTerm);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
optionLogic = new ConcreteMaterialOptionLogic(this, limitState);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
var strength = factorLogic.GetTotalFactor(limitState, calcTerm);
|
||||
materialOptions.ExternalFactor.Compressive = strength.Compressive;
|
||||
materialOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||
LoaderMaterialBuilders.IMaterialBuilder builder = new LoaderMaterialBuilders.ConcreteBuilder(materialOptions);
|
||||
LoaderMaterialBuilders.IBuilderDirector director = new LoaderMaterialBuilders.BuilderDirector(builder);
|
||||
lmOptions.ExternalFactor.Compressive = strength.Compressive;
|
||||
lmOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||
LMBuilders.IMaterialBuilder builder = new LMBuilders.ConcreteBuilder(lmOptions);
|
||||
LMBuilders.IBuilderDirector director = new LMBuilders.BuilderDirector(builder);
|
||||
return director.BuildMaterial();
|
||||
}
|
||||
|
||||
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
strengthLogic = new LoaderMaterialLogic.TrueStrengthConcreteLogicSP63_2018(MaterialEntity.MainStrength);
|
||||
strengthLogic = new LMLogic.TrueStrengthConcreteLogicSP63_2018(MaterialEntity.MainStrength);
|
||||
var strength = strengthLogic.GetTrueStrength();
|
||||
double compressionFactor = 1d;
|
||||
double tensionFactor = 1d;
|
||||
|
||||
@@ -3,8 +3,10 @@ using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -15,7 +17,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public enum HeadmaterialType
|
||||
{
|
||||
Concrete40,
|
||||
Reinforecement400,
|
||||
Reinforcement400,
|
||||
Reinforecement500,
|
||||
Elastic200,
|
||||
Carbon1400,
|
||||
@@ -25,14 +27,13 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public static class HeadMaterialFactory
|
||||
{
|
||||
private static CodeTypes codeType;
|
||||
private static IEnumerable<ILibMaterialEntity> LibConcreteMaterials => LibMaterialPepository.GetConcreteRepository(codeType);
|
||||
private static IEnumerable<ILibMaterialEntity> LibReinforcementMaterials => LibMaterialPepository.GetReinforcementRepository(codeType);
|
||||
private static IEnumerable<ILibMaterialEntity> LibConcreteMaterials => LibMaterialPepository.GetConcreteRepository();
|
||||
private static IEnumerable<ILibMaterialEntity> LibReinforcementMaterials => LibMaterialPepository.GetReinforcementRepository();
|
||||
|
||||
public static IHeadMaterial GetHeadMaterial(HeadmaterialType type, CodeTypes code)
|
||||
public static IHeadMaterial GetHeadMaterial(HeadmaterialType type)
|
||||
{
|
||||
codeType = code;
|
||||
if (type == HeadmaterialType.Concrete40) { return GetConcrete40(); }
|
||||
if (type == HeadmaterialType.Reinforecement400) { return GetReinforcement400(); }
|
||||
if (type == HeadmaterialType.Reinforcement400) { return GetReinforcement400(); }
|
||||
if (type == HeadmaterialType.Reinforecement500) { return GetReinforcement500(); }
|
||||
if (type == HeadmaterialType.Elastic200) { return GetElastic200(); }
|
||||
if (type == HeadmaterialType.Carbon1400) { return GetCarbon1400(); }
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace StructureHelper.Models.Materials
|
||||
{
|
||||
private Color color;
|
||||
|
||||
public string Id { get; }
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
public Color Color
|
||||
{
|
||||
@@ -31,12 +31,16 @@ namespace StructureHelper.Models.Materials
|
||||
}
|
||||
public IHelperMaterial HelperMaterial {get; set;}
|
||||
|
||||
public HeadMaterial()
|
||||
public HeadMaterial(Guid id)
|
||||
{
|
||||
Id = Convert.ToString(Guid.NewGuid());
|
||||
Id = id;
|
||||
Color = ColorProcessor.GetRandomColor();
|
||||
}
|
||||
|
||||
public HeadMaterial() : this(Guid.NewGuid())
|
||||
{
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
@@ -55,5 +59,9 @@ namespace StructureHelper.Models.Materials
|
||||
return material;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,9 +11,8 @@ using System.Windows.Media;
|
||||
|
||||
namespace StructureHelper.Models.Materials
|
||||
{
|
||||
public interface IHeadMaterial : ICloneable
|
||||
public interface IHeadMaterial : ISaveable, ICloneable
|
||||
{
|
||||
string Id { get; }
|
||||
string Name { get; set; }
|
||||
Color Color { get; set; }
|
||||
IHelperMaterial HelperMaterial { get; set; }
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public interface IMaterialOptionLogic
|
||||
{
|
||||
LCMB.IMaterialOptions SetMaterialOptions(ILibMaterialEntity materialEntity, LimitStates limitState, CalcTerms calcTerm);
|
||||
void SetMaterialOptions(LCMB.IMaterialOptions materialOptions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
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;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class ConcreteMaterialOptionLogic : IMaterialOptionLogic
|
||||
{
|
||||
private IConcreteLibMaterial material;
|
||||
private LimitStates limitState;
|
||||
public ConcreteMaterialOptionLogic(IConcreteLibMaterial material, LimitStates limitState)
|
||||
{
|
||||
this.material = material;
|
||||
this.limitState = limitState;
|
||||
}
|
||||
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
|
||||
{
|
||||
Check(materialOptions);
|
||||
var concreteOptions = materialOptions as LCMB.ConcreteOptions;
|
||||
concreteOptions.WorkInTension = false;
|
||||
if (limitState == LimitStates.ULS & material.TensionForULS == true)
|
||||
{
|
||||
concreteOptions.WorkInTension = true;
|
||||
}
|
||||
if (limitState == LimitStates.SLS & material.TensionForSLS == true)
|
||||
{
|
||||
concreteOptions.WorkInTension = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void Check(LCMB.IMaterialOptions materialOptions)
|
||||
{
|
||||
if (materialOptions is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": expected {typeof(LCMB.ConcreteOptions)}, but was null");
|
||||
}
|
||||
if (materialOptions is not LCMB.ConcreteOptions)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": expected {typeof(LCMB.ConcreteOptions)}, but was {materialOptions.GetType()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,16 +11,20 @@ using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class MaterialOptionLogic : IMaterialOptionLogic
|
||||
public class MaterialCommonOptionLogic : IMaterialOptionLogic
|
||||
{
|
||||
private LCMB.IMaterialOptions materialOptions;
|
||||
private ILibMaterialEntity materialEntity;
|
||||
private LimitStates limitState;
|
||||
private CalcTerms calcTerm;
|
||||
|
||||
public MaterialOptionLogic(LCMB.IMaterialOptions materialOptions)
|
||||
public MaterialCommonOptionLogic(ILibMaterialEntity materialEntity, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
this.materialOptions = materialOptions;
|
||||
this.materialEntity = materialEntity;
|
||||
this.limitState = limitState;
|
||||
this.calcTerm = calcTerm;
|
||||
}
|
||||
|
||||
public LCMB.IMaterialOptions SetMaterialOptions(ILibMaterialEntity materialEntity, LimitStates limitState, CalcTerms calcTerm)
|
||||
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
|
||||
{
|
||||
materialOptions.Strength = materialEntity.MainStrength;
|
||||
if (materialEntity.CodeType == CodeTypes.EuroCode_2_1990)
|
||||
@@ -39,8 +43,6 @@ namespace StructureHelperLogics.Models.Materials
|
||||
if (calcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
|
||||
else if (calcTerm == CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
|
||||
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
|
||||
|
||||
return materialOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,24 +6,25 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Loadermaterials = LoaderCalculator.Data.Materials;
|
||||
using LoaderMaterialBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LoaderMaterialLogics = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class ReinforcementLibMaterial : IReinforcementLibMaterial
|
||||
{
|
||||
private LMBuilders.ReinforcementOptions lmOptions;
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private IFactorLogic factorLogic => new FactorLogic(SafetyFactors);
|
||||
private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||
|
||||
private IMaterialOptionLogic optionLogic;
|
||||
private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
|
||||
|
||||
public ReinforcementLibMaterial()
|
||||
{
|
||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||
optionLogic = new MaterialOptionLogic(new LoaderMaterialBuilders.ReinforcementOptions());
|
||||
lmOptions = new LMBuilders.ReinforcementOptions();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
@@ -33,12 +34,13 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public Loadermaterials.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm);
|
||||
optionLogic = new MaterialCommonOptionLogic(MaterialEntity, limitState, calcTerm);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
var factors = factorLogic.GetTotalFactor(limitState, calcTerm);
|
||||
materialOptions.ExternalFactor.Compressive = factors.Compressive;
|
||||
materialOptions.ExternalFactor.Tensile = factors.Tensile;
|
||||
LoaderMaterialBuilders.IMaterialBuilder builder = new LoaderMaterialBuilders.ReinforcementBuilder(materialOptions);
|
||||
LoaderMaterialBuilders.IBuilderDirector director = new LoaderMaterialBuilders.BuilderDirector(builder);
|
||||
lmOptions.ExternalFactor.Compressive = factors.Compressive;
|
||||
lmOptions.ExternalFactor.Tensile = factors.Tensile;
|
||||
LMBuilders.IMaterialBuilder builder = new LMBuilders.ReinforcementBuilder(lmOptions);
|
||||
LMBuilders.IBuilderDirector director = new LMBuilders.BuilderDirector(builder);
|
||||
return director.BuildMaterial();
|
||||
}
|
||||
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class LinePrimitive : IPrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public IPoint2D Center { get; set; }
|
||||
public IShape Shape { get; }
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
public IEnumerable<IHeadMaterial> GetHeadMaterials()
|
||||
{
|
||||
var result = new List<IHeadMaterial>();
|
||||
var concrete = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, ProgramSetting.CodeType);
|
||||
var concrete = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
concrete.Name = "Concrete";
|
||||
concrete.Color = (Color)ColorConverter.ConvertFromString("AliceBlue");
|
||||
result.Add(concrete);
|
||||
var reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforecement400, ProgramSetting.CodeType);
|
||||
var reinforcement = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
reinforcement.Name = "Reinforcement";
|
||||
reinforcement.Color = (Color)ColorConverter.ConvertFromString("Red");
|
||||
result.Add(reinforcement);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class CirclePrimitive : ICirclePrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
@@ -32,8 +32,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public bool Triangulate { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public CirclePrimitive()
|
||||
public CirclePrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Circle";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
@@ -43,6 +44,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
ClearUnderlying = false;
|
||||
Triangulate = true;
|
||||
}
|
||||
public CirclePrimitive() : this (Guid.NewGuid())
|
||||
{}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
@@ -75,5 +78,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
if (distance > Diameter / 2) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class PointPrimitive : IPointPrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get; }
|
||||
public string? Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
//public double NdmMaxSize { get; set; }
|
||||
//public int NdmMinDivision { get; set; }
|
||||
public StrainTuple UsersPrestrain { get; private set; }
|
||||
public StrainTuple AutoPrestrain { get; private set; }
|
||||
public double Area { get; set; }
|
||||
@@ -31,8 +31,9 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
public bool Triangulate { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public PointPrimitive()
|
||||
public PointPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Point";
|
||||
Area = 0.0005d;
|
||||
VisualProperty = new VisualProperty();
|
||||
@@ -40,7 +41,8 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
AutoPrestrain = new StrainTuple();
|
||||
Triangulate = true;
|
||||
}
|
||||
|
||||
public PointPrimitive() : this (Guid.NewGuid())
|
||||
{}
|
||||
public PointPrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class RectanglePrimitive : IRectanglePrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get;}
|
||||
public string Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
@@ -36,8 +36,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public RectanglePrimitive()
|
||||
public RectanglePrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Rectangle";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
@@ -47,6 +48,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
ClearUnderlying = false;
|
||||
Triangulate = true;
|
||||
}
|
||||
public RectanglePrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
@@ -18,6 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <inheritdoc/>
|
||||
public class ReinforcementPrimitive : IPointPrimitive, IHasHostPrimitive
|
||||
{
|
||||
IDataRepository<ReinforcementPrimitive> repository;
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
@@ -34,13 +36,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public IVisualProperty VisualProperty { get; private set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
public double Area { get; set; }
|
||||
public INdmPrimitive HostPrimitive { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public ReinforcementPrimitive()
|
||||
public ReinforcementPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Reinforcement";
|
||||
Area = 0.0005d;
|
||||
VisualProperty = new VisualProperty();
|
||||
@@ -48,6 +51,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
AutoPrestrain = new StrainTuple();
|
||||
Triangulate = true;
|
||||
}
|
||||
public ReinforcementPrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
@@ -67,7 +74,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
repository.Save(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
List<INdm> ndms = new List<INdm>();
|
||||
var headMaterials = GetPrimitiveMaterials(ndmPrimitives);
|
||||
Dictionary<string, IMaterial> materials = GetMaterials(headMaterials, options);
|
||||
Dictionary<Guid, IMaterial> materials = GetMaterials(headMaterials, options);
|
||||
foreach (var ndmPrimitive in ndmPrimitives)
|
||||
{
|
||||
IHeadMaterial headMaterial = ndmPrimitive.HeadMaterial;
|
||||
@@ -36,9 +36,9 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
/// </summary>
|
||||
/// <param name="ndmPrimitives"></param>
|
||||
/// <returns></returns>
|
||||
private static Dictionary<string, IHeadMaterial> GetPrimitiveMaterials(IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||
private static Dictionary<Guid, IHeadMaterial> GetPrimitiveMaterials(IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||
{
|
||||
Dictionary<string, IHeadMaterial> headMaterials = new Dictionary<string, IHeadMaterial>();
|
||||
Dictionary<Guid, IHeadMaterial> headMaterials = new Dictionary<Guid, IHeadMaterial>();
|
||||
foreach (var ndmPrimitive in ndmPrimitives)
|
||||
{
|
||||
IHeadMaterial material = ndmPrimitive.HeadMaterial;
|
||||
@@ -53,12 +53,12 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="StructureHelperException"></exception>
|
||||
private static Dictionary<string, IMaterial> GetMaterials(Dictionary<string, IHeadMaterial> PrimitiveMaterials, ITriangulationOptions options)
|
||||
private static Dictionary<Guid, IMaterial> GetMaterials(Dictionary<Guid, IHeadMaterial> PrimitiveMaterials, ITriangulationOptions options)
|
||||
{
|
||||
Dictionary<string, IMaterial> materials = new Dictionary<string, IMaterial>();
|
||||
IEnumerable<string> keyCollection = PrimitiveMaterials.Keys;
|
||||
Dictionary<Guid, IMaterial> materials = new Dictionary<Guid, IMaterial>();
|
||||
IEnumerable<Guid> keyCollection = PrimitiveMaterials.Keys;
|
||||
IMaterial material;
|
||||
foreach (string id in keyCollection)
|
||||
foreach (var id in keyCollection)
|
||||
{
|
||||
IHeadMaterial headMaterial;
|
||||
if (PrimitiveMaterials.TryGetValue(id, out headMaterial) == false) { throw new StructureHelperException("Material dictionary is not valid"); }
|
||||
|
||||
Reference in New Issue
Block a user