Crack Calculator was added
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class CircleShapeUpdateStrategy : IUpdateStrategy<ICircleShape>
|
||||
{
|
||||
public void Update(ICircleShape targetObject, ICircleShape sourceObject)
|
||||
{
|
||||
targetObject.Diameter = sourceObject.Diameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class LineShapeUpdateStrategy : IUpdateStrategy<ILineShape>
|
||||
{
|
||||
readonly PointShapeUpdateStrategy pointUpdateStrategy = new();
|
||||
public void Update(ILineShape targetObject, ILineShape sourceObject)
|
||||
{
|
||||
pointUpdateStrategy.Update(targetObject.StartPoint, sourceObject.StartPoint);
|
||||
pointUpdateStrategy.Update(targetObject.EndPoint, sourceObject.EndPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
namespace StructureHelperCommon.Models.Shapes.Logics
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class PointUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||
public class PointShapeUpdateStrategy : IUpdateStrategy<IPoint2D>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Update(IPoint2D targetObject, IPoint2D sourceObject)
|
||||
@@ -0,0 +1,19 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class RectangleShapeUpdateStrategy : IUpdateStrategy<IRectangleShape>
|
||||
{
|
||||
public void Update(IRectangleShape targetObject, IRectangleShape sourceObject)
|
||||
{
|
||||
targetObject.Width = sourceObject.Width;
|
||||
targetObject.Height = sourceObject.Height;
|
||||
targetObject.Angle = sourceObject.Angle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace StructureHelperCommon.Models.Shapes
|
||||
/// <inheritdoc />
|
||||
public class Point2D : IPoint2D
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint2D> updateStrategy = new PointUpdateStrategy();
|
||||
private readonly IUpdateStrategy<IPoint2D> updateStrategy = new PointShapeUpdateStrategy();
|
||||
/// <inheritdoc />
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user