From 54d51e7de8a80c3623326d6f4560199bf058166c Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Fri, 8 Jul 2022 19:52:09 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D1=8B=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B8=D1=81=D1=85=D0=BE=D0=B4=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B8=D1=82=D0=B8=D0=B2=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D1=82=D1=80=D0=B8=D0=B0=D0=BD=D0=B3?= =?UTF-8?q?=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