implement

This commit is contained in:
2026-02-17 00:48:28 +01:00
parent 0119c7a737
commit 5c7909034f
57 changed files with 1676 additions and 114 deletions

View File

@@ -0,0 +1,13 @@
using AipsCore.Domain.Models.Shape.ValueObjects;
namespace AipsCore.Domain.Models.Shape;
public partial class Shape
{
public virtual void Move(int newPositionX, int newPositionY)
{
var newPosition = new Position(newPositionX, newPositionY);
this.Position = newPosition;
}
}

View File

@@ -7,7 +7,7 @@ using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Shape;
public abstract class Shape : DomainModel<ShapeId>
public abstract partial class Shape : DomainModel<ShapeId>
{
public WhiteboardId WhiteboardId { get; private set; }

View File

@@ -0,0 +1,11 @@
namespace AipsCore.Domain.Models.Shape.Sub.Arrow;
public partial class Arrow
{
public override void Move(int newPositionX, int newPositionY)
{
EndPosition.X += newPositionX - Position.X;
EndPosition.Y += newPositionY - Position.Y;
base.Move(newPositionX, newPositionY);
}
}

View File

@@ -6,7 +6,7 @@ using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Shape.Sub.Arrow;
public class Arrow : Shape
public partial class Arrow : Shape
{
public Position EndPosition { get; private set; }
public Thickness Thickness { get; private set; }

View File

@@ -0,0 +1,11 @@
namespace AipsCore.Domain.Models.Shape.Sub.Line;
public partial class Line
{
public override void Move(int newPositionX, int newPositionY)
{
EndPosition.X += newPositionX - Position.X;
EndPosition.Y += newPositionY - Position.Y;
base.Move(newPositionX, newPositionY);
}
}

View File

@@ -6,7 +6,7 @@ using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Shape.Sub.Line;
public class Line : Shape
public partial class Line : Shape
{
public Position EndPosition { get; private set; }
public Thickness Thickness { get; private set; }

View File

@@ -0,0 +1,11 @@
namespace AipsCore.Domain.Models.Shape.Sub.Rectangle;
public partial class Rectangle
{
public override void Move(int newPositionX, int newPositionY)
{
EndPosition.X += newPositionX - Position.X;
EndPosition.Y += newPositionY - Position.Y;
base.Move(newPositionX, newPositionY);
}
}

View File

@@ -6,11 +6,11 @@ using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Shape.Sub.Rectangle;
public class Rectangle : Shape
public partial class Rectangle : Shape
{
public override ShapeType ShapeType => ShapeType.Rectangle;
public Position EndPosition { get; }
public Position EndPosition { get; set; }
public Thickness BorderThickness { get; }

View File

@@ -0,0 +1,9 @@
using AipsCore.Domain.Abstract.Validation;
using AipsCore.Domain.Models.Shape.ValueObjects;
namespace AipsCore.Domain.Models.Shape.Validation;
public class ShapeErrors : AbstractErrors<Shape, ShapeId>
{
}

View File

@@ -5,8 +5,8 @@ namespace AipsCore.Domain.Models.Shape.ValueObjects;
public record Position : AbstractValueObject
{
public int X { get; }
public int Y { get; }
public int X { get; set; }
public int Y { get; set; }
public Position(int x, int y)
{
@@ -20,4 +20,14 @@ public record Position : AbstractValueObject
];
}
public static Position operator -(Position position, Position otherPosition)
{
return new Position(position.X - otherPosition.X, position.Y - otherPosition.Y);
}
public static Position operator +(Position position, Position otherPosition)
{
return new Position(position.X + otherPosition.X, position.Y + otherPosition.Y);
}
};