mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
41 lines
1.9 KiB
C#
41 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Windows;
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels
|
|
{
|
|
class PathGeneratorsViewModel : BaseViewModel
|
|
{
|
|
public PathGeneratorsViewModel()
|
|
{
|
|
Title = "Link Path Generators";
|
|
Info = "Path generators are functions that take as input the calculated route and output SVG paths, " +
|
|
"alongside the markers positions and their angles. There are currently two generators: Straight and Smooth.";
|
|
|
|
_service.ColorViewModel.FillColor.Color = System.Windows.Media.Colors.Orange;
|
|
|
|
DiagramViewModel = new DiagramViewModel();
|
|
DiagramViewModel.PageSizeType = PageSizeType.Custom;
|
|
DiagramViewModel.PageSize = new Size(double.NaN, double.NaN);
|
|
|
|
DefaultDesignerItemViewModel node1 = new DefaultDesignerItemViewModel() { Left = 50, Top = 80, Text = "1" };
|
|
DiagramViewModel.DirectAddItemCommand.Execute(node1);
|
|
|
|
DefaultDesignerItemViewModel node2 = new DefaultDesignerItemViewModel() { Left = 300, Top = 350, Text = "2" };
|
|
DiagramViewModel.DirectAddItemCommand.Execute(node2);
|
|
|
|
DefaultDesignerItemViewModel node3 = new DefaultDesignerItemViewModel() { Left = 400, Top = 100, Text = "3" };
|
|
DiagramViewModel.DirectAddItemCommand.Execute(node3);
|
|
|
|
ConnectionViewModel connector1 = new ConnectionViewModel(node1.RightConnector, node2.LeftConnector, DrawMode.ConnectingLineStraight, RouterMode.RouterNormal);
|
|
connector1.AddLabel("Straight");
|
|
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
|
|
|
|
ConnectionViewModel connector2 = new ConnectionViewModel(node2.RightConnector, node3.LeftConnector, DrawMode.ConnectingLineSmooth, RouterMode.RouterNormal);
|
|
connector2.AddLabel("Smooth");
|
|
DiagramViewModel.DirectAddItemCommand.Execute(connector2);
|
|
}
|
|
}
|
|
}
|