自动布局完成

This commit is contained in:
艾竹
2023-12-21 22:20:38 +08:00
parent 467bec839a
commit 6e917a2107
5 changed files with 340 additions and 320 deletions

View File

@@ -10,6 +10,7 @@ using System.Windows.Input;
using System.Windows.Media;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
using AIStudio.Wpf.DiagramDesigner.Helpers;
using AIStudio.Wpf.DiagramDesigner.Layout;
using AIStudio.Wpf.DiagramDesigner.Models;
using Newtonsoft.Json;
using static System.Net.Mime.MediaTypeNames;
@@ -676,6 +677,16 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
private ICommand _autoLayoutCommand;
public ICommand AutoLayoutCommand
{
get
{
return this._autoLayoutCommand ?? (this._autoLayoutCommand = new SimpleCommand(ExecuteEnable, ExecuteAutoLayoutCommand));
}
}
private ICommand _groupCommand;
public ICommand GroupCommand
{
@@ -2438,6 +2449,12 @@ namespace AIStudio.Wpf.DiagramDesigner
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitHeight };
}
}
private void ExecuteAutoLayoutCommand(object parameter)
{
ForceDirectedLayouter layouter = new ForceDirectedLayouter();
layouter.Layout(new Configuration { Network = this }, 10000);
}
#endregion
#region