From 0d6debe87f154f546ba18557d55f150a7d266836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=89=BE=E7=AB=B9?= Date: Sat, 4 Feb 2023 12:19:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PathGenerators/PathGeneratorResult.cs | 18 +----------------- .../PathGenerators/PathGenerators.Boundary.cs | 2 +- .../PathGenerators/PathGenerators.Corner.cs | 2 +- .../PathGenerators/PathGenerators.Smooth.cs | 4 ++-- .../PathGenerators/PathGenerators.Straight.cs | 2 +- 5 files changed, 6 insertions(+), 22 deletions(-) diff --git a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGeneratorResult.cs b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGeneratorResult.cs index 3bf9838..00cb97a 100644 --- a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGeneratorResult.cs +++ b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGeneratorResult.cs @@ -5,14 +5,13 @@ namespace AIStudio.Wpf.DiagramDesigner public class PathGeneratorResult { public PathGeneratorResult(string[] paths, double sourceMarkerAngle, PointBase sourceMarkerPosition, - double targetMarkerAngle, PointBase targetMarkerPosition, PointBase[] route) + double targetMarkerAngle, PointBase targetMarkerPosition) { Paths = paths; SourceMarkerAngle = sourceMarkerAngle; SourceMarkerPosition = sourceMarkerPosition; TargetMarkerAngle = targetMarkerAngle; TargetMarkerPosition = targetMarkerPosition; - Route = route; } public string[] Paths @@ -42,20 +41,5 @@ namespace AIStudio.Wpf.DiagramDesigner { get; } - - public PointBase[] Route - { - get; - } - - public PointBase Last1 - { - get => Route[Route.Length - 1]; - } - - public PointBase Last2 - { - get => Route[Route.Length - 2]; - } } } diff --git a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Boundary.cs b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Boundary.cs index f7cd310..d01826a 100644 --- a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Boundary.cs +++ b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Boundary.cs @@ -27,7 +27,7 @@ namespace AIStudio.Wpf.DiagramDesigner 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); + return new PathGeneratorResult(paths, sourceAngle, route[0], targetAngle, route[route.Length - 1]); } private static PointBase[] GetRouteWithMiddlePoints(IDiagramViewModel _, ConnectionViewModel link, PointBase[] route) diff --git a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Corner.cs b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Corner.cs index c8a2250..3201616 100644 --- a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Corner.cs +++ b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Corner.cs @@ -30,7 +30,7 @@ namespace AIStudio.Wpf.DiagramDesigner 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); + return new PathGeneratorResult(paths, sourceAngle, route[0], targetAngle, route[route.Length - 1]); } private const int const_margin = 20; diff --git a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Smooth.cs b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Smooth.cs index 66a8301..0ea196a 100644 --- a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Smooth.cs +++ b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Smooth.cs @@ -23,7 +23,7 @@ namespace AIStudio.Wpf.DiagramDesigner DoShift(route, link); var path = FormattableString.Invariant($"M {route[0].X} {route[0].Y} C {route[1].X} {route[1].Y}, {route[2].X} {route[2].Y}, {route[3].X} {route[3].Y}"); - return new PathGeneratorResult(new[] { path }, sourceAngle, route[0], targetAngle, route[route.Length - 1], route); + return new PathGeneratorResult(new[] { path }, sourceAngle, route[0], targetAngle, route[route.Length - 1]); } private static PathGeneratorResult CurveThroughPoints(PointBase[] route, ConnectionViewModel link) @@ -47,7 +47,7 @@ namespace AIStudio.Wpf.DiagramDesigner } // Todo: adjust marker positions based on closest control points - return new PathGeneratorResult(paths, sourceAngle, route[0], targetAngle, route[route.Length - 1], route); + return new PathGeneratorResult(paths, sourceAngle, route[0], targetAngle, route[route.Length - 1]); } private static PointBase[] GetRouteWithCurvePoints(ConnectionViewModel link, PointBase[] route) diff --git a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Straight.cs b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Straight.cs index 3bfe0ba..811319f 100644 --- a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Straight.cs +++ b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Straight.cs @@ -20,7 +20,7 @@ namespace AIStudio.Wpf.DiagramDesigner 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); + return new PathGeneratorResult(paths, sourceAngle, route[0], targetAngle, route[route.Length - 1]); } } }