RT state managment and rectangle support

This commit is contained in:
2026-02-16 16:14:25 +01:00
parent 0f0418dee3
commit d9caeb2209
21 changed files with 459 additions and 5 deletions

View File

@@ -0,0 +1,52 @@
using AipsCore.Application.Abstract;
using AipsCore.Application.Models.Whiteboard.Query.GetWhiteboardInfoRT;
using AipsCore.Domain.Models.Shape.Enums;
using AipsRT.Model.Whiteboard.Shapes.Map;
namespace AipsRT.Model.Whiteboard;
public class GetWhiteboardService
{
private readonly IDispatcher _dispatcher;
public GetWhiteboardService(IDispatcher dispatcher)
{
_dispatcher = dispatcher;
}
public async Task<Whiteboard> GetWhiteboard(Guid whiteboardId)
{
var query = new GetWhiteboardInfoRTQuery(whiteboardId);
return Map(await _dispatcher.Execute(query));
}
private static Whiteboard Map(AipsCore.Infrastructure.Persistence.Whiteboard.Whiteboard entity)
{
var whiteboard = new Whiteboard()
{
WhiteboardId = entity.Id,
OwnerId = entity.OwnerId,
};
foreach (var shape in entity.Shapes)
{
switch (shape.Type)
{
case ShapeType.Rectangle:
whiteboard.AddRectangle(shape.ToRectangle());
break;
case ShapeType.Arrow:
whiteboard.AddArrow(shape.ToArrow());
break;
case ShapeType.Line:
whiteboard.AddLine(shape.ToLine());
break;
case ShapeType.Text:
whiteboard.AddTextShape(shape.ToTextShape());
break;
}
}
return whiteboard;
}
}