RemoveUnderlying property for primitives was added

This commit is contained in:
Evgeny Redikultsev
2023-03-05 19:50:24 +05:00
parent b29d7bfd58
commit edb8afe321
41 changed files with 693 additions and 160 deletions

View File

@@ -142,7 +142,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
private string CheckInputData()
{
string result = "";
if (Primitives.Count == 0) { result += "Calculator does not contain any primitives \n"; }
NdmPrimitivesService.CheckPrimitives(Primitives);
if (ForceCombinationLists.Count == 0) { result += "Calculator does not contain any forces \n"; }
if (LimitStatesList.Count == 0) { result += "Calculator does not contain any limit states \n"; }
if (CalcTermsList.Count == 0) { result += "Calculator does not contain any duration \n"; }

View File

@@ -1,22 +1,14 @@
using LoaderCalculator.Data.Materials.MaterialBuilders;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Logics;
using LoaderCalculator.Logics.Geometry;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Analyses;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling
{

View File

@@ -2,6 +2,7 @@
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ShapeServices;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
@@ -20,16 +21,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public double CenterX { get; set; }
public double CenterY { get; set; }
public IHeadMaterial? HeadMaterial { get; set; }
public IStrainTuple UsersPrestrain { get; }
public IStrainTuple AutoPrestrain { get; }
public IVisualProperty VisualProperty { get; }
public double Diameter { get; set; }
public double NdmMaxSize { get; set; }
public int NdmMinDivision { get; set; }
public bool ClearUnderlying { get; set; }
public bool Triangulate { get; set; }
public CirclePrimitive()
{
@@ -39,11 +38,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
VisualProperty = new VisualProperty { Opacity = 0.8d };
UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
ClearUnderlying = false;
Triangulate = true;
}
public object Clone()
{
var primitive = new CirclePrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
ShapeService.CopyCircleProperties(this, primitive);
return primitive;
@@ -62,5 +64,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
{
throw new NotImplementedException();
}
public bool IsPointInside(IPoint2D point)
{
var dX = CenterX - point.X;
var dY = CenterY - point.Y;
var distance = Math.Sqrt(dX * dX + dY * dY);
if (distance > Diameter / 2) { return false; }
return true;
}
}
}

View File

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface ICirclePrimitive : IHasDivisionSize, ICircleShape
public interface ICirclePrimitive : INdmPrimitive, IHasDivisionSize, ICircleShape
{
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperLogics.Models.Primitives;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,9 +8,28 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface IHasDivisionSize : INdmPrimitive
/// <summary>
/// Include parameters of triangulation for shapes
/// </summary>
public interface IHasDivisionSize
{
/// <summary>
/// Maximum size of Ndm part
/// </summary>
double NdmMaxSize { get; set; }
/// <summary>
/// Mimimum division for sides of shape
/// </summary>
int NdmMinDivision { get; set; }
/// <summary>
/// Flag of removing ndm part which located inside shape
/// </summary>
bool ClearUnderlying { get; set; }
/// <summary>
/// Shows if point is located inside shape
/// </summary>
/// <param name=""></param>
/// <returns></returns>
bool IsPointInside(IPoint2D point);
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface IHasSorroundingPrimitive
{
INdmPrimitive SorroundingPrimitive { get; set; }
}
}

View File

@@ -13,15 +13,16 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface INdmPrimitive : ISaveable, ICloneable
{
string Name { get; set; }
string? Name { get; set; }
double CenterX { get; set; }
double CenterY { get; set; }
IHeadMaterial? HeadMaterial { get; set; }
/// <summary>
/// Flag of triangulation
/// </summary>
bool Triangulate { get; set; }
IStrainTuple UsersPrestrain { get; }
IStrainTuple AutoPrestrain { get; }
//double PrestrainKx { get; set; }
//double PrestrainKy { get; set; }
//double PrestrainEpsZ { get; set; }
IVisualProperty VisualProperty {get; }
IEnumerable<INdm> GetNdms(IMaterial material);

View File

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface IRectanglePrimitive : IHasDivisionSize, IRectangleShape
public interface IRectanglePrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
{
}
}

View File

@@ -38,6 +38,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public IStrainTuple AutoPrestrain => throw new NotImplementedException();
public bool ClearUnderlying { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public bool Triangulate { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public LinePrimitive()
{
StartPoint = new Point2D();
@@ -65,5 +68,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
{
throw new NotImplementedException();
}
public bool IsPointInside(IPoint2D point)
{
throw new NotImplementedException();
}
}
}

View File

@@ -16,7 +16,7 @@ namespace StructureHelperLogics.Models.Primitives
public class PointPrimitive : IPointPrimitive
{
public int Id { get; set; }
public string Name { get; set; }
public string? Name { get; set; }
public double CenterX { get; set; }
public double CenterY { get; set; }
public IHeadMaterial HeadMaterial { get; set; }
@@ -27,8 +27,7 @@ namespace StructureHelperLogics.Models.Primitives
public double Area { get; set; }
public IVisualProperty VisualProperty { get; }
public bool Triangulate { get; set; }
public PointPrimitive()
{
@@ -37,6 +36,7 @@ namespace StructureHelperLogics.Models.Primitives
VisualProperty = new VisualProperty();
UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
Triangulate = true;
}
public PointPrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }

View File

@@ -30,9 +30,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public double Width { get; set; }
public double Height { get; set; }
public double Angle { get; set; }
public bool ClearUnderlying { get; set; }
public bool Triangulate { get; set; }
public IVisualProperty VisualProperty { get; }
public RectanglePrimitive()
{
Name = "New Rectangle";
@@ -41,6 +43,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
VisualProperty = new VisualProperty { Opacity = 0.8d};
UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
ClearUnderlying = false;
Triangulate = true;
}
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
@@ -48,6 +52,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public object Clone()
{
var primitive = new RectanglePrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
ShapeService.CopyRectangleProperties(this, primitive);
return primitive;
@@ -66,5 +71,19 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
{
throw new NotImplementedException();
}
public bool IsPointInside(IPoint2D point)
{
var xMax = CenterX + Width / 2;
var xMin = CenterX - Width / 2;
var yMax = CenterY + Height / 2;
var yMin = CenterY - Height / 2;
if (point.X > xMax ||
point.X < xMin ||
point.Y > yMax ||
point.Y < yMin)
{ return false; }
return true;
}
}
}

View File

@@ -0,0 +1,71 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Ndms;
using StructureHelper.Models.Materials;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Media3D;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
/// <inheritdoc/>
public class ReinforcementPrimitive : IPointPrimitive, IHasSorroundingPrimitive
{
/// <inheritdoc/>
public string Name { get; set; }
/// <inheritdoc/>
public double CenterX { get; set; }
/// <inheritdoc/>
public double CenterY { get; set; }
/// <inheritdoc/>
public IHeadMaterial? HeadMaterial { get; set; }
public bool Triangulate { get; set; }
public IStrainTuple UsersPrestrain { get; private set; }
public IStrainTuple AutoPrestrain { get; private set; }
public IVisualProperty VisualProperty { get; private set; }
public int Id { get; set; }
public double Area { get; set; }
public INdmPrimitive SorroundingPrimitive { get; set; }
public ReinforcementPrimitive()
{
Name = "New Reinforcement";
Area = 0.0005d;
VisualProperty = new VisualProperty();
UsersPrestrain = new StrainTuple();
AutoPrestrain = new StrainTuple();
Triangulate = true;
}
public object Clone()
{
var primitive = new ReinforcementPrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
primitive.Area = Area;
primitive.SorroundingPrimitive = this.SorroundingPrimitive;
return primitive;
}
public IEnumerable<INdm> GetNdms(IMaterial material)
{
var options = new PointTriangulationLogicOptions(this);
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
return logic.GetNdmCollection(material);
}
public void Save()
{
throw new NotImplementedException();
}
}
}

View File

@@ -71,23 +71,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
private static IEnumerable<INdm> GetNdmsByPrimitive(INdmPrimitive primitive, IMaterial material)
{
List<INdm> ndms = new List<INdm>();
//ITriangulationLogicOptions options;
//ICenter center = primitive.Center;
//IShape shape = primitive.Shape;
ndms.AddRange(primitive.GetNdms(material));
//if (shape is IRectangleShape)
//{
// options = new RectangleTriangulationLogicOptions(primitive);
// ITriangulationLogic logic = new RectangleTriangulationLogic(options);
// ndms.AddRange(logic.GetNdmCollection(material));
//}
//else if (shape is IPoint)
//{
// options = new PointTriangulationLogicOptions(primitive);
// IPointTriangulationLogic logic = new PointTriangulationLogic(options);
// ndms.AddRange(logic.GetNdmCollection(material));
//}
//else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
return ndms;
}
}