RemoveUnderlying property for primitives was added
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user