Add circle shape calculation for shear
This commit is contained in:
@@ -43,7 +43,7 @@ namespace DataAccess.DTOs
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new BeamShearSectionUpdateStrategy();
|
||||
updateStrategy ??= new BeamShearSectionUpdateStrategy() { UpdateChildren = false};
|
||||
shapeConvertStrategy = new DictionaryConvertStrategy<IShape, IShape>
|
||||
(this, new ShapeFromDTOConvertStrategy(this));
|
||||
concreteConvertStrategy = new ConcreteLibMaterialFromDTOConvertStrategy()
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace DataAccess.DTOs
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
updateStrategy ??= new BeamShearSectionUpdateStrategy();
|
||||
updateStrategy ??= new BeamShearSectionUpdateStrategy() { UpdateChildren = false};
|
||||
shapeConvertStrategy = new DictionaryConvertStrategy<IShape, IShape>
|
||||
(this, new ShapeToDTOConvertStrategy(this));
|
||||
concreteConvertStrategy = new ConcreteLibMaterialToDTOConvertStrategy()
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CircleShapeFromDTOConvertStrategy : ConvertStrategy<CircleShape, CircleShapeDTO>
|
||||
{
|
||||
private IUpdateStrategy<ICircleShape> updateStrategy;
|
||||
|
||||
public CircleShapeFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
|
||||
public override CircleShape GetNewItem(CircleShapeDTO source)
|
||||
{
|
||||
ChildClass = this;
|
||||
ChildClass = this;
|
||||
updateStrategy ??= new CircleShapeUpdateStrategy();
|
||||
NewItem = new CircleShape(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CircleShapeToDTOConvertStrategy : ConvertStrategy<CircleShapeDTO, ICircleShape>
|
||||
{
|
||||
private IUpdateStrategy<ICircleShape> updateStrategy;
|
||||
|
||||
public CircleShapeToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
|
||||
public override CircleShapeDTO GetNewItem(ICircleShape source)
|
||||
{
|
||||
ChildClass = this;
|
||||
updateStrategy ??= new CircleShapeUpdateStrategy();
|
||||
NewItem = new(source.Id);
|
||||
updateStrategy.Update(NewItem, source);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ namespace DataAccess.DTOs
|
||||
internal class ShapeFromDTOConvertStrategy : ConvertStrategy<IShape, IShape>
|
||||
{
|
||||
private IConvertStrategy<RectangleShape, RectangleShapeDTO> rectangleConvertStrategy;
|
||||
private IConvertStrategy<CircleShape, CircleShapeDTO> circleConvertStrategy;
|
||||
|
||||
public ShapeFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
@@ -14,12 +15,19 @@ namespace DataAccess.DTOs
|
||||
|
||||
public override IShape GetNewItem(IShape source)
|
||||
{
|
||||
ChildClass = this;
|
||||
if (source is RectangleShapeDTO rectangleShapeDTO)
|
||||
{
|
||||
rectangleConvertStrategy ??= new DictionaryConvertStrategy<RectangleShape, RectangleShapeDTO>
|
||||
(this, new RectangleShapeFromDTOConvertStrategy(this));
|
||||
NewItem = rectangleConvertStrategy.Convert(rectangleShapeDTO);
|
||||
}
|
||||
if (source is CircleShapeDTO circleShapeDTO)
|
||||
{
|
||||
circleConvertStrategy ??= new DictionaryConvertStrategy<CircleShape, CircleShapeDTO>
|
||||
(this, new CircleShapeFromDTOConvertStrategy(this));
|
||||
NewItem = circleConvertStrategy.Convert(circleShapeDTO);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": shape is unknown");
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace DataAccess.DTOs
|
||||
public class ShapeToDTOConvertStrategy : ConvertStrategy<IShape, IShape>
|
||||
{
|
||||
private IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleConvertStrategy;
|
||||
private IConvertStrategy<CircleShapeDTO, ICircleShape> circleConvertStrategy;
|
||||
|
||||
public ShapeToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
@@ -15,16 +16,9 @@ namespace DataAccess.DTOs
|
||||
|
||||
public override IShape GetNewItem(IShape source)
|
||||
{
|
||||
try
|
||||
{
|
||||
GetNewShape(source);
|
||||
return NewItem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceErrorByEntity(this, ex.Message);
|
||||
throw;
|
||||
}
|
||||
ChildClass = this;
|
||||
GetNewShape(source);
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
private void GetNewShape(IShape source)
|
||||
@@ -34,6 +28,10 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
ProcessRectangle(rectangle);
|
||||
}
|
||||
else if (source is ICircleShape circle)
|
||||
{
|
||||
ProcessCircle(circle);
|
||||
}
|
||||
else
|
||||
{
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source) + ": shape type";
|
||||
@@ -42,6 +40,14 @@ namespace DataAccess.DTOs
|
||||
TraceLogger?.AddMessage($"Shape converting Id = {NewItem.Id} has been has been finished successfully", TraceLogStatuses.Debug);
|
||||
}
|
||||
|
||||
private void ProcessCircle(ICircleShape circle)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Shape is circle", TraceLogStatuses.Debug);
|
||||
circleConvertStrategy = new DictionaryConvertStrategy<CircleShapeDTO, ICircleShape>
|
||||
(this, new CircleShapeToDTOConvertStrategy(this));
|
||||
NewItem = circleConvertStrategy.Convert(circle);
|
||||
}
|
||||
|
||||
private void ProcessRectangle(IRectangleShape rectangle)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Shape is rectangle", TraceLogStatuses.Debug);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace DataAccess.DTOs
|
||||
public List<IBeamShearSection> Sections { get; } = new();
|
||||
[JsonProperty("Stirrups")]
|
||||
public List<IStirrup> Stirrups { get; } = new();
|
||||
public IBeamShearDesignRangeProperty DesignRangeProperty { get; set; }
|
||||
public IBeamShearDesignRangeProperty DesignRangeProperty { get; set; } = new BeamShearDesignRangePropertyDTO(Guid.NewGuid());
|
||||
|
||||
public BeamShearCalculatorInputDataDTO(Guid id)
|
||||
{
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace DataAccess.DTOs
|
||||
[JsonProperty("AbsoluteRangeValue")]
|
||||
public double AbsoluteRangeValue { get; set; } = 0.0;
|
||||
[JsonProperty("RelativeEffectiveDepthRangeValue")]
|
||||
public double RelativeEffectiveDepthRangeValue { get; set; } = 3.0;
|
||||
public double RelativeEffectiveDepthRangeValue { get; set; } = 3.3;
|
||||
[JsonProperty("StepCount")]
|
||||
public int StepCount { get; set; } = 50;
|
||||
public int StepCount { get; set; } = 55;
|
||||
|
||||
public BeamShearDesignRangePropertyDTO(Guid id)
|
||||
{
|
||||
|
||||
@@ -17,13 +17,13 @@ namespace DataAccess.DTOs
|
||||
[JsonProperty("Shape")]
|
||||
public IShape Shape { get; set; } = new RectangleShapeDTO(Guid.Empty);
|
||||
[JsonProperty("ConcreteMaterial")]
|
||||
public IConcreteLibMaterial ConcreteMaterial { get; set; }
|
||||
public IConcreteLibMaterial ConcreteMaterial { get; set; } = new ConcreteLibMaterial(Guid.NewGuid());
|
||||
[JsonProperty("CenterCover")]
|
||||
public double CenterCover { get; set; }
|
||||
[JsonProperty("ReinforcementArea")]
|
||||
public double ReinforcementArea { get; set; }
|
||||
[JsonProperty("ReinforcementMaterial")]
|
||||
public IReinforcementLibMaterial ReinforcementMaterial { get; set; }
|
||||
public IReinforcementLibMaterial ReinforcementMaterial { get; set; } = new ReinforcementLibMaterial(Guid.NewGuid());
|
||||
|
||||
public BeamShearSectionDTO(Guid id)
|
||||
{
|
||||
|
||||
23
DataAccess/DTOs/DTOEntities/CircleShapeDTO.cs
Normal file
23
DataAccess/DTOs/DTOEntities/CircleShapeDTO.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CircleShapeDTO : ICircleShape
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("Diameter")]
|
||||
public double Diameter { get; set; }
|
||||
|
||||
public CircleShapeDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ namespace DataAccess.DTOs
|
||||
List<(Type type, string name)> newList = new List<(Type type, string name)>
|
||||
{
|
||||
{ (typeof(AccuracyDTO), "Accuracy") },
|
||||
{ (typeof(CircleShapeDTO), "CircleShape") },
|
||||
{ (typeof(ConcreteLibMaterialDTO), "ConcreteLibMaterial") },
|
||||
{ (typeof(ColumnFilePropertyDTO), "ColumnFileProperty") },
|
||||
{ (typeof(ColumnedFilePropertyDTO), "ColumnedFileProperty") },
|
||||
@@ -119,6 +120,7 @@ namespace DataAccess.DTOs
|
||||
{ (typeof(BeamShearAnalysisDTO), "BeamShearAnalysis") },
|
||||
{ (typeof(BeamShearCalculatorDTO), "BeamShearCalculator") },
|
||||
{ (typeof(BeamShearCalculatorInputDataDTO), "BeamShearCalculatorInputData") },
|
||||
{ (typeof(BeamShearDesignRangePropertyDTO), "BeamShearDesignRangeProperty") },
|
||||
{ (typeof(BeamShearRepositoryDTO), "BeamShearRepository") },
|
||||
{ (typeof(BeamShearSectionDTO), "BeamShearSection") },
|
||||
{ (typeof(List<IBeamShearAction>), "ListOfBeamShearActions") },
|
||||
|
||||
Reference in New Issue
Block a user