From 0695dfb9179e0524b9694f99a72d9ba87ca7106d Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Sun, 19 Jun 2022 20:57:08 +0500 Subject: [PATCH 001/107] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=82=D0=B5=D1=81=D1=82=D1=8B=20=D0=B1=D0=B8=D0=B1?= =?UTF-8?q?=D0=BB=D0=B8=D0=BE=D1=82=D0=B5=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Libraries/LoaderCalculator.dll | Bin 0 -> 46080 bytes StructureHelper.csproj | 4 +- StructureHelper.sln | 11 +- .../Logics/ExpectedProcessor.cs | 15 ++ .../Ndms/RCSections/RCSectionTest.cs | 184 ++++++++++++++++++ .../StructureHelperTests.csproj | 55 ++++-- .../StructureHelperTests.csproj.bak | 64 ++++++ StructureHelperTests/TestExampleClass.cs | 14 -- .../RectangleTriangulationTest.cs | 51 +++++ StructureHelperTests/packages.config | 8 +- 10 files changed, 371 insertions(+), 35 deletions(-) create mode 100644 Libraries/LoaderCalculator.dll create mode 100644 StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs create mode 100644 StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs create mode 100644 StructureHelperTests/StructureHelperTests.csproj.bak delete mode 100644 StructureHelperTests/TestExampleClass.cs create mode 100644 StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs diff --git a/Libraries/LoaderCalculator.dll b/Libraries/LoaderCalculator.dll new file mode 100644 index 0000000000000000000000000000000000000000..d2054c828102ba9b006b5e5b29bd789a530bc101 GIT binary patch literal 46080 zcmeIb33wdE(LY=>J3D(wD`|DxmhJTgYs*%Af(1S#OEw66TNqh3u@`A=3nY!%l?=9# zk+>3W2seaaa}!8_T#$srCd45mB#@AhgMgjG;R*o)3GgQ7`&D(%?CNkJ@Atm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Ak&9wThQK<>^Vn3%WEKH*4_lQLM{x z+5uwTt)Cd*#!Oe?cV(g4w5nNE)2gPb!a@+0;78R4-g`srmR6u4A-vfs&scG*_)~fJ zI=nKxWI4zB3-NvR8GP^O6!qbP_ycu##~y#x;z#&?Me$u&;3E3Ea#j7RgD-BpdPn!K zPW;;56<7WBwsO>oU$8u8oqFhd9iAI^((BTxO#4Nr_}b~Sjv}qd8}DjG(AdwsHEHCRSIoZJS2zFe?T?{B z?&n3uV=mSI`opYzM0oZ%Ro~vuH~!QcU&&+@KL@8jA5Vaofo5?N^_72ZlJNIQsJDLt zyQBP&(;zICGt^L5ol(1X@~2*rEavhCtc7ys>)fs!7TJnDFk;Y@6{;MI6TIfk-)RM+7hwc#+2>Y<0b zNmJ+KyfJf6%=w-~_Q4Ww*4z{9G&X_!o96kR+%2N}HdqR;@9}01p9Y-l#^j`#Pp#Gc zj4s(^VxZ!40{)f--eK46P};P>3VinY0uLBlj^L(rj}3Y`LjUmz-QN+L<(Da3ywp%C7W>M zh=bryw8cu%XPGX;J|-HdGs ue{Y2Qp%%91W8@Bapt@&u_%fYBWrz-J(GyNZAf&T|Nm)djy literal 0 HcmV?d00001 diff --git a/StructureHelper.csproj b/StructureHelper.csproj index 73e59fd..ccb845b 100644 --- a/StructureHelper.csproj +++ b/StructureHelper.csproj @@ -128,6 +128,8 @@ Designer - + + + \ No newline at end of file diff --git a/StructureHelper.sln b/StructureHelper.sln index 587bc98..f02c1d9 100644 --- a/StructureHelper.sln +++ b/StructureHelper.sln @@ -5,7 +5,12 @@ VisualStudioVersion = 16.0.32002.261 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelper", "StructureHelper.csproj", "{BAD27E27-4444-4300-ADF8-E21042C0781D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperTests", ".\StructureHelperTests\StructureHelperTests.csproj", "{7AC480BB-8A34-4913-B7AA-C6A5D7F35509}" +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} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperLogics", "..\StructureHelperLogics\StructureHelperLogics\StructureHelperLogics.csproj", "{23138426-7994-46A7-834D-08AFB9741A86}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs b/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs new file mode 100644 index 0000000..f729eac --- /dev/null +++ b/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LoaderCalculator.Tests.Infrastructures.Logics +{ + internal static class ExpectedProcessor + { + internal static double GetAccuracyForExpectedValue(double expectedValue, double accuracy = 0.001d) + { + if (expectedValue == 0d) { return 1.0e-15d; } + else return Math.Abs(expectedValue) * accuracy; + } + } +} diff --git a/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs new file mode 100644 index 0000000..f50917f --- /dev/null +++ b/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs @@ -0,0 +1,184 @@ +using LoaderCalculator.Data.Materials; +using LoaderCalculator.Data.Materials.MaterialBuilders; +using LoaderCalculator.Data.Matrix; +using LoaderCalculator.Data.Ndms; +using LoaderCalculator.Data.Ndms.Transformations; +using LoaderCalculator.Data.Planes; +using LoaderCalculator.Data.SourceData; +using LoaderCalculator.Infrastructure; +using LoaderCalculator.Tests.Infrastructures.Logics; +using LoaderCalculator.Triangulations; +using Moq; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +namespace LoaderCalculator.Tests.FunctionalTests.SectionTests +{ + public class RCSectionTest + { + private IMaterialOptions _reinforcementOptions; + private IMaterialBuilder _reinforcementBuilder; + private IBuilderDirector _reinforcementDirector; + private IMaterialOptions _concreteOptions; + private IMaterialBuilder _concreteBuilder; + private IBuilderDirector _concreteDirector; + [SetUp] + public void Setup() + { + _reinforcementOptions = new ReinforcementOptions(); + _reinforcementBuilder = new ReinforcementBuilder(_reinforcementOptions); + _reinforcementDirector = new BuilderDirector(_reinforcementBuilder); + _concreteOptions = new ConcreteOptions(); + _concreteBuilder = new ConcreteBuilder(_concreteOptions); + _concreteDirector = new BuilderDirector(_concreteBuilder); + } + //Theoretical limit momemt Mx = 43kN*m + [TestCase(0.000113, 0.000494, 10e3, 0d, 0d, 0.00084665917358052976d, 0.0d, 0.00020754144937701132d)] + [TestCase(0.000113, 0.000494, 40e3, 0d, 0d, 0.0033939850380287412d, 0d, 0.00082989880025069202d)] + [TestCase(0.000113, 0.000494, 42e3, 0d, 0d, 0.0056613831873867241d, 0d, 0.0014291081844183839d)] + //Theoretical limit momemt Mx = -187kN*m + [TestCase(0.000113, 0.000494, -50e3, 0d, 0d, -0.0011229555729294297d, 0d, 0.00021353225742956321d)] + [TestCase(0.000113, 0.000494, -180e3, 0d, 0d, -0.0098365950945499738d, 0d, 0.0022035516889170013d)] + [TestCase(0.000113, 0.000494, -183e3, 0d, 0d, -0.021718635290382458d, 0d, 0.0053526701372818789d)] + public void Run_ShouldPass(double topArea, double bottomArea, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ) + { + //Arrange + double width = 0.4; + double height = 0.6; + ArrangeMaterial(LimitStates.Collapse, true); + List ndmList = new List(); + ndmList.AddRange(GetConcreteNdms(width, height)); + ndmList.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea)); + var loaderData = new LoaderOptions + { + Preconditions = new Preconditions + { + ConditionRate = 0.01, + MaxIterationCount = 100, + StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz } + }, + NdmCollection = ndmList + }; + var calculator = new Calculator(); + //Act + calculator.Run(loaderData, new CancellationToken()); + var results = calculator.Result; + //Assert + Assert.NotNull(results); + var strainMatrix = results.StrainMatrix; + Assert.NotNull(strainMatrix); + Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx)); + Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy)); + Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ)); + } + //Longitudenal prestrain only + [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0.0d, 0d)] + [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.001d, 0d, 0.0d, -4.410e-05d)] + [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.0015d, 0d, 0.0d, -6.666e-05d)] + [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.002d, 0d, 0.0d, -8.131e-05d)] + [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.003d, 0d, 0.0d, -8.131e-05d)] + [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, -0.001d, 0d, 0.0d, 0.001d)] + [TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, -0.002d, 0d, 0.0d, 0.002d)] + //Curvature prestrain only + [TestCase(0.000494, 0.000494, 0d, 0d, 0d, -1e-5d, 0d, 0d, 5.4638e-6d, 0.0d, 1.069e-06d)] + //Test shows that prestrain and external forces are neglegiate one by another + [TestCase(0.000494, 0.000494, 0d, 0d, 3.952e5d, 0d, 0d, 0.001d, 0d, 0.0d, 0d)] + [TestCase(0.000494, 0.000494, 0d, 0d, 6.873e5d, 0d, 0d, 0.002d, 0d, 0.0d, -1.703e-8d)] + [TestCase(0.000494, 0.000494, 0d, 0d, 6.873e5d, 0d, 0d, 0.003d, 0d, 0.0d, -3.796e-8d)] + public void Run_ShouldPassPrestrain(double topArea, double bottomArea, double mx, double my, double nz, double prestrainKx, double prestrainKy, double prestrainEpsZ, double expectedKx, double expectedKy, double expectedEpsilonZ) + { + //Arrange + double width = 0.4; + double height = 0.6; + ArrangeMaterial(LimitStates.Collapse, true); + List ndmList = new List(); + IStrainMatrix prestrainMatrix = new StrainMatrix() { Kx = prestrainKx, Ky = prestrainKy, EpsZ = prestrainEpsZ }; + ndmList.AddRange(GetConcreteNdms(width, height)); + var reinforcement = GetReinforcementNdms(width, height, topArea, bottomArea); + NdmTransform.SetPrestrain(reinforcement, prestrainMatrix); + ndmList.AddRange(reinforcement); + var loaderData = new LoaderOptions + { + Preconditions = new Preconditions + { + ConditionRate = 0.001, + MaxIterationCount = 100, + StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz } + }, + NdmCollection = ndmList + }; + var calculator = new Calculator(); + //Act + calculator.Run(loaderData, new CancellationToken()); + var results = calculator.Result; + //Assert + Assert.NotNull(results); + var strainMatrix = results.StrainMatrix; + Assert.NotNull(strainMatrix); + Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx)); + Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy)); + Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ)); + } + + private void ArrangeMaterial(LimitStates limitStates, bool isShortTerm) + { + _reinforcementOptions.InitModulus = 2.0e11; + _reinforcementOptions.LimitState = limitStates; + _reinforcementOptions.IsShortTerm = isShortTerm; + _reinforcementOptions.Strength = 400.0e6; + + _concreteOptions.LimitState = limitStates; + _concreteOptions.IsShortTerm = isShortTerm; + _concreteOptions.Strength = 40.0e6; + } + + private IEnumerable GetConcreteNdms(double width, double heigth) + { + IMaterial _material = _concreteDirector.BuildMaterial(); + RectangleTriangulationLogicOptions logicOptions = new RectangleTriangulationLogicOptions(width, heigth, 1, 20); + var logic = Triangulation.GetLogicInstance(logicOptions); + var ndmCollection = logic.GetNdmCollection(new RectangularPlane { Material = _material }); + return ndmCollection; + } + + private IEnumerable GetReinforcementNdms(double width, double heigth, double topArea, double bottomArea) + { + IMaterial _material = _reinforcementDirector.BuildMaterial(); + double gap = 0.05; + var ndmCollection = new INdm[] + { + new Ndm + { + Area = topArea, + CenterX = width / 2 - gap, + CenterY = heigth / 2 - gap, + Material = _material + }, + new Ndm + { + Area = topArea, + CenterX = -(width / 2 - gap), + CenterY = heigth / 2 - gap, + Material = _material + }, + new Ndm + { + Area = bottomArea, + CenterX = width / 2 - gap, + CenterY = -(heigth / 2 - gap), + Material = _material + }, + new Ndm + { + Area = bottomArea, + CenterX = -(width / 2 - gap), + CenterY = -(heigth / 2 - gap), + Material = _material + } + }; + return ndmCollection; + } + } +} diff --git a/StructureHelperTests/StructureHelperTests.csproj b/StructureHelperTests/StructureHelperTests.csproj index 5576498..f2ac88c 100644 --- a/StructureHelperTests/StructureHelperTests.csproj +++ b/StructureHelperTests/StructureHelperTests.csproj @@ -1,7 +1,7 @@  - - + + Debug AnyCPU @@ -39,30 +39,51 @@ 4 - - ..\StructureHelper\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - - - ..\StructureHelper\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll - - - - - - + + + + + + ..\packages\Castle.Core.5.0.0\lib\net462\Castle.Core.dll + + + ..\Libraries\LoaderCalculator.dll + True + + + ..\packages\Moq.4.18.1\lib\net462\Moq.dll + + + ..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll + + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + + + + + + {23138426-7994-46a7-834d-08afb9741a86} + StructureHelperLogics + + - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + - \ No newline at end of file diff --git a/StructureHelperTests/StructureHelperTests.csproj.bak b/StructureHelperTests/StructureHelperTests.csproj.bak new file mode 100644 index 0000000..8bbe88a --- /dev/null +++ b/StructureHelperTests/StructureHelperTests.csproj.bak @@ -0,0 +1,64 @@ + + + + Debug + AnyCPU + {7AC480BB-8A34-4913-B7AA-C6A5D7F35509} + Library + Properties + StructureHelperTests + StructureHelperTests + v4.7.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/StructureHelperTests/TestExampleClass.cs b/StructureHelperTests/TestExampleClass.cs deleted file mode 100644 index 6c778ba..0000000 --- a/StructureHelperTests/TestExampleClass.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; - -namespace StructureHelperTests -{ - [TestClass] - public class TestExampleClass - { - [TestMethod] - public void TestMethod() - { - } - } -} diff --git a/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs new file mode 100644 index 0000000..d3b14ec --- /dev/null +++ b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs @@ -0,0 +1,51 @@ +using LoaderCalculator.Data.Materials; +using LoaderCalculator.Data.Materials.MaterialBuilders; +using LoaderCalculator.Data.Matrix; +using LoaderCalculator.Data.Ndms; +using LoaderCalculator.Data.Ndms.Transformations; +using LoaderCalculator.Data.Planes; +using LoaderCalculator.Data.SourceData; +using LoaderCalculator.Infrastructure; +using LoaderCalculator.Tests.Infrastructures.Logics; +using LoaderCalculator.Triangulations; +using Moq; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using StructureHelperLogics.NdmCalculations.Triangulations; +using StructureHelperLogics.Data.Shapes; + +namespace StructureHelperTests.UnitTests.Ndms.Triangulations +{ + public class RectangleTriangulationTest + { + //Участок по центру + [TestCase(0d, 0d, 1.0d, 1.0d, 0d, 0.02d, 1, 50 * 50, -0.49d, -0.49d)] + //Участок со смещением от центра + [TestCase(2d, 2d, 1.0d, 1.0d, 0d, 0.02d, 1, 50 * 50, 1.51d, 1.51d)] + [TestCase(2d, 1d, 1.0d, 1.0d, 0d, 0.02d, 1, 50 * 50, 1.51d, 0.51d)] + //Участок с поворотом на 1 радиан + [TestCase(0d, 0d, 1.0d, 1.0d, 1d, 0.02d, 1, 50 * 50, 0.14757265268048089d, -0.67706891243125777d)] + //Участок со смещением и поворотом на 1 радиан + [TestCase(2d, 2d, 1.0d, 1.0d, 1d, 0.02d, 1, 50 * 50, -0.45476470519903267d, 2.0864776689208147d)] + public void Run_ShouldPass (double centerX, double centerY, double width, double height, double angle, double ndmMaxSize, int ndmMinDivision, int expectedCount, double expectedFirstCenterX, double expectedFirstCenterY) + { + //Arrange + IMaterial material = new Material(); + ICenter center = new Center() { CenterX = centerX, CenterY = centerY }; + IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = angle }; + IRectangleTriangulationOptions options = new RectangleTriangulationOptions(center, rectangle, ndmMaxSize, ndmMinDivision); + IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options); + //Act + var result = logic.GetNdmCollection(material); + //Assert + Assert.NotNull(result); + Assert.AreEqual(expectedCount, result.Count()); + var firstNdm = result.First(); + Assert.AreEqual(expectedFirstCenterX, firstNdm.CenterX); + Assert.AreEqual(expectedFirstCenterY, firstNdm.CenterY); + } + } +} diff --git a/StructureHelperTests/packages.config b/StructureHelperTests/packages.config index f84cb10..e3e465e 100644 --- a/StructureHelperTests/packages.config +++ b/StructureHelperTests/packages.config @@ -1,5 +1,9 @@  - - + + + + + + \ No newline at end of file From 068b865a89006c927a546249fbb1a40ee43ccd06 Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Mon, 20 Jun 2022 18:44:24 +0500 Subject: [PATCH 002/107] =?UTF-8?q?=D0=92=D0=BE=D1=81=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B8=D0=BB=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=20Logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StructureHelper.sln | 12 +++--- StructureHelperLogics/Data/Shapes/Center.cs | 15 +++++++ StructureHelperLogics/Data/Shapes/ICenter.cs | 24 +++++++++++ .../Data/Shapes/IRectangle.cs | 22 ++++++++++ .../Data/Shapes/Rectangle.cs | 17 ++++++++ .../IRectangleTriangulationLogic.cs | 10 +++++ .../IRectangleTriangulationOptions.cs | 31 ++++++++++++++ .../Triangulations/ITriangulationLogic.cs | 15 +++++++ .../ITriangulationLogicOptions.cs | 10 +++++ .../RectangleTriangulationLogic.cs | 42 +++++++++++++++++++ .../RectangleTriangulationOptions.cs | 28 +++++++++++++ .../StructureHelperLogics.csproj | 13 ++++++ .../StructureHelperTests.csproj | 4 +- 13 files changed, 235 insertions(+), 8 deletions(-) create mode 100644 StructureHelperLogics/Data/Shapes/Center.cs create mode 100644 StructureHelperLogics/Data/Shapes/ICenter.cs create mode 100644 StructureHelperLogics/Data/Shapes/IRectangle.cs create mode 100644 StructureHelperLogics/Data/Shapes/Rectangle.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationOptions.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs create mode 100644 StructureHelperLogics/StructureHelperLogics.csproj 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 From 6d0f2136e328bf329679ba09e28e0d640ab2ef01 Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Tue, 21 Jun 2022 22:07:42 +0500 Subject: [PATCH 003/107] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20=D0=BF?= =?UTF-8?q?=D1=80=D1=8F=D0=BC=D0=BE=D1=83=D0=B3=D0=BE=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StructureHelperLogics/Data/Shapes/Center.cs | 4 +- StructureHelperLogics/Data/Shapes/ICenter.cs | 4 +- .../Data/Shapes/ICenterShape.cs | 12 ++ StructureHelperLogics/Data/Shapes/ICircle.cs | 11 ++ StructureHelperLogics/Data/Shapes/IPoint.cs | 11 ++ .../Data/Shapes/IRectangle.cs | 2 +- StructureHelperLogics/Data/Shapes/IShape.cs | 10 ++ StructureHelperLogics/Data/Shapes/Point.cs | 11 ++ .../Infrastructures/CommonEnums/CalcTerms.cs | 12 ++ .../CommonEnums/LimitStates.cs | 13 ++ .../NdmCalculations/Entities/INdmPrimitive.cs | 17 +++ .../NdmCalculations/Entities/NdmPrimitive.cs | 17 +++ .../Materials/IPrimitiveMaterial.cs | 14 +++ .../Materials/MaterialTypes.cs | 14 +++ .../Materials/PrimitiveMaterial.cs | 19 +++ .../Triangulations/ITriangulationOptions.cs | 13 ++ .../RectangleTriangulationLogic.cs | 4 +- .../RectangleTriangulationOptions.cs | 10 ++ .../Triangulations/Triangulation.cs | 114 ++++++++++++++++++ .../Triangulations/TriangulationOptions.cs | 13 ++ .../Ndms/RCSections/RCSectionTest.cs | 12 ++ .../Ndms/SteelSections/ReinforcementTest.cs | 55 +++++++++ .../StructureHelperTests.csproj | 6 +- .../RectangleTriangulationTest.cs | 2 +- 24 files changed, 389 insertions(+), 11 deletions(-) create mode 100644 StructureHelperLogics/Data/Shapes/ICenterShape.cs create mode 100644 StructureHelperLogics/Data/Shapes/ICircle.cs create mode 100644 StructureHelperLogics/Data/Shapes/IPoint.cs create mode 100644 StructureHelperLogics/Data/Shapes/IShape.cs create mode 100644 StructureHelperLogics/Data/Shapes/Point.cs create mode 100644 StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs create mode 100644 StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs create mode 100644 StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs create mode 100644 StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs create mode 100644 StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs create mode 100644 StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs create mode 100644 StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs create mode 100644 StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs create mode 100644 StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs diff --git a/StructureHelperLogics/Data/Shapes/Center.cs b/StructureHelperLogics/Data/Shapes/Center.cs index 409230c..15a0a06 100644 --- a/StructureHelperLogics/Data/Shapes/Center.cs +++ b/StructureHelperLogics/Data/Shapes/Center.cs @@ -8,8 +8,8 @@ namespace StructureHelperLogics.Data.Shapes public class Center : ICenter { /// - public double CenterX { get; set; } + public double X { get; set; } /// - public double CenterY { get; set; } + public double Y { get; set; } } } diff --git a/StructureHelperLogics/Data/Shapes/ICenter.cs b/StructureHelperLogics/Data/Shapes/ICenter.cs index ec6d513..0bb3cff 100644 --- a/StructureHelperLogics/Data/Shapes/ICenter.cs +++ b/StructureHelperLogics/Data/Shapes/ICenter.cs @@ -14,11 +14,11 @@ namespace StructureHelperLogics.Data.Shapes /// Coordinate of center of rectangle by local axis X, m /// Координата центра вдоль локальной оси X, м /// - double CenterX { get;} + double X { get;} /// /// Coordinate of center of rectangle by local axis Y, m /// Координата центра вдоль локальной оси Y, м /// - double CenterY { get;} + double Y { get;} } } diff --git a/StructureHelperLogics/Data/Shapes/ICenterShape.cs b/StructureHelperLogics/Data/Shapes/ICenterShape.cs new file mode 100644 index 0000000..d855f45 --- /dev/null +++ b/StructureHelperLogics/Data/Shapes/ICenterShape.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Data.Shapes +{ + public interface ICenterShape + { + ICenter Center {get;} + IShape Shape { get;} + } +} diff --git a/StructureHelperLogics/Data/Shapes/ICircle.cs b/StructureHelperLogics/Data/Shapes/ICircle.cs new file mode 100644 index 0000000..7adf5ee --- /dev/null +++ b/StructureHelperLogics/Data/Shapes/ICircle.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Data.Shapes +{ + public interface ICircle : IShape + { + double Diameter { get; set; } + } +} diff --git a/StructureHelperLogics/Data/Shapes/IPoint.cs b/StructureHelperLogics/Data/Shapes/IPoint.cs new file mode 100644 index 0000000..fe39f04 --- /dev/null +++ b/StructureHelperLogics/Data/Shapes/IPoint.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Data.Shapes +{ + public interface IPoint : IShape + { + double Area { get; set; } + } +} diff --git a/StructureHelperLogics/Data/Shapes/IRectangle.cs b/StructureHelperLogics/Data/Shapes/IRectangle.cs index fa67bc9..c035e1c 100644 --- a/StructureHelperLogics/Data/Shapes/IRectangle.cs +++ b/StructureHelperLogics/Data/Shapes/IRectangle.cs @@ -4,7 +4,7 @@ using System.Text; namespace StructureHelperLogics.Data.Shapes { - public interface IRectangle + public interface IRectangle : IShape { /// /// Width of rectangle, m diff --git a/StructureHelperLogics/Data/Shapes/IShape.cs b/StructureHelperLogics/Data/Shapes/IShape.cs new file mode 100644 index 0000000..71f6a08 --- /dev/null +++ b/StructureHelperLogics/Data/Shapes/IShape.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Data.Shapes +{ + public interface IShape + { + } +} diff --git a/StructureHelperLogics/Data/Shapes/Point.cs b/StructureHelperLogics/Data/Shapes/Point.cs new file mode 100644 index 0000000..a53ce97 --- /dev/null +++ b/StructureHelperLogics/Data/Shapes/Point.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Data.Shapes +{ + public class Point : IPoint + { + public double Area { get; set; } + } +} diff --git a/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs b/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs new file mode 100644 index 0000000..2046c9d --- /dev/null +++ b/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Infrastructures.CommonEnums +{ + public enum CalcTerms + { + ShortTerm, + LongTerm, + } +} diff --git a/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs b/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs new file mode 100644 index 0000000..3ded8d5 --- /dev/null +++ b/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Infrastructures.CommonEnums +{ + public enum LimitStates + { + Collapse = 1, + ServiceAbility = 2, + Special = 3, + } +} diff --git a/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs b/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs new file mode 100644 index 0000000..520ae44 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs @@ -0,0 +1,17 @@ +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Materials; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Entities +{ + public interface INdmPrimitive + { + ICenter Center { get; set; } + IShape Shape { get; set; } + IPrimitiveMaterial PrimitiveMaterial {get;set;} + double NdmMaxSize { get; set; } + int NdmMinDivision { get; set; } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs b/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs new file mode 100644 index 0000000..6cd643b --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs @@ -0,0 +1,17 @@ +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Materials; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Entities +{ + public class NdmPrimitive : INdmPrimitive + { + public ICenter Center { get; set; } + public IShape Shape { get; set; } + public IPrimitiveMaterial PrimitiveMaterial { get; set; } + public double NdmMaxSize { get; set; } + public int NdmMinDivision { get; set; } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs b/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs new file mode 100644 index 0000000..9b37530 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Materials +{ + public interface IPrimitiveMaterial + { + string Id { get;} + MaterialTypes MaterialType { get; } + string ClassName { get; } + double Strength { get; } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs b/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs new file mode 100644 index 0000000..6b76a13 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Materials +{ + public enum MaterialTypes + { + Concrete, + Reinforcement, + //Steel, + //CarbonFiber, + } +} diff --git a/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs b/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs new file mode 100644 index 0000000..70864e6 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Materials +{ + public class PrimitiveMaterial : IPrimitiveMaterial + { + public string Id { get; } + public MaterialTypes MaterialType { get; set; } + public string ClassName { get; set; } + public double Strength { get; set; } + + public PrimitiveMaterial() + { + Id = Convert.ToString(Guid.NewGuid()); + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs new file mode 100644 index 0000000..384e40b --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs @@ -0,0 +1,13 @@ +using StructureHelperLogics.Infrastructures.CommonEnums; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + public interface ITriangulationOptions + { + LimitStates LimiteState { get; } + CalcTerms CalcTerm { get; } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs index 8a2b0fc..9f2e6d9 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs @@ -21,8 +21,8 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations 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; + double dX = rectangleOptions.Center.X; + double dY = rectangleOptions.Center.Y; NdmTransform.Move(ndmCollection, dX, dY); double angle = rectangleOptions.Rectangle.Angle; NdmTransform.Rotate(ndmCollection, angle); diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs index 6aabf70..d9e2aeb 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs @@ -1,4 +1,5 @@ using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Entities; using System; using System.Collections.Generic; using System.Text; @@ -24,5 +25,14 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations NdmMaxSize = ndmMaxSize; NdmMinDivision = ndmMinDivision; } + + public RectangleTriangulationOptions(INdmPrimitive primitive) + { + if (! (primitive.Shape is IRectangle)) { throw new Exception("Shape type is not valid"); } + Center = primitive.Center; + Rectangle = primitive.Shape as IRectangle; + NdmMaxSize = primitive.NdmMaxSize; + NdmMinDivision = primitive.NdmMinDivision; + } } } diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs new file mode 100644 index 0000000..ac07cdb --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Text; +using LoaderCalculator.Data.Materials; +using LoaderCalculator.Data.Materials.MaterialBuilders; +using LoaderCalculator.Data.Ndms; +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Entities; +using StructureHelperLogics.NdmCalculations.Materials; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + public static class Triangulation + { + public static IEnumerable GetNdms(IEnumerable ndmPrimitives, ITriangulationOptions options) + { + List ndms = new List(); + Dictionary primitiveMaterials = GetPrimitiveMaterials(ndmPrimitives); + Dictionary materials = GetMaterials(primitiveMaterials, options); + foreach (var ndmPrimitive in ndmPrimitives) + { + IPrimitiveMaterial primitiveMaterial = ndmPrimitive.PrimitiveMaterial; + IMaterial material; + if (materials.TryGetValue(primitiveMaterial.Id, out material) == false) { throw new Exception("Material dictionary is not valid"); } + IEnumerable localNdms = GetNdmsByPrimitive(ndmPrimitive, material); + ndms.AddRange(localNdms); + } + return ndms; + } + + private static Dictionary GetPrimitiveMaterials(IEnumerable ndmPrimitives) + { + Dictionary primitiveMaterials = new Dictionary(); + foreach (var ndmPrimitive in ndmPrimitives) + { + IPrimitiveMaterial material = ndmPrimitive.PrimitiveMaterial; + if (!primitiveMaterials.ContainsKey(material.Id)) { primitiveMaterials.Add(material.Id, material); } + } + return primitiveMaterials; + } + + private static Dictionary GetMaterials(Dictionary PrimitiveMaterials, ITriangulationOptions options) + { + Dictionary materials = new Dictionary(); + IEnumerable keyCollection = PrimitiveMaterials.Keys; + IMaterial material; + foreach (string id in keyCollection) + { + IPrimitiveMaterial primitiveMaterial; + if (PrimitiveMaterials.TryGetValue(id, out primitiveMaterial) == false) { throw new Exception("Material dictionary is not valid"); } + material = GetMaterial(primitiveMaterial, options); + materials.Add(id, material); + } + return materials; + } + + private static IEnumerable GetNdmsByPrimitive(INdmPrimitive primitive, IMaterial material) + { + List ndms = new List(); + ITriangulationLogicOptions options; + ICenter center = primitive.Center; + IShape shape = primitive.Shape; + if (shape is IRectangle) + { + IRectangle rectangle = shape as IRectangle; + options = new RectangleTriangulationOptions(primitive); + IRectangleTriangulationLogic logic = new RectangleTriangulationLogic(options); + ndms.AddRange(logic.GetNdmCollection(material)); + } + else { throw new Exception("Primitive type is not valid"); } + return ndms; + } + + private static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) + { + IMaterial material; + if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); } + else if (primitiveMaterial.MaterialType == MaterialTypes.Reinforcement) { material = GetReinforcementMaterial(primitiveMaterial, options); } + else { throw new Exception("Material type is invalid"); } + return material; + } + + private static IMaterial GetConcreteMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) + { + IMaterialOptions materialOptions = new ConcreteOptions(); + SetMaterialOptions(materialOptions, primitiveMaterial, options); + IMaterialBuilder builder = new ConcreteBuilder(materialOptions); + IBuilderDirector director = new BuilderDirector(builder); + return director.BuildMaterial(); + } + + private static IMaterial GetReinforcementMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) + { + IMaterialOptions materialOptions = new ReinforcementOptions(); + SetMaterialOptions(materialOptions, primitiveMaterial, options); + IMaterialBuilder builder = new ReinforcementBuilder(materialOptions); + IBuilderDirector director = new BuilderDirector(builder); + return director.BuildMaterial(); + } + + private static void SetMaterialOptions(IMaterialOptions materialOptions, IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) + { + materialOptions.Strength = primitiveMaterial.Strength; + materialOptions.CodesType = CodesType.EC2_1990; + if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Collapse) { materialOptions.LimitState = LimitStates.Collapse; } + else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.ServiceAbility) { materialOptions.LimitState = LimitStates.ServiceAbility; } + else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Special) { materialOptions.LimitState = LimitStates.Special; } + else { throw new Exception("LimitStateType is not valid"); } + if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; } + else if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; } + else { throw new Exception("Calculation term is not valid"); } + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs new file mode 100644 index 0000000..d13b47b --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs @@ -0,0 +1,13 @@ +using StructureHelperLogics.Infrastructures.CommonEnums; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + public class TriangulationOptions : ITriangulationOptions + { + public LimitStates LimiteState { get; set; } + public CalcTerms CalcTerm { get; set; } + } +} diff --git a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs new file mode 100644 index 0000000..2177b66 --- /dev/null +++ b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperTests.FunctionalTests.Ndms.RCSections +{ + class RCSectionTest + { + } +} diff --git a/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs new file mode 100644 index 0000000..6b7250b --- /dev/null +++ b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs @@ -0,0 +1,55 @@ +using LoaderCalculator; +using LoaderCalculator.Data.Matrix; +using LoaderCalculator.Data.SourceData; +using LoaderCalculator.Tests.Infrastructures.Logics; +using NUnit.Framework; +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Entities; +using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperLogics.NdmCalculations.Triangulations; +using System.Collections.Generic; +using System.Threading; + +namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections +{ + public class ReinforcementTest + { + [TestCase(0.3, 0.6, 4e8, 0, 0, 1800000, 0d, 0d, 5e-5d)] + [TestCase(0.3, 0.6, 4e8, 0, 0, -1800000, 0d, 0d, -5e-5d)] + [TestCase(0.3, 0.6, 4e8, 7000000, 0, 0, 0.0065882684745345067d, 0d, 0d)] + [TestCase(0.3, 0.6, 6e8, 10000000, 0, 0, 0.010485801788961743d, 0d, -0.00011114996218404612d)] + public void Run_ShouldPass(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ) + { + //Arrange + ICenter center = new Center() { X = 0, Y = 0 }; + IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 }; + IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength }; + ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; + INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 100 }; + List primitives = new List(); + primitives.Add(primitive); + var ndmList = Triangulation.GetNdms(primitives, options); + var loaderData = new LoaderOptions + { + Preconditions = new Preconditions + { + ConditionRate = 0.01, + MaxIterationCount = 100, + StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz } + }, + NdmCollection = ndmList + }; + var calculator = new Calculator(); + //Act + calculator.Run(loaderData, new CancellationToken()); + var results = calculator.Result; + //Assert + Assert.NotNull(results); + var strainMatrix = results.StrainMatrix; + Assert.NotNull(strainMatrix); + Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx)); + Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy)); + Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ)); + } + } +} diff --git a/StructureHelperTests/StructureHelperTests.csproj b/StructureHelperTests/StructureHelperTests.csproj index b93619b..d41ee1e 100644 --- a/StructureHelperTests/StructureHelperTests.csproj +++ b/StructureHelperTests/StructureHelperTests.csproj @@ -39,6 +39,8 @@ 4 + + @@ -69,9 +71,7 @@ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll - - - + {330bef5b-15be-4d2c-a750-b1ae50fb2be3} diff --git a/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs index d3b14ec..0666cc4 100644 --- a/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs +++ b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs @@ -34,7 +34,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations { //Arrange IMaterial material = new Material(); - ICenter center = new Center() { CenterX = centerX, CenterY = centerY }; + ICenter center = new Center() { X = centerX, Y = centerY }; IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = angle }; IRectangleTriangulationOptions options = new RectangleTriangulationOptions(center, rectangle, ndmMaxSize, ndmMinDivision); IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options); From 5f9d2d4bafa96db4547895b6c3630cd75f554a1a Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Thu, 23 Jun 2022 20:34:22 +0500 Subject: [PATCH 004/107] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BE=D0=BF=D1=86=D0=B8=D0=B8=20=D1=82=D1=80=D0=B8=D0=B0=D0=BD?= =?UTF-8?q?=D0=B3=D1=83=D0=BB=D1=8F=D1=86=D0=B8=D0=B8=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=82=D0=BE=D1=87=D0=BA=D0=B8=20=D0=B8=20=D1=81=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B0=D0=BB=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B6=D0=B5=D0=BB=D0=B5=D0=B7=D0=BE=D0=B1=D0=B5=D1=82?= =?UTF-8?q?=D0=BE=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Triangulations/IPointTiangulationLogic.cs | 10 ++ .../IPointTriangulationLogicOptions.cs | 13 +++ ...=> IRectangleTriangulationLogicOptions.cs} | 2 +- .../Triangulations/PointTriangulationLogic.cs | 35 +++++++ .../PointTriangulationLogicOptions.cs | 26 +++++ .../RectangleTriangulationLogic.cs | 2 +- ... => RectangleTriangulationLogicOptions.cs} | 6 +- .../Triangulations/Triangulation.cs | 4 +- .../Ndms/RCSections/RCSectionTest.cs | 95 ++++++++++++++++++- .../Ndms/SteelSections/ReinforcementTest.cs | 4 +- .../RectangleTriangulationTest.cs | 2 +- 11 files changed, 184 insertions(+), 15 deletions(-) create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs rename StructureHelperLogics/NdmCalculations/Triangulations/{IRectangleTriangulationOptions.cs => IRectangleTriangulationLogicOptions.cs} (91%) create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs create mode 100644 StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs rename StructureHelperLogics/NdmCalculations/Triangulations/{RectangleTriangulationOptions.cs => RectangleTriangulationLogicOptions.cs} (77%) diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs new file mode 100644 index 0000000..bd9217b --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + interface IPointTiangulationLogic : ITriangulationLogic + { + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs new file mode 100644 index 0000000..10fe244 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs @@ -0,0 +1,13 @@ +using StructureHelperLogics.Data.Shapes; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + public interface IPointTriangulationLogicOptions : ITriangulationLogicOptions + { + ICenter Center { get; } + double Area { get; } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs similarity index 91% rename from StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationOptions.cs rename to StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs index 9f421c1..24f2555 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs @@ -9,7 +9,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations /// Parameter of triangulation of rectangle part of section /// Параметры триангуляции прямоугольного участка сечения /// - public interface IRectangleTriangulationOptions : ITriangulationLogicOptions + public interface IRectangleTriangulationLogicOptions : ITriangulationLogicOptions { /// /// diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs new file mode 100644 index 0000000..a7660d7 --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs @@ -0,0 +1,35 @@ +using LoaderCalculator.Data.Materials; +using LoaderCalculator.Data.Ndms; +using StructureHelperLogics.Data.Shapes; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + public class PointTriangulationLogic : IPointTiangulationLogic + { + public ITriangulationLogicOptions Options { get; } + + public PointTriangulationLogic(IPointTriangulationLogicOptions options) + { + Options = options; + } + + public IEnumerable GetNdmCollection(IMaterial material) + { + IPointTriangulationLogicOptions options = Options as IPointTriangulationLogicOptions; + ICenter center = options.Center; + double area = options.Area; + List ndmCollection = new List(); + INdm ndm = new Ndm() { CenterX = center.X, CenterY = center.Y, Area = area, Material = material }; + ndmCollection.Add(ndm); + return ndmCollection; + } + + public void ValidateOptions(ITriangulationLogicOptions options) + { + throw new NotImplementedException(); + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs new file mode 100644 index 0000000..c2d7c5e --- /dev/null +++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs @@ -0,0 +1,26 @@ +using StructureHelperLogics.Data.Shapes; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.NdmCalculations.Triangulations +{ + /// + /// + /// + public class PointTriangulationLogicOptions : IPointTriangulationLogicOptions + { + /// + /// + /// + public ICenter Center { get; } + + public double Area { get; } + + public PointTriangulationLogicOptions(ICenter center, double area) + { + Center = center; + Area = area; + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs index 9f2e6d9..f732d76 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs @@ -13,7 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations public IEnumerable GetNdmCollection(IMaterial material) { - IRectangleTriangulationOptions rectangleOptions = Options as IRectangleTriangulationOptions; + IRectangleTriangulationLogicOptions rectangleOptions = Options as IRectangleTriangulationLogicOptions; double width = rectangleOptions.Rectangle.Width; double height = rectangleOptions.Rectangle.Height; double ndmMaxSize = rectangleOptions.NdmMaxSize; diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs similarity index 77% rename from StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs rename to StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs index d9e2aeb..59455e1 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs @@ -7,7 +7,7 @@ using System.Text; namespace StructureHelperLogics.NdmCalculations.Triangulations { /// - public class RectangleTriangulationOptions : IRectangleTriangulationOptions + public class RectangleTriangulationLogicOptions : IRectangleTriangulationLogicOptions { /// public ICenter Center { get; } @@ -18,7 +18,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations /// public int NdmMinDivision { get; } - public RectangleTriangulationOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision) + public RectangleTriangulationLogicOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision) { Center = center; Rectangle = rectangle; @@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations NdmMinDivision = ndmMinDivision; } - public RectangleTriangulationOptions(INdmPrimitive primitive) + public RectangleTriangulationLogicOptions(INdmPrimitive primitive) { if (! (primitive.Shape is IRectangle)) { throw new Exception("Shape type is not valid"); } Center = primitive.Center; diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs index ac07cdb..e04eebf 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs @@ -63,7 +63,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations if (shape is IRectangle) { IRectangle rectangle = shape as IRectangle; - options = new RectangleTriangulationOptions(primitive); + options = new RectangleTriangulationLogicOptions(primitive); IRectangleTriangulationLogic logic = new RectangleTriangulationLogic(options); ndms.AddRange(logic.GetNdmCollection(material)); } @@ -71,7 +71,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations return ndms; } - private static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) + public static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) { IMaterial material; if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); } diff --git a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs index 2177b66..dd13903 100644 --- a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs +++ b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs @@ -1,12 +1,97 @@ -using System; +using LoaderCalculator; +using LoaderCalculator.Data.Materials; +using LoaderCalculator.Data.Matrix; +using LoaderCalculator.Data.Ndms; +using LoaderCalculator.Data.SourceData; +using LoaderCalculator.Tests.Infrastructures.Logics; +using NUnit.Framework; +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Entities; +using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperLogics.NdmCalculations.Triangulations; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Threading; namespace StructureHelperTests.FunctionalTests.Ndms.RCSections { - class RCSectionTest + public class RCSectionTest { + //Theoretical limit momemt Mx = 43kN*m + [TestCase(0.000113, 0.000494, 10e3, 0d, 0d, 0.00084665917358052976d, 0.0d, 0.00020754144937701132d)] + [TestCase(0.000113, 0.000494, 40e3, 0d, 0d, 0.0033939850380287412d, 0d, 0.00082989880025069202d)] + [TestCase(0.000113, 0.000494, 42e3, 0d, 0d, 0.0056613831873867241d, 0d, 0.0014291081844183839d)] + //Theoretical limit momemt Mx = -187kN*m + [TestCase(0.000113, 0.000494, -50e3, 0d, 0d, -0.0011229555729294297d, 0d, 0.00021353225742956321d)] + [TestCase(0.000113, 0.000494, -180e3, 0d, 0d, -0.0098365950945499738d, 0d, 0.0022035516889170013d)] + [TestCase(0.000113, 0.000494, -183e3, 0d, 0d, -0.021718635290382458d, 0d, 0.0053526701372818789d)] + public void Run_ShouldPass(double topArea, double bottomArea, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ) + { + //Arrange + double width = 0.4; + double height = 0.6; + var ndmCollection = new List(); + ndmCollection.AddRange(GetConcreteNdms(width, height)); + ndmCollection.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea)); + var loaderData = new LoaderOptions + { + Preconditions = new Preconditions + { + ConditionRate = 0.01, + MaxIterationCount = 100, + StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz } + }, + NdmCollection = ndmCollection + }; + var calculator = new Calculator(); + //Act + calculator.Run(loaderData, new CancellationToken()); + var results = calculator.Result; + //Assert + Assert.NotNull(results); + var strainMatrix = results.StrainMatrix; + Assert.NotNull(strainMatrix); + Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx)); + Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy)); + Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ)); + } + + private IEnumerable GetConcreteNdms(double width, double height) + { + double strength = 40e6; + ICenter center = new Center() { X = 0, Y = 0 }; + IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 }; + IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Concrete, ClassName = "С20", Strength = strength }; + ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; + INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 }; + List primitives = new List(); + primitives.Add(primitive); + var ndmCollection = Triangulation.GetNdms(primitives, options); + return ndmCollection; + } + + private IEnumerable GetReinforcementNdms(double width, double height, double topArea, double bottomArea) + { + double gap = 0.05d; + double strength = 4e8; + IShape topReinforcement = new Point() { Area = topArea }; + IShape bottomReinforcement = new Point() { Area = bottomArea }; + IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength }; + ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; + IMaterial material = Triangulation.GetMaterial(primitiveMaterial, options); + ICenter centerRT = new Center() { X = width / 2 - gap, Y = height / 2 - gap }; + ICenter centerLT = new Center() { X = - (width / 2 - gap), Y = height / 2 - gap }; + ICenter centerRB = new Center() { X = width / 2 - gap, Y = - (height / 2 - gap) }; + ICenter centerLB = new Center() { X = -(width / 2 - gap), Y = - (height / 2 - gap) }; + IPointTriangulationLogicOptions optionsRT = new PointTriangulationLogicOptions(centerRT, topArea); + IPointTriangulationLogicOptions optionsLT = new PointTriangulationLogicOptions(centerLT, topArea); + IPointTriangulationLogicOptions optionsRB = new PointTriangulationLogicOptions(centerRB, bottomArea); + IPointTriangulationLogicOptions optionsLB = new PointTriangulationLogicOptions(centerLB, bottomArea); + var ndmCollection = new List(); + ndmCollection.AddRange((new PointTriangulationLogic(optionsRT)).GetNdmCollection(material)); + ndmCollection.AddRange((new PointTriangulationLogic(optionsLT)).GetNdmCollection(material)); + ndmCollection.AddRange((new PointTriangulationLogic(optionsRB)).GetNdmCollection(material)); + ndmCollection.AddRange((new PointTriangulationLogic(optionsLB)).GetNdmCollection(material)); + return ndmCollection; + } } } diff --git a/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs index 6b7250b..230ba3f 100644 --- a/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs +++ b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs @@ -28,7 +28,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 100 }; List primitives = new List(); primitives.Add(primitive); - var ndmList = Triangulation.GetNdms(primitives, options); + var ndmCollection = Triangulation.GetNdms(primitives, options); var loaderData = new LoaderOptions { Preconditions = new Preconditions @@ -37,7 +37,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections MaxIterationCount = 100, StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz } }, - NdmCollection = ndmList + NdmCollection = ndmCollection }; var calculator = new Calculator(); //Act diff --git a/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs index 0666cc4..152ae97 100644 --- a/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs +++ b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs @@ -36,7 +36,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations IMaterial material = new Material(); ICenter center = new Center() { X = centerX, Y = centerY }; IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = angle }; - IRectangleTriangulationOptions options = new RectangleTriangulationOptions(center, rectangle, ndmMaxSize, ndmMinDivision); + IRectangleTriangulationLogicOptions options = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision); IRectangleTriangulationLogic logic = new StructureHelperLogics.NdmCalculations.Triangulations.RectangleTriangulationLogic(options); //Act var result = logic.GetNdmCollection(material); From bc867d5db2f1c523375e2f9dbc9e1346047ef4f2 Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Thu, 23 Jun 2022 21:52:26 +0500 Subject: [PATCH 005/107] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20=D1=82?= =?UTF-8?q?=D1=80=D0=B8=D0=B0=D0=BD=D0=B3=D1=83=D0=BB=D1=8F=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D1=82=D0=BE=D1=87=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StructureHelperLogics/Data/Shapes/IPoint.cs | 2 +- ...onLogic.cs => IPointTriangulationLogic.cs} | 2 +- .../Triangulations/PointTriangulationLogic.cs | 4 +- .../Triangulations/Triangulation.cs | 12 +++-- .../Ndms/RCSections/RCSectionTest.cs | 45 ++++++++++--------- 5 files changed, 38 insertions(+), 27 deletions(-) rename StructureHelperLogics/NdmCalculations/Triangulations/{IPointTiangulationLogic.cs => IPointTriangulationLogic.cs} (71%) diff --git a/StructureHelperLogics/Data/Shapes/IPoint.cs b/StructureHelperLogics/Data/Shapes/IPoint.cs index fe39f04..998be59 100644 --- a/StructureHelperLogics/Data/Shapes/IPoint.cs +++ b/StructureHelperLogics/Data/Shapes/IPoint.cs @@ -6,6 +6,6 @@ namespace StructureHelperLogics.Data.Shapes { public interface IPoint : IShape { - double Area { get; set; } + double Area { get; } } } diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogic.cs similarity index 71% rename from StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs rename to StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogic.cs index bd9217b..b3d7a8d 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTiangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogic.cs @@ -4,7 +4,7 @@ using System.Text; namespace StructureHelperLogics.NdmCalculations.Triangulations { - interface IPointTiangulationLogic : ITriangulationLogic + interface IPointTriangulationLogic : ITriangulationLogic { } } diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs index a7660d7..49d53c2 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs @@ -7,11 +7,11 @@ using System.Text; namespace StructureHelperLogics.NdmCalculations.Triangulations { - public class PointTriangulationLogic : IPointTiangulationLogic + public class PointTriangulationLogic : IPointTriangulationLogic { public ITriangulationLogicOptions Options { get; } - public PointTriangulationLogic(IPointTriangulationLogicOptions options) + public PointTriangulationLogic(ITriangulationLogicOptions options) { Options = options; } diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs index e04eebf..b452d87 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs @@ -62,16 +62,22 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations IShape shape = primitive.Shape; if (shape is IRectangle) { - IRectangle rectangle = shape as IRectangle; options = new RectangleTriangulationLogicOptions(primitive); - IRectangleTriangulationLogic logic = new RectangleTriangulationLogic(options); + ITriangulationLogic logic = new RectangleTriangulationLogic(options); + ndms.AddRange(logic.GetNdmCollection(material)); + } + else if (shape is IPoint) + { + IPoint point = shape as IPoint; + options = new PointTriangulationLogicOptions(primitive.Center, point.Area); + IPointTriangulationLogic logic = new PointTriangulationLogic(options); ndms.AddRange(logic.GetNdmCollection(material)); } else { throw new Exception("Primitive type is not valid"); } return ndms; } - public static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) + private static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options) { IMaterial material; if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); } diff --git a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs index dd13903..939c52f 100644 --- a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs +++ b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs @@ -30,8 +30,11 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections double width = 0.4; double height = 0.6; var ndmCollection = new List(); - ndmCollection.AddRange(GetConcreteNdms(width, height)); - ndmCollection.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea)); + ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; + var primitives = new List(); + primitives.AddRange(GetConcreteNdms(width, height)); + primitives.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea)); + ndmCollection.AddRange(Triangulation.GetNdms(primitives, options)); var loaderData = new LoaderOptions { Preconditions = new Preconditions @@ -55,21 +58,19 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ)); } - private IEnumerable GetConcreteNdms(double width, double height) + private IEnumerable GetConcreteNdms(double width, double height) { double strength = 40e6; ICenter center = new Center() { X = 0, Y = 0 }; IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 }; - IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Concrete, ClassName = "С20", Strength = strength }; + IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength }; ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 }; - List primitives = new List(); - primitives.Add(primitive); - var ndmCollection = Triangulation.GetNdms(primitives, options); - return ndmCollection; + List primitives = new List {primitive}; + return primitives; } - private IEnumerable GetReinforcementNdms(double width, double height, double topArea, double bottomArea) + private IEnumerable GetReinforcementNdms(double width, double height, double topArea, double bottomArea) { double gap = 0.05d; double strength = 4e8; @@ -77,21 +78,25 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections IShape bottomReinforcement = new Point() { Area = bottomArea }; IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength }; ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; - IMaterial material = Triangulation.GetMaterial(primitiveMaterial, options); ICenter centerRT = new Center() { X = width / 2 - gap, Y = height / 2 - gap }; ICenter centerLT = new Center() { X = - (width / 2 - gap), Y = height / 2 - gap }; ICenter centerRB = new Center() { X = width / 2 - gap, Y = - (height / 2 - gap) }; ICenter centerLB = new Center() { X = -(width / 2 - gap), Y = - (height / 2 - gap) }; - IPointTriangulationLogicOptions optionsRT = new PointTriangulationLogicOptions(centerRT, topArea); - IPointTriangulationLogicOptions optionsLT = new PointTriangulationLogicOptions(centerLT, topArea); - IPointTriangulationLogicOptions optionsRB = new PointTriangulationLogicOptions(centerRB, bottomArea); - IPointTriangulationLogicOptions optionsLB = new PointTriangulationLogicOptions(centerLB, bottomArea); - var ndmCollection = new List(); - ndmCollection.AddRange((new PointTriangulationLogic(optionsRT)).GetNdmCollection(material)); - ndmCollection.AddRange((new PointTriangulationLogic(optionsLT)).GetNdmCollection(material)); - ndmCollection.AddRange((new PointTriangulationLogic(optionsRB)).GetNdmCollection(material)); - ndmCollection.AddRange((new PointTriangulationLogic(optionsLB)).GetNdmCollection(material)); - return ndmCollection; + List primitives = new List(); + INdmPrimitive primitive; + //Right top bar + primitive = new NdmPrimitive() { Center = centerRT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial}; + primitives.Add(primitive); + //Left top bar + primitive = new NdmPrimitive() { Center = centerLT, Shape = topReinforcement, PrimitiveMaterial = primitiveMaterial }; + primitives.Add(primitive); + //Right bottom bar + primitive = new NdmPrimitive() { Center = centerRB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial }; + primitives.Add(primitive); + //Left bottom bar + primitive = new NdmPrimitive() { Center = centerLB, Shape = bottomReinforcement, PrimitiveMaterial = primitiveMaterial }; + primitives.Add(primitive); + return primitives; } } } From 54d51e7de8a80c3623326d6f4560199bf058166c Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Fri, 8 Jul 2022 19:52:09 +0500 Subject: [PATCH 006/107] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D1=8B=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=84=D0=BE=D1=80=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B8=D1=81=D1=85=D0=BE=D0=B4=D0=BD=D1=8B?= =?UTF-8?q?=D1=85=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B8=D1=82=D0=B8=D0=B2=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B4=D0=BB=D1=8F=20=D1=82=D1=80=D0=B8=D0=B0=D0=BD?= =?UTF-8?q?=D0=B3=D1=83=D0=BB=D1=8F=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/UI/DataContexts/Ellipse.cs | 18 ++++++++++++++++++ .../UI/DataContexts/PrimitiveBase.cs | 12 ++++++++++++ Infrastructure/UI/DataContexts/Rectangle.cs | 18 ++++++++++++++++++ StructureHelper.csproj | 6 ++++++ 4 files changed, 54 insertions(+) diff --git a/Infrastructure/UI/DataContexts/Ellipse.cs b/Infrastructure/UI/DataContexts/Ellipse.cs index 79e9eb6..6f969a5 100644 --- a/Infrastructure/UI/DataContexts/Ellipse.cs +++ b/Infrastructure/UI/DataContexts/Ellipse.cs @@ -1,7 +1,11 @@ using System; using System.Windows.Media; using StructureHelper.Infrastructure.Enums; +using StructureHelper.Models.Materials; using StructureHelper.Windows.MainWindow; +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Entities; +using StructureHelperLogics.NdmCalculations.Materials; namespace StructureHelper.Infrastructure.UI.DataContexts { @@ -26,5 +30,19 @@ namespace StructureHelper.Infrastructure.UI.DataContexts ShowedX = 0; ShowedY = 0; } + + public override INdmPrimitive GetNdmPrimitive() + { + double strength = 0; + double centerX = 0; + double centerY = 0; + double area = 0; + string materialName = "s400"; + ICenter center = new Center() { X = centerX, Y = centerY }; + IShape shape = new Point() { Area = area }; + IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ; + INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial }; + return ndmPrimitive; + } } } diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs index 88acc99..7a1711d 100644 --- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs +++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs @@ -4,6 +4,8 @@ using System.Windows.Media; using StructureHelper.Infrastructure.Enums; using StructureHelper.Models.Materials; using StructureHelper.Windows.MainWindow; +using StructureHelperLogics.NdmCalculations.Entities; +using StructureHelperLogics.NdmCalculations.Materials; namespace StructureHelper.Infrastructure.UI.DataContexts { @@ -254,5 +256,15 @@ namespace StructureHelper.Infrastructure.UI.DataContexts if (Type == PrimitiveType.Rectangle) Y = -showedY + Xy1 - PrimitiveHeight; if (Type == PrimitiveType.Ellipse) Y = -showedY + Xy1 - PrimitiveWidth / 2; } + + public abstract INdmPrimitive GetNdmPrimitive(); + public MaterialTypes GetMaterialTypes() + { + MaterialTypes materialTypes; + if (Material is ConcreteDefinition) { materialTypes = MaterialTypes.Concrete; } + else if (Material is RebarDefinition) { materialTypes = MaterialTypes.Reinforcement; } + else { throw new Exception("MaterialType is unknown"); } + return materialTypes; + } } } diff --git a/Infrastructure/UI/DataContexts/Rectangle.cs b/Infrastructure/UI/DataContexts/Rectangle.cs index 3847e3a..732eb8d 100644 --- a/Infrastructure/UI/DataContexts/Rectangle.cs +++ b/Infrastructure/UI/DataContexts/Rectangle.cs @@ -3,6 +3,9 @@ using System.Windows.Input; using System.Windows.Media; using StructureHelper.Infrastructure.Enums; using StructureHelper.Windows.MainWindow; +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Entities; +using StructureHelperLogics.NdmCalculations.Materials; namespace StructureHelper.Infrastructure.UI.DataContexts { @@ -15,5 +18,20 @@ namespace StructureHelper.Infrastructure.UI.DataContexts ShowedX = 0; ShowedY = 0; } + + public override INdmPrimitive GetNdmPrimitive() + { + double strength = 0; + double centerX = 0; + double centerY = 0; + string materialName = "C20"; + ICenter center = new Center() { X = centerX, Y = centerY }; + double height = 0; + double width = 0; + IShape shape = new StructureHelperLogics.Data.Shapes.Rectangle() { Height = height, Width = width, Angle = 0 }; + IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ; + INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial }; + return ndmPrimitive; + } } } diff --git a/StructureHelper.csproj b/StructureHelper.csproj index bc8d12c..a53a43f 100644 --- a/StructureHelper.csproj +++ b/StructureHelper.csproj @@ -157,5 +157,11 @@ + + + {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3} + StructureHelperLogics + + \ No newline at end of file From 4d3ecf7770ca21b748993fe0e3145fd9a4b816fb Mon Sep 17 00:00:00 2001 From: NickAppLab Date: Thu, 14 Jul 2022 11:00:14 +0500 Subject: [PATCH 007/107] Shapes Mapping has been added to DataContext's primitives --- Infrastructure/UI/DataContexts/Ellipse.cs | 5 +++- .../UI/DataContexts/PrimitiveBase.cs | 4 ++- Infrastructure/UI/DataContexts/Rectangle.cs | 6 +++- MaterialDefinitions/ConcreteDefinition.cs | 18 ------------ MaterialDefinitions/MaterialDefinition.cs | 28 ------------------- MaterialDefinitions/RebarDefinition.cs | 18 ------------ 6 files changed, 12 insertions(+), 67 deletions(-) delete mode 100644 MaterialDefinitions/ConcreteDefinition.cs delete mode 100644 MaterialDefinitions/MaterialDefinition.cs delete mode 100644 MaterialDefinitions/RebarDefinition.cs diff --git a/Infrastructure/UI/DataContexts/Ellipse.cs b/Infrastructure/UI/DataContexts/Ellipse.cs index 6f969a5..5cc82b2 100644 --- a/Infrastructure/UI/DataContexts/Ellipse.cs +++ b/Infrastructure/UI/DataContexts/Ellipse.cs @@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Materials; namespace StructureHelper.Infrastructure.UI.DataContexts { - public class Ellipse : PrimitiveBase + public class Ellipse : PrimitiveBase { private double square; public double Square @@ -44,5 +44,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial }; return ndmPrimitive; } + + public override Point MapToShape() + => new Point {Area = Square}; } } diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs index 7a1711d..8a9c6bc 100644 --- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs +++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs @@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Materials; namespace StructureHelper.Infrastructure.UI.DataContexts { - public abstract class PrimitiveBase : ViewModelBase + public abstract class PrimitiveBase : ViewModelBase where T : StructureHelperLogics.Data.Shapes.IShape { #region Поля @@ -266,5 +266,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts else { throw new Exception("MaterialType is unknown"); } return materialTypes; } + + public abstract T MapToShape(); } } diff --git a/Infrastructure/UI/DataContexts/Rectangle.cs b/Infrastructure/UI/DataContexts/Rectangle.cs index 732eb8d..ca1fdd8 100644 --- a/Infrastructure/UI/DataContexts/Rectangle.cs +++ b/Infrastructure/UI/DataContexts/Rectangle.cs @@ -6,10 +6,11 @@ using StructureHelper.Windows.MainWindow; using StructureHelperLogics.Data.Shapes; using StructureHelperLogics.NdmCalculations.Entities; using StructureHelperLogics.NdmCalculations.Materials; +using RectangleShape = StructureHelperLogics.Data.Shapes.Rectangle; namespace StructureHelper.Infrastructure.UI.DataContexts { - public class Rectangle : PrimitiveBase + public class Rectangle : PrimitiveBase { public Rectangle(double primitiveWidth, double primitiveHeight, double rectX, double rectY, MainViewModel mainViewModel) : base(PrimitiveType.Rectangle, rectX, rectY, mainViewModel) { @@ -33,5 +34,8 @@ namespace StructureHelper.Infrastructure.UI.DataContexts INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial }; return ndmPrimitive; } + + public override RectangleShape MapToShape() + => new RectangleShape {Height = PrimitiveHeight, Width = PrimitiveWidth}; } } diff --git a/MaterialDefinitions/ConcreteDefinition.cs b/MaterialDefinitions/ConcreteDefinition.cs deleted file mode 100644 index 2d7c372..0000000 --- a/MaterialDefinitions/ConcreteDefinition.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MaterialResistanceCalc -{ - public class ConcreteDefinition : MaterialDefinition - { - public ConcreteDefinition(string materialClass, double youngModulus, double compressiveStrengthCoef, double tensileStrengthCoef, double materialCoefInCompress, double materialCoefInTension) - : base(materialClass, youngModulus, compressiveStrengthCoef, tensileStrengthCoef, materialCoefInCompress, materialCoefInTension) - { - CompressiveStrength = compressiveStrengthCoef * Math.Pow(10, 6); - TensileStrength = tensileStrengthCoef * Math.Sqrt(CompressiveStrength); - } - } -} diff --git a/MaterialDefinitions/MaterialDefinition.cs b/MaterialDefinitions/MaterialDefinition.cs deleted file mode 100644 index c64a46e..0000000 --- a/MaterialDefinitions/MaterialDefinition.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MaterialResistanceCalc -{ - public class MaterialDefinition - { - public string MaterialClass { get; set; } - public double YoungModulus { get; set; } - public double CompressiveStrength { get; set; } - public double TensileStrength { get; set; } - public double MaterialCoefInCompress { get; set; } - public double MaterialCoefInTension { get; set; } - - public MaterialDefinition(string materialClass, double youngModulus, double compressiveStrengthCoef, double tensileStrengthCoef, double materialCoefInCompress, double materialCoefInTension) - { - MaterialClass = materialClass; - YoungModulus = youngModulus; - CompressiveStrength = compressiveStrengthCoef; - TensileStrength = tensileStrengthCoef; - MaterialCoefInCompress = materialCoefInCompress; - MaterialCoefInTension = materialCoefInTension; - } - } -} diff --git a/MaterialDefinitions/RebarDefinition.cs b/MaterialDefinitions/RebarDefinition.cs deleted file mode 100644 index 2bbd3e6..0000000 --- a/MaterialDefinitions/RebarDefinition.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MaterialResistanceCalc -{ - public class RebarDefinition : MaterialDefinition - { - public RebarDefinition(string materialClass, double youngModulus, double compressiveStrengthCoef, double tensileStrengthCoef, double materialCoefInCompress, double materialCoefInTension) : base(materialClass, youngModulus, compressiveStrengthCoef, tensileStrengthCoef, materialCoefInCompress, materialCoefInTension) - { - YoungModulus = youngModulus * Math.Pow(10, 11); - CompressiveStrength = compressiveStrengthCoef * Math.Pow(10, 6); - TensileStrength = tensileStrengthCoef * Math.Pow(10, 6); - } - } -} From 02f53bea5c1926042565290d09d7af8b779fdc8e Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Sat, 16 Jul 2022 10:15:48 +0500 Subject: [PATCH 008/107] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B8=D1=82=D0=B8=D0=B2=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D1=82=D0=BE=D1=87=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StructureHelperLogics/Data/Shapes/IPoint.cs | 2 +- .../Models/NdmPrimitives/IPrimitive.cs | 15 ++++++ .../Models/NdmPrimitives/PointPrimitive.cs | 50 +++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs create mode 100644 StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs diff --git a/StructureHelperLogics/Data/Shapes/IPoint.cs b/StructureHelperLogics/Data/Shapes/IPoint.cs index 998be59..fe39f04 100644 --- a/StructureHelperLogics/Data/Shapes/IPoint.cs +++ b/StructureHelperLogics/Data/Shapes/IPoint.cs @@ -6,6 +6,6 @@ namespace StructureHelperLogics.Data.Shapes { public interface IPoint : IShape { - double Area { get; } + double Area { get; set; } } } diff --git a/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs b/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs new file mode 100644 index 0000000..0ed9ac9 --- /dev/null +++ b/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs @@ -0,0 +1,15 @@ +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Entities; +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureHelperLogics.Models.NdmPrimitives +{ + public interface IPrimitive + { + ICenter Center { get;} + IShape Shape { get;} + INdmPrimitive GetNdmPrimitive(); + } +} diff --git a/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs b/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs new file mode 100644 index 0000000..e824ed9 --- /dev/null +++ b/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs @@ -0,0 +1,50 @@ +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 + { + 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; + } + } + + public PointPrimitive(ICenter center, IShape shape) + { + _center = center; + _shape = shape; + } + public 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; + } + } +} From ac40c10bb71bc87fd8ae819428c7291f6e24c1a3 Mon Sep 17 00:00:00 2001 From: NickAppLab Date: Tue, 19 Jul 2022 00:01:22 +0500 Subject: [PATCH 009/107] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3,=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=B9=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B8=D1=82=D0=B8?= =?UTF-8?q?=D0=B2=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/Enums/PrimitiveType.cs | 2 +- .../UI/DataContexts/{Ellipse.cs => Point.cs} | 11 ++--- .../UI/DataContexts/PrimitiveBase.cs | 40 +++++++++---------- Infrastructure/UI/DataContexts/Rectangle.cs | 11 +---- .../UI/DataTemplates/EllipseTemplate.xaml.cs | 3 +- .../DataTemplates/RectangleTemplate.xaml.cs | 3 +- .../UI/UserControls/PrimitivePopup.xaml | 2 +- .../MaterialCatalogView.xaml.cs | 4 +- StructureHelper.csproj | 2 +- StructureHelperLogics/Data/Shapes/Center.cs | 6 +-- StructureHelperLogics/Data/Shapes/ICenter.cs | 6 +-- .../Data/Shapes/ICenterShape.cs | 6 +-- StructureHelperLogics/Data/Shapes/ICircle.cs | 6 +-- StructureHelperLogics/Data/Shapes/IPoint.cs | 6 +-- .../Data/Shapes/IRectangle.cs | 6 +-- StructureHelperLogics/Data/Shapes/IShape.cs | 6 +-- StructureHelperLogics/Data/Shapes/Point.cs | 6 +-- .../Data/Shapes/Rectangle.cs | 6 +-- .../Infrastructures/CommonEnums/CalcTerms.cs | 6 +-- .../CommonEnums/LimitStates.cs | 6 +-- .../Models/NdmPrimitives/IPrimitive.cs | 7 +--- .../Models/NdmPrimitives/PointPrimitive.cs | 30 +++----------- .../Models/NdmPrimitives/PrimitiveBase.cs | 22 ++++++++++ .../NdmPrimitives/RectanglePrimitive.cs | 31 ++++++++++++++ .../NdmCalculations/Entities/INdmPrimitive.cs | 3 -- .../NdmCalculations/Entities/NdmPrimitive.cs | 3 -- .../Materials/IPrimitiveMaterial.cs | 6 +-- .../Materials/MaterialTypes.cs | 6 +-- .../Materials/PrimitiveMaterial.cs | 2 - .../IPointTriangulationLogic.cs | 6 +-- .../IPointTriangulationLogicOptions.cs | 3 -- .../IRectangleTriangulationLogic.cs | 6 +-- .../IRectangleTriangulationLogicOptions.cs | 3 -- .../Triangulations/ITriangulationLogic.cs | 4 +- .../ITriangulationLogicOptions.cs | 6 +-- .../Triangulations/ITriangulationOptions.cs | 3 -- .../Triangulations/PointTriangulationLogic.cs | 1 - .../PointTriangulationLogicOptions.cs | 3 -- .../RectangleTriangulationLogic.cs | 1 - .../RectangleTriangulationLogicOptions.cs | 2 - .../Triangulations/Triangulation.cs | 1 - .../Triangulations/TriangulationOptions.cs | 3 -- .../ColorPickerWindow/ColorPickerView.xaml.cs | 4 +- Windows/MainWindow/MainView.xaml | 2 +- Windows/MainWindow/MainViewModel.cs | 26 ++++++------ 45 files changed, 123 insertions(+), 205 deletions(-) rename Infrastructure/UI/DataContexts/{Ellipse.cs => Point.cs} (77%) create mode 100644 StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs create mode 100644 StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs diff --git a/Infrastructure/Enums/PrimitiveType.cs b/Infrastructure/Enums/PrimitiveType.cs index 6cd5693..7cf1ab0 100644 --- a/Infrastructure/Enums/PrimitiveType.cs +++ b/Infrastructure/Enums/PrimitiveType.cs @@ -2,7 +2,7 @@ { public enum PrimitiveType { - Ellipse, + Point, Rectangle } } \ No newline at end of file diff --git a/Infrastructure/UI/DataContexts/Ellipse.cs b/Infrastructure/UI/DataContexts/Point.cs similarity index 77% rename from Infrastructure/UI/DataContexts/Ellipse.cs rename to Infrastructure/UI/DataContexts/Point.cs index 5cc82b2..e6c34ac 100644 --- a/Infrastructure/UI/DataContexts/Ellipse.cs +++ b/Infrastructure/UI/DataContexts/Point.cs @@ -1,7 +1,5 @@ using System; -using System.Windows.Media; using StructureHelper.Infrastructure.Enums; -using StructureHelper.Models.Materials; using StructureHelper.Windows.MainWindow; using StructureHelperLogics.Data.Shapes; using StructureHelperLogics.NdmCalculations.Entities; @@ -9,7 +7,7 @@ using StructureHelperLogics.NdmCalculations.Materials; namespace StructureHelper.Infrastructure.UI.DataContexts { - public class Ellipse : PrimitiveBase + public class Point : PrimitiveBase { private double square; public double Square @@ -24,7 +22,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts } } - public Ellipse(double square, double ellipseX, double ellipseY, MainViewModel mainViewModel) : base(PrimitiveType.Ellipse, ellipseX, ellipseY, mainViewModel) + public Point(double square, double x, double y, MainViewModel mainViewModel) : base(PrimitiveType.Point, x, y, mainViewModel) { Square = square; ShowedX = 0; @@ -39,13 +37,10 @@ namespace StructureHelper.Infrastructure.UI.DataContexts double area = 0; string materialName = "s400"; ICenter center = new Center() { X = centerX, Y = centerY }; - IShape shape = new Point() { Area = area }; + IShape shape = new StructureHelperLogics.Data.Shapes.Point() { Area = area }; IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ; INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial }; return ndmPrimitive; } - - public override Point MapToShape() - => new Point {Area = Square}; } } diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs index 8a9c6bc..5937084 100644 --- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs +++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs @@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Materials; namespace StructureHelper.Infrastructure.UI.DataContexts { - public abstract class PrimitiveBase : ViewModelBase where T : StructureHelperLogics.Data.Shapes.IShape + public abstract class PrimitiveBase: ViewModelBase { #region Поля @@ -163,7 +163,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts public ICommand PrimitiveLeftButtonDown { get; } public ICommand PrimitiveLeftButtonUp { get; } public ICommand RectanglePreviewMouseMove { get; } - public ICommand EllipsePreviewMouseMove { get; } + public ICommand PointPreviewMouseMove { get; } public ICommand PrimitiveDoubleClick { get; } #endregion @@ -208,30 +208,30 @@ namespace StructureHelper.Infrastructure.UI.DataContexts //ElementLock = rect.ElementLock; } }); - EllipsePreviewMouseMove = new RelayCommand(o => + PointPreviewMouseMove = new RelayCommand(o => { - if (!(o is Ellipse ellipse)) return; - if (ellipse.Captured && !ellipse.ElementLock) + if (!(o is Point point)) return; + if (point.Captured && !point.ElementLock) { - var ellipseDelta = ellipse.PrimitiveWidth / 2; + var pointDelta = point.PrimitiveWidth / 2; - if (ellipse.ShowedX % 10 <= ellipseDelta || ellipse.ShowedX % 10 >= 10 - ellipseDelta) - ellipse.ShowedX = Math.Round((mainViewModel.PanelX - Yx1) / 10) * 10; + if (point.ShowedX % 10 <= pointDelta || point.ShowedX % 10 >= 10 - pointDelta) + point.ShowedX = Math.Round((mainViewModel.PanelX - Yx1) / 10) * 10; else - ellipse.ShowedX = mainViewModel.PanelX - ellipseDelta - Yx1; + point.ShowedX = mainViewModel.PanelX - pointDelta - Yx1; - if (ellipse.ShowedY % 10 <= ellipseDelta || ellipse.ShowedY % 10 >= 10 - ellipseDelta) - ellipse.ShowedY = -(Math.Round((mainViewModel.PanelY - Xy1) / 10) * 10); + if (point.ShowedY % 10 <= pointDelta || point.ShowedY % 10 >= 10 - pointDelta) + point.ShowedY = -(Math.Round((mainViewModel.PanelY - Xy1) / 10) * 10); else - ellipse.ShowedY = -(mainViewModel.PanelY - ellipseDelta - Xy1); + point.ShowedY = -(mainViewModel.PanelY - pointDelta - Xy1); } if (ParameterCaptured) { - //EllipseParameterX = ellipse.ShowedX; - //EllipseParameterY = ellipse.ShowedY; - //EllipseParameterSquare = ellipse.Square; - //ParameterOpacity = ellipse.ShowedOpacity; - //ElementLock = ellipse.ElementLock; + //EllipseParameterX = point.ShowedX; + //EllipseParameterY = point.ShowedY; + //EllipseParameterSquare = point.Square; + //ParameterOpacity = point.ShowedOpacity; + //ElementLock = point.ElementLock; } }); PrimitiveDoubleClick = new RelayCommand(o => @@ -249,12 +249,12 @@ namespace StructureHelper.Infrastructure.UI.DataContexts private void UpdateCoordinatesX(double showedX) { if (Type == PrimitiveType.Rectangle) X = showedX + Yx1; - if (Type == PrimitiveType.Ellipse) X = showedX + Yx1 - PrimitiveWidth / 2; + if (Type == PrimitiveType.Point) X = showedX + Yx1 - PrimitiveWidth / 2; } private void UpdateCoordinatesY(double showedY) { if (Type == PrimitiveType.Rectangle) Y = -showedY + Xy1 - PrimitiveHeight; - if (Type == PrimitiveType.Ellipse) Y = -showedY + Xy1 - PrimitiveWidth / 2; + if (Type == PrimitiveType.Point) Y = -showedY + Xy1 - PrimitiveWidth / 2; } public abstract INdmPrimitive GetNdmPrimitive(); @@ -266,7 +266,5 @@ namespace StructureHelper.Infrastructure.UI.DataContexts else { throw new Exception("MaterialType is unknown"); } return materialTypes; } - - public abstract T MapToShape(); } } diff --git a/Infrastructure/UI/DataContexts/Rectangle.cs b/Infrastructure/UI/DataContexts/Rectangle.cs index ca1fdd8..b655723 100644 --- a/Infrastructure/UI/DataContexts/Rectangle.cs +++ b/Infrastructure/UI/DataContexts/Rectangle.cs @@ -1,16 +1,12 @@ -using System; -using System.Windows.Input; -using System.Windows.Media; -using StructureHelper.Infrastructure.Enums; +using StructureHelper.Infrastructure.Enums; using StructureHelper.Windows.MainWindow; using StructureHelperLogics.Data.Shapes; using StructureHelperLogics.NdmCalculations.Entities; using StructureHelperLogics.NdmCalculations.Materials; -using RectangleShape = StructureHelperLogics.Data.Shapes.Rectangle; namespace StructureHelper.Infrastructure.UI.DataContexts { - public class Rectangle : PrimitiveBase + public class Rectangle : PrimitiveBase { public Rectangle(double primitiveWidth, double primitiveHeight, double rectX, double rectY, MainViewModel mainViewModel) : base(PrimitiveType.Rectangle, rectX, rectY, mainViewModel) { @@ -34,8 +30,5 @@ namespace StructureHelper.Infrastructure.UI.DataContexts INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial }; return ndmPrimitive; } - - public override RectangleShape MapToShape() - => new RectangleShape {Height = PrimitiveHeight, Width = PrimitiveWidth}; } } diff --git a/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml.cs b/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml.cs index c406719..0976c39 100644 --- a/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml.cs +++ b/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml.cs @@ -1,5 +1,4 @@ -using System.Windows; -using System.Windows.Controls; +using System.Windows.Controls; namespace StructureHelper.Infrastructure.UI.DataTemplates { diff --git a/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml.cs b/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml.cs index 4a08178..d5c0561 100644 --- a/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml.cs +++ b/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml.cs @@ -1,5 +1,4 @@ -using System.Windows; -using System.Windows.Controls; +using System.Windows.Controls; namespace StructureHelper.Infrastructure.UI.DataTemplates { diff --git a/Infrastructure/UI/UserControls/PrimitivePopup.xaml b/Infrastructure/UI/UserControls/PrimitivePopup.xaml index 316963c..2a6d966 100644 --- a/Infrastructure/UI/UserControls/PrimitivePopup.xaml +++ b/Infrastructure/UI/UserControls/PrimitivePopup.xaml @@ -75,7 +75,7 @@ - + diff --git a/MaterialCatalogWindow/MaterialCatalogView.xaml.cs b/MaterialCatalogWindow/MaterialCatalogView.xaml.cs index 9f1ea35..64b925a 100644 --- a/MaterialCatalogWindow/MaterialCatalogView.xaml.cs +++ b/MaterialCatalogWindow/MaterialCatalogView.xaml.cs @@ -1,5 +1,5 @@ -using System.Windows; -using StructureHelper.Infrastructure.UI.DataContexts; +using StructureHelper.Infrastructure.UI.DataContexts; +using System.Windows; namespace StructureHelper.MaterialCatalogWindow { diff --git a/StructureHelper.csproj b/StructureHelper.csproj index a53a43f..22861e5 100644 --- a/StructureHelper.csproj +++ b/StructureHelper.csproj @@ -89,7 +89,7 @@ - + diff --git a/StructureHelperLogics/Data/Shapes/Center.cs b/StructureHelperLogics/Data/Shapes/Center.cs index 15a0a06..358144b 100644 --- a/StructureHelperLogics/Data/Shapes/Center.cs +++ b/StructureHelperLogics/Data/Shapes/Center.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperLogics.Data.Shapes { /// public class Center : ICenter diff --git a/StructureHelperLogics/Data/Shapes/ICenter.cs b/StructureHelperLogics/Data/Shapes/ICenter.cs index 0bb3cff..78ed338 100644 --- a/StructureHelperLogics/Data/Shapes/ICenter.cs +++ b/StructureHelperLogics/Data/Shapes/ICenter.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperLogics.Data.Shapes { /// /// Interface for point of center of some shape diff --git a/StructureHelperLogics/Data/Shapes/ICenterShape.cs b/StructureHelperLogics/Data/Shapes/ICenterShape.cs index d855f45..38d19f4 100644 --- a/StructureHelperLogics/Data/Shapes/ICenterShape.cs +++ b/StructureHelperLogics/Data/Shapes/ICenterShape.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperLogics.Data.Shapes { public interface ICenterShape { diff --git a/StructureHelperLogics/Data/Shapes/ICircle.cs b/StructureHelperLogics/Data/Shapes/ICircle.cs index 7adf5ee..8a5ad56 100644 --- a/StructureHelperLogics/Data/Shapes/ICircle.cs +++ b/StructureHelperLogics/Data/Shapes/ICircle.cs @@ -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 { diff --git a/StructureHelperLogics/Data/Shapes/IPoint.cs b/StructureHelperLogics/Data/Shapes/IPoint.cs index fe39f04..7df8127 100644 --- a/StructureHelperLogics/Data/Shapes/IPoint.cs +++ b/StructureHelperLogics/Data/Shapes/IPoint.cs @@ -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 { diff --git a/StructureHelperLogics/Data/Shapes/IRectangle.cs b/StructureHelperLogics/Data/Shapes/IRectangle.cs index c035e1c..255cf63 100644 --- a/StructureHelperLogics/Data/Shapes/IRectangle.cs +++ b/StructureHelperLogics/Data/Shapes/IRectangle.cs @@ -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 { diff --git a/StructureHelperLogics/Data/Shapes/IShape.cs b/StructureHelperLogics/Data/Shapes/IShape.cs index 71f6a08..6d32153 100644 --- a/StructureHelperLogics/Data/Shapes/IShape.cs +++ b/StructureHelperLogics/Data/Shapes/IShape.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperLogics.Data.Shapes { public interface IShape { diff --git a/StructureHelperLogics/Data/Shapes/Point.cs b/StructureHelperLogics/Data/Shapes/Point.cs index a53ce97..0a4a124 100644 --- a/StructureHelperLogics/Data/Shapes/Point.cs +++ b/StructureHelperLogics/Data/Shapes/Point.cs @@ -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 { diff --git a/StructureHelperLogics/Data/Shapes/Rectangle.cs b/StructureHelperLogics/Data/Shapes/Rectangle.cs index 05a9663..cd3fce7 100644 --- a/StructureHelperLogics/Data/Shapes/Rectangle.cs +++ b/StructureHelperLogics/Data/Shapes/Rectangle.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperLogics.Data.Shapes { /// public class Rectangle : IRectangle diff --git a/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs b/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs index 2046c9d..19bec6b 100644 --- a/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs +++ b/StructureHelperLogics/Infrastructures/CommonEnums/CalcTerms.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.Infrastructures.CommonEnums +namespace StructureHelperLogics.Infrastructures.CommonEnums { public enum CalcTerms { diff --git a/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs b/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs index 3ded8d5..fb53187 100644 --- a/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs +++ b/StructureHelperLogics/Infrastructures/CommonEnums/LimitStates.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.Infrastructures.CommonEnums +namespace StructureHelperLogics.Infrastructures.CommonEnums { public enum LimitStates { diff --git a/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs b/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs index 0ed9ac9..944a386 100644 --- a/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs +++ b/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs @@ -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(); } } diff --git a/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs b/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs index e824ed9..513cb6d 100644 --- a/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs +++ b/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs @@ -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 { - 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"; diff --git a/StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs b/StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs new file mode 100644 index 0000000..089d110 --- /dev/null +++ b/StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs @@ -0,0 +1,22 @@ +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Entities; + +namespace StructureHelperLogics.Models.NdmPrimitives +{ + public abstract class PrimitiveBase : 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(); + } +} diff --git a/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs b/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs new file mode 100644 index 0000000..3467fd5 --- /dev/null +++ b/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs @@ -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 + { + 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; + } + } +} diff --git a/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs b/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs index 520ae44..7c42182 100644 --- a/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs +++ b/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs @@ -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 { diff --git a/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs b/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs index 6cd643b..74988d0 100644 --- a/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs +++ b/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs @@ -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 { diff --git a/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs b/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs index 9b37530..b0307ff 100644 --- a/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs +++ b/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.NdmCalculations.Materials +namespace StructureHelperLogics.NdmCalculations.Materials { public interface IPrimitiveMaterial { diff --git a/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs b/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs index 6b76a13..487bcc7 100644 --- a/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs +++ b/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.NdmCalculations.Materials +namespace StructureHelperLogics.NdmCalculations.Materials { public enum MaterialTypes { diff --git a/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs b/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs index 70864e6..4c45b3b 100644 --- a/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs +++ b/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace StructureHelperLogics.NdmCalculations.Materials { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogic.cs index b3d7a8d..16f3c63 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogic.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.NdmCalculations.Triangulations +namespace StructureHelperLogics.NdmCalculations.Triangulations { interface IPointTriangulationLogic : ITriangulationLogic { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs index 10fe244..24c8b6a 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs @@ -1,7 +1,4 @@ using StructureHelperLogics.Data.Shapes; -using System; -using System.Collections.Generic; -using System.Text; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs index e0dd3bd..f2d285d 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogic.cs @@ -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 { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs index 24f2555..82004e3 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs @@ -1,7 +1,4 @@ using StructureHelperLogics.Data.Shapes; -using System; -using System.Collections.Generic; -using System.Text; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs index 15bba04..ad313e1 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogic.cs @@ -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; diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs index e759866..9abe4ec 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationLogicOptions.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StructureHelperLogics.NdmCalculations.Triangulations +namespace StructureHelperLogics.NdmCalculations.Triangulations { public interface ITriangulationLogicOptions { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs index 384e40b..23c47c3 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/ITriangulationOptions.cs @@ -1,7 +1,4 @@ using StructureHelperLogics.Infrastructures.CommonEnums; -using System; -using System.Collections.Generic; -using System.Text; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs index 49d53c2..99b413d 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs @@ -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 { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs index c2d7c5e..254b187 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs @@ -1,7 +1,4 @@ using StructureHelperLogics.Data.Shapes; -using System; -using System.Collections.Generic; -using System.Text; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs index f732d76..7297316 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogic.cs @@ -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 diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs index 59455e1..e33ee89 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs @@ -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 { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs index b452d87..786d0c7 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs @@ -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; diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs index d13b47b..90ad22a 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/TriangulationOptions.cs @@ -1,7 +1,4 @@ using StructureHelperLogics.Infrastructures.CommonEnums; -using System; -using System.Collections.Generic; -using System.Text; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/Windows/ColorPickerWindow/ColorPickerView.xaml.cs b/Windows/ColorPickerWindow/ColorPickerView.xaml.cs index df08018..655447a 100644 --- a/Windows/ColorPickerWindow/ColorPickerView.xaml.cs +++ b/Windows/ColorPickerWindow/ColorPickerView.xaml.cs @@ -1,5 +1,5 @@ -using System.Windows; -using StructureHelper.Infrastructure.UI.DataContexts; +using StructureHelper.Infrastructure.UI.DataContexts; +using System.Windows; namespace StructureHelper.Windows.ColorPickerWindow { diff --git a/Windows/MainWindow/MainView.xaml b/Windows/MainWindow/MainView.xaml index 149ed70..d74f54f 100644 --- a/Windows/MainWindow/MainView.xaml +++ b/Windows/MainWindow/MainView.xaml @@ -19,7 +19,7 @@ - + diff --git a/Windows/MainWindow/MainViewModel.cs b/Windows/MainWindow/MainViewModel.cs index b27b5dd..f1b9f62 100644 --- a/Windows/MainWindow/MainViewModel.cs +++ b/Windows/MainWindow/MainViewModel.cs @@ -75,23 +75,23 @@ namespace StructureHelper.Windows.MainWindow } } - private double ellipseParameterX, ellipseParameterY, ellipseParameterSquare; + private double pointParameterX, pointParameterY, pointParameterSquare; public double EllipseParameterX { - get => ellipseParameterX; - set => OnPropertyChanged(value, ref ellipseParameterX); + get => pointParameterX; + set => OnPropertyChanged(value, ref pointParameterX); } public double EllipseParameterY { - get => ellipseParameterY; - set => OnPropertyChanged(value, ref ellipseParameterY); + get => pointParameterY; + set => OnPropertyChanged(value, ref pointParameterY); } public double EllipseParameterSquare { - get => ellipseParameterSquare; - set => OnPropertyChanged(value, ref ellipseParameterSquare); + get => pointParameterSquare; + set => OnPropertyChanged(value, ref pointParameterSquare); } private bool elementLock; public bool ElementLock @@ -237,10 +237,10 @@ namespace StructureHelper.Windows.MainWindow rectangle.PrimitiveWidth = RectParameterWidth; rectangle.PrimitiveHeight = RectParameterHeight; break; - case Ellipse ellipse: - ellipse.Square = EllipseParameterSquare; - ellipse.ShowedX = EllipseParameterX; - ellipse.ShowedY = EllipseParameterY; + case Point point: + point.Square = EllipseParameterSquare; + point.ShowedX = EllipseParameterX; + point.ShowedY = EllipseParameterY; break; } } @@ -312,8 +312,8 @@ namespace StructureHelper.Windows.MainWindow }); AddEllipse = new RelayCommand(o => { - var ellipse = new Ellipse(2000, YX1, XY1, this); - Primitives.Add(ellipse); + var point = new Point(2000, YX1, XY1, this); + Primitives.Add(point); PrimitivesCount = Primitives.Count; }); From 47dc9617c30ccb98f08d2ccfe60ab4b176f222e2 Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Wed, 20 Jul 2022 20:21:49 +0500 Subject: [PATCH 010/107] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20=D0=B1?= =?UTF-8?q?=D0=B5=D1=82=D0=BE=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BF=D1=80?= =?UTF-8?q?=D1=8F=D0=BC=D0=BE=D1=83=D0=B3=D0=BE=D0=BB=D1=8C=D0=BD=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/NdmPrimitives/PointPrimitive.cs | 2 +- .../NdmPrimitives/RectanglePrimitive.cs | 8 +- .../RCSectionFromNdmPrimitiveTest.cs | 85 +++++++++++++++++++ .../Ndms/RCSections/RCSectionTest.cs | 4 +- .../StructureHelperTests.csproj | 1 + 5 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionFromNdmPrimitiveTest.cs diff --git a/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs b/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs index 513cb6d..4985a6a 100644 --- a/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs +++ b/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs @@ -15,7 +15,7 @@ namespace StructureHelperLogics.Models.NdmPrimitives public PointPrimitive(ICenter center, IPoint shape) : base(center, shape) { } public override INdmPrimitive GetNdmPrimitive() { - double strength = 400; + 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 }; diff --git a/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs b/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs index 3467fd5..4d18109 100644 --- a/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs +++ b/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs @@ -16,16 +16,16 @@ namespace StructureHelperLogics.Models.NdmPrimitives public override INdmPrimitive GetNdmPrimitive() { - double strength = 400; - string materialName = "s400"; + 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 }; + INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = _center, Shape = _shape, PrimitiveMaterial = primitiveMaterial, NdmMaxSize = 1, NdmMinDivision = 20 }; return ndmPrimitive; } private MaterialTypes GetMaterialTypes() { - return MaterialTypes.Reinforcement; + return MaterialTypes.Concrete; } } } diff --git a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionFromNdmPrimitiveTest.cs b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionFromNdmPrimitiveTest.cs new file mode 100644 index 0000000..4a04d53 --- /dev/null +++ b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionFromNdmPrimitiveTest.cs @@ -0,0 +1,85 @@ +using LoaderCalculator; +using LoaderCalculator.Data.Materials; +using LoaderCalculator.Data.Matrix; +using LoaderCalculator.Data.Ndms; +using LoaderCalculator.Data.SourceData; +using LoaderCalculator.Tests.Infrastructures.Logics; +using NUnit.Framework; +using StructureHelperLogics.Data.Shapes; +using StructureHelperLogics.NdmCalculations.Entities; +using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperLogics.NdmCalculations.Triangulations; +using System.Collections.Generic; +using System.Threading; +using StructureHelperLogics.Models.NdmPrimitives; + +namespace StructureHelperTests.FunctionalTests.Ndms.RCSections +{ + //В тесте создается 1 прямоугольник размером 400х600мм (0.4х0.6м). + //Материал прямоугольника - бетон, пока задается жестко в модели прямоугольника, надо сделать чтобы редактировалось через материалы + //Также создается 4 точки, соответствующие арматуре, материал - арматура, также пока жестко задается в свойствах точки + //Входными параметрами являтся 3 параметра усилий - Mx, My, Nz + //Выходными параметрами являются 3 параметра перемещений - Kx, Ky, EpsilonZ + // + public class RCSectionFromNdmPrimitiveTest + { + //Theoretical limit momemt Mx = 43kN*m + [TestCase(0.000113, 0.000494, 10e3, 0d, 0d, 0.00084665917358052976d, 0.0d, 0.00020754144937701132d)] + [TestCase(0.000113, 0.000494, 40e3, 0d, 0d, 0.0033939850380287412d, 0d, 0.00082989880025069202d)] + [TestCase(0.000113, 0.000494, 42e3, 0d, 0d, 0.0056613831873867241d, 0d, 0.0014291081844183839d)] + //Theoretical limit momemt Mx = -187kN*m + [TestCase(0.000113, 0.000494, -50e3, 0d, 0d, -0.0011229555729294297d, 0d, 0.00021353225742956321d)] + [TestCase(0.000113, 0.000494, -180e3, 0d, 0d, -0.0098365950945499738d, 0d, 0.0022035516889170013d)] + [TestCase(0.000113, 0.000494, -183e3, 0d, 0d, -0.021718635290382458d, 0d, 0.0053526701372818789d)] + public void Run_ShouldPass(double topArea, double bottomArea, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ) + { + //Arrange + double width = 0.4; + double height = 0.6; + //Коллекция для хранения элементарных участков + var ndmCollection = new List(); + //Настройки триангуляции, пока опции могут быть только такие + ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; + var ndmPrimitives = new List(); + //Добавляем прямоугольник бетонного сечения + var concreteRectangle = new RectanglePrimitive(new Center() { X = 0, Y = 0 }, new Rectangle() { Width = width, Height = height, Angle = 0 }); + ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive()); + //Добавляем 4 точки для арматуры + // 0.05 - величина защитного слоя (расстояние от грани прямоугольника до центра арматуры + //С площадью нижней арматуры + var leftBottomReinforcementPoint = new PointPrimitive(new Center() { X = -width / 2 + 0.05d, Y = -height / 2 + 0.05 }, new Point() { Area = bottomArea }); + ndmPrimitives.Add(leftBottomReinforcementPoint.GetNdmPrimitive()); + var rightBottomReinforcementPoint = new PointPrimitive(new Center() { X = width / 2 - 0.05d, Y = -height / 2 + 0.05 }, new Point() { Area = bottomArea }); + ndmPrimitives.Add(rightBottomReinforcementPoint.GetNdmPrimitive()); + //С площадью верхней арматуры + var leftTopReinforcementPoint = new PointPrimitive(new Center() { X = -width / 2 + 0.05d, Y = height / 2 - 0.05 }, new Point() { Area = topArea }); + ndmPrimitives.Add(leftTopReinforcementPoint.GetNdmPrimitive()); + var rightTopReinforcementPoint = new PointPrimitive(new Center() { X = width / 2 - 0.05d, Y = height / 2 - 0.05 }, new Point() { Area = topArea }); + ndmPrimitives.Add(rightTopReinforcementPoint.GetNdmPrimitive()); + //Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию) + ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options)); + var loaderData = new LoaderOptions + { + Preconditions = new Preconditions + { + ConditionRate = 0.01, + MaxIterationCount = 100, + StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz } + }, + NdmCollection = ndmCollection + }; + var calculator = new Calculator(); + //Act + calculator.Run(loaderData, new CancellationToken()); + var results = calculator.Result; + //Assert + Assert.NotNull(results); + //Основной результат расчета - матрица (матрица-столбец) деформаций, состоящая из трех членов + var strainMatrix = results.StrainMatrix; + Assert.NotNull(strainMatrix); + Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx)); + Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy)); + Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ)); + } + } +} diff --git a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs index 939c52f..bf02474 100644 --- a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs +++ b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs @@ -64,7 +64,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections ICenter center = new Center() { X = 0, Y = 0 }; IRectangle rectangle = new Rectangle() { Width = width, Height = height, Angle = 0 }; IPrimitiveMaterial material = new PrimitiveMaterial() { MaterialType = MaterialTypes.Concrete, ClassName = "С40", Strength = strength }; - ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; + //ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; INdmPrimitive primitive = new NdmPrimitive() { Center = center, Shape = rectangle, PrimitiveMaterial = material, NdmMaxSize = 1, NdmMinDivision = 20 }; List primitives = new List {primitive}; return primitives; @@ -77,7 +77,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections IShape topReinforcement = new Point() { Area = topArea }; IShape bottomReinforcement = new Point() { Area = bottomArea }; IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = MaterialTypes.Reinforcement, ClassName = "S400", Strength = strength }; - ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; + //ITriangulationOptions options = new TriangulationOptions() { LimiteState = StructureHelperLogics.Infrastructures.CommonEnums.LimitStates.Collapse, CalcTerm = StructureHelperLogics.Infrastructures.CommonEnums.CalcTerms.ShortTerm }; ICenter centerRT = new Center() { X = width / 2 - gap, Y = height / 2 - gap }; ICenter centerLT = new Center() { X = - (width / 2 - gap), Y = height / 2 - gap }; ICenter centerRB = new Center() { X = width / 2 - gap, Y = - (height / 2 - gap) }; diff --git a/StructureHelperTests/StructureHelperTests.csproj b/StructureHelperTests/StructureHelperTests.csproj index d41ee1e..6776db4 100644 --- a/StructureHelperTests/StructureHelperTests.csproj +++ b/StructureHelperTests/StructureHelperTests.csproj @@ -39,6 +39,7 @@ 4 + From d9cb4fe3b8d577001e9e42297f5a623036b9fd13 Mon Sep 17 00:00:00 2001 From: NickAppLab Date: Tue, 26 Jul 2022 03:53:57 +0500 Subject: [PATCH 011/107] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=D1=8B?= =?UTF-8?q?=20CalculationService,=20PrimitiveService,=20Common-=D1=81?= =?UTF-8?q?=D0=B1=D0=BE=D1=80=D0=BA=D0=B0=20=D1=81=20=D1=82=D0=B8=D0=BF?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Необходимо реализовать в дальнейшем GetInnerPoints в PrimitiveService --- App.config | 14 +++- App.xaml.cs | 22 ++++++ Infrastructure/UI/DataContexts/Point.cs | 14 ++-- .../UI/DataContexts/PrimitiveBase.cs | 4 +- Infrastructure/UI/DataContexts/Rectangle.cs | 8 +- Services/PrimitiveService.cs | 75 +++++++++++++++++++ StructureHelper.csproj | 39 +++++++++- StructureHelper.sln | 10 ++- .../Models}/Entities/INdmPrimitive.cs | 6 +- .../Models}/Entities/NdmPrimitive.cs | 6 +- .../Models}/Materials/IPrimitiveMaterial.cs | 2 +- .../Models}/Materials/MaterialTypes.cs | 2 +- .../Models}/Materials/PrimitiveMaterial.cs | 2 +- .../Models/NdmPrimitives/IPrimitive.cs | 10 +++ .../Models/NdmPrimitives/PointPrimitive.cs | 8 +- .../Models/NdmPrimitives/PrimitiveBase.cs | 8 +- .../NdmPrimitives/RectanglePrimitive.cs | 8 +- .../Models}/Shapes/Center.cs | 2 +- .../Models}/Shapes/ICenter.cs | 2 +- .../Models}/Shapes/ICenterShape.cs | 2 +- .../Models}/Shapes/ICircle.cs | 2 +- .../Models}/Shapes/IPoint.cs | 2 +- .../Models}/Shapes/IRectangle.cs | 2 +- StructureHelperCommon/Models/Shapes/IShape.cs | 6 ++ .../Models}/Shapes/Point.cs | 2 +- .../Models}/Shapes/Rectangle.cs | 2 +- .../Properties/AssemblyInfo.cs | 36 +++++++++ .../StructureHelperCommon.csproj | 66 ++++++++++++++++ StructureHelperLogics/Data/Shapes/IShape.cs | 6 -- .../Models/NdmPrimitives/IPrimitive.cs | 10 --- .../IPointTriangulationLogicOptions.cs | 2 +- .../IRectangleTriangulationLogicOptions.cs | 2 +- .../Triangulations/PointTriangulationLogic.cs | 2 +- .../PointTriangulationLogicOptions.cs | 2 +- .../RectangleTriangulationLogicOptions.cs | 6 +- .../Triangulations/Triangulation.cs | 6 +- .../Services/CalculationService.cs | 67 +++++++++++++++++ .../StructureHelperLogics.csproj | 9 +++ Windows/MainWindow/MainView.xaml.cs | 10 ++- Windows/MainWindow/MainViewModel.cs | 23 +++--- packages.config | 8 ++ 41 files changed, 426 insertions(+), 89 deletions(-) create mode 100644 Services/PrimitiveService.cs rename {StructureHelperLogics/NdmCalculations => StructureHelperCommon/Models}/Entities/INdmPrimitive.cs (62%) rename {StructureHelperLogics/NdmCalculations => StructureHelperCommon/Models}/Entities/NdmPrimitive.cs (66%) rename {StructureHelperLogics/NdmCalculations => StructureHelperCommon/Models}/Materials/IPrimitiveMaterial.cs (75%) rename {StructureHelperLogics/NdmCalculations => StructureHelperCommon/Models}/Materials/MaterialTypes.cs (67%) rename {StructureHelperLogics/NdmCalculations => StructureHelperCommon/Models}/Materials/PrimitiveMaterial.cs (86%) create mode 100644 StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs rename {StructureHelperLogics => StructureHelperCommon}/Models/NdmPrimitives/PointPrimitive.cs (81%) rename {StructureHelperLogics => StructureHelperCommon}/Models/NdmPrimitives/PrimitiveBase.cs (64%) rename {StructureHelperLogics => StructureHelperCommon}/Models/NdmPrimitives/RectanglePrimitive.cs (82%) rename {StructureHelperLogics/Data => StructureHelperCommon/Models}/Shapes/Center.cs (80%) rename {StructureHelperLogics/Data => StructureHelperCommon/Models}/Shapes/ICenter.cs (93%) rename {StructureHelperLogics/Data => StructureHelperCommon/Models}/Shapes/ICenterShape.cs (68%) rename {StructureHelperLogics/Data => StructureHelperCommon/Models}/Shapes/ICircle.cs (65%) rename {StructureHelperLogics/Data => StructureHelperCommon/Models}/Shapes/IPoint.cs (63%) rename {StructureHelperLogics/Data => StructureHelperCommon/Models}/Shapes/IRectangle.cs (89%) create mode 100644 StructureHelperCommon/Models/Shapes/IShape.cs rename {StructureHelperLogics/Data => StructureHelperCommon/Models}/Shapes/Point.cs (64%) rename {StructureHelperLogics/Data => StructureHelperCommon/Models}/Shapes/Rectangle.cs (85%) create mode 100644 StructureHelperCommon/Properties/AssemblyInfo.cs create mode 100644 StructureHelperCommon/StructureHelperCommon.csproj delete mode 100644 StructureHelperLogics/Data/Shapes/IShape.cs delete mode 100644 StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs create mode 100644 StructureHelperLogics/Services/CalculationService.cs diff --git a/App.config b/App.config index 56efbc7..d089989 100644 --- a/App.config +++ b/App.config @@ -1,6 +1,14 @@ - + - + - \ No newline at end of file + + + + + + + + + diff --git a/App.xaml.cs b/App.xaml.cs index a696ce9..835413f 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -1,4 +1,7 @@ using System.Windows; +using Autofac; +using StructureHelper.Services; +using StructureHelper.Windows.MainWindow; namespace StructureHelper { @@ -7,5 +10,24 @@ namespace StructureHelper /// public partial class App : Application { + public static IContainer Container { get; private set; } + protected override void OnStartup(StartupEventArgs e) + { + var builder = new ContainerBuilder(); + builder.RegisterType().As(); + builder.RegisterType().As(); + builder.RegisterType().AsSelf(); + builder.RegisterType().AsSelf(); + + builder.RegisterType().AsSelf(); + + Container = builder.Build(); + + using (var scope = Container.BeginLifetimeScope()) + { + var window = scope.Resolve(); + window.ShowDialog(); + } + } } } diff --git a/Infrastructure/UI/DataContexts/Point.cs b/Infrastructure/UI/DataContexts/Point.cs index e6c34ac..d7632f7 100644 --- a/Infrastructure/UI/DataContexts/Point.cs +++ b/Infrastructure/UI/DataContexts/Point.cs @@ -1,9 +1,9 @@ using System; using StructureHelper.Infrastructure.Enums; using StructureHelper.Windows.MainWindow; -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; -using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Materials; +using StructureHelperCommon.Models.Shapes; namespace StructureHelper.Infrastructure.UI.DataContexts { @@ -36,10 +36,10 @@ namespace StructureHelper.Infrastructure.UI.DataContexts double centerY = 0; double area = 0; string materialName = "s400"; - ICenter center = new Center() { X = centerX, Y = centerY }; - IShape shape = new StructureHelperLogics.Data.Shapes.Point() { Area = area }; - IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ; - INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial }; + ICenter center = new Center { X = centerX, Y = centerY }; + IShape shape = new StructureHelperCommon.Models.Shapes.Point { Area = area }; + IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ; + INdmPrimitive ndmPrimitive = new NdmPrimitive { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial }; return ndmPrimitive; } } diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs index 5937084..bfed87c 100644 --- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs +++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs @@ -4,8 +4,8 @@ using System.Windows.Media; using StructureHelper.Infrastructure.Enums; using StructureHelper.Models.Materials; using StructureHelper.Windows.MainWindow; -using StructureHelperLogics.NdmCalculations.Entities; -using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Materials; namespace StructureHelper.Infrastructure.UI.DataContexts { diff --git a/Infrastructure/UI/DataContexts/Rectangle.cs b/Infrastructure/UI/DataContexts/Rectangle.cs index b655723..7fa02b3 100644 --- a/Infrastructure/UI/DataContexts/Rectangle.cs +++ b/Infrastructure/UI/DataContexts/Rectangle.cs @@ -1,8 +1,8 @@ using StructureHelper.Infrastructure.Enums; using StructureHelper.Windows.MainWindow; -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; -using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Materials; +using StructureHelperCommon.Models.Shapes; namespace StructureHelper.Infrastructure.UI.DataContexts { @@ -25,7 +25,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts ICenter center = new Center() { X = centerX, Y = centerY }; double height = 0; double width = 0; - IShape shape = new StructureHelperLogics.Data.Shapes.Rectangle() { Height = height, Width = width, Angle = 0 }; + IShape shape = new StructureHelperCommon.Models.Shapes.Rectangle() { Height = height, Width = width, Angle = 0 }; IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial() { MaterialType = GetMaterialTypes(), ClassName = materialName, Strength = strength }; ; INdmPrimitive ndmPrimitive = new NdmPrimitive() { Center = center, Shape = shape, PrimitiveMaterial = primitiveMaterial }; return ndmPrimitive; diff --git a/Services/PrimitiveService.cs b/Services/PrimitiveService.cs new file mode 100644 index 0000000..eae3a35 --- /dev/null +++ b/Services/PrimitiveService.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StructureHelper.Infrastructure.UI.DataContexts; +using StructureHelperCommon.Models.NdmPrimitives; +using StructureHelperCommon.Models.Shapes; +using Point = StructureHelper.Infrastructure.UI.DataContexts.Point; +using Rectangle = StructureHelper.Infrastructure.UI.DataContexts.Rectangle; + +namespace StructureHelper.Services +{ + public interface IPrimitiveRepository + { + void Add(PrimitiveBase primitive); + void Delete(PrimitiveBase primitive); + IEnumerable GetPoints(); + IEnumerable GetRectangles(); + } + class PrimitiveRepository : IPrimitiveRepository + { + List points = new List(); + List rectangles = new List(); + + public void Add(PrimitiveBase primitive) + { + switch (primitive) + { + case Point point: + points.Add(point); + break; + case Rectangle rectangle: + rectangles.Add(rectangle); + break; + } + } + public void Delete(PrimitiveBase primitive) + { + switch (primitive) + { + case Point point: + points.Remove(point); + break; + case Rectangle rectangle: + rectangles.Remove(rectangle); + break; + } + } + + public IEnumerable GetPoints() => points; + + public IEnumerable GetRectangles() => rectangles; + } + + public class PrimitiveService : IPrimitiveService + { + IPrimitiveRepository primitiveRepository; + + public PrimitiveService(IPrimitiveRepository primitiveRepository) + { + this.primitiveRepository = primitiveRepository; + } + + public PointPrimitive[] GetInnerPoints(RectanglePrimitive rectanglePrimitive) + { + return new[] { new PointPrimitive(new Center(), new StructureHelperCommon.Models.Shapes.Point()) }; + } + } + + public interface IPrimitiveService + { + PointPrimitive[] GetInnerPoints(RectanglePrimitive rectanglePrimitive); + } +} diff --git a/StructureHelper.csproj b/StructureHelper.csproj index 22861e5..e29a909 100644 --- a/StructureHelper.csproj +++ b/StructureHelper.csproj @@ -8,12 +8,13 @@ WinExe StructureHelper StructureHelper - v4.7.2 + v4.8 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true true + AnyCPU @@ -35,6 +36,16 @@ 4 + + packages\Autofac.6.4.0\lib\netstandard2.0\Autofac.dll + + + False + Libraries\LoaderCalculator.dll + + + packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll + packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll @@ -42,7 +53,26 @@ packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + + packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll + + + packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll + packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\System.Windows.Interactivity.dll @@ -69,6 +99,7 @@ PrimitivePopup.xaml + AddMaterialView.xaml @@ -158,9 +189,9 @@ - - {330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3} - StructureHelperLogics + + {5dfec3fd-9677-47bb-9e88-eb71828b5913} + StructureHelperCommon diff --git a/StructureHelper.sln b/StructureHelper.sln index 9807f81..af32771 100644 --- a/StructureHelper.sln +++ b/StructureHelper.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32002.261 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32630.192 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelper", "StructureHelper.csproj", "{BAD27E27-4444-4300-ADF8-E21042C0781D}" EndProject @@ -12,6 +12,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperTests", "Str EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureHelperLogics", "StructureHelperLogics\StructureHelperLogics.csproj", "{330BEF5B-15BE-4D2C-A750-B1AE50FB2BE3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureHelperCommon", "StructureHelperCommon\StructureHelperCommon.csproj", "{5DFEC3FD-9677-47BB-9E88-EB71828B5913}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -30,6 +32,10 @@ Global {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 + {5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DFEC3FD-9677-47BB-9E88-EB71828B5913}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs b/StructureHelperCommon/Models/Entities/INdmPrimitive.cs similarity index 62% rename from StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs rename to StructureHelperCommon/Models/Entities/INdmPrimitive.cs index 7c42182..34e29fe 100644 --- a/StructureHelperLogics/NdmCalculations/Entities/INdmPrimitive.cs +++ b/StructureHelperCommon/Models/Entities/INdmPrimitive.cs @@ -1,7 +1,7 @@ -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperCommon.Models.Materials; +using StructureHelperCommon.Models.Shapes; -namespace StructureHelperLogics.NdmCalculations.Entities +namespace StructureHelperCommon.Models.Entities { public interface INdmPrimitive { diff --git a/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs b/StructureHelperCommon/Models/Entities/NdmPrimitive.cs similarity index 66% rename from StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs rename to StructureHelperCommon/Models/Entities/NdmPrimitive.cs index 74988d0..627c5f7 100644 --- a/StructureHelperLogics/NdmCalculations/Entities/NdmPrimitive.cs +++ b/StructureHelperCommon/Models/Entities/NdmPrimitive.cs @@ -1,7 +1,7 @@ -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperCommon.Models.Materials; +using StructureHelperCommon.Models.Shapes; -namespace StructureHelperLogics.NdmCalculations.Entities +namespace StructureHelperCommon.Models.Entities { public class NdmPrimitive : INdmPrimitive { diff --git a/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs b/StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs similarity index 75% rename from StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs rename to StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs index b0307ff..881c4c9 100644 --- a/StructureHelperLogics/NdmCalculations/Materials/IPrimitiveMaterial.cs +++ b/StructureHelperCommon/Models/Materials/IPrimitiveMaterial.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.NdmCalculations.Materials +namespace StructureHelperCommon.Models.Materials { public interface IPrimitiveMaterial { diff --git a/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs b/StructureHelperCommon/Models/Materials/MaterialTypes.cs similarity index 67% rename from StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs rename to StructureHelperCommon/Models/Materials/MaterialTypes.cs index 487bcc7..b53a479 100644 --- a/StructureHelperLogics/NdmCalculations/Materials/MaterialTypes.cs +++ b/StructureHelperCommon/Models/Materials/MaterialTypes.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.NdmCalculations.Materials +namespace StructureHelperCommon.Models.Materials { public enum MaterialTypes { diff --git a/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs b/StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs similarity index 86% rename from StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs rename to StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs index 4c45b3b..c39a763 100644 --- a/StructureHelperLogics/NdmCalculations/Materials/PrimitiveMaterial.cs +++ b/StructureHelperCommon/Models/Materials/PrimitiveMaterial.cs @@ -1,6 +1,6 @@ using System; -namespace StructureHelperLogics.NdmCalculations.Materials +namespace StructureHelperCommon.Models.Materials { public class PrimitiveMaterial : IPrimitiveMaterial { diff --git a/StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs b/StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs new file mode 100644 index 0000000..53d260a --- /dev/null +++ b/StructureHelperCommon/Models/NdmPrimitives/IPrimitive.cs @@ -0,0 +1,10 @@ +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Shapes; + +namespace StructureHelperCommon.Models.NdmPrimitives +{ + public interface IPrimitive : ICenterShape + { + INdmPrimitive GetNdmPrimitive(); + } +} diff --git a/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs b/StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs similarity index 81% rename from StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs rename to StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs index 4985a6a..7bdaf6f 100644 --- a/StructureHelperLogics/Models/NdmPrimitives/PointPrimitive.cs +++ b/StructureHelperCommon/Models/NdmPrimitives/PointPrimitive.cs @@ -1,8 +1,8 @@ -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; -using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Materials; +using StructureHelperCommon.Models.Shapes; -namespace StructureHelperLogics.Models.NdmPrimitives +namespace StructureHelperCommon.Models.NdmPrimitives { public class PointPrimitive : PrimitiveBase, IPoint { diff --git a/StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs b/StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs similarity index 64% rename from StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs rename to StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs index 089d110..0af755d 100644 --- a/StructureHelperLogics/Models/NdmPrimitives/PrimitiveBase.cs +++ b/StructureHelperCommon/Models/NdmPrimitives/PrimitiveBase.cs @@ -1,7 +1,7 @@ -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Shapes; -namespace StructureHelperLogics.Models.NdmPrimitives +namespace StructureHelperCommon.Models.NdmPrimitives { public abstract class PrimitiveBase : IPrimitive where T : IShape { @@ -11,7 +11,7 @@ namespace StructureHelperLogics.Models.NdmPrimitives public ICenter Center => _center; public IShape Shape => _shape; - public PrimitiveBase(ICenter center, T shape) + protected PrimitiveBase(ICenter center, T shape) { _center = center; _shape = shape; diff --git a/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs b/StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs similarity index 82% rename from StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs rename to StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs index 4d18109..8b94342 100644 --- a/StructureHelperLogics/Models/NdmPrimitives/RectanglePrimitive.cs +++ b/StructureHelperCommon/Models/NdmPrimitives/RectanglePrimitive.cs @@ -1,8 +1,8 @@ -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; -using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Materials; +using StructureHelperCommon.Models.Shapes; -namespace StructureHelperLogics.Models.NdmPrimitives +namespace StructureHelperCommon.Models.NdmPrimitives { public class RectanglePrimitive : PrimitiveBase, IRectangle { diff --git a/StructureHelperLogics/Data/Shapes/Center.cs b/StructureHelperCommon/Models/Shapes/Center.cs similarity index 80% rename from StructureHelperLogics/Data/Shapes/Center.cs rename to StructureHelperCommon/Models/Shapes/Center.cs index 358144b..74630ce 100644 --- a/StructureHelperLogics/Data/Shapes/Center.cs +++ b/StructureHelperCommon/Models/Shapes/Center.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperCommon.Models.Shapes { /// public class Center : ICenter diff --git a/StructureHelperLogics/Data/Shapes/ICenter.cs b/StructureHelperCommon/Models/Shapes/ICenter.cs similarity index 93% rename from StructureHelperLogics/Data/Shapes/ICenter.cs rename to StructureHelperCommon/Models/Shapes/ICenter.cs index 78ed338..2fb9f90 100644 --- a/StructureHelperLogics/Data/Shapes/ICenter.cs +++ b/StructureHelperCommon/Models/Shapes/ICenter.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperCommon.Models.Shapes { /// /// Interface for point of center of some shape diff --git a/StructureHelperLogics/Data/Shapes/ICenterShape.cs b/StructureHelperCommon/Models/Shapes/ICenterShape.cs similarity index 68% rename from StructureHelperLogics/Data/Shapes/ICenterShape.cs rename to StructureHelperCommon/Models/Shapes/ICenterShape.cs index 38d19f4..00f2531 100644 --- a/StructureHelperLogics/Data/Shapes/ICenterShape.cs +++ b/StructureHelperCommon/Models/Shapes/ICenterShape.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperCommon.Models.Shapes { public interface ICenterShape { diff --git a/StructureHelperLogics/Data/Shapes/ICircle.cs b/StructureHelperCommon/Models/Shapes/ICircle.cs similarity index 65% rename from StructureHelperLogics/Data/Shapes/ICircle.cs rename to StructureHelperCommon/Models/Shapes/ICircle.cs index 8a5ad56..93b181f 100644 --- a/StructureHelperLogics/Data/Shapes/ICircle.cs +++ b/StructureHelperCommon/Models/Shapes/ICircle.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperCommon.Models.Shapes { public interface ICircle : IShape { diff --git a/StructureHelperLogics/Data/Shapes/IPoint.cs b/StructureHelperCommon/Models/Shapes/IPoint.cs similarity index 63% rename from StructureHelperLogics/Data/Shapes/IPoint.cs rename to StructureHelperCommon/Models/Shapes/IPoint.cs index 7df8127..c1077c7 100644 --- a/StructureHelperLogics/Data/Shapes/IPoint.cs +++ b/StructureHelperCommon/Models/Shapes/IPoint.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperCommon.Models.Shapes { public interface IPoint : IShape { diff --git a/StructureHelperLogics/Data/Shapes/IRectangle.cs b/StructureHelperCommon/Models/Shapes/IRectangle.cs similarity index 89% rename from StructureHelperLogics/Data/Shapes/IRectangle.cs rename to StructureHelperCommon/Models/Shapes/IRectangle.cs index 255cf63..5ecbad3 100644 --- a/StructureHelperLogics/Data/Shapes/IRectangle.cs +++ b/StructureHelperCommon/Models/Shapes/IRectangle.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperCommon.Models.Shapes { public interface IRectangle : IShape { diff --git a/StructureHelperCommon/Models/Shapes/IShape.cs b/StructureHelperCommon/Models/Shapes/IShape.cs new file mode 100644 index 0000000..d916974 --- /dev/null +++ b/StructureHelperCommon/Models/Shapes/IShape.cs @@ -0,0 +1,6 @@ +namespace StructureHelperCommon.Models.Shapes +{ + public interface IShape + { + } +} diff --git a/StructureHelperLogics/Data/Shapes/Point.cs b/StructureHelperCommon/Models/Shapes/Point.cs similarity index 64% rename from StructureHelperLogics/Data/Shapes/Point.cs rename to StructureHelperCommon/Models/Shapes/Point.cs index 0a4a124..2bbf5a4 100644 --- a/StructureHelperLogics/Data/Shapes/Point.cs +++ b/StructureHelperCommon/Models/Shapes/Point.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperCommon.Models.Shapes { public class Point : IPoint { diff --git a/StructureHelperLogics/Data/Shapes/Rectangle.cs b/StructureHelperCommon/Models/Shapes/Rectangle.cs similarity index 85% rename from StructureHelperLogics/Data/Shapes/Rectangle.cs rename to StructureHelperCommon/Models/Shapes/Rectangle.cs index cd3fce7..be9d236 100644 --- a/StructureHelperLogics/Data/Shapes/Rectangle.cs +++ b/StructureHelperCommon/Models/Shapes/Rectangle.cs @@ -1,4 +1,4 @@ -namespace StructureHelperLogics.Data.Shapes +namespace StructureHelperCommon.Models.Shapes { /// public class Rectangle : IRectangle diff --git a/StructureHelperCommon/Properties/AssemblyInfo.cs b/StructureHelperCommon/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..27e2e0c --- /dev/null +++ b/StructureHelperCommon/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов для изменения сведений, +// связанные со сборкой. +[assembly: AssemblyTitle("StructureHelperCommon")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("StructureHelperCommon")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, задайте атрибуту ComVisible значение TRUE для этого типа. +[assembly: ComVisible(false)] + +// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM +[assembly: Guid("5dfec3fd-9677-47bb-9e88-eb71828b5913")] + +// Сведения о версии сборки состоят из указанных ниже четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +// Можно задать все значения или принять номера сборки и редакции по умолчанию +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/StructureHelperCommon/StructureHelperCommon.csproj b/StructureHelperCommon/StructureHelperCommon.csproj new file mode 100644 index 0000000..568d6ad --- /dev/null +++ b/StructureHelperCommon/StructureHelperCommon.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {5DFEC3FD-9677-47BB-9E88-EB71828B5913} + Library + Properties + StructureHelperCommon + StructureHelperCommon + v4.8 + 512 + true + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/StructureHelperLogics/Data/Shapes/IShape.cs b/StructureHelperLogics/Data/Shapes/IShape.cs deleted file mode 100644 index 6d32153..0000000 --- a/StructureHelperLogics/Data/Shapes/IShape.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace StructureHelperLogics.Data.Shapes -{ - public interface IShape - { - } -} diff --git a/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs b/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs deleted file mode 100644 index 944a386..0000000 --- a/StructureHelperLogics/Models/NdmPrimitives/IPrimitive.cs +++ /dev/null @@ -1,10 +0,0 @@ -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; - -namespace StructureHelperLogics.Models.NdmPrimitives -{ - public interface IPrimitive : ICenterShape - { - INdmPrimitive GetNdmPrimitive(); - } -} diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs index 24c8b6a..5f6ec96 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IPointTriangulationLogicOptions.cs @@ -1,4 +1,4 @@ -using StructureHelperLogics.Data.Shapes; +using StructureHelperCommon.Models.Shapes; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs index 82004e3..ddfd6a8 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/IRectangleTriangulationLogicOptions.cs @@ -1,4 +1,4 @@ -using StructureHelperLogics.Data.Shapes; +using StructureHelperCommon.Models.Shapes; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs index 99b413d..8500845 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogic.cs @@ -1,8 +1,8 @@ using LoaderCalculator.Data.Materials; using LoaderCalculator.Data.Ndms; -using StructureHelperLogics.Data.Shapes; using System; using System.Collections.Generic; +using StructureHelperCommon.Models.Shapes; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs index 254b187..3f8b36c 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/PointTriangulationLogicOptions.cs @@ -1,4 +1,4 @@ -using StructureHelperLogics.Data.Shapes; +using StructureHelperCommon.Models.Shapes; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs index e33ee89..b941871 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/RectangleTriangulationLogicOptions.cs @@ -1,6 +1,6 @@ -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; -using System; +using System; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Shapes; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs index 786d0c7..4c810fe 100644 --- a/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs +++ b/StructureHelperLogics/NdmCalculations/Triangulations/Triangulation.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using LoaderCalculator.Data.Materials; using LoaderCalculator.Data.Materials.MaterialBuilders; using LoaderCalculator.Data.Ndms; -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; -using StructureHelperLogics.NdmCalculations.Materials; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Materials; +using StructureHelperCommon.Models.Shapes; namespace StructureHelperLogics.NdmCalculations.Triangulations { diff --git a/StructureHelperLogics/Services/CalculationService.cs b/StructureHelperLogics/Services/CalculationService.cs new file mode 100644 index 0000000..259b2b6 --- /dev/null +++ b/StructureHelperLogics/Services/CalculationService.cs @@ -0,0 +1,67 @@ +using Autofac; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using LoaderCalculator; +using LoaderCalculator.Data.Matrix; +using LoaderCalculator.Data.Ndms; +using LoaderCalculator.Data.SourceData; +using StructureHelper; +using StructureHelper.Services; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.NdmPrimitives; +using StructureHelperLogics.NdmCalculations.Triangulations; +using StructureHelperLogics.Infrastructures.CommonEnums; + +namespace StructureHelperLogics.Services +{ + public class CalculationService + { + public IStrainMatrix GetPrimitiveStrainMatrix(double topArea, double bottomArea, RectanglePrimitive concreteRectangle, double mx, double my, double nz) + { + var ndmPrimitives = new List(); + //Добавляем прямоугольник бетонного сечения + + ndmPrimitives.Add(concreteRectangle.GetNdmPrimitive()); + + using (var scope = App.Container.BeginLifetimeScope()) + { + var primitiveService = scope.Resolve(); + //Добавляем точки внутри прямоугольника + ndmPrimitives.AddRange(primitiveService.GetInnerPoints(concreteRectangle).Select(x=>x.GetNdmPrimitive())); + } + + //Коллекция для хранения элементарных участков + var ndmCollection = new List(); + //Настройки триангуляции, пока опции могут быть только такие + ITriangulationOptions options = new TriangulationOptions + { + LimiteState = LimitStates.Collapse, + CalcTerm = CalcTerms.ShortTerm + }; + + //Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию) + ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options)); + + var calculator = new Calculator(); + var calculationData = new LoaderOptions + { + Preconditions = new Preconditions + { + ConditionRate = 0.01, + MaxIterationCount = 100, + StartForceMatrix = new ForceMatrix + { + Mx = mx, + My = my, + Nz = nz + } + }, + NdmCollection = ndmCollection + }; + calculator.Run(calculationData, new CancellationToken()); + var results = calculator.Result; + return results.StrainMatrix; + } + } +} diff --git a/StructureHelperLogics/StructureHelperLogics.csproj b/StructureHelperLogics/StructureHelperLogics.csproj index 325d167..30b7446 100644 --- a/StructureHelperLogics/StructureHelperLogics.csproj +++ b/StructureHelperLogics/StructureHelperLogics.csproj @@ -4,6 +4,15 @@ netstandard2.0 + + + + + + + + + ..\..\StructureHelper\Libraries\LoaderCalculator.dll diff --git a/Windows/MainWindow/MainView.xaml.cs b/Windows/MainWindow/MainView.xaml.cs index 1ec16a6..c714a32 100644 --- a/Windows/MainWindow/MainView.xaml.cs +++ b/Windows/MainWindow/MainView.xaml.cs @@ -1,13 +1,17 @@ using System.Windows; +using StructureHelper.Services; namespace StructureHelper.Windows.MainWindow { public partial class MainView : Window { - public MainView() + public IPrimitiveRepository PrimitiveRepository { get; } + public IPrimitiveService PrimitiveService { get; } + + public MainView(IPrimitiveRepository primitiveRepository, IPrimitiveService primitiveService, MainViewModel viewModel) { - var model = new MainModel(); - var viewModel = new MainViewModel(model, this); + PrimitiveRepository = primitiveRepository; + PrimitiveService = primitiveService; DataContext = viewModel; InitializeComponent(); } diff --git a/Windows/MainWindow/MainViewModel.cs b/Windows/MainWindow/MainViewModel.cs index f1b9f62..1d4fffd 100644 --- a/Windows/MainWindow/MainViewModel.cs +++ b/Windows/MainWindow/MainViewModel.cs @@ -6,14 +6,16 @@ using StructureHelper.Infrastructure; using StructureHelper.Infrastructure.Extensions; using StructureHelper.Infrastructure.UI.DataContexts; using StructureHelper.MaterialCatalogWindow; +using StructureHelper.Services; using StructureHelper.Windows.ColorPickerWindow; namespace StructureHelper.Windows.MainWindow { public class MainViewModel : ViewModelBase { - private MainModel rectanglesModel; - private MainView rectanglesView; + private IPrimitiveService PrimitiveService { get; } + private IPrimitiveRepository PrimitiveRepository { get; } + private MainModel Model { get; } public ObservableCollection Primitives { get; set; } public ICommand AddRectangle { get; } @@ -178,13 +180,12 @@ namespace StructureHelper.Windows.MainWindow public ICommand SetPopupCanBeClosedFalse { get; } private double delta = 0.5; - - - public MainViewModel() { } - public MainViewModel(MainModel rectanglesModel, MainView rectanglesView) + + public MainViewModel(MainModel model, IPrimitiveService primitiveService, IPrimitiveRepository primitiveRepository) { - this.rectanglesModel = rectanglesModel; - this.rectanglesView = rectanglesView; + PrimitiveService = primitiveService; + PrimitiveRepository = primitiveRepository; + Model = model; CanvasWidth = 1500; CanvasHeight = 1000; @@ -304,17 +305,21 @@ namespace StructureHelper.Windows.MainWindow }); Primitives = new ObservableCollection(); + AddRectangle = new RelayCommand(o => { var rectangle = new Rectangle(60, 40, YX1, XY1, this); Primitives.Add(rectangle); PrimitivesCount = Primitives.Count; + PrimitiveRepository.Add(rectangle); }); + AddEllipse = new RelayCommand(o => { var point = new Point(2000, YX1, XY1, this); Primitives.Add(point); PrimitivesCount = Primitives.Count; + PrimitiveRepository.Add(point); }); SetPopupCanBeClosedTrue = new RelayCommand(o => @@ -329,4 +334,4 @@ namespace StructureHelper.Windows.MainWindow }); } } -} +} \ No newline at end of file diff --git a/packages.config b/packages.config index e7d7544..700ac20 100644 --- a/packages.config +++ b/packages.config @@ -1,5 +1,13 @@  + + + + + + + + \ No newline at end of file From 5d2c6a85d73043e49a60f16864cace2aeb7bdaa0 Mon Sep 17 00:00:00 2001 From: NickAppLab Date: Tue, 26 Jul 2022 03:56:59 +0500 Subject: [PATCH 012/107] Tests fix --- .../RCSections/RCSectionFromNdmPrimitiveTest.cs | 8 +++----- .../Ndms/RCSections/RCSectionTest.cs | 7 +++---- .../Ndms/SteelSections/ReinforcementTest.cs | 6 +++--- .../Infrastructures/Logics/ExpectedProcessor.cs | 2 -- .../Ndms/RCSections/RCSectionTest.cs | 4 ---- StructureHelperTests/Properties/AssemblyInfo.cs | 1 - StructureHelperTests/StructureHelperTests.csproj | 7 ++++++- .../Triangulations/RectangleTriangulationTest.cs | 15 +-------------- 8 files changed, 16 insertions(+), 34 deletions(-) diff --git a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionFromNdmPrimitiveTest.cs b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionFromNdmPrimitiveTest.cs index 4a04d53..307e58e 100644 --- a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionFromNdmPrimitiveTest.cs +++ b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionFromNdmPrimitiveTest.cs @@ -1,17 +1,15 @@ using LoaderCalculator; -using LoaderCalculator.Data.Materials; using LoaderCalculator.Data.Matrix; using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.SourceData; using LoaderCalculator.Tests.Infrastructures.Logics; using NUnit.Framework; -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; -using StructureHelperLogics.NdmCalculations.Materials; using StructureHelperLogics.NdmCalculations.Triangulations; using System.Collections.Generic; using System.Threading; -using StructureHelperLogics.Models.NdmPrimitives; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.NdmPrimitives; +using StructureHelperCommon.Models.Shapes; namespace StructureHelperTests.FunctionalTests.Ndms.RCSections { diff --git a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs index bf02474..9574179 100644 --- a/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs +++ b/StructureHelperTests/FunctionalTests/Ndms/RCSections/RCSectionTest.cs @@ -1,16 +1,15 @@ using LoaderCalculator; -using LoaderCalculator.Data.Materials; using LoaderCalculator.Data.Matrix; using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.SourceData; using LoaderCalculator.Tests.Infrastructures.Logics; using NUnit.Framework; -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; -using StructureHelperLogics.NdmCalculations.Materials; using StructureHelperLogics.NdmCalculations.Triangulations; using System.Collections.Generic; using System.Threading; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Materials; +using StructureHelperCommon.Models.Shapes; namespace StructureHelperTests.FunctionalTests.Ndms.RCSections { diff --git a/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs index 230ba3f..bd95006 100644 --- a/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs +++ b/StructureHelperTests/FunctionalTests/Ndms/SteelSections/ReinforcementTest.cs @@ -3,12 +3,12 @@ using LoaderCalculator.Data.Matrix; using LoaderCalculator.Data.SourceData; using LoaderCalculator.Tests.Infrastructures.Logics; using NUnit.Framework; -using StructureHelperLogics.Data.Shapes; -using StructureHelperLogics.NdmCalculations.Entities; -using StructureHelperLogics.NdmCalculations.Materials; using StructureHelperLogics.NdmCalculations.Triangulations; using System.Collections.Generic; using System.Threading; +using StructureHelperCommon.Models.Entities; +using StructureHelperCommon.Models.Materials; +using StructureHelperCommon.Models.Shapes; namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections { diff --git a/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs b/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs index f729eac..b35907f 100644 --- a/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs +++ b/StructureHelperTests/Infrastructures/Logics/ExpectedProcessor.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace LoaderCalculator.Tests.Infrastructures.Logics { diff --git a/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs b/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs index f50917f..dc128e8 100644 --- a/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs +++ b/StructureHelperTests/LibrariesTests/Ndms/RCSections/RCSectionTest.cs @@ -5,14 +5,10 @@ using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.Ndms.Transformations; using LoaderCalculator.Data.Planes; using LoaderCalculator.Data.SourceData; -using LoaderCalculator.Infrastructure; using LoaderCalculator.Tests.Infrastructures.Logics; using LoaderCalculator.Triangulations; -using Moq; using NUnit.Framework; -using System; using System.Collections.Generic; -using System.Linq; using System.Threading; namespace LoaderCalculator.Tests.FunctionalTests.SectionTests { diff --git a/StructureHelperTests/Properties/AssemblyInfo.cs b/StructureHelperTests/Properties/AssemblyInfo.cs index b03a2ce..97c282f 100644 --- a/StructureHelperTests/Properties/AssemblyInfo.cs +++ b/StructureHelperTests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("StructureHelperTests")] diff --git a/StructureHelperTests/StructureHelperTests.csproj b/StructureHelperTests/StructureHelperTests.csproj index 6776db4..5caf80a 100644 --- a/StructureHelperTests/StructureHelperTests.csproj +++ b/StructureHelperTests/StructureHelperTests.csproj @@ -10,7 +10,7 @@ Properties StructureHelperTests StructureHelperTests - v4.7.2 + v4.8 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15.0 @@ -20,6 +20,7 @@ UnitTest + true @@ -74,6 +75,10 @@ + + {5DFEC3FD-9677-47BB-9E88-EB71828B5913} + StructureHelperCommon + {330bef5b-15be-4d2c-a750-b1ae50fb2be3} StructureHelperLogics diff --git a/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs index 152ae97..46c04c7 100644 --- a/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs +++ b/StructureHelperTests/UnitTests/Ndms/Triangulations/RectangleTriangulationTest.cs @@ -1,21 +1,8 @@ using LoaderCalculator.Data.Materials; -using LoaderCalculator.Data.Materials.MaterialBuilders; -using LoaderCalculator.Data.Matrix; -using LoaderCalculator.Data.Ndms; -using LoaderCalculator.Data.Ndms.Transformations; -using LoaderCalculator.Data.Planes; -using LoaderCalculator.Data.SourceData; -using LoaderCalculator.Infrastructure; -using LoaderCalculator.Tests.Infrastructures.Logics; -using LoaderCalculator.Triangulations; -using Moq; using NUnit.Framework; -using System; -using System.Collections.Generic; using System.Linq; -using System.Threading; +using StructureHelperCommon.Models.Shapes; using StructureHelperLogics.NdmCalculations.Triangulations; -using StructureHelperLogics.Data.Shapes; namespace StructureHelperTests.UnitTests.Ndms.Triangulations { From efa7de7617241ae4e3604c10f42d3ef1a6d747b2 Mon Sep 17 00:00:00 2001 From: NickAppLab Date: Fri, 29 Jul 2022 16:36:15 +0500 Subject: [PATCH 013/107] DI StartUp fixes --- App.xaml | 3 +-- App.xaml.cs | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/App.xaml b/App.xaml index 6c920ed..7b2d341 100644 --- a/App.xaml +++ b/App.xaml @@ -1,8 +1,7 @@  + xmlns:local="clr-namespace:StructureHelper"> diff --git a/App.xaml.cs b/App.xaml.cs index 835413f..da89033 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -11,23 +11,30 @@ namespace StructureHelper public partial class App : Application { public static IContainer Container { get; private set; } + public static ILifetimeScope Scope { get; private set; } + protected override void OnStartup(StartupEventArgs e) { + base.OnStartup(e); var builder = new ContainerBuilder(); - builder.RegisterType().As(); - builder.RegisterType().As(); - builder.RegisterType().AsSelf(); - builder.RegisterType().AsSelf(); + builder.RegisterType().As().SingleInstance(); + builder.RegisterType().As().SingleInstance(); + builder.RegisterType().AsSelf().SingleInstance(); + builder.RegisterType().AsSelf().SingleInstance(); builder.RegisterType().AsSelf(); Container = builder.Build(); - - using (var scope = Container.BeginLifetimeScope()) - { - var window = scope.Resolve(); - window.ShowDialog(); - } + Scope = Container.Resolve(); + + var window = Scope.Resolve(); + window.Show(); + } + + protected override void OnExit(ExitEventArgs e) + { + Scope.Dispose(); + base.OnExit(e); } } } From 75b00e76032ee319edfe76d4ef769599c1a7227a Mon Sep 17 00:00:00 2001 From: NickAppLab Date: Mon, 8 Aug 2022 15:50:58 +0500 Subject: [PATCH 014/107] StructureHelper: UI fix --- .../UI/DataContexts/PrimitiveBase.cs | 23 ++- Infrastructure/UI/DataContexts/Rectangle.cs | 1 + .../UI/DataTemplates/EllipseTemplate.xaml | 22 ++- .../UI/DataTemplates/RectangleTemplate.xaml | 54 +++-- Infrastructure/UI/Styles.xaml | 34 ---- .../UI/UserControls/PrimitivePopup.xaml | 187 ++++++------------ .../UI/UserControls/PrimitivePopup.xaml.cs | 2 +- Windows/MainWindow/MainViewModel.cs | 3 + 8 files changed, 142 insertions(+), 184 deletions(-) diff --git a/Infrastructure/UI/DataContexts/PrimitiveBase.cs b/Infrastructure/UI/DataContexts/PrimitiveBase.cs index bfed87c..cce3d18 100644 --- a/Infrastructure/UI/DataContexts/PrimitiveBase.cs +++ b/Infrastructure/UI/DataContexts/PrimitiveBase.cs @@ -1,4 +1,5 @@ using System; +using System.Windows; using System.Windows.Input; using System.Windows.Media; using StructureHelper.Infrastructure.Enums; @@ -9,7 +10,7 @@ using StructureHelperCommon.Models.Materials; namespace StructureHelper.Infrastructure.UI.DataContexts { - public abstract class PrimitiveBase: ViewModelBase + public abstract class PrimitiveBase : ViewModelBase { #region Поля @@ -24,7 +25,18 @@ namespace StructureHelper.Infrastructure.UI.DataContexts #region Свойства - public PrimitiveType Type => type; + public PrimitiveType Type + { + get => type; + set + { + OnPropertyChanged(value, type); + OnPropertyChanged(nameof(RectangleFieldVisibility)); + OnPropertyChanged(nameof(PrimitiveDimension)); + OnPropertyChanged(nameof(HeightRowHeight)); + } + } + public bool Captured { set => OnPropertyChanged(value, ref captured); @@ -157,6 +169,10 @@ namespace StructureHelper.Infrastructure.UI.DataContexts set => OnPropertyChanged(value, ref borderCaptured); } + public Visibility RectangleFieldVisibility => Type == PrimitiveType.Rectangle ? Visibility.Visible : Visibility.Hidden; + public string PrimitiveDimension => Type == PrimitiveType.Rectangle ? "Ширина" : "Диаметр"; + public double HeightRowHeight => Type == PrimitiveType.Rectangle ? 40 : 0; + #endregion #region Команды @@ -239,6 +255,9 @@ namespace StructureHelper.Infrastructure.UI.DataContexts PopupCanBeClosed = false; Captured = false; ParamsPanelVisibilty = true; + ParameterCaptured = true; + + //if (primitive is Rectangle rect) // rect.BorderCaptured = false; diff --git a/Infrastructure/UI/DataContexts/Rectangle.cs b/Infrastructure/UI/DataContexts/Rectangle.cs index 7fa02b3..fa2727b 100644 --- a/Infrastructure/UI/DataContexts/Rectangle.cs +++ b/Infrastructure/UI/DataContexts/Rectangle.cs @@ -10,6 +10,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts { public Rectangle(double primitiveWidth, double primitiveHeight, double rectX, double rectY, MainViewModel mainViewModel) : base(PrimitiveType.Rectangle, rectX, rectY, mainViewModel) { + Type = PrimitiveType.Rectangle; PrimitiveWidth = primitiveWidth; PrimitiveHeight = primitiveHeight; ShowedX = 0; diff --git a/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml b/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml index 66dfa6e..30795d1 100644 --- a/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml +++ b/Infrastructure/UI/DataTemplates/EllipseTemplate.xaml @@ -9,7 +9,23 @@ xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts" xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls" mc:Ignorable="d"> - - - + + + + + + + + + + + + + + + + + + + diff --git a/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml b/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml index 2230f86..e4432fc 100644 --- a/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml +++ b/Infrastructure/UI/DataTemplates/RectangleTemplate.xaml @@ -8,21 +8,41 @@ xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure" xmlns:mouseEventTriggers="clr-namespace:StructureHelper.Infrastructure.UI.Triggers.MouseEventTriggers" xmlns:userControls="clr-namespace:StructureHelper.Infrastructure.UI.UserControls" - mc:Ignorable="d"> - - - - - - - - - - - - - - - - + xmlns:dataContexts="clr-namespace:StructureHelper.Infrastructure.UI.DataContexts" + mc:Ignorable="d" + d:DataContext="{d:DesignInstance dataContexts:Rectangle}"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Infrastructure/UI/Styles.xaml b/Infrastructure/UI/Styles.xaml index a502d4c..b3058cc 100644 --- a/Infrastructure/UI/Styles.xaml +++ b/Infrastructure/UI/Styles.xaml @@ -52,38 +52,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Infrastructure/UI/UserControls/PrimitivePopup.xaml b/Infrastructure/UI/UserControls/PrimitivePopup.xaml index 2a6d966..3d7826f 100644 --- a/Infrastructure/UI/UserControls/PrimitivePopup.xaml +++ b/Infrastructure/UI/UserControls/PrimitivePopup.xaml @@ -1,4 +1,4 @@ - + mc:Ignorable="d" IsOpen="{Binding ParamsPanelVisibilty}"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -