Добавлены сервисы CalculationService, PrimitiveService, Common-сборка с типами
Необходимо реализовать в дальнейшем GetInnerPoints в PrimitiveService
This commit is contained in:
10
StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs
Normal file
10
StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.NdmPrimitives
|
||||
{
|
||||
public interface IPrimitive : ICenterShape
|
||||
{
|
||||
INdmPrimitive GetNdmPrimitive();
|
||||
}
|
||||
}
|
||||
30
StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
Normal file
30
StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.NdmPrimitives
|
||||
{
|
||||
public class PointPrimitive : PrimitiveBase<IPoint>, IPoint
|
||||
{
|
||||
public double Area
|
||||
{
|
||||
get => _shape.Area;
|
||||
set => _shape.Area = value;
|
||||
}
|
||||
|
||||
public PointPrimitive(ICenter center, IPoint shape) : base(center, shape) { }
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
double strength = 400e6d;
|
||||
string materialName = "s400";
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
|
||||
private MaterialTypes GetMaterialTypes()
|
||||
{
|
||||
return MaterialTypes.Reinforcement;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs
Normal file
22
StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.NdmPrimitives
|
||||
{
|
||||
public abstract class PrimitiveBase<T> : IPrimitive where T : IShape
|
||||
{
|
||||
protected ICenter _center;
|
||||
protected T _shape;
|
||||
|
||||
public ICenter Center => _center;
|
||||
public IShape Shape => _shape;
|
||||
|
||||
protected PrimitiveBase(ICenter center, T shape)
|
||||
{
|
||||
_center = center;
|
||||
_shape = shape;
|
||||
}
|
||||
|
||||
public abstract INdmPrimitive GetNdmPrimitive();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperCommon.Models.NdmPrimitives
|
||||
{
|
||||
public class RectanglePrimitive : PrimitiveBase<IRectangle>, IRectangle
|
||||
{
|
||||
public RectanglePrimitive(ICenter center, IRectangle shape) : base(center, shape) { }
|
||||
|
||||
public double Width => _shape.Width;
|
||||
|
||||
public double Height => _shape.Height;
|
||||
|
||||
public double Angle => _shape.Angle;
|
||||
|
||||
public override INdmPrimitive GetNdmPrimitive()
|
||||
{
|
||||
double strength = 40e6d;
|
||||
string materialName = "C40/45";
|
||||
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ;
|
||||
INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||
return ndmPrimitive;
|
||||
}
|
||||
|
||||
private MaterialTypes GetMaterialTypes()
|
||||
{
|
||||
return MaterialTypes.Concrete;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user