2023-01-08 09:22:37 +08:00
|
|
|
|
using System;
|
2023-01-12 23:02:53 +08:00
|
|
|
|
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
2023-01-08 09:22:37 +08:00
|
|
|
|
|
|
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
|
|
|
|
|
{
|
|
|
|
|
|
public static partial class PathGenerators
|
|
|
|
|
|
{
|
2023-01-24 17:53:04 +08:00
|
|
|
|
public static PathGeneratorResult Straight(IDiagramViewModel _, ConnectionViewModel link, PointBase[] route, PointBase source, PointBase target)
|
2023-01-08 09:22:37 +08:00
|
|
|
|
{
|
|
|
|
|
|
route = ConcatRouteAndSourceAndTarget(route, source, target);
|
|
|
|
|
|
|
2023-01-26 18:27:17 +08:00
|
|
|
|
double sourceAngle = SourceMarkerAdjustement(route, link.GetSourceMarkerWidth());
|
|
|
|
|
|
double targetAngle = TargetMarkerAdjustement(route, link.GetSinkMarkerWidth());
|
2023-01-08 09:22:37 +08:00
|
|
|
|
|
2023-01-12 23:02:53 +08:00
|
|
|
|
DoShift(route, link);
|
|
|
|
|
|
|
2023-01-08 09:22:37 +08:00
|
|
|
|
var paths = new string[route.Length - 1];
|
|
|
|
|
|
for (var i = 0; i < route.Length - 1; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
paths[i] = FormattableString.Invariant($"M {route[i].X} {route[i].Y} L {route[i + 1].X} {route[i + 1].Y}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new PathGeneratorResult(paths, sourceAngle, route[0], targetAngle, route[route.Length - 1]);
|
2023-01-12 23:02:53 +08:00
|
|
|
|
}
|
2023-01-08 09:22:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|