Add polygon shape

This commit is contained in:
Evgeny Redikultsev
2025-09-14 19:47:23 +05:00
parent c31e56869c
commit 35fccfaa11
56 changed files with 867 additions and 113 deletions

View File

@@ -7,7 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Shapes.Logics
namespace StructureHelperCommon.Models.Shapes
{
public class ShapeUpdateStrategy : IUpdateStrategy<IShape>
{
@@ -24,12 +24,29 @@ namespace StructureHelperCommon.Models.Shapes.Logics
{
ProcessCircles(targetObject, sourceCircle);
}
else if (sourceObject is IPolygonShape sourcePolygon)
{
ProcessPolygon(targetObject, sourcePolygon);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
}
}
private void ProcessPolygon(IShape targetObject, IPolygonShape sourcePolygon)
{
if (targetObject is IPolygonShape targetPolygon)
{
var updateLogic = new PolygonShapeUpdateStrategy();
updateLogic.Update(targetPolygon, sourcePolygon);
}
else
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": target object is not a polygon");
}
}
private static void ProcessCircles(IShape targetObject, ICircleShape sourceCircle)
{
if (targetObject is ICircleShape targetCircle)