View primitives was fixed

This commit is contained in:
Evgeny Redikultsev
2022-11-22 21:03:48 +05:00
parent b566373f16
commit f849ee024a
40 changed files with 689 additions and 601 deletions

View File

@@ -1,4 +1,5 @@
using System;
using StructureHelperLogics.Models.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
internal interface IHasDivisionSize
public interface IHasDivisionSize : INdmPrimitive
{
double NdmMaxSize { get; set; }
int NdmMinDivision { get; set; }

View File

@@ -0,0 +1,13 @@
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface ILinePrimitive : IHasDivisionSize, ILineShape
{
}
}

View File

@@ -5,14 +5,16 @@ using System.Collections;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.Materials;
using System.Collections.Generic;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
namespace StructureHelperLogics.Models.Primitives
{
public interface INdmPrimitive
public interface INdmPrimitive : ISaveable, ICloneable
{
string Name { get; set; }
ICenter Center { get; set; }
IShape Shape { get; set; }
double CenterX { get; set; }
double CenterY { get; set; }
IHeadMaterial HeadMaterial { get; set; }
double PrestrainKx { get; set; }
double PrestrainKy { get; set; }

View File

@@ -0,0 +1,14 @@
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface IPointPrimitive : INdmPrimitive, IPointShape
{
}
}

View File

@@ -0,0 +1,13 @@
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface IRectanglePrimitive : IHasDivisionSize, IRectangleShape
{
}
}

View File

@@ -14,13 +14,12 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public class LinePrimitive : INdmPrimitive, ILineShape, IHasDivisionSize, ISaveable, ICloneable
public class LinePrimitive : ILinePrimitive
{
public ICenter Center { get; set; }
public IShape Shape { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public double CenterX { get; set; }
public double CenterY { get; set; }
public double NdmMaxSize { get; set; }
public int NdmMinDivision { get; set; }
public IHeadMaterial HeadMaterial { get; set; }
@@ -31,6 +30,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public ICenter StartPoint { get; set; }
public ICenter EndPoint { get; set; }
public double Thickness { get; set; }
public LinePrimitive()
{
@@ -44,8 +44,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public object Clone()
{
LinePrimitive primitive = new LinePrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
var primitive = new LinePrimitive();
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
ShapeService.CopyLineProperties(this, primitive);
return primitive;

View File

@@ -6,42 +6,56 @@ using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
namespace StructureHelperLogics.Models.Primitives
{
public class NdmPrimitive : INdmPrimitive, ISaveable, ICloneable
public class PointPrimitive : IPointPrimitive
{
public ICenter Center { get; set; }
public IShape Shape { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public IHeadMaterial HeadMaterial { get; private 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 PrestrainKx { get; set; }
public double PrestrainKy { get; set; }
public double PrestrainEpsZ { get; set; }
public double Area { get; set; }
public NdmPrimitive(IHeadMaterial material)
public PointPrimitive()
{
Name = "New Point";
Area = 0.0005d;
}
public PointPrimitive(IHeadMaterial material)
{
HeadMaterial = material;
}
public IEnumerable<INdm> GetNdms(IMaterial material)
{
throw new System.NotImplementedException();
var options = new PointTriangulationLogicOptions(this);
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
return logic.GetNdmCollection(material);
}
public void Save()
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}
public object Clone()
{
throw new NotImplementedException();
{
var primitive = new PointPrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
primitive.Area = Area;
return primitive;
}
}
}

View File

@@ -5,6 +5,7 @@ using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ShapeServices;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
@@ -14,27 +15,34 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
public class RectanglePrimitive : INdmPrimitive, IRectangleShape, IHasDivisionSize, ISaveable, ICloneable
public class RectanglePrimitive : IRectanglePrimitive
{
public int Id { get; set; }
public string Name { get; set; }
public ICenter Center { get; set; }
public IShape Shape { get; set; }
public double CenterX { get; set; }
public double CenterY { get; set; }
public IHeadMaterial HeadMaterial { get; set; }
public double PrestrainKx { get; set; }
public double PrestrainKy { get; set; }
public double PrestrainEpsZ { get; set; }
public double NdmMaxSize { get; set; }
public int NdmMinDivision { get; set; }
public int Id { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public double Angle { get; set; }
public RectanglePrimitive()
{
Name = "New Rectangle";
Width = 0.4d;
Height = 0.6d;
NdmMaxSize = 0.01d;
NdmMinDivision = 10;
}
public object Clone()
{
RectanglePrimitive primitive = new RectanglePrimitive();
NdmPrimitivesService.CopyNdmProperties(this, primitive);
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
ShapeService.CopyRectangleProperties(this, primitive);
return primitive;
@@ -42,7 +50,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
public IEnumerable<INdm> GetNdms(IMaterial material)
{
throw new NotImplementedException();
List<INdm> ndms = new List<INdm>();
var options = new RectangleTriangulationLogicOptions(this);
ITriangulationLogic logic = new RectangleTriangulationLogic(options);
ndms.AddRange(logic.GetNdmCollection(material));
return ndms;
}
public void Save()