Восстановил проект Logic

This commit is contained in:
Evgeny Redikultsev
2022-06-20 18:44:24 +05:00
parent 0695dfb917
commit 068b865a89
13 changed files with 235 additions and 8 deletions

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
{
/// <inheritdoc />
public class Center : ICenter
{
/// <inheritdoc />
public double CenterX { get; set; }
/// <inheritdoc />
public double CenterY { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
{
/// <summary>
/// Interface for point of center of some shape
/// Интерфейс для точки центра некоторой формы
/// </summary>
public interface ICenter
{
/// <summary>
/// Coordinate of center of rectangle by local axis X, m
/// Координата центра вдоль локальной оси X, м
/// </summary>
double CenterX { get;}
/// <summary>
/// Coordinate of center of rectangle by local axis Y, m
/// Координата центра вдоль локальной оси Y, м
/// </summary>
double CenterY { get;}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
{
public interface IRectangle
{
/// <summary>
/// Width of rectangle, m
/// </summary>
double Width { get; }
/// <summary>
/// Height of rectangle, m
/// </summary>
double Height { get; }
/// <summary>
/// Angle of rotating rectangle, rad
/// </summary>
double Angle { get; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Data.Shapes
{
/// <inheritdoc />
public class Rectangle : IRectangle
{
/// <inheritdoc />
public double Width { get; set; }
/// <inheritdoc />
public double Height { get; set; }
/// <inheritdoc />
public double Angle { get; set; }
}
}

View File

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

View File

@@ -0,0 +1,31 @@
using StructureHelperLogics.Data.Shapes;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
/// <summary>
/// Parameter of triangulation of rectangle part of section
/// Параметры триангуляции прямоугольного участка сечения
/// </summary>
public interface IRectangleTriangulationOptions : ITriangulationLogicOptions
{
/// <summary>
///
/// </summary>
ICenter Center { get; }
/// <summary>
///
/// </summary>
IRectangle Rectangle { get; }
/// <summary>
/// Maximum size (width or height) of ndm part after triangulation
/// </summary>
double NdmMaxSize { get; }
/// <summary>
/// Minimum quantity of division of side of rectangle after triangulation
/// </summary>
int NdmMinDivision { get; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.Materials;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
public interface ITriangulationLogic
{
ITriangulationLogicOptions Options { get; }
IEnumerable<INdm> GetNdmCollection(IMaterial material);
void ValidateOptions(ITriangulationLogicOptions options);
}
}

View File

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

View File

@@ -0,0 +1,42 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Ndms;
using System;
using System.Collections.Generic;
using System.Text;
using LoaderCalculator.Data.Ndms.Transformations;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
public class RectangleTriangulationLogic : IRectangleTriangulationLogic
{
public ITriangulationLogicOptions Options { get; }
public IEnumerable<INdm> GetNdmCollection(IMaterial material)
{
IRectangleTriangulationOptions rectangleOptions = Options as IRectangleTriangulationOptions;
double width = rectangleOptions.Rectangle.Width;
double height = rectangleOptions.Rectangle.Height;
double ndmMaxSize = rectangleOptions.NdmMaxSize;
int ndmMinDivision = rectangleOptions.NdmMinDivision;
LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions logicOptions = new LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions(width, height, ndmMaxSize, ndmMinDivision);
var logic = LoaderCalculator.Triangulations.Triangulation.GetLogicInstance(logicOptions);
var ndmCollection = logic.GetNdmCollection(new LoaderCalculator.Data.Planes.RectangularPlane { Material = material });
double dX = rectangleOptions.Center.CenterX;
double dY = rectangleOptions.Center.CenterY;
NdmTransform.Move(ndmCollection, dX, dY);
double angle = rectangleOptions.Rectangle.Angle;
NdmTransform.Rotate(ndmCollection, angle);
return ndmCollection;
}
public void ValidateOptions(ITriangulationLogicOptions options)
{
throw new NotImplementedException();
}
public RectangleTriangulationLogic(ITriangulationLogicOptions options)
{
Options = options;
}
}
}

View File

@@ -0,0 +1,28 @@
using StructureHelperLogics.Data.Shapes;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
/// <inheritdoc />
public class RectangleTriangulationOptions : IRectangleTriangulationOptions
{
/// <inheritdoc />
public ICenter Center { get; }
/// <inheritdoc />
public IRectangle Rectangle { get; }
/// <inheritdoc />
public double NdmMaxSize { get; }
/// <inheritdoc />
public int NdmMinDivision { get; }
public RectangleTriangulationOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision)
{
Center = center;
Rectangle = rectangle;
NdmMaxSize = ndmMaxSize;
NdmMinDivision = ndmMinDivision;
}
}
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="LoaderCalculator">
<HintPath>..\..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
</Reference>
</ItemGroup>
</Project>