Add triangulation of polygon

This commit is contained in:
Evgeny Redikultsev
2025-10-26 22:19:25 +05:00
parent 196dc636bb
commit 09dcf4e7e9
52 changed files with 686 additions and 180 deletions

View File

@@ -0,0 +1,33 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
namespace DataAccess.DTOs
{
public class VertexFtomDTOConvertStrategy : ConvertStrategy<IVertex, IVertex>
{
private IUpdateStrategy<IVertex> updateStrategy;
private IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy;
private Vertex newItem;
public VertexFtomDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
updateStrategy = new VertexUpdateStrategy() { UpdateChildren = false };
pointConvertStrategy = new Point2DFromDTOConvertStrategy(this);
}
public override IVertex GetNewItem(IVertex source)
{
ChildClass = this;
if (source is not VertexDTO sourceDTO)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": source vertex is not DTO object");
}
newItem = new(sourceDTO.Id);
updateStrategy.Update(newItem, sourceDTO);
newItem.Point = pointConvertStrategy.Convert(sourceDTO.Point as Point2DDTO);
NewItem = newItem;
return NewItem;
}
}
}