Add calculators saving
This commit is contained in:
@@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class EllipsePrimitive : IEllipsePrimitive
|
||||
public class EllipseNdmPrimitive : IEllipseNdmPrimitive
|
||||
{
|
||||
private static readonly EllipsePrimitiveUpdateStrategy updateStrategy = new();
|
||||
private readonly RectangleShape rectangleShape = new();
|
||||
@@ -45,19 +45,19 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public IDivisionSize DivisionSize { get; } = new DivisionSize();
|
||||
/// <inheritdoc/>
|
||||
public IShape Shape => rectangleShape;
|
||||
/// <inheritdoc/>
|
||||
public double RotationAngle { get; set; }
|
||||
|
||||
public double Angle { get; set; }
|
||||
|
||||
public EllipsePrimitive(Guid id)
|
||||
public EllipseNdmPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Circle";
|
||||
}
|
||||
public EllipsePrimitive() : this (Guid.NewGuid()) {}
|
||||
public EllipseNdmPrimitive() : this (Guid.NewGuid()) {}
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new EllipsePrimitive();
|
||||
var primitive = new EllipseNdmPrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IEllipsePrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
public interface IEllipseNdmPrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
{
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <summary>
|
||||
/// Geometry primitive of point
|
||||
/// </summary>
|
||||
public interface IPointPrimitive : INdmPrimitive, IPointShape
|
||||
public interface IPointNdmPrimitive : INdmPrimitive, IPointShape
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <summary>
|
||||
/// Geometry primitive of rebar (bar of reinforcement)
|
||||
/// </summary>
|
||||
public interface IRebarPrimitive : IPointPrimitive, IHasHostPrimitive
|
||||
public interface IRebarNdmPrimitive : IPointNdmPrimitive, IHasHostPrimitive
|
||||
{
|
||||
Ndm GetConcreteNdm(ITriangulationOptions triangulationOptions);
|
||||
RebarNdm GetRebarNdm(ITriangulationOptions triangulationOptions);
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IRectanglePrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
public interface IRectangleNdmPrimitive : INdmPrimitive, IHasDivisionSize, IRectangleShape
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
}
|
||||
targetObject.NdmElement.Triangulate = sourceObject.NdmElement.Triangulate;
|
||||
point2DUpdateStrategy.Update(targetObject.Center, sourceObject.Center);
|
||||
targetObject.RotationAngle = sourceObject.RotationAngle;
|
||||
visualPropsUpdateStrategy.Update(targetObject.VisualProperty, sourceObject.VisualProperty);
|
||||
tupleUpdateStrategy.Update(targetObject.NdmElement.UsersPrestrain, sourceObject.NdmElement.UsersPrestrain);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
foreach (var primitive in HasPrimitives.Primitives)
|
||||
{
|
||||
if (primitive is IRebarPrimitive rebar)
|
||||
if (primitive is IRebarNdmPrimitive rebar)
|
||||
{
|
||||
CheckRebar(rebar);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckRebar(IRebarPrimitive rebar)
|
||||
private void CheckRebar(IRebarNdmPrimitive rebar)
|
||||
{
|
||||
if (checkRebarPrimitiveLogic is null)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
private string checkResult;
|
||||
private bool result;
|
||||
|
||||
public IRebarPrimitive RebarPrimitive { get; set; }
|
||||
public IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class EllipsePrimitiveUpdateStrategy : IUpdateStrategy<IEllipsePrimitive>
|
||||
public class EllipsePrimitiveUpdateStrategy : IUpdateStrategy<IEllipseNdmPrimitive>
|
||||
{
|
||||
private IUpdateStrategy<INdmPrimitive> basePrimitiveUpdateStrategy;
|
||||
private IUpdateStrategy<IDivisionSize> divisionPropsUpdateStrategy;
|
||||
@@ -26,7 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
|
||||
}
|
||||
public void Update(IEllipsePrimitive targetObject, IEllipsePrimitive sourceObject)
|
||||
public void Update(IEllipseNdmPrimitive targetObject, IEllipseNdmPrimitive sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, "source object");
|
||||
CheckObject.IsNull(targetObject, "target object");
|
||||
|
||||
@@ -9,6 +9,6 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
public interface ICheckRebarPrimitiveLogic : ICheckLogic
|
||||
{
|
||||
IRebarPrimitive RebarPrimitive { get; set; }
|
||||
IRebarNdmPrimitive RebarPrimitive { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,21 +11,21 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
if (targetObject is PointPrimitive point)
|
||||
if (targetObject is PointNdmPrimitive point)
|
||||
{
|
||||
new PointUpdateStrategy().Update(point, (PointPrimitive)sourceObject);
|
||||
new PointPrimitiveUpdateStrategy().Update(point, (PointNdmPrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is RebarPrimitive rebar)
|
||||
else if (targetObject is RebarNdmPrimitive rebar)
|
||||
{
|
||||
new RebarUpdateStrategy().Update(rebar, (RebarPrimitive)sourceObject);
|
||||
new RebarNdmPrimitiveUpdateStrategy().Update(rebar, (RebarNdmPrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is RectanglePrimitive rectangle)
|
||||
else if (targetObject is RectangleNdmPrimitive rectangle)
|
||||
{
|
||||
new RectanglePrimitiveUpdateStrategy().Update(rectangle, (RectanglePrimitive)sourceObject);
|
||||
new RectanglePrimitiveUpdateStrategy().Update(rectangle, (RectangleNdmPrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is EllipsePrimitive circle)
|
||||
else if (targetObject is EllipseNdmPrimitive circle)
|
||||
{
|
||||
new EllipsePrimitiveUpdateStrategy().Update(circle, (EllipsePrimitive)sourceObject);
|
||||
new EllipsePrimitiveUpdateStrategy().Update(circle, (EllipseNdmPrimitive)sourceObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -8,10 +8,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class PointUpdateStrategy : IUpdateStrategy<PointPrimitive>
|
||||
public class PointPrimitiveUpdateStrategy : IUpdateStrategy<IPointNdmPrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
public void Update(PointPrimitive targetObject, PointPrimitive sourceObject)
|
||||
public void Update(IPointNdmPrimitive targetObject, IPointNdmPrimitive sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
@@ -7,12 +7,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class RebarUpdateStrategy : IUpdateStrategy<RebarPrimitive>
|
||||
public class RebarNdmPrimitiveUpdateStrategy : IUpdateStrategy<IRebarNdmPrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
public void Update(RebarPrimitive targetObject, RebarPrimitive sourceObject)
|
||||
public void Update(IRebarNdmPrimitive targetObject, IRebarNdmPrimitive sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
if (sourceObject.HostPrimitive is not null)
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.Area = sourceObject.Area;
|
||||
targetObject.HostPrimitive = sourceObject.HostPrimitive;
|
||||
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class RectanglePrimitiveUpdateStrategy : IUpdateStrategy<IRectanglePrimitive>
|
||||
public class RectanglePrimitiveUpdateStrategy : IUpdateStrategy<IRectangleNdmPrimitive>
|
||||
{
|
||||
private IUpdateStrategy<INdmPrimitive> basePrimitiveUpdateStrategy;
|
||||
private IUpdateStrategy<IDivisionSize> divisionPropsUpdateStrategy;
|
||||
@@ -32,7 +32,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
}
|
||||
|
||||
public void Update(IRectanglePrimitive targetObject, IRectanglePrimitive sourceObject)
|
||||
public void Update(IRectangleNdmPrimitive targetObject, IRectangleNdmPrimitive sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, "source object");
|
||||
CheckObject.IsNull(targetObject, "target object");
|
||||
|
||||
@@ -9,9 +9,9 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
|
||||
namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class PointPrimitive : IPointPrimitive
|
||||
public class PointNdmPrimitive : IPointNdmPrimitive
|
||||
{
|
||||
static readonly PointUpdateStrategy updateStrategy = new();
|
||||
static readonly PointPrimitiveUpdateStrategy updateStrategy = new();
|
||||
public Guid Id { get; }
|
||||
public string? Name { get; set; }
|
||||
public IPoint2D Center { get; set; }
|
||||
@@ -25,19 +25,21 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
|
||||
public IShape Shape => throw new NotImplementedException();
|
||||
|
||||
public PointPrimitive(Guid id)
|
||||
public double RotationAngle { get; set; } = 0d;
|
||||
|
||||
public PointNdmPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Point";
|
||||
Area = 0.0005d;
|
||||
Center = new Point2D();
|
||||
}
|
||||
public PointPrimitive() : this (Guid.NewGuid())
|
||||
public PointNdmPrimitive() : this (Guid.NewGuid())
|
||||
{}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new PointPrimitive();
|
||||
var primitive = new PointNdmPrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
@@ -20,9 +20,9 @@ using System.Windows.Media.Media3D;
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class RebarPrimitive : IRebarPrimitive
|
||||
public class RebarNdmPrimitive : IRebarNdmPrimitive
|
||||
{
|
||||
static readonly RebarUpdateStrategy updateStrategy = new();
|
||||
static readonly RebarNdmPrimitiveUpdateStrategy updateStrategy = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
@@ -43,21 +43,23 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public IShape Shape => throw new NotImplementedException();
|
||||
|
||||
public RebarPrimitive(Guid id)
|
||||
public double RotationAngle { get; set; } = 0d;
|
||||
|
||||
public RebarNdmPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Reinforcement";
|
||||
Area = 0.0005d;
|
||||
Center = new Point2D();
|
||||
}
|
||||
public RebarPrimitive() : this(Guid.NewGuid())
|
||||
public RebarNdmPrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new RebarPrimitive();
|
||||
var primitive = new RebarNdmPrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class RectanglePrimitive : IRectanglePrimitive
|
||||
public class RectangleNdmPrimitive : IRectangleNdmPrimitive
|
||||
{
|
||||
private readonly RectanglePrimitiveUpdateStrategy updateStrategy = new();
|
||||
private readonly RectangleShape rectangleShape = new();
|
||||
@@ -17,7 +17,6 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public string Name { get; set; }
|
||||
public double Width { get => rectangleShape.Width; set => rectangleShape.Width = value; }
|
||||
public double Height { get => rectangleShape.Height; set => rectangleShape.Height = value; }
|
||||
public double Angle { get => rectangleShape.Angle; set => rectangleShape.Angle = value; }
|
||||
public IVisualProperty VisualProperty { get; } = new VisualProperty() { Opacity = 0.8d };
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
@@ -29,19 +28,21 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public IShape Shape => rectangleShape;
|
||||
|
||||
public RectanglePrimitive(Guid id)
|
||||
public double RotationAngle { get; set; } = 0d;
|
||||
|
||||
public RectangleNdmPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Rectangle";
|
||||
}
|
||||
public RectanglePrimitive() : this(Guid.NewGuid())
|
||||
public RectangleNdmPrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new RectanglePrimitive();
|
||||
var primitive = new RectangleNdmPrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
Reference in New Issue
Block a user