Headmaterial was repaired

This commit is contained in:
Evgeny Redikultsev
2022-11-11 21:29:24 +05:00
parent 1d7a97f4fd
commit ba609091aa
26 changed files with 165 additions and 187 deletions

View File

@@ -53,9 +53,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
string materialName = MaterialName; string materialName = MaterialName;
ICenter center = new Center { X = CenterX, Y = CenterY }; ICenter center = new Center { X = CenterX, Y = CenterY };
IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = this.Area }; IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = this.Area };
IPrimitiveMaterial primitiveMaterial = GetPrimitiveMaterial(); INdmPrimitive ndmPrimitive = new NdmPrimitive(HeadMaterial)
//IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength }; { Center = center, Shape = shape,
INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial,
PrestrainKx = PrestrainKx, PrestrainKx = PrestrainKx,
PrestrainKy = PrestrainKy, PrestrainKy = PrestrainKy,
PrestrainEpsZ = PrestrainEpsZ PrestrainEpsZ = PrestrainEpsZ

View File

@@ -369,9 +369,5 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); } else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); }
return materialTypes; return materialTypes;
} }
public IPrimitiveMaterial GetPrimitiveMaterial()
{
return HeadMaterial.HelperMaterial.GetPrimitiveMaterial();
}
} }
} }

View File

