diff --git a/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs b/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs index e7b7fb2..4d869a6 100644 --- a/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs +++ b/StructureHelper/Infrastructure/UI/DataContexts/ReinforcementViewPrimitive.cs @@ -7,17 +7,17 @@ using System.Threading.Tasks; namespace StructureHelper.Infrastructure.UI.DataContexts { - public class ReinforcementViewPrimitive : PointViewPrimitive, IHasSurroundingPrimitive + public class ReinforcementViewPrimitive : PointViewPrimitive, IHasHostPrimitive { ReinforcementPrimitive primitive; - public INdmPrimitive SurroundingPrimitive + public INdmPrimitive HostPrimitive { - get => primitive.SurroundingPrimitive; + get => primitive.HostPrimitive; set { - primitive.SurroundingPrimitive = value; - OnPropertyChanged(nameof(SurroundingPrimitive)); + primitive.HostPrimitive = value; + OnPropertyChanged(nameof(HostPrimitive)); } } diff --git a/StructureHelper/Libraries/LoaderCalculator.dll b/StructureHelper/Libraries/LoaderCalculator.dll index 16ad4e5..59ef3f1 100644 Binary files a/StructureHelper/Libraries/LoaderCalculator.dll and b/StructureHelper/Libraries/LoaderCalculator.dll differ diff --git a/StructureHelper/Services/ResultViewers/ShowAnchorageResult.cs b/StructureHelper/Services/ResultViewers/ShowAnchorageResult.cs new file mode 100644 index 0000000..f461a5c --- /dev/null +++ b/StructureHelper/Services/ResultViewers/ShowAnchorageResult.cs @@ -0,0 +1,71 @@ +using LoaderCalculator.Data.Materials; +using LoaderCalculator.Data.Matrix; +using LoaderCalculator.Logics; +using StructureHelper.Infrastructure.UI.DataContexts; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Strings; +using StructureHelperLogics.Models.Materials; +using StructureHelperLogics.Models.Primitives; +using StructureHelperLogics.NdmCalculations.Analyses.RC; +using StructureHelperLogics.NdmCalculations.Primitives; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelper.Services.ResultViewers +{ + public static class ShowAnchorageResult + { + private static IStressLogic stressLogic => new StressLogic(); + public static void ShowAnchorageField (IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable primitives) + { + foreach (var item in primitives) + { + if (item is ReinforcementViewPrimitive) + { + var primitive = item as ReinforcementViewPrimitive; + var ndmPrimitive = primitive.GetNdmPrimitive() as ReinforcementPrimitive; + var inputData = new AnchorageInputData(); + inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive); + inputData.ReinforcementStrength = GetReinforcementStrength(limitState, calcTerm, ndmPrimitive); + inputData.CrossSectionArea = ndmPrimitive.Area; + var diameter = Math.Sqrt(ndmPrimitive.Area / Math.PI) * 2d; + inputData.CrossSectionPerimeter = Math.PI * diameter; + var material = ndmPrimitive.HeadMaterial.GetLoaderMaterial(limitState, calcTerm); + var ndm = ndmPrimitive.GetNdms(material).Single(); + inputData.ReinforcementStress = stressLogic.GetStress(strainMatrix, ndm); + inputData.LappedCountRate = 0.5d; + } + } + } + private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive) + { + if (primitive.HostPrimitive is not null) + { + var host = primitive.HostPrimitive; + var hostMaterial = host.HeadMaterial.HelperMaterial; + if (hostMaterial is IConcreteLibMaterial) + { + var concreteMaterial = hostMaterial as IConcreteLibMaterial; + var concreteStrength = concreteMaterial.GetStrength(limitState, calcTerm).Tensile; + return concreteStrength; + } + } + throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host's material is incorrect or null"); + } + + private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive) + { + if (primitive.HeadMaterial.HelperMaterial is IReinforcementLibMaterial) + { + var material = primitive.HeadMaterial.HelperMaterial as IReinforcementLibMaterial; + var strength = material.GetStrength(limitState, calcTerm).Tensile; + return strength; + } + throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host's material is incorrect or null"); + } + } +} diff --git a/StructureHelper/Windows/CalculationWindows/CalculationResultWindow/CalculationResultView.xaml b/StructureHelper/Windows/CalculationWindows/CalculationResultWindow/CalculationResultView.xaml deleted file mode 100644 index add966a..0000000 --- a/StructureHelper/Windows/CalculationWindows/CalculationResultWindow/CalculationResultView.xaml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - -