From 1e98e2cc5712be9afd70216f7739cae592725bcb Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Sun, 13 Nov 2022 15:46:50 +0500 Subject: [PATCH] Templates was added --- App.xaml | 1 + App.xaml.cs | 1 + .../IRectangleBeamProperties.cs | 14 ++ .../UI/PrimitiveTemplates/TemplateFactory.cs | 41 ++++ .../UI/Resources/ShapeEditTemplates.xaml | 21 ++ Infrastructure/UI/Styles.xaml | 8 + Libraries/LoaderCalculator.dll | Bin 57856 -> 59392 bytes StructureHelper.csproj | 14 ++ .../Models/Materials/LibMaterial.cs | 4 +- .../Templates/RCs/IRectangleBeamTemplate.cs | 19 ++ .../Templates/RCs/RectangleBeamTemplate.cs | 39 ++++ .../Triangulations/Triangulation.cs | 44 ---- .../CalculationService.cs | 44 ++-- .../CalculationPropertyView.xaml.cs | 6 +- Windows/MainWindow/MainModel.cs | 49 +++-- Windows/MainWindow/MainView.xaml | 6 +- Windows/MainWindow/MainViewModel.cs | 199 +++++++++++------- .../RCs/RectangleBeam/RectangleBeamView.xaml | 51 +++++ .../RectangleBeam/RectangleBeamView.xaml.cs | 37 ++++ .../RCs/RectangleBeamViewModel.cs | 113 ++++++++++ 20 files changed, 550 insertions(+), 161 deletions(-) create mode 100644 Infrastructure/UI/PrimitiveTemplates/IRectangleBeamProperties.cs create mode 100644 Infrastructure/UI/PrimitiveTemplates/TemplateFactory.cs create mode 100644 Infrastructure/UI/Resources/ShapeEditTemplates.xaml create mode 100644 StructureHelperLogics/Models/Templates/RCs/IRectangleBeamTemplate.cs create mode 100644 StructureHelperLogics/Models/Templates/RCs/RectangleBeamTemplate.cs rename StructureHelperLogics/Services/{ => NdmCalculations}/CalculationService.cs (77%) create mode 100644 Windows/PrimitiveTemplates/RCs/RectangleBeam/RectangleBeamView.xaml create mode 100644 Windows/PrimitiveTemplates/RCs/RectangleBeam/RectangleBeamView.xaml.cs create mode 100644 Windows/ViewModels/PrimitiveTemplates/RCs/RectangleBeamViewModel.cs diff --git a/App.xaml b/App.xaml index 7b2d341..222cb68 100644 --- a/App.xaml +++ b/App.xaml @@ -6,6 +6,7 @@ + diff --git a/App.xaml.cs b/App.xaml.cs index a4bac68..0e74be2 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -5,6 +5,7 @@ using StructureHelper.Services.Primitives; using StructureHelper.UnitSystem; using StructureHelper.Windows.MainWindow; using StructureHelperLogics.Services; +using StructureHelperLogics.Services.NdmCalculations; namespace StructureHelper { diff --git a/Infrastructure/UI/PrimitiveTemplates/IRectangleBeamProperties.cs b/Infrastructure/UI/PrimitiveTemplates/IRectangleBeamProperties.cs new file mode 100644 index 0000000..5d27e97 --- /dev/null +++ b/Infrastructure/UI/PrimitiveTemplates/IRectangleBeamProperties.cs @@ -0,0 +1,14 @@ +using StructureHelperCommon.Models.Shapes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelper.Infrastructure.UI.PrimitiveTemplates +{ + public interface IRectangleBeamProperties + { + IShape Shape { get; } + } +} diff --git a/Infrastructure/UI/PrimitiveTemplates/TemplateFactory.cs b/Infrastructure/UI/PrimitiveTemplates/TemplateFactory.cs new file mode 100644 index 0000000..cd06d70 --- /dev/null +++ b/Infrastructure/UI/PrimitiveTemplates/TemplateFactory.cs @@ -0,0 +1,41 @@ +using StructureHelper.Infrastructure.UI.DataContexts; +using StructureHelper.Models.Materials; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Models.Shapes; +using StructureHelperLogics.Models.Templates.RCs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Shapes = StructureHelperCommon.Models.Shapes; + +namespace StructureHelper.Infrastructure.UI.PrimitiveTemplates +{ + internal static class TemplateFactory + { + //public static IEnumerable RectangleBeam(IRectangleBeamTemplate properties) + //{ + // var rect = properties.Shape as Shapes.Rectangle; + // var width = rect.Width; + // var height = rect.Height; + // var area1 = Math.PI * properties.BottomDiameter * properties.BottomDiameter / 4d; + // var area2 = Math.PI * properties.TopDiameter * properties.TopDiameter / 4d; + // var gap = properties.CoverGap; + + //IHeadMaterial concrete = new HeadMaterial() { Name = "Concrete 40" }; + //concrete.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Concrete & x.Name.Contains("40"))).First(); + //IHeadMaterial reinforcement = new HeadMaterial() { Name = "Reinforcement 400" }; + //reinforcement.HelperMaterial = Model.HeadMaterialRepository.LibMaterials.Where(x => (x.MaterialType == MaterialTypes.Reinforcement & x.Name.Contains("400"))).First(); + //headMaterials.Add(concrete); + //headMaterials.Add(reinforcement); + //OnPropertyChanged(nameof(headMaterials)); + + //yield return new Rectangle(width, height, 0, 0, this) { HeadMaterial = concrete }; + //yield return new Point(area1, -width / 2 + gap, -height / 2 + gap, this) { HeadMaterial = reinforcement }; + //yield return new Point(area1, width / 2 - gap, -height / 2 + gap, this) { HeadMaterial = reinforcement }; + //yield return new Point(area2, -width / 2 + gap, height / 2 - gap, this) { HeadMaterial = reinforcement }; + //yield return new Point(area2, width / 2 - gap, height / 2 - gap, this) { HeadMaterial = reinforcement }; + //} + } +} diff --git a/Infrastructure/UI/Resources/ShapeEditTemplates.xaml b/Infrastructure/UI/Resources/ShapeEditTemplates.xaml new file mode 100644 index 0000000..b660237 --- /dev/null +++ b/Infrastructure/UI/Resources/ShapeEditTemplates.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Infrastructure/UI/Styles.xaml b/Infrastructure/UI/Styles.xaml index 7af6e64..1c53221 100644 --- a/Infrastructure/UI/Styles.xaml +++ b/Infrastructure/UI/Styles.xaml @@ -11,6 +11,14 @@ + +