@@ -49,10 +49,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
double centerY = CenterY; double centerY = CenterY;
ICenter center = new Center { X = centerX, Y = centerY }; ICenter center = new Center { X = centerX, Y = centerY };
IShape shape = new StructureHelperCommon.Models.Shapes.Rectangle { Height = height, Width = width, Angle = 0 }; IShape shape = new StructureHelperCommon.Models.Shapes.Rectangle { Height = height, Width = width, Angle = 0 };
IPrimitiveMaterial primitiveMaterial = GetPrimitiveMaterial(); INdmPrimitive ndmPrimitive = new NdmPrimitive(HeadMaterial)
//IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = Material.DesignCompressiveStrength }; { Center = center, Shape = shape,
INdmPrimitive ndmPrimitive = new NdmPrimitive
{ Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial,
NdmMaxSize = MaxElementSize, NdmMinDivision = MinElementDivision, NdmMaxSize = MaxElementSize, NdmMinDivision = MinElementDivision,
PrestrainKx = PrestrainKx, PrestrainKx = PrestrainKx,
PrestrainKy = PrestrainKy, PrestrainKy = PrestrainKy,

View File

@@ -1,4 +1,4 @@
namespace StructureHelperLogics.Infrastructures.CommonEnums namespace StructureHelperCommon.Infrastructures.Enums
{ {
public enum CalcTerms public enum CalcTerms
{ {

View File

@@ -1,4 +1,4 @@
namespace StructureHelperLogics.Infrastructures.CommonEnums namespace StructureHelperCommon.Infrastructures.Enums
{ {
public enum LimitStates public enum LimitStates
{ {

View File

@@ -46,7 +46,9 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Infrastructures\Enums\CalcTerms.cs" />
<Compile Include="Infrastructures\Enums\CodeTypes.cs" /> <Compile Include="Infrastructures\Enums\CodeTypes.cs" />
<Compile Include="Infrastructures\Enums\LimitStates.cs" />
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" /> <Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" /> <Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
<Compile Include="Infrastructures\Strings\ErrorString.cs" /> <Compile Include="Infrastructures\Strings\ErrorString.cs" />

View File

@@ -1,8 +1,5 @@
using LoaderCalculator.Data.Matrix; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Infrastructures.CommonEnums;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.Calculations.CalculationProperties namespace StructureHelperLogics.Models.Calculations.CalculationProperties
{ {

View File

@@ -1,8 +1,5 @@
using LoaderCalculator.Data.Matrix; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Infrastructures.CommonEnums;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.Calculations.CalculationProperties namespace StructureHelperLogics.Models.Calculations.CalculationProperties
{ {

View File

@@ -1,4 +1,6 @@
using StructureHelperLogics.Models.Materials; using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Models.Materials;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -11,14 +13,14 @@ namespace StructureHelperLogics.Models.Materials
{ {
public double Modulus { get; set; } public double Modulus { get; set; }
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
{
throw new NotImplementedException();
}
public object Clone() public object Clone()
{ {
return new ElasticMaterial() { Modulus = Modulus }; return new ElasticMaterial() { Modulus = Modulus };
} }
public IPrimitiveMaterial GetPrimitiveMaterial()
{
throw new NotImplementedException();
}
} }
} }

View File

@@ -6,6 +6,8 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Media; using System.Windows.Media;
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Services.ColorServices; using StructureHelperCommon.Services.ColorServices;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
@@ -13,17 +15,22 @@ namespace StructureHelper.Models.Materials
{ {
public class HeadMaterial : IHeadMaterial public class HeadMaterial : IHeadMaterial
{ {
public string Id { get; }
public string Name { get; set; } public string Name { get; set; }
public Color Color { get; set; } public Color Color { get; set; }
public IHelperMaterial HelperMaterial {get; set;} public IHelperMaterial HelperMaterial {get; set;}
//public MaterialDefinitionBase Material { get; set; }
public HeadMaterial() public HeadMaterial()
{ {
Id = Convert.ToString(Guid.NewGuid());
Color = ColorProcessor.GetRandomColor(); Color = ColorProcessor.GetRandomColor();
} }
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
{
return HelperMaterial.GetLoaderMaterial(limitState, calcTerm);
}
public object Clone() public object Clone()
{ {
IHeadMaterial material = new HeadMaterial IHeadMaterial material = new HeadMaterial
@@ -34,5 +41,6 @@ namespace StructureHelper.Models.Materials
}; };
return material; return material;
} }
} }
} }

View File

@@ -1,4 +1,6 @@
using StructureHelperLogics.Models.Materials; using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Models.Materials;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -10,9 +12,11 @@ namespace StructureHelper.Models.Materials
{ {
public interface IHeadMaterial : ICloneable public interface IHeadMaterial : ICloneable
{ {
string Id { get; }
string Name { get; set; } string Name { get; set; }
Color Color { get; set; } Color Color { get; set; }
IHelperMaterial HelperMaterial { get; set; } IHelperMaterial HelperMaterial { get; set; }
//MaterialDefinitionBase Material { get; set; } //MaterialDefinitionBase Material { get; set; }
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
} }
} }

View File

@@ -1,4 +1,5 @@
using LoaderCalculator.Data.Materials; using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -8,6 +9,6 @@ namespace StructureHelperLogics.Models.Materials
{ {
public interface IHelperMaterial : ICloneable public interface IHelperMaterial : ICloneable
{ {
IPrimitiveMaterial GetPrimitiveMaterial(); IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
} }
} }

View File

@@ -1,6 +1,5 @@
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Infrastructures.CommonEnums;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -10,7 +9,7 @@ namespace StructureHelperLogics.Models.Materials
public interface ILibMaterial : IHelperMaterial public interface ILibMaterial : IHelperMaterial
{ {
MaterialTypes MaterialType { get; set; } MaterialTypes MaterialType { get; set; }
CodeTypes CodeType { get; set; } //CodeTypes CodeType { get; set; }
string Name { get; set; } string Name { get; set; }
double MainStrength { get; set; } double MainStrength { get; set; }
} }

View File

@@ -1,13 +0,0 @@
using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperLogics.Models.Materials
{
public interface IPrimitiveMaterial
{
string Id { get;}
MaterialTypes MaterialType { get; }
CodeTypes CodeType { get; set; }
string ClassName { get; }
double Strength { get; }
}
}

View File

@@ -1,73 +1,85 @@
using LoaderCalculator.Data.Materials; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings; using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperLogics.Models.Materials; using LCM = LoaderCalculator.Data.Materials;
using System; using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.Materials namespace StructureHelperLogics.Models.Materials
{ {
public class LibMaterial : ILibMaterial public class LibMaterial : ILibMaterial
{ {
private LCMB.IMaterialOptions materialOptions;
public MaterialTypes MaterialType { get; set; } public MaterialTypes MaterialType { get; set; }
public CodeTypes CodeType { get; set; } private CodeTypes codeType;
private LimitStates limitState;
private CalcTerms calcTerm;
public string Name { get; set; } public string Name { get; set; }
public double MainStrength { get; set; } public double MainStrength { get; set; }
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength) public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
{ {
MaterialType = materialType; this.MaterialType = materialType;
CodeType = codeType; this.codeType = codeType;
Name = name; Name = name;
MainStrength = mainStrength; MainStrength = mainStrength;
} }
public IPrimitiveMaterial GetPrimitiveMaterial() public LCM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
{ {
if (MaterialType == MaterialTypes.Concrete & CodeType == CodeTypes.EuroCode_2_1990) this.limitState = limitState;
{ return GetConcreteEurocode();} this.calcTerm = calcTerm;
else if (MaterialType == MaterialTypes.Reinforcement & CodeType == CodeTypes.EuroCode_2_1990) if (MaterialType == MaterialTypes.Concrete)
{ return GetReinfrocementeEurocode();} { return GetConcrete();}
if (MaterialType == MaterialTypes.Concrete & CodeType == CodeTypes.SP63_13330_2018) else if (MaterialType == MaterialTypes.Reinforcement)
{ return GetConcreteSP63(); } { return GetReinfrocemente();}
else if (MaterialType == MaterialTypes.Reinforcement & CodeType == CodeTypes.SP63_13330_2018) else throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown}: material type = {MaterialType}, code type = {codeType}");
{ return GetReinfrocementeSP63(); }
else throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown}: material type = {MaterialType}, code type = {CodeType}");
} }
private IPrimitiveMaterial GetReinfrocementeSP63()
private LCM.IMaterial GetReinfrocemente()
{ {
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial materialOptions = new LCMB.ReinforcementOptions();
{ MaterialType = MaterialType, CodeType = CodeTypes.SP63_13330_2018, ClassName = $"Reinforcement {Name}", Strength = MainStrength }; SetMaterialOptions();
return primitiveMaterial; LCMB.IMaterialBuilder builder = new LCMB.ReinforcementBuilder(materialOptions);
LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder);
return director.BuildMaterial();
} }
private IPrimitiveMaterial GetConcreteSP63() private LCM.IMaterial GetConcrete()
{ {
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial materialOptions = new LCMB.ConcreteOptions();
{ MaterialType = MaterialType, CodeType = CodeTypes.SP63_13330_2018, ClassName = $"Concrete {Name}", Strength = MainStrength }; SetMaterialOptions();
return primitiveMaterial; LCMB.IMaterialBuilder builder = new LCMB.ConcreteBuilder(materialOptions);
LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder);
return director.BuildMaterial();
} }
private IPrimitiveMaterial GetReinfrocementeEurocode() private void SetMaterialOptions()
{ {
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial materialOptions.Strength = MainStrength;
{ MaterialType = MaterialType, CodeType = CodeTypes.EuroCode_2_1990, ClassName = $"Reinforcement {Name}", Strength = MainStrength }; if (codeType == CodeTypes.EuroCode_2_1990)
return primitiveMaterial; {
} materialOptions.CodesType = LCMB.CodesType.EC2_1990;
}
private IPrimitiveMaterial GetConcreteEurocode() else if (codeType == CodeTypes.SP63_13330_2018)
{ {
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial materialOptions.CodesType = LCMB.CodesType.SP63_2018;
{ MaterialType = MaterialType, CodeType = CodeTypes.EuroCode_2_1990, ClassName = $"Concrete {Name}", Strength = MainStrength }; }
return primitiveMaterial; else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {codeType}"); }
if (limitState == LimitStates.Collapse) { materialOptions.LimitState = LCMB.LimitStates.Collapse; }
else if (limitState == LimitStates.ServiceAbility) { materialOptions.LimitState = LCMB.LimitStates.ServiceAbility; }
else if (limitState == LimitStates.Special) { materialOptions.LimitState = LCMB.LimitStates.Special; }
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
if (calcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
else if (calcTerm == CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
} }
public object Clone() public object Clone()
{ {
return new LibMaterial(this.MaterialType, this.CodeType, this.Name, this.MainStrength); return new LibMaterial(this.MaterialType, this.codeType, this.Name, this.MainStrength);
} }
} }
} }

View File

@@ -1,22 +0,0 @@
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using System;
namespace StructureHelperLogics.Models.Materials
{
public class PrimitiveMaterial : IPrimitiveMaterial
{
public string Id { get; }
public MaterialTypes MaterialType { get; set; }
public CodeTypes CodeType { get; set; }
IHeadMaterial HeadMaterial { get; set; }
public string ClassName { get; set; }
public double Strength { get; set; }
public PrimitiveMaterial()
{
Id = Convert.ToString(Guid.NewGuid());
}
}
}

View File

@@ -1,5 +1,6 @@
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using StructureHelper.Models.Materials;
namespace StructureHelperLogics.Models.Primitives namespace StructureHelperLogics.Models.Primitives
{ {
@@ -7,7 +8,7 @@ namespace StructureHelperLogics.Models.Primitives
{ {
ICenter Center { get; set; } ICenter Center { get; set; }
IShape Shape { get; set; } IShape Shape { get; set; }
IPrimitiveMaterial PrimitiveMaterial {get;set;} IHeadMaterial HeadMaterial { get; }
double NdmMaxSize { get; set; } double NdmMaxSize { get; set; }
int NdmMinDivision { get; set; } int NdmMinDivision { get; set; }
double PrestrainKx { get; set; } double PrestrainKx { get; set; }

View File

@@ -1,17 +1,25 @@
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using StructureHelper.Models.Materials;
namespace StructureHelperLogics.Models.Primitives namespace StructureHelperLogics.Models.Primitives
{ {
public class NdmPrimitive : INdmPrimitive public class NdmPrimitive : INdmPrimitive
{ {
private IHeadMaterial headMaterial;
public ICenter Center { get; set; } public ICenter Center { get; set; }
public IShape Shape { get; set; } public IShape Shape { get; set; }
public IPrimitiveMaterial PrimitiveMaterial { get; set; } public IHeadMaterial HeadMaterial { get => headMaterial; }
public double NdmMaxSize { get; set; } public double NdmMaxSize { get; set; }
public int NdmMinDivision { get; set; } public int NdmMinDivision { get; set; }
public double PrestrainKx { get; set; } public double PrestrainKx { get; set; }
public double PrestrainKy { get; set; } public double PrestrainKy { get; set; }
public double PrestrainEpsZ { get; set; } public double PrestrainEpsZ { get; set; }
public NdmPrimitive(IHeadMaterial material)
{
headMaterial = material;
}
} }
} }

View File

@@ -1,4 +1,4 @@
using StructureHelperLogics.Infrastructures.CommonEnums; using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperLogics.NdmCalculations.Triangulations namespace StructureHelperLogics.NdmCalculations.Triangulations
{ {

View File

@@ -9,6 +9,7 @@ using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Primitives; using StructureHelperLogics.Models.Primitives;
using StructureHelper.Models.Materials;
namespace StructureHelperLogics.NdmCalculations.Triangulations namespace StructureHelperLogics.NdmCalculations.Triangulations
{ {
@@ -17,13 +18,13 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public static IEnumerable<INdm> GetNdms(IEnumerable<INdmPrimitive> ndmPrimitives, ITriangulationOptions options) public static IEnumerable<INdm> GetNdms(IEnumerable<INdmPrimitive> ndmPrimitives, ITriangulationOptions options)
{ {
List<INdm> ndms = new List<INdm>(); List<INdm> ndms = new List<INdm>();
Dictionary<string, IPrimitiveMaterial> primitiveMaterials = GetPrimitiveMaterials(ndmPrimitives); var headMaterials = GetPrimitiveMaterials(ndmPrimitives);
Dictionary<string, IMaterial> materials = GetMaterials(primitiveMaterials, options); Dictionary<string, IMaterial> materials = GetMaterials(headMaterials, options);
foreach (var ndmPrimitive in ndmPrimitives) foreach (var ndmPrimitive in ndmPrimitives)
{ {
IPrimitiveMaterial primitiveMaterial = ndmPrimitive.PrimitiveMaterial; IHeadMaterial headMaterial = ndmPrimitive.HeadMaterial;
IMaterial material; IMaterial material;
if (materials.TryGetValue(primitiveMaterial.Id, out material) == false) { throw new Exception("Material dictionary is not valid"); } if (materials.TryGetValue(headMaterial.Id, out material) == false) { throw new Exception("Material dictionary is not valid"); }
IEnumerable<INdm> localNdms = GetNdmsByPrimitive(ndmPrimitive, material); IEnumerable<INdm> localNdms = GetNdmsByPrimitive(ndmPrimitive, material);
ndms.AddRange(localNdms); ndms.AddRange(localNdms);
} }
@@ -34,15 +35,15 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
/// </summary> /// </summary>
/// <param name="ndmPrimitives"></param> /// <param name="ndmPrimitives"></param>
/// <returns></returns> /// <returns></returns>
private static Dictionary<string, IPrimitiveMaterial> GetPrimitiveMaterials(IEnumerable<INdmPrimitive> ndmPrimitives) private static Dictionary<string, IHeadMaterial> GetPrimitiveMaterials(IEnumerable<INdmPrimitive> ndmPrimitives)
{ {
Dictionary<string, IPrimitiveMaterial> primitiveMaterials = new Dictionary<string, IPrimitiveMaterial>(); Dictionary<string, IHeadMaterial> headMaterials = new Dictionary<string, IHeadMaterial>();
foreach (var ndmPrimitive in ndmPrimitives) foreach (var ndmPrimitive in ndmPrimitives)
{ {
IPrimitiveMaterial material = ndmPrimitive.PrimitiveMaterial; IHeadMaterial material = ndmPrimitive.HeadMaterial;
if (!primitiveMaterials.ContainsKey(material.Id)) { primitiveMaterials.Add(material.Id, material); } if (!headMaterials.ContainsKey(material.Id)) { headMaterials.Add(material.Id, material); }
} }
return primitiveMaterials; return headMaterials;
} }
/// <summary> /// <summary>
/// Return dictionary of ndm-materials by dictionary of primirive materials /// Return dictionary of ndm-materials by dictionary of primirive materials
@@ -51,16 +52,16 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
/// <param name="options"></param> /// <param name="options"></param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="StructureHelperException"></exception> /// <exception cref="StructureHelperException"></exception>
private static Dictionary<string, IMaterial> GetMaterials(Dictionary<string, IPrimitiveMaterial> PrimitiveMaterials, ITriangulationOptions options) private static Dictionary<string, IMaterial> GetMaterials(Dictionary<string, IHeadMaterial> PrimitiveMaterials, ITriangulationOptions options)
{ {
Dictionary<string, IMaterial> materials = new Dictionary<string, IMaterial>(); Dictionary<string, IMaterial> materials = new Dictionary<string, IMaterial>();
IEnumerable<string> keyCollection = PrimitiveMaterials.Keys; IEnumerable<string> keyCollection = PrimitiveMaterials.Keys;
IMaterial material; IMaterial material;
foreach (string id in keyCollection) foreach (string id in keyCollection)
{ {
IPrimitiveMaterial primitiveMaterial; IHeadMaterial headMaterial;
if (PrimitiveMaterials.TryGetValue(id, out primitiveMaterial) == false) { throw new StructureHelperException("Material dictionary is not valid"); } if (PrimitiveMaterials.TryGetValue(id, out headMaterial) == false) { throw new StructureHelperException("Material dictionary is not valid"); }
material = GetMaterial(primitiveMaterial, options); material = headMaterial.GetLoaderMaterial(options.LimiteState, options.CalcTerm);
materials.Add(id, material); materials.Add(id, material);
} }
return materials; return materials;
@@ -87,53 +88,49 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); } else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
return ndms; return ndms;
} }
//private static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
private static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) //{
{ // IMaterial material;
IMaterial material; // if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); }
if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); } // else if (primitiveMaterial.MaterialType == MaterialTypes.Reinforcement) { material = GetReinforcementMaterial(primitiveMaterial, options); }
else if (primitiveMaterial.MaterialType == MaterialTypes.Reinforcement) { material = GetReinforcementMaterial(primitiveMaterial, options); } // else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); }
else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); } // return material;
return material; //}
} //private static IMaterial GetConcreteMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
//{
private static IMaterial GetConcreteMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) // IMaterialOptions materialOptions = new ConcreteOptions();
{ // SetMaterialOptions(materialOptions, primitiveMaterial, options);
IMaterialOptions materialOptions = new ConcreteOptions(); // IMaterialBuilder builder = new ConcreteBuilder(materialOptions);
SetMaterialOptions(materialOptions, primitiveMaterial, options); // IBuilderDirector director = new BuilderDirector(builder);
IMaterialBuilder builder = new ConcreteBuilder(materialOptions); // return director.BuildMaterial();
IBuilderDirector director = new BuilderDirector(builder); //}
return director.BuildMaterial(); //private static IMaterial GetReinforcementMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
} //{
// IMaterialOptions materialOptions = new ReinforcementOptions();
private static IMaterial GetReinforcementMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) // SetMaterialOptions(materialOptions, primitiveMaterial, options);
{ // IMaterialBuilder builder = new ReinforcementBuilder(materialOptions);
IMaterialOptions materialOptions = new ReinforcementOptions(); // IBuilderDirector director = new BuilderDirector(builder);
SetMaterialOptions(materialOptions, primitiveMaterial, options); // return director.BuildMaterial();
IMaterialBuilder builder = new ReinforcementBuilder(materialOptions); //}
IBuilderDirector director = new BuilderDirector(builder); //private static void SetMaterialOptions(IMaterialOptions materialOptions, IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
return director.BuildMaterial(); //{
} // materialOptions.Strength = primitiveMaterial.Strength;
// if (primitiveMaterial.CodeType == CodeTypes.EuroCode_2_1990)
private static void SetMaterialOptions(IMaterialOptions materialOptions, IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) // {
{ // materialOptions.CodesType = CodesType.EC2_1990;
materialOptions.Strength = primitiveMaterial.Strength; // }
if (primitiveMaterial.CodeType == CodeTypes.EuroCode_2_1990) // else if (primitiveMaterial.CodeType == CodeTypes.SP63_13330_2018)
{ // {
materialOptions.CodesType = CodesType.EC2_1990; // materialOptions.CodesType = CodesType.SP63_2018;
} // }
else if (primitiveMaterial.CodeType == CodeTypes.SP63_13330_2018) // else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {primitiveMaterial.CodeType}"); }
{ // if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Collapse) { materialOptions.LimitState = LimitStates.Collapse; }
materialOptions.CodesType = CodesType.SP63_2018; // else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.ServiceAbility) { materialOptions.LimitState = LimitStates.ServiceAbility; }
} // else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Special) { materialOptions.LimitState = LimitStates.Special; }
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {primitiveMaterial.CodeType}"); } // else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Collapse) { materialOptions.LimitState = LimitStates.Collapse; } // if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.ServiceAbility) { materialOptions.LimitState = LimitStates.ServiceAbility; } // else if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Special) { materialOptions.LimitState = LimitStates.Special; } // else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); } //}
if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
else if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
}
} }
} }

View File

@@ -1,4 +1,4 @@
using StructureHelperLogics.Infrastructures.CommonEnums; using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperLogics.NdmCalculations.Triangulations namespace StructureHelperLogics.NdmCalculations.Triangulations
{ {

View File

@@ -5,11 +5,11 @@ using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.SourceData; using LoaderCalculator.Data.SourceData;
using StructureHelperLogics.NdmCalculations.Triangulations; using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Infrastructures.CommonEnums;
using StructureHelperLogics.Models.Calculations.CalculationsResults; using StructureHelperLogics.Models.Calculations.CalculationsResults;
using StructureHelperLogics.Models.Calculations.CalculationProperties; using StructureHelperLogics.Models.Calculations.CalculationProperties;
using System; using System;
using StructureHelperLogics.Models.Primitives; using StructureHelperLogics.Models.Primitives;
using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperLogics.Services namespace StructureHelperLogics.Services
{ {

View File

@@ -17,4 +17,8 @@
<Reference Include="System.Windows" /> <Reference Include="System.Windows" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Infrastructures\" />
</ItemGroup>
</Project> </Project>

View File

@@ -1,18 +1,7 @@
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies; using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
using StructureHelperLogics.Infrastructures.CommonEnums; using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow namespace StructureHelper.Windows.CalculationWindows.CalculationPropertyWindow
{ {

View File

@@ -9,7 +9,6 @@ using StructureHelper.Services.Primitives;
using StructureHelper.UnitSystem; using StructureHelper.UnitSystem;
using StructureHelper.UnitSystem.Systems; using StructureHelper.UnitSystem.Systems;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Infrastructures.CommonEnums;
using StructureHelperLogics.Models.Calculations.CalculationProperties; using StructureHelperLogics.Models.Calculations.CalculationProperties;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Models.Materials.Factories; using StructureHelperLogics.Models.Materials.Factories;

View File

@@ -1,5 +1,5 @@
using StructureHelper.Infrastructure; using StructureHelper.Infrastructure;
using StructureHelperLogics.Infrastructures.CommonEnums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Models.Calculations.CalculationProperties; using StructureHelperLogics.Models.Calculations.CalculationProperties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;