mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-11 11:46:37 +08:00
修改暂存一下
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
[ValueConversion(typeof(List<Point>), typeof(PathSegmentCollection))]
|
||||
public class ConnectionPathConverter : IValueConverter
|
||||
public class ConnectionPathConverter : IMultiValueConverter
|
||||
{
|
||||
static ConnectionPathConverter()
|
||||
{
|
||||
@@ -23,21 +24,22 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
private set;
|
||||
}
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
List<ConnectorPoint> points = (List<ConnectorPoint>)value;
|
||||
PointCollection pointCollection = new PointCollection();
|
||||
if (points != null)
|
||||
GeometryGroup geometryGroup = new GeometryGroup();
|
||||
if (values[0] is PathGeneratorResult result)
|
||||
{
|
||||
foreach (var point in points)
|
||||
foreach (var path in result.Paths)
|
||||
{
|
||||
pointCollection.Add(new Point(point.X, point.Y));
|
||||
PathGeometry pathGeometry = PathGeometry.CreateFromGeometry(Geometry.Parse(path));
|
||||
geometryGroup.Children.Add(pathGeometry);
|
||||
}
|
||||
}
|
||||
return pointCollection;
|
||||
|
||||
return geometryGroup;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user