mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
27 lines
1.1 KiB
C#
27 lines
1.1 KiB
C#
using System;
|
|
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
|
{
|
|
public static partial class PathGenerators
|
|
{
|
|
public static PathGeneratorResult Straight(IDiagramViewModel _, ConnectionViewModel link, PointBase[] route, PointBase source, PointBase target)
|
|
{
|
|
route = ConcatRouteAndSourceAndTarget(route, source, target);
|
|
|
|
double sourceAngle = SourceMarkerAdjustement(route, link.GetSourceMarkerWidth(), link.GetSourceMarkerHeight());
|
|
double targetAngle = TargetMarkerAdjustement(route, link.GetSinkMarkerWidth(), link.GetSinkMarkerHeight());
|
|
|
|
DoShift(route, link);
|
|
|
|
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], route);
|
|
}
|
|
}
|
|
}
|