Add polygon shape
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user