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

@@ -2,6 +2,7 @@
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
@@ -29,13 +30,10 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
Area = area;
}
public PointTriangulationLogicOptions(INdmPrimitive primitive)
public PointTriangulationLogicOptions(IPointPrimitive primitive)
{
if (!(primitive.Shape is IPoint)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
Center = primitive.Center;
IPoint point = primitive.Shape as IPoint;
Center = primitive.Center;
Area = point.Area;
Center = new Center() { X = primitive.CenterX, Y = primitive.CenterY };
Area = primitive.Area;
PrestrainKx = primitive.PrestrainKx;
PrestrainKy = primitive.PrestrainKy;
PrestrainEpsZ = primitive.PrestrainEpsZ;

View File

@@ -33,16 +33,12 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
NdmMinDivision = ndmMinDivision;
}
public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
{
if (! (primitive.Shape is IRectangleShape)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
Center = primitive.Center;
Rectangle = primitive.Shape as IRectangleShape;
if (primitive is IHasDivisionSize)
{
NdmMaxSize = (primitive as IHasDivisionSize).NdmMaxSize;
NdmMinDivision = (primitive as IHasDivisionSize).NdmMinDivision;
}
Center = new Center() { X = primitive.CenterX, Y = primitive.CenterY };
Rectangle = primitive;
NdmMaxSize = primitive.NdmMaxSize;
NdmMinDivision = primitive.NdmMinDivision;
PrestrainKx = primitive.PrestrainKx;
PrestrainKy = primitive.PrestrainKy;
PrestrainEpsZ = primitive.PrestrainEpsZ;

View File

@@ -70,22 +70,23 @@ 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;
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)}"); }
//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;
}
}