Materials were refactored

This commit is contained in:
Evgeny Redikultsev
2023-06-18 12:22:29 +05:00
parent 5a9ced0870
commit 816c4a112b
50 changed files with 914 additions and 339 deletions

View File

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

View File

@@ -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)

View File

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

View File

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