mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-12 04:06:36 +08:00
继续调整
This commit is contained in:
@@ -25,42 +25,46 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
List<PointInfoBase> points = (List<PointInfoBase>)values[0];
|
||||
PathGeometry pathGeometry = new PathGeometry();
|
||||
PathFigure figure = new PathFigure();
|
||||
figure.StartPoint = points[0];
|
||||
if (values[1]?.ToString() == DrawMode.RadiusConnectingLine.ToString())
|
||||
if (values[0] != null)
|
||||
{
|
||||
for (var i = 0; i < points.Count - 1; i++)
|
||||
{
|
||||
int current = i, last = i - 1, next = i + 1, next2 = i + 2;
|
||||
if (last == -1)
|
||||
{
|
||||
last = 0;
|
||||
}
|
||||
if (next == points.Count)
|
||||
{
|
||||
next = points.Count - 1;
|
||||
}
|
||||
if (next2 == points.Count)
|
||||
{
|
||||
next2 = points.Count - 1;
|
||||
}
|
||||
var bzs = SegmentHelper.GetBezierSegment(points[current], points[last], points[next], points[next2]);
|
||||
figure.Segments.Add(bzs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < points.Count; i++)
|
||||
{
|
||||
List<PointInfoBase> points = (List<PointInfoBase>)values[0];
|
||||
|
||||
LineSegment arc = new LineSegment(points[i], true);
|
||||
figure.Segments.Add(arc);
|
||||
PathFigure figure = new PathFigure();
|
||||
figure.StartPoint = points[0];
|
||||
if (values[1]?.ToString() == DrawMode.RadiusConnectingLine.ToString())
|
||||
{
|
||||
for (var i = 0; i < points.Count - 1; i++)
|
||||
{
|
||||
int current = i, last = i - 1, next = i + 1, next2 = i + 2;
|
||||
if (last == -1)
|
||||
{
|
||||
last = 0;
|
||||
}
|
||||
if (next == points.Count)
|
||||
{
|
||||
next = points.Count - 1;
|
||||
}
|
||||
if (next2 == points.Count)
|
||||
{
|
||||
next2 = points.Count - 1;
|
||||
}
|
||||
var bzs = SegmentHelper.GetBezierSegment(points[current], points[last], points[next], points[next2]);
|
||||
figure.Segments.Add(bzs);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < points.Count; i++)
|
||||
{
|
||||
|
||||
pathGeometry.Figures.Add(figure);
|
||||
LineSegment arc = new LineSegment(points[i], true);
|
||||
figure.Segments.Add(arc);
|
||||
}
|
||||
}
|
||||
|
||||
pathGeometry.Figures.Add(figure);
|
||||
}
|
||||
return pathGeometry;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user