mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-05-02 05:51:28 +08:00
修改暂存一下
This commit is contained in:
12
AIStudio.Wpf.DiagramDesigner/Routers/IRouter.cs
Normal file
12
AIStudio.Wpf.DiagramDesigner/Routers/IRouter.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
15
AIStudio.Wpf.DiagramDesigner/Routers/NormalRouter.cs
Normal file
15
AIStudio.Wpf.DiagramDesigner/Routers/NormalRouter.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
AIStudio.Wpf.DiagramDesigner/Routers/OrthogonalRouter.cs
Normal file
15
AIStudio.Wpf.DiagramDesigner/Routers/OrthogonalRouter.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Linq;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometry;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user