Add new strrrups DTOs

This commit is contained in:
RedikultsevEvg
2025-07-17 00:06:26 +05:00
parent 0addeda339
commit efb0fa6e1e
13 changed files with 237 additions and 17 deletions

View File

@@ -47,6 +47,14 @@ namespace DataAccess.DTOs
{
newItem = ProcessRebar(rebar);
}
else if (stirrup is IStirrupGroup group)
{
newItem = ProcessGroup(group);
}
else if (stirrup is IStirrupByInclinedRebar inclinatedRebar)
{
newItem = ProcessInclinatedRebar(inclinatedRebar);
}
else if (stirrup is IStirrupByDensity density)
{
newItem = ProcessDensity(density);
@@ -55,10 +63,19 @@ namespace DataAccess.DTOs
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(stirrup));
}
return newItem;
}
private IStirrup ProcessInclinatedRebar(IStirrupByInclinedRebar inclinatedRebar)
{
throw new NotImplementedException();
}
private IStirrup ProcessGroup(IStirrupGroup group)
{
throw new NotImplementedException();
}
private IStirrup ProcessDensity(IStirrupByDensity density)
{
traceLogger?.AddMessage("Stirrup is stirrup by density");

View File

@@ -0,0 +1,19 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.Models.BeamShears;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
internal class StirrupGroupToDTOConvertStrategy : ConvertStrategy<StirrupGroupDTO, IStirrupGroup>
{
public override StirrupGroupDTO GetNewItem(IStirrupGroup source)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,37 @@
using Newtonsoft.Json;
using StructureHelperLogics.Models.BeamShears;
using StructureHelperLogics.Models.Materials;
namespace DataAccess.DTOs
{
public class StirrupByInclinedRebarDTO : IStirrupByInclinedRebar
{
[JsonProperty("Id")]
public Guid Id { get; }
[JsonProperty("Name")]
public string? Name { get; set; }
[JsonProperty("CompressedGap")]
public double CompressedGap { get; set; }
[JsonProperty("StartCoordinate")]
public double StartCoordinate { get; set; }
[JsonProperty("TransferLength")]
public double TransferLength { get; set; }
[JsonProperty("AngleOfInclination")]
public double AngleOfInclination { get; set; }
[JsonProperty("LegCount")]
public double LegCount { get; set; }
[JsonProperty("RebarSection")]
public IRebarSection RebarSection { get; set; }
public StirrupByInclinedRebarDTO(Guid id)
{
Id = id;
}
public object Clone()
{
return this;
}
}
}

View File

@@ -0,0 +1,27 @@
using Newtonsoft.Json;
using StructureHelperLogics.Models.BeamShears;
namespace DataAccess.DTOs
{
public class StirrupGroupDTO : IStirrupGroup
{
[JsonProperty("Id")]
public Guid Id { get; }
[JsonProperty("Name")]
public string? Name { get; set; }
[JsonProperty("CompressedGap")]
public double CompressedGap { get; set; }
[JsonProperty("Stirrups")]
public List<IStirrup> Stirrups { get; } = new();
public StirrupGroupDTO(Guid id)
{
Id = id;
}
public object Clone()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,26 @@
using Newtonsoft.Json;
using StructureHelperLogics.Models.Materials;
namespace DataAccess.DTOs
{
public class RebarSectionDTO : IRebarSection
{
[JsonProperty("Id")]
public Guid Id { get; }
[JsonProperty("Material")]
public IReinforcementLibMaterial Material { get; set; }
[JsonProperty("Diameter")]
public double Diameter { get; set; }
public RebarSectionDTO(Guid id)
{
Id = id;
}
public object Clone()
{
throw new NotImplementedException();
}
}
}

View File

@@ -6,6 +6,7 @@ namespace StructureHelper.Windows.BeamShears
{
public class StirrupByInclinedRebarViewModel : OkCancelViewModelBase
{
private const double minTransferLengthValue = 0.01;
private readonly IStirrupByInclinedRebar stirrupByInclinedRebar;
@@ -49,13 +50,14 @@ namespace StructureHelper.Windows.BeamShears
}
}
public double OffSet
public double TransferLength
{
get => stirrupByInclinedRebar.OffSet;
get => stirrupByInclinedRebar.TransferLength;
set
{
stirrupByInclinedRebar.OffSet = value;
OnPropertyChanged(nameof(OffSet));
if (value < minTransferLengthValue) { value = minTransferLengthValue; }
stirrupByInclinedRebar.TransferLength = value;
OnPropertyChanged(nameof(TransferLength));
}
}

View File

@@ -46,8 +46,8 @@
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding AngleOfInclination, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
<TextBlock Grid.Row="5" Text="Distance to compressed edge"/>
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding CompressedGap, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
<TextBlock Grid.Row="6" Text="Offset"/>
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding OffSet, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
<TextBlock Grid.Row="6" Text="Transfer length"/>
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding TransferLength, Converter={StaticResource LengthConverter}, ValidatesOnDataErrors=True}"/>
</Grid>
</TabItem>
<TabItem Header="Material" DataContext="{Binding RebarSectionViewModel}">

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Services
{
public interface IInterpolateValueLogic
{
double X1 { get; set; }
double Y1 { get; set; }
double X2 { get; set; }
double Y2 { get; set; }
double KnownValueX { get; set; }
double GetValueY();
}
}

View File

@@ -0,0 +1,34 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Services
{
public class InterpolateValueLogic : IInterpolateValueLogic
{
public double X1 { get; set; }
public double Y1 { get; set; }
public double X2 { get; set; }
public double Y2 { get; set; }
public double KnownValueX { get; set; }
public double GetValueY()
{
Check();
double tangent = (Y2-Y1) / (X2-X1);
double value = Y1 + (tangent * (KnownValueX - X1));
return value;
}
private void Check()
{
if (X1 == X2)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Value X1 = {X1} must be inequal to value X2, but it was");
}
}
}
}

View File

@@ -19,7 +19,7 @@ namespace StructureHelperLogics.Models.BeamShears
/// <summary>
/// Distance beetwen start/end point and point where rebar work is started
/// </summary>
double OffSet { get; set; }
double TransferLength { get; set; }
/// <summary>
/// Angle of inclination of rebar in degrees
/// </summary>

View File

@@ -1,6 +1,8 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models;
using StructureHelperCommon.Services;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -20,6 +22,7 @@ namespace StructureHelperLogics.Models.BeamShears
private double rebarEndPoint;
private double rebarTrueStartPoint;
private double rebarTrueEndPoint;
private IInterpolateValueLogic interpolationLogic;
public IShiftTraceLogger? TraceLogger { get; set; }
@@ -34,19 +37,55 @@ namespace StructureHelperLogics.Models.BeamShears
public double GetShearStrength()
{
GetGeometry();
if (inclinedSection.StartCoord > rebarTrueEndPoint)
if (inclinedSection.StartCoord > rebarEndPoint)
{
TraceLogger?.AddMessage($"Inclined section start point coordinate X = {inclinedSection.StartCoord} is greater than inclined rebar true end point x = {rebarTrueEndPoint}, inclined rebar has been ignored");
TraceLogger?.AddMessage($"Inclined section start point coordinate X = {inclinedSection.StartCoord} is greater than inclined rebar end point x = {rebarEndPoint}, inclined rebar has been ignored");
return 0.0;
}
if (inclinedSection.EndCoord < rebarTrueStartPoint)
if (inclinedSection.EndCoord < rebarStartPoint)
{
TraceLogger?.AddMessage($"Inclined section end point coordinate X = {inclinedSection.EndCoord} is less than inclined rebar true end point x = {rebarTrueStartPoint}, inclined rebar has been ignored");
TraceLogger?.AddMessage($"Inclined section end point coordinate X = {inclinedSection.EndCoord} is less than inclined rebar start point x = {rebarStartPoint}, inclined rebar has been ignored");
return 0.0;
}
if (inclinedSection.StartCoord > rebarTrueEndPoint & inclinedSection.StartCoord < rebarEndPoint)
{
TraceLogger?.AddMessage($"Inclined section start point coordinate X = {inclinedSection.StartCoord} is in end transfer zone");
return GetEndTransferValue();
}
if (inclinedSection.EndCoord > rebarStartPoint & inclinedSection.EndCoord < rebarTrueStartPoint)
{
TraceLogger?.AddMessage($"Inclined section end point coordinate X = {inclinedSection.EndCoord} is in start transfer zone");
return GetStartTransferValue();
}
return GetInclinedRebarStrength();
}
private double GetStartTransferValue()
{
interpolationLogic = new InterpolateValueLogic()
{
X1 = rebarStartPoint,
X2 = rebarTrueStartPoint,
Y1 = 0.0,
Y2 = GetInclinedRebarStrength(),
KnownValueX = inclinedSection.EndCoord
};
return interpolationLogic.GetValueY();
}
private double GetEndTransferValue()
{
interpolationLogic = new InterpolateValueLogic()
{
X1 = rebarTrueEndPoint,
X2 = rebarEndPoint,
Y1 = GetInclinedRebarStrength(),
Y2 = 0.0,
KnownValueX = inclinedSection.StartCoord
};
return interpolationLogic.GetValueY();
}
private double GetInclinedRebarStrength()
{
rebarSectionStrengthLogic ??= new RebarSectionStrengthLogic()
@@ -67,12 +106,13 @@ namespace StructureHelperLogics.Models.BeamShears
private void GetGeometry()
{
double transferLength = Math.Max(inclinedRebar.TransferLength, 0.01);
angleInRad = inclinedRebar.AngleOfInclination / 180 * Math.PI;
rebarStartPoint = inclinedRebar.StartCoordinate;
rebarHeight = inclinedSection.EffectiveDepth - inclinedRebar.CompressedGap;
rebarEndPoint = rebarStartPoint + rebarHeight * Math.Cos(angleInRad);
rebarTrueStartPoint = rebarStartPoint + inclinedRebar.OffSet;
rebarTrueEndPoint = rebarEndPoint - inclinedRebar.OffSet;
rebarEndPoint = rebarStartPoint + rebarHeight / Math.Tan(angleInRad);
rebarTrueStartPoint = rebarStartPoint + transferLength;
rebarTrueEndPoint = rebarEndPoint - transferLength;
}
}
}

View File

@@ -17,7 +17,7 @@ namespace StructureHelperLogics.Models.BeamShears
baseUpdateStrategy ??= new StirrupBaseUpdateStrategy();
baseUpdateStrategy.Update(targetObject, sourceObject);
targetObject.StartCoordinate = sourceObject.StartCoordinate;
targetObject.OffSet = sourceObject.OffSet;
targetObject.TransferLength = sourceObject.TransferLength;
targetObject.AngleOfInclination = sourceObject.AngleOfInclination;
targetObject.LegCount = sourceObject.LegCount;
CheckObject.IsNull(sourceObject.RebarSection, "Rebar section");

View File

@@ -46,7 +46,7 @@ namespace StructureHelperLogics.Models.BeamShears
}
}
/// <inheritdoc>
public double OffSet { get; set; } = 0.05;
public double TransferLength { get; set; } = 0.05;
/// <inheritdoc>
public double AngleOfInclination
{