使用PointBase代替Point

This commit is contained in:
艾竹
2023-01-08 09:22:37 +08:00
parent 8fc69bc96d
commit 5d7717cc2b
65 changed files with 4317 additions and 403 deletions

View File

@@ -0,0 +1,28 @@
using AIStudio.Wpf.DiagramDesigner.Models;
namespace AIStudio.Wpf.DiagramDesigner.Geometry
{
public delegate IShape ShapeDefiner(DesignerItemViewModelBase node);
public static class Shapes
{
public static IShape Rectangle(DesignerItemViewModelBase node) => new RectangleBase(node.Position, node.Size);
public static IShape Circle(DesignerItemViewModelBase node)
{
var halfWidth = node.Size.Width / 2;
var centerX = node.Position.X + halfWidth;
var centerY = node.Position.Y + node.Size.Height / 2;
return new EllipseBase(centerX, centerY, halfWidth, halfWidth);
}
public static IShape Ellipse(DesignerItemViewModelBase node)
{
var halfWidth = node.Size.Width / 2;
var halfHeight = node.Size.Height / 2;
var centerX = node.Position.X + halfWidth;
var centerY = node.Position.Y + halfHeight;
return new EllipseBase(centerX, centerY, halfWidth, halfHeight);
}
}
}