Рефакторинг, добавление моделей примитивов

This commit is contained in:
NickAppLab
2022-07-19 00:01:22 +05:00
parent 02f53bea5c
commit ac40c10bb7
45 changed files with 123 additions and 205 deletions

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
namespace StructureHelperLogics.Data.Shapes
{
/// <inheritdoc />
public class Center : ICenter

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
namespace StructureHelperLogics.Data.Shapes
{
/// <summary>
/// Interface for point of center of some shape

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
namespace StructureHelperLogics.Data.Shapes
{
public interface ICenterShape
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
namespace StructureHelperLogics.Data.Shapes
{
public interface ICircle : IShape
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
namespace StructureHelperLogics.Data.Shapes
{
public interface IPoint : IShape
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
namespace StructureHelperLogics.Data.Shapes
{
public interface IRectangle : IShape
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
namespace StructureHelperLogics.Data.Shapes
{
public interface IShape
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
namespace StructureHelperLogics.Data.Shapes
{
public class Point : IPoint
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
namespace StructureHelperLogics.Data.Shapes
{
/// <inheritdoc />
public class Rectangle : IRectangle

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Infrastructures.CommonEnums
namespace StructureHelperLogics.Infrastructures.CommonEnums
{
public enum CalcTerms
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Infrastructures.CommonEnums
namespace StructureHelperLogics.Infrastructures.CommonEnums
{
public enum LimitStates
{

View File

@@ -1,15 +1,10 @@
using StructureHelperLogics.Data.Shapes;
using StructureHelperLogics.NdmCalculations.Entities;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.NdmPrimitives
{
public interface IPrimitive
public interface IPrimitive : ICenterShape
{
ICenter Center { get;}
IShape Shape { get;}
INdmPrimitive GetNdmPrimitive();
}
}

View File

@@ -1,39 +1,19 @@
using StructureHelperLogics.Data.Shapes;
using StructureHelperLogics.NdmCalculations.Entities;
using StructureHelperLogics.NdmCalculations.Materials;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.NdmPrimitives
{
public class PointPrimitive : IPrimitive
public class PointPrimitive : PrimitiveBase<IPoint>, IPoint
{
ICenter _center;
IShape _shape;
public ICenter Center => _center;
public IShape Shape => _shape;
public double Area
{
get
{
IPoint point = _shape as IPoint;
return point.Area;
}
set
{
IPoint point = _shape as IPoint;
point.Area = value;
}
get => _shape.Area;
set => _shape.Area = value;
}
public PointPrimitive(ICenter center, IShape shape)
{
_center = center;
_shape = shape;
}
public INdmPrimitive GetNdmPrimitive()
public PointPrimitive(ICenter center, IPoint shape) : base(center, shape) { }
public override INdmPrimitive GetNdmPrimitive()
{
double strength = 400;
string materialName = "s400";

View File

@@ -0,0 +1,22 @@
using StructureHelperLogics.Data.Shapes;
using StructureHelperLogics.NdmCalculations.Entities;
namespace StructureHelperLogics.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;
public PrimitiveBase(ICenter center, T shape)
{
_center = center;
_shape = shape;
}
public abstract INdmPrimitive GetNdmPrimitive();
}
}

View File

@@ -0,0 +1,31 @@
using StructureHelperLogics.Data.Shapes;
using StructureHelperLogics.NdmCalculations.Entities;
using StructureHelperLogics.NdmCalculations.Materials;
namespace StructureHelperLogics.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 = 400;
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;
}
}
}

View File

@@ -1,8 +1,5 @@
using StructureHelperLogics.Data.Shapes;
using StructureHelperLogics.NdmCalculations.Materials;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Entities
{

View File

@@ -1,8 +1,5 @@
using StructureHelperLogics.Data.Shapes;
using StructureHelperLogics.NdmCalculations.Materials;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Entities
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Materials
namespace StructureHelperLogics.NdmCalculations.Materials
{
public interface IPrimitiveMaterial
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Materials
namespace StructureHelperLogics.NdmCalculations.Materials
{
public enum MaterialTypes
{

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Materials
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
interface IPointTriangulationLogic : ITriangulationLogic
{

View File

@@ -1,7 +1,4 @@
using StructureHelperLogics.Data.Shapes;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
public interface IRectangleTriangulationLogic : ITriangulationLogic
{

View File

@@ -1,7 +1,4 @@
using StructureHelperLogics.Data.Shapes;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.Materials;

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
public interface ITriangulationLogicOptions
{

View File

@@ -1,7 +1,4 @@
using StructureHelperLogics.Infrastructures.CommonEnums;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{

View File

@@ -3,7 +3,6 @@ using LoaderCalculator.Data.Ndms;
using StructureHelperLogics.Data.Shapes;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{

View File

@@ -1,7 +1,4 @@
using StructureHelperLogics.Data.Shapes;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{

View File

@@ -2,7 +2,6 @@
using LoaderCalculator.Data.Ndms;
using System;
using System.Collections.Generic;
using System.Text;
using LoaderCalculator.Data.Ndms.Transformations;
namespace StructureHelperLogics.NdmCalculations.Triangulations

View File

@@ -1,8 +1,6 @@
using StructureHelperLogics.Data.Shapes;
using StructureHelperLogics.NdmCalculations.Entities;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using LoaderCalculator.Data.Ndms;

View File

@@ -1,7 +1,4 @@
using StructureHelperLogics.Infrastructures.CommonEnums;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{