Objects of NdmElement were added
This commit is contained in:
13
DataAccess/DTOs/CirclePrimitiveDTO.cs
Normal file
13
DataAccess/DTOs/CirclePrimitiveDTO.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CirclePrimitiveDTO
|
||||
{
|
||||
}
|
||||
}
|
||||
35
DataAccess/DTOs/NdmPrimitiveDTO.cs
Normal file
35
DataAccess/DTOs/NdmPrimitiveDTO.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class NdmPrimitiveDTO : INdmElement
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("Center")]
|
||||
public IPoint2D Center { get; set; }
|
||||
[JsonProperty("HeadMaterial")]
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
[JsonProperty("Triangulate")]
|
||||
public bool Triangulate { get; set; }
|
||||
[JsonProperty("UserPrestrain")]
|
||||
public StrainTuple UsersPrestrain { get; } = new StrainTuple();
|
||||
[JsonIgnore]
|
||||
public StrainTuple AutoPrestrain => throw new NotImplementedException();
|
||||
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,8 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public void Update(IForceTuple targetObject, IForceTuple sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
|
||||
targetObject.Mx = sourceObject.Mx;
|
||||
targetObject.My = sourceObject.My;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public bool ClearUnderlying { get; set; }
|
||||
public bool Triangulate { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public INdmElement NdmElement { get; } = new NdmElement();
|
||||
|
||||
public CirclePrimitive(Guid id)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface INdmElement : ISaveable, ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Base point of primitive
|
||||
/// </summary>
|
||||
IPoint2D Center { get; }
|
||||
/// <summary>
|
||||
/// Material of primitive
|
||||
/// </summary>
|
||||
IHeadMaterial? HeadMaterial { get; set; }
|
||||
/// <summary>
|
||||
/// Flag of triangulation
|
||||
/// </summary>
|
||||
bool Triangulate { get; set; }
|
||||
/// <summary>
|
||||
/// Prestrain assigned from user
|
||||
/// </summary>
|
||||
StrainTuple UsersPrestrain { get; }
|
||||
/// <summary>
|
||||
/// Prestrain assigned from calculations
|
||||
/// </summary>
|
||||
StrainTuple AutoPrestrain { get; }
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// Name of primitive
|
||||
/// </summary>
|
||||
string? Name { get; set; }
|
||||
INdmElement NdmElement { get;}
|
||||
/// <summary>
|
||||
/// Base point of primitive
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -19,6 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public void Update(INdmPrimitive targetObject, INdmPrimitive sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
if (sourceObject.HeadMaterial != null) targetObject.HeadMaterial = sourceObject.HeadMaterial;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
public class INdmElementUpdateStrategy : IUpdateStrategy<INdmElement>
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint2D> point2DUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IForceTuple> tupleUpdateStrategy;
|
||||
|
||||
public INdmElementUpdateStrategy(IUpdateStrategy<IPoint2D> point2DUpdateStrategy,
|
||||
IUpdateStrategy<IForceTuple> tupleUpdateStrategy)
|
||||
{
|
||||
this.point2DUpdateStrategy = point2DUpdateStrategy;
|
||||
this.tupleUpdateStrategy = tupleUpdateStrategy;
|
||||
}
|
||||
|
||||
public INdmElementUpdateStrategy() : this (
|
||||
new Point2DUpdateStrategy(),
|
||||
new ForceTupleUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Update(INdmElement targetObject, INdmElement sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
|
||||
point2DUpdateStrategy.Update(targetObject.Center, sourceObject.Center);
|
||||
if (sourceObject.HeadMaterial != null)
|
||||
{
|
||||
targetObject.HeadMaterial = sourceObject.HeadMaterial;
|
||||
}
|
||||
targetObject.Triangulate = sourceObject.Triangulate;
|
||||
tupleUpdateStrategy.Update(targetObject.UsersPrestrain, sourceObject.UsersPrestrain);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class NdmElement : INdmElement
|
||||
{
|
||||
private IUpdateStrategy<INdmElement> updateStrategy;
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public IPoint2D Center { get; } = new Point2D();
|
||||
/// <inheritdoc/>
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public bool Triangulate { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public StrainTuple UsersPrestrain { get; } = new();
|
||||
/// <inheritdoc/>
|
||||
public StrainTuple AutoPrestrain { get; } = new();
|
||||
|
||||
public NdmElement(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public NdmElement() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
public bool Triangulate { get; set; }
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public INdmElement NdmElement { get; } = new NdmElement();
|
||||
|
||||
public PointPrimitive(Guid id)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <inheritdoc/>
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public INdmElement NdmElement { get; } = new NdmElement();
|
||||
|
||||
public RebarPrimitive(Guid id)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public IPoint2D Center { get; private set; }
|
||||
|
||||
public INdmElement NdmElement { get; } = new NdmElement();
|
||||
|
||||
public RectanglePrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
|
||||
Reference in New Issue
Block a user