RT state managment and rectangle support
This commit is contained in:
10
dotnet/AipsRT/Model/Whiteboard/Shapes/Arrow.cs
Normal file
10
dotnet/AipsRT/Model/Whiteboard/Shapes/Arrow.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using AipsRT.Model.Whiteboard.Structs;
|
||||
|
||||
namespace AipsRT.Model.Whiteboard.Shapes;
|
||||
|
||||
public class Arrow : Shape
|
||||
{
|
||||
public Position EndPosition { get; set; }
|
||||
|
||||
public int Thickness { get; set; }
|
||||
}
|
||||
10
dotnet/AipsRT/Model/Whiteboard/Shapes/Line.cs
Normal file
10
dotnet/AipsRT/Model/Whiteboard/Shapes/Line.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using AipsRT.Model.Whiteboard.Structs;
|
||||
|
||||
namespace AipsRT.Model.Whiteboard.Shapes;
|
||||
|
||||
public class Line : Shape
|
||||
{
|
||||
public Position EndPosition { get; set; }
|
||||
|
||||
public int Thickness { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using AipsRT.Model.Whiteboard.Structs;
|
||||
|
||||
namespace AipsRT.Model.Whiteboard.Shapes.Map;
|
||||
|
||||
public static class ShapeMappingExtensions
|
||||
{
|
||||
extension(AipsCore.Infrastructure.Persistence.Shape.Shape shape)
|
||||
{
|
||||
public Rectangle ToRectangle()
|
||||
{
|
||||
return new Rectangle()
|
||||
{
|
||||
Id = shape.Id,
|
||||
Position = new Position(shape.PositionX, shape.PositionY),
|
||||
Color = shape.Color,
|
||||
EndPosition = new Position(shape.EndPositionX!.Value, shape.EndPositionY!.Value),
|
||||
BorderThickness = shape.Thickness!.Value,
|
||||
};
|
||||
}
|
||||
|
||||
public Arrow ToArrow()
|
||||
{
|
||||
return new Arrow()
|
||||
{
|
||||
Id = shape.Id,
|
||||
Position = new Position(shape.PositionX, shape.PositionY),
|
||||
Color = shape.Color,
|
||||
EndPosition = new Position(shape.EndPositionX!.Value, shape.EndPositionY!.Value),
|
||||
Thickness = shape.Thickness!.Value,
|
||||
};
|
||||
}
|
||||
|
||||
public Line ToLine()
|
||||
{
|
||||
return new Line()
|
||||
{
|
||||
Id = shape.Id,
|
||||
Position = new Position(shape.PositionX, shape.PositionY),
|
||||
Color = shape.Color,
|
||||
EndPosition = new Position(shape.EndPositionX!.Value, shape.EndPositionY!.Value),
|
||||
Thickness = shape.Thickness!.Value,
|
||||
};
|
||||
}
|
||||
|
||||
public TextShape ToTextShape()
|
||||
{
|
||||
return new TextShape()
|
||||
{
|
||||
Id = shape.Id,
|
||||
Position = new Position(shape.PositionX, shape.PositionY),
|
||||
Color = shape.Color,
|
||||
TextValue = shape.TextValue!,
|
||||
TextSize = shape.TextSize!.Value
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
10
dotnet/AipsRT/Model/Whiteboard/Shapes/Rectangle.cs
Normal file
10
dotnet/AipsRT/Model/Whiteboard/Shapes/Rectangle.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using AipsRT.Model.Whiteboard.Structs;
|
||||
|
||||
namespace AipsRT.Model.Whiteboard.Shapes;
|
||||
|
||||
public class Rectangle : Shape
|
||||
{
|
||||
public Position EndPosition { get; set; }
|
||||
|
||||
public int BorderThickness { get; set; }
|
||||
}
|
||||
14
dotnet/AipsRT/Model/Whiteboard/Shapes/Shape.cs
Normal file
14
dotnet/AipsRT/Model/Whiteboard/Shapes/Shape.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using AipsRT.Model.Whiteboard.Structs;
|
||||
|
||||
namespace AipsRT.Model.Whiteboard.Shapes;
|
||||
|
||||
public abstract class Shape
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Guid OwnerId { get; set; }
|
||||
|
||||
public Position Position { get; set; }
|
||||
|
||||
public string Color { get; set; }
|
||||
}
|
||||
10
dotnet/AipsRT/Model/Whiteboard/Shapes/TextShape.cs
Normal file
10
dotnet/AipsRT/Model/Whiteboard/Shapes/TextShape.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using AipsRT.Model.Whiteboard.Shapes;
|
||||
|
||||
namespace AipsRT.Model.Whiteboard.Shapes;
|
||||
|
||||
public class TextShape : Shape
|
||||
{
|
||||
public string TextValue { get; set; }
|
||||
|
||||
public int TextSize { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user