修改暂存一下

This commit is contained in:
艾竹
2023-01-12 23:02:53 +08:00
parent 5d7717cc2b
commit 6a4c31106a
58 changed files with 776 additions and 468 deletions

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
namespace AIStudio.Wpf.DiagramDesigner
{
public interface IRouter
{
PointBase[] Get(IDiagramViewModel _, ConnectorViewModel link);
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
namespace AIStudio.Wpf.DiagramDesigner
{
public class NormalRouter : IRouter
{
public PointBase[] Get(IDiagramViewModel _, ConnectorViewModel link)
{
return Routers.Normal(_, link);
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
namespace AIStudio.Wpf.DiagramDesigner
{
public class OrthogonalRouter : IRouter
{
public PointBase[] Get(IDiagramViewModel _, ConnectorViewModel link)
{
return Routers.Orthogonal(_, link);
}
}
}

View File

@@ -1,5 +1,5 @@
using System.Linq;
using AIStudio.Wpf.DiagramDesigner.Geometry;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
namespace AIStudio.Wpf.DiagramDesigner
{

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
using AIStudio.Wpf.DiagramDesigner.Geometry;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
// Implementation taken from the JS version: https://gist.github.com/menendezpoo/4a8894c152383b9d7a870c24a04447e4
// Todo: Make it more c#, Benchmark A* vs Dijkstra, Add more options
@@ -122,12 +122,12 @@ namespace AIStudio.Wpf.DiagramDesigner
{
foreach (var x in verticals)
{
result.Set(row, column++, new RectangleBase(lastX, lastY, x, y));
result.Set(row, column++, new RectangleBase(lastX, lastY, x, y, true));
lastX = x;
}
// Last cell of the row
result.Set(row, column, new RectangleBase(lastX, lastY, bounds.Right, y));
result.Set(row, column, new RectangleBase(lastX, lastY, bounds.Right, y, true));
lastX = bounds.Left;
lastY = y;
column = 0;
@@ -139,12 +139,12 @@ namespace AIStudio.Wpf.DiagramDesigner
// Last fow of cells
foreach (var x in verticals)
{
result.Set(row, column++, new RectangleBase(lastX, lastY, x, bounds.Bottom));
result.Set(row, column++, new RectangleBase(lastX, lastY, x, bounds.Bottom, true));
lastX = x;
}
// Last cell of last row
result.Set(row, column, new RectangleBase(lastX, lastY, bounds.Right, bounds.Bottom));
result.Set(row, column, new RectangleBase(lastX, lastY, bounds.Right, bounds.Bottom, true));
return result;
}

View File

@@ -1,4 +1,4 @@
using AIStudio.Wpf.DiagramDesigner.Geometry;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
using AIStudio.Wpf.DiagramDesigner.Models;
namespace AIStudio.Wpf.DiagramDesigner
@@ -7,7 +7,7 @@ namespace AIStudio.Wpf.DiagramDesigner
{
public static PointBase GetPortPositionBasedOnAlignment(ConnectorInfoBase port)
{
var pt = port.Position;
var pt = port.Location.Position;
switch (port.Orientation)
{
case ConnectorOrientation.Top: