Add Force DTOs
This commit is contained in:
@@ -16,7 +16,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public double Modulus { get; set; }
|
||||
public double CompressiveStrength { get; set; }
|
||||
public double TensileStrength { get; set; }
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
|
||||
|
||||
public Guid Id { get; }
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public double CompressiveStrength { get; set; }
|
||||
public double TensileStrength { get; set; }
|
||||
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; } = new();
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
|
||||
public double ULSConcreteStrength { get; set; }
|
||||
public double SumThickness { get; set; }
|
||||
public double GammaF2 => GetGammaF2();
|
||||
|
||||
@@ -12,6 +12,5 @@ namespace StructureHelperLogics.Models.Materials
|
||||
double Modulus { get; set; }
|
||||
double CompressiveStrength { get; set; }
|
||||
double TensileStrength { get; set; }
|
||||
List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,5 +13,6 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public interface ILibMaterial : IHelperMaterial
|
||||
{
|
||||
ILibMaterialEntity MaterialEntity { get; set; }
|
||||
List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||
IMaterialLogic MaterialLogic { get; set; }
|
||||
List<IMaterialLogic> MaterialLogics { get; }
|
||||
(double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm);
|
||||
|
||||
@@ -9,11 +9,12 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class ElasticUpdateStrategy : IUpdateStrategy<IElasticMaterial>
|
||||
public class ElasticUpdateStrategy : IUpdateStrategy<IElasticMaterial>
|
||||
{
|
||||
public void Update(IElasticMaterial targetObject, IElasticMaterial sourceObject)
|
||||
{
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Modulus = sourceObject.Modulus;
|
||||
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;
|
||||
|
||||
@@ -9,11 +9,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class FRUpdateStrategy : IUpdateStrategy<IFRMaterial>
|
||||
/// <inheritdoc/>
|
||||
public class FRUpdateStrategy : IUpdateStrategy<IFRMaterial>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void Update(IFRMaterial targetObject, IFRMaterial sourceObject)
|
||||
{
|
||||
CheckObject.ReferenceEquals(targetObject, sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Modulus = sourceObject.Modulus;
|
||||
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials.Logics
|
||||
{
|
||||
public class HelpermaterialSafetyFactorsUpdateStrategy : IUpdateStrategy<IHelperMaterial>
|
||||
{
|
||||
public void Update(IHelperMaterial targetObject, IHelperMaterial sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
if (sourceObject.SafetyFactors is not null)
|
||||
{
|
||||
if (targetObject.SafetyFactors is null)
|
||||
{
|
||||
targetObject.SafetyFactors = new();
|
||||
}
|
||||
targetObject.SafetyFactors.Clear();
|
||||
foreach (var item in sourceObject.SafetyFactors)
|
||||
{
|
||||
targetObject.SafetyFactors.Add(item.Clone() as IMaterialSafetyFactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.Models.Materials.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -15,6 +17,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
private IUpdateStrategy<IFRMaterial> frStrategy;
|
||||
private IUpdateStrategy<IConcreteLibMaterial> concreteStrategy;
|
||||
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy;
|
||||
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy = new HelpermaterialSafetyFactorsUpdateStrategy();
|
||||
public HelperMaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
|
||||
IUpdateStrategy<IFRMaterial> frStrategy,
|
||||
IUpdateStrategy<IConcreteLibMaterial> concreteStrategy,
|
||||
@@ -38,6 +41,8 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
CheckObject.IsNull(sourceObject);
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
safetyFactorUpdateStrategy.Update(targetObject, sourceObject);
|
||||
if (sourceObject is ILibMaterial)
|
||||
{
|
||||
UpdateLibMaterial(targetObject, sourceObject);
|
||||
|
||||
@@ -17,18 +17,6 @@ namespace StructureHelperLogics.Models.Materials
|
||||
CheckObject.IsNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.MaterialEntity = sourceObject.MaterialEntity;
|
||||
if (sourceObject.SafetyFactors is not null)
|
||||
{
|
||||
if (targetObject.SafetyFactors is null)
|
||||
{
|
||||
targetObject.SafetyFactors = new();
|
||||
}
|
||||
targetObject.SafetyFactors.Clear();
|
||||
foreach (var item in sourceObject.SafetyFactors)
|
||||
{
|
||||
targetObject.SafetyFactors.Add(item.Clone() as IMaterialSafetyFactor);
|
||||
}
|
||||
}
|
||||
targetObject.MaterialLogic = sourceObject.MaterialLogic;
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
var diameter = template.Shape.Diameter;
|
||||
var concreteMaterial = HeadMaterials.ToList()[0];
|
||||
var primitives = new List<INdmPrimitive>();
|
||||
concreteBlock = new EllipsePrimitive() { DiameterByX = diameter, Name = "Concrete block"};
|
||||
concreteBlock = new EllipsePrimitive() { Width = diameter, Name = "Concrete block"};
|
||||
concreteBlock.NdmElement.HeadMaterial = concreteMaterial;
|
||||
primitives.Add(concreteBlock);
|
||||
return primitives;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <inheritdoc/>
|
||||
public IVisualProperty VisualProperty { get; } = new VisualProperty { Opacity = 0.8d };
|
||||
/// <inheritdoc/>
|
||||
public double DiameterByX
|
||||
public double Width
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -36,7 +36,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
}
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public double DiameterByY { get => rectangleShape.Height; set => rectangleShape.Height = value; }
|
||||
public double Height { get => rectangleShape.Height; set => rectangleShape.Height = value; }
|
||||
/// <inheritdoc/>
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
/// <inheritdoc/>
|
||||
@@ -46,6 +46,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <inheritdoc/>
|
||||
public IShape Shape => rectangleShape;
|
||||
|
||||
public double Angle { get; set; }
|
||||
|
||||
public EllipsePrimitive(Guid id)
|
||||
{
|
||||
@@ -78,7 +79,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
var dX = Center.X - point.X;
|
||||
var dY = Center.Y - point.Y;
|
||||
var distance = Math.Sqrt(dX * dX + dY * dY);
|
||||
if (distance > DiameterByX / 2) { return false; }
|
||||
if (distance > Width / 2) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -96,28 +97,28 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Left",
|
||||
Point = new Point2D() { X = Center.X - DiameterByX / 2d, Y = Center.Y},
|
||||
Point = new Point2D() { X = Center.X - Width / 2d, Y = Center.Y},
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Top",
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y + DiameterByX / 2d },
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y + Width / 2d },
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Right",
|
||||
Point = new Point2D() { X = Center.X + DiameterByX / 2d, Y = Center.Y },
|
||||
Point = new Point2D() { X = Center.X + Width / 2d, Y = Center.Y },
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Bottom",
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y - DiameterByX / 2d },
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y - Width / 2d },
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
|
||||
@@ -7,10 +7,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IEllipsePrimitive : INdmPrimitive, IHasDivisionSize
|
||||
public interface IEllipsePrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
{
|
||||
double DiameterByX { get; set; }
|
||||
double DiameterByY { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
Center = primitive.Center.Clone() as Point2D;
|
||||
//to do change to ellipse
|
||||
Circle = new CircleShape() { Diameter = primitive.DiameterByX };
|
||||
Circle = new CircleShape() { Diameter = primitive.Width };
|
||||
NdmMaxSize = primitive.DivisionSize.NdmMaxSize;
|
||||
NdmMinDivision = primitive.DivisionSize.NdmMinDivision;
|
||||
HeadMaterial = primitive.NdmElement.HeadMaterial;
|
||||
|
||||
Reference in New Issue
Block a user