diff --git a/StructureHelper.sln b/StructureHelper.sln index f02c1d9..9807f81 100644 --- a/StructureHelper.sln +++ b/StructureHelper.sln @@ -7,10 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelper", "Structur EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperTests", "StructureHelperTests\StructureHelperTests.csproj", "{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}" ProjectSection(ProjectDependencies) = postProject - {23138426-7994-46A7-834D-08AFB9741A86} = {23138426-7994-46A7-834D-08AFB9741A86} + {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3} = {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperLogics", "..\StructureHelperLogics\StructureHelperLogics\StructureHelperLogics.csproj", "{23138426-7994-46A7-834D-08AFB9741A86}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -26,10 +26,10 @@ Global {7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Debug|Any CPU.Build.0 = Debug|Any CPU {7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Release|Any CPU.ActiveCfg = Release|Any CPU {7AC480BB-8A34-4913-B7AA-C6A5D7F35509}.Release|Any CPU.Build.0 = Release|Any CPU - {23138426-7994-46A7-834D-08AFB9741A86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {23138426-7994-46A7-834D-08AFB9741A86}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23138426-7994-46A7-834D-08AFB9741A86}.Release|Any CPU.ActiveCfg = Release|Any CPU - {23138426-7994-46A7-834D-08AFB9741A86}.Release|Any CPU.Build.0 = Release|Any CPU + {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/StructureHelperLogics/Data/Shapes/Center.cs b/StructureHelperLogics/Data/Shapes/Center.cs new file mode 100644 index 0000000..409230c --- /dev/null +++ b/StructureHelperLogics/Data/Shapes/Center.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Data.Shapes +{ + /// + public class Center : ICenter + { + /// + public double CenterX { get; set; } + /// + public double CenterY { get; set; } + } +} diff --git a/StructureHelperLogics/Data/Shapes/ICenter.cs b/StructureHelperLogics/Data/Shapes/ICenter.cs new file mode 100644 index 0000000..ec6d513 --- /dev/null +++ b/StructureHelperLogics/Data/Shapes/ICenter.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Data.Shapes +{ + /// + /// Interface for point of center of some shape + /// Интерфейс для точки центра некоторой формы + /// + public interface ICenter + { + /// + /// Coordinate of center of rectangle by local axis X, m + /// Координата центра вдоль локальной оси X, м + /// + double CenterX { get;} + /// + /// Coordinate of center of rectangle by local axis Y, m + /// Координата центра вдоль локальной оси Y, м + /// + double CenterY { get;} + } +} diff --git a/StructureHelperLogics/Data/Shapes/IRectangle.cs b/StructureHelperLogics/Data/Shapes/IRectangle.cs new file mode 100644 index 0000000..fa67bc9 --- /dev/null +++ b/StructureHelperLogics/Data/Shapes/IRectangle.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Data.Shapes +{ + public interface IRectangle + { + /// + /// Width of rectangle, m + /// + double Width { get; } + /// + /// Height of rectangle, m + /// + double Height { get; } + /// + /// Angle of rotating rectangle, rad + /// + double Angle { get; } + } +} diff --git a/StructureHelperLogics/Data/Shapes/Rectangle.cs b/StructureHelperLogics/Data/Shapes/Rectangle.cs new file mode 100644 index 0000000..05a9663 --- /dev/null +++ b/StructureHelperLogics/Data/Shapes/Rectangle.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Data.Shapes +{ + /// + public class Rectangle : IRectangle + { + /// + public double Width { get; set; } + /// + public double Height { get; set; } + /// + public double Angle { get; set; } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs new file mode 100644 index 0000000..e0dd3bd --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + public interface IRectangleTriangulationLogic : ITriangulationLogic + { + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationOptions.cs new file mode 100644 index 0000000..9f421c1 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationOptions.cs @@ -0,0 +1,31 @@ +using StructureHelperLogics.Data.Shapes; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + /// + /// Parameter of triangulation of rectangle part of section + /// Параметры триангуляции прямоугольного участка сечения + /// + public interface IRectangleTriangulationOptions : ITriangulationLogicOptions + { + /// + /// + /// + ICenter Center { get; } + /// + /// + /// + IRectangle Rectangle { get; } + /// + /// Maximum size (width or height) of ndm part after triangulation + /// + double NdmMaxSize { get; } + /// + /// Minimum quantity of division of side of rectangle after triangulation + /// + int NdmMinDivision { get; } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs new file mode 100644 index 0000000..15bba04 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs @@ -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 GetNdmCollection(IMaterial material); + void ValidateOptions(ITriangulationLogicOptions options); + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs new file mode 100644 index 0000000..e759866 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + public interface ITriangulationLogicOptions + { + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs new file mode 100644 index 0000000..8a2b0fc --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs @@ -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 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; + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs new file mode 100644 index 0000000..6aabf70 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs @@ -0,0 +1,28 @@ +using StructureHelperLogics.Data.Shapes; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + /// + public class RectangleTriangulationOptions : IRectangleTriangulationOptions + { + /// + public ICenter Center { get; } + /// + public IRectangle Rectangle { get; } + /// + public double NdmMaxSize { get; } + /// + public int NdmMinDivision { get; } + + public RectangleTriangulationOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision) + { + Center = center; + Rectangle = rectangle; + NdmMaxSize = ndmMaxSize; + NdmMinDivision = ndmMinDivision; + } + } +} diff --git a/StructureHelperLogics/StructureHelperLogics.csproj b/StructureHelperLogics/StructureHelperLogics.csproj new file mode 100644 index 0000000..325d167 --- /dev/null +++ b/StructureHelperLogics/StructureHelperLogics.csproj @@ -0,0 +1,13 @@ + + + + netstandard2.0 + + + + + ..\..\StructureHelper\Libraries\LoaderCalculator.dll + + + + diff --git a/StructureHelperTests/StructureHelperTests.csproj b/StructureHelperTests/StructureHelperTests.csproj index f2ac88c..b93619b 100644 --- a/StructureHelperTests/StructureHelperTests.csproj +++ b/StructureHelperTests/StructureHelperTests.csproj @@ -73,8 +73,8 @@ - - {23138426-7994-46a7-834d-08afb9741a86} + + {330bef5b-15be-4d2c-a750-b1ae50fb2be3} StructureHelperLogics