RemoveUnderlying property for primitives was added
This commit is contained in:
@@ -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"; }
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface ICirclePrimitive : IHasDivisionSize, ICircleShape
|
||||
public interface ICirclePrimitive : INdmPrimitive, IHasDivisionSize, ICircleShape
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IRectanglePrimitive : IHasDivisionSize, IRectangleShape
|
||||
public interface IRectanglePrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
@@ -8,6 +11,7 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
@@ -32,24 +36,59 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
CopyVisualProperty(source.VisualProperty, target.VisualProperty);
|
||||
target.CenterX = source.CenterX;
|
||||
target.CenterY = source.CenterY;
|
||||
target.Triangulate = source.Triangulate;
|
||||
StrainTupleService.CopyProperties(source.UsersPrestrain, target.UsersPrestrain);
|
||||
}
|
||||
|
||||
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
|
||||
{
|
||||
CopyNdmProperties(source, target);
|
||||
target.NdmMaxSize = source.NdmMaxSize;
|
||||
target.NdmMinDivision = source.NdmMinDivision;
|
||||
target.ClearUnderlying = source.ClearUnderlying;
|
||||
}
|
||||
|
||||
public static List<INdm> GetNdms(IEnumerable<INdmPrimitive> primitives, LimitStates limitState, CalcTerms calcTerm)
|
||||
public static List<INdm> GetNdms(INdmPrimitive primitive, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
//Настройки триангуляции
|
||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = limitState, CalcTerm = calcTerm };
|
||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
||||
List<INdm> ndmCollection = new List<INdm>();
|
||||
ndmCollection.AddRange(Triangulation.GetNdms(primitives, options));
|
||||
var material = primitive.HeadMaterial.GetLoaderMaterial(limitState, calcTerm);
|
||||
ndmCollection.AddRange(primitive.GetNdms(material));
|
||||
return ndmCollection;
|
||||
}
|
||||
public static List<INdm> GetNdms(IEnumerable<INdmPrimitive> primitives, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
var orderedNdmPrimitives = primitives.OrderBy(x => x.VisualProperty.ZIndex);
|
||||
var ndms = new List<INdm>();
|
||||
foreach (var item in orderedNdmPrimitives)
|
||||
{
|
||||
if (item is IHasDivisionSize)
|
||||
{
|
||||
var hasDivision = item as IHasDivisionSize;
|
||||
if (hasDivision.ClearUnderlying == true)
|
||||
{
|
||||
ndms.RemoveAll(x => hasDivision.IsPointInside(new Point2D() { X = x.CenterX, Y = x.CenterY }) == true);
|
||||
}
|
||||
}
|
||||
if (item.Triangulate == true)
|
||||
{
|
||||
ndms.AddRange(GetNdms(item, limitState, calcTerm));
|
||||
}
|
||||
}
|
||||
return ndms;
|
||||
}
|
||||
|
||||
public static bool CheckPrimitives(IEnumerable<INdmPrimitive> primitives)
|
||||
{
|
||||
if (primitives.Count() == 0) { throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Count of primitive must be greater than zero"); }
|
||||
if (primitives.Count(x => x.Triangulate == true) == 0) { throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": There are not primitives to triangulate"); }
|
||||
foreach (var item in primitives)
|
||||
{
|
||||
if (item.Triangulate == true &
|
||||
item.HeadMaterial is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Primitive: {item.Name} can't be triangulated since material is null");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user