mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-05-04 15:01:29 +08:00
连接线改成path绘制,方便绘制曲线
This commit is contained in:
@@ -59,7 +59,7 @@ namespace AIStudio.Wpf.ADiagram.Models
|
|||||||
public SFCToolBoxData(SFCNodeKinds kind, Type type, double width = 32, double height = 32) : base(null, null, type, width, height)
|
public SFCToolBoxData(SFCNodeKinds kind, Type type, double width = 32, double height = 32) : base(null, null, type, width, height)
|
||||||
{
|
{
|
||||||
Kind = kind;
|
Kind = kind;
|
||||||
ColorViewModel.LineColor.Color = Colors.Black;
|
ColorViewModel.LineColor.Color = Colors.Gray;
|
||||||
ColorViewModel.FillColor.Color = Colors.Blue;
|
ColorViewModel.FillColor.Color = Colors.Blue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
|||||||
ConnectorOrientation sinkConnectorOrientation = connection.SinkOrientation;
|
ConnectorOrientation sinkConnectorOrientation = connection.SinkOrientation;
|
||||||
FullyCreatedConnectorInfo sinkConnectorInfo = GetFullConnectorInfo(connection.Id, sinkItem, sinkConnectorOrientation, connection.SinkXRatio, connection.SinkYRatio, connection.SinkInnerPoint);
|
FullyCreatedConnectorInfo sinkConnectorInfo = GetFullConnectorInfo(connection.Id, sinkItem, sinkConnectorOrientation, connection.SinkXRatio, connection.SinkYRatio, connection.SinkInnerPoint);
|
||||||
|
|
||||||
ConnectorViewModel connectionVM = new ConnectorViewModel(viewModel, sourceConnectorInfo, sinkConnectorInfo, connection);
|
ConnectorViewModel connectionVM = new ConnectorViewModel(viewModel, sourceConnectorInfo, sinkConnectorInfo, connection, connection.VectorLineDrawMode);
|
||||||
viewModel.Items.Add(connectionVM);
|
viewModel.Items.Add(connectionVM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,7 +445,7 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
|||||||
ConnectorOrientation sinkConnectorOrientation = connection.SinkOrientation;
|
ConnectorOrientation sinkConnectorOrientation = connection.SinkOrientation;
|
||||||
FullyCreatedConnectorInfo sinkConnectorInfo = GetFullConnectorInfo(connection.Id, sinkItem, sinkConnectorOrientation, connection.SinkXRatio, connection.SinkYRatio, connection.SinkInnerPoint);
|
FullyCreatedConnectorInfo sinkConnectorInfo = GetFullConnectorInfo(connection.Id, sinkItem, sinkConnectorOrientation, connection.SinkXRatio, connection.SinkYRatio, connection.SinkInnerPoint);
|
||||||
|
|
||||||
ConnectorViewModel connectionVM = new ConnectorViewModel(DiagramViewModel, sourceConnectorInfo, sinkConnectorInfo, connection);
|
ConnectorViewModel connectionVM = new ConnectorViewModel(DiagramViewModel, sourceConnectorInfo, sinkConnectorInfo, connection, connection.VectorLineDrawMode);
|
||||||
items.Add(connectionVM);
|
items.Add(connectionVM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -989,7 +989,7 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
|||||||
ConnectorOrientation sinkConnectorOrientation = connection.SinkOrientation;
|
ConnectorOrientation sinkConnectorOrientation = connection.SinkOrientation;
|
||||||
FullyCreatedConnectorInfo sinkConnectorInfo = GetFullConnectorInfo(connection.Id, sinkItem, sinkConnectorOrientation, connection.SinkXRatio, connection.SinkYRatio, connection.SinkInnerPoint);
|
FullyCreatedConnectorInfo sinkConnectorInfo = GetFullConnectorInfo(connection.Id, sinkItem, sinkConnectorOrientation, connection.SinkXRatio, connection.SinkYRatio, connection.SinkInnerPoint);
|
||||||
|
|
||||||
ConnectorViewModel connectionVM = new ConnectorViewModel(viewModel, sourceConnectorInfo, sinkConnectorInfo, connection);
|
ConnectorViewModel connectionVM = new ConnectorViewModel(viewModel, sourceConnectorInfo, sinkConnectorInfo, connection, connection.VectorLineDrawMode);
|
||||||
viewModel.Items.Add(connectionVM);
|
viewModel.Items.Add(connectionVM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,20 +17,15 @@ namespace AIStudio.Wpf.Flowchart
|
|||||||
{
|
{
|
||||||
public FlowchartViewModel(string title, string status, DiagramType diagramType) : base(title, status, diagramType)
|
public FlowchartViewModel(string title, string status, DiagramType diagramType) : base(title, status, diagramType)
|
||||||
{
|
{
|
||||||
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.BoundaryConnectingLine;
|
|
||||||
}
|
}
|
||||||
public FlowchartViewModel(string filename, DiagramDocument diagramDocument) : base(filename, diagramDocument)
|
public FlowchartViewModel(string filename, DiagramDocument diagramDocument) : base(filename, diagramDocument)
|
||||||
{
|
{
|
||||||
if (DiagramViewModel != null)
|
if (DiagramViewModel != null)
|
||||||
{
|
{
|
||||||
FlowchartService.InitData(DiagramViewModel.Items.OfType<FlowNode>().ToList(), DiagramViewModel.Items.OfType<ConnectorViewModel>().ToList(), DiagramViewModel);
|
FlowchartService.InitData(DiagramViewModel.Items.OfType<FlowNode>().ToList(), DiagramViewModel.Items.OfType<ConnectorViewModel>().ToList(), DiagramViewModel);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OpenFile(DiagramDocument diagramDocument)
|
|
||||||
{
|
|
||||||
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.BoundaryConnectingLine;
|
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.BoundaryConnectingLine;
|
||||||
base.OpenFile(diagramDocument);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void InitDiagramViewModel()
|
protected override void InitDiagramViewModel()
|
||||||
@@ -41,6 +36,7 @@ namespace AIStudio.Wpf.Flowchart
|
|||||||
DiagramViewModel.GridCellSize = new Size(100, 100);
|
DiagramViewModel.GridCellSize = new Size(100, 100);
|
||||||
DiagramViewModel.CellHorizontalAlignment = CellHorizontalAlignment.Center;
|
DiagramViewModel.CellHorizontalAlignment = CellHorizontalAlignment.Center;
|
||||||
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.Center;
|
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.Center;
|
||||||
|
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.BoundaryConnectingLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Init()
|
protected override void Init()
|
||||||
@@ -74,36 +70,36 @@ namespace AIStudio.Wpf.Flowchart
|
|||||||
DesignerItemViewModelBase end = new EndFlowNode() { Left = 100, Top = 700, Color = Colors.Yellow.ToString() };
|
DesignerItemViewModelBase end = new EndFlowNode() { Left = 100, Top = 700, Color = Colors.Yellow.ToString() };
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(end);
|
DiagramViewModel.DirectAddItemCommand.Execute(end);
|
||||||
|
|
||||||
ConnectorViewModel connector1 = new ConnectorViewModel(start.BottomConnector, middle1.TopConnector);
|
ConnectorViewModel connector1 = new ConnectorViewModel(start.BottomConnector, middle1.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
|
||||||
|
|
||||||
ConnectorViewModel connector2 = new ConnectorViewModel(middle1.BottomConnector, decide.TopConnector);
|
ConnectorViewModel connector2 = new ConnectorViewModel(middle1.BottomConnector, decide.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector2);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector2);
|
||||||
|
|
||||||
ConnectorViewModel connector3 = new ConnectorViewModel(decide.RightConnector, middle2.TopConnector);
|
ConnectorViewModel connector3 = new ConnectorViewModel(decide.RightConnector, middle2.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector3);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector3);
|
||||||
connector3.AddText(">=3");
|
connector3.AddText(">=3");
|
||||||
|
|
||||||
ConnectorViewModel connector4 = new ConnectorViewModel(middle2.BottomConnector, cobegin.TopConnector);
|
ConnectorViewModel connector4 = new ConnectorViewModel(middle2.BottomConnector, cobegin.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector4);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector4);
|
||||||
|
|
||||||
ConnectorViewModel connector5 = new ConnectorViewModel(decide.BottomConnector, cobegin.TopConnector);
|
ConnectorViewModel connector5 = new ConnectorViewModel(decide.BottomConnector, cobegin.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector5);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector5);
|
||||||
connector5.AddText("<3");
|
connector5.AddText("<3");
|
||||||
|
|
||||||
ConnectorViewModel connector6 = new ConnectorViewModel(cobegin.BottomConnector, middle3.TopConnector);
|
ConnectorViewModel connector6 = new ConnectorViewModel(cobegin.BottomConnector, middle3.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector6);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector6);
|
||||||
|
|
||||||
ConnectorViewModel connector7 = new ConnectorViewModel(cobegin.BottomConnector, middle4.TopConnector);
|
ConnectorViewModel connector7 = new ConnectorViewModel(cobegin.BottomConnector, middle4.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector7);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector7);
|
||||||
|
|
||||||
ConnectorViewModel connector8 = new ConnectorViewModel(middle3.BottomConnector, coend.TopConnector);
|
ConnectorViewModel connector8 = new ConnectorViewModel(middle3.BottomConnector, coend.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector8);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector8);
|
||||||
|
|
||||||
ConnectorViewModel connector9 = new ConnectorViewModel(middle4.BottomConnector, coend.TopConnector);
|
ConnectorViewModel connector9 = new ConnectorViewModel(middle4.BottomConnector, coend.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector9);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector9);
|
||||||
|
|
||||||
ConnectorViewModel connector10 = new ConnectorViewModel(coend.BottomConnector, end.TopConnector);
|
ConnectorViewModel connector10 = new ConnectorViewModel(coend.BottomConnector, end.TopConnector, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector10);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector10);
|
||||||
|
|
||||||
DiagramViewModel.ClearSelectedItems();
|
DiagramViewModel.ClearSelectedItems();
|
||||||
|
|||||||
@@ -13,17 +13,11 @@ namespace AIStudio.Wpf.Logical
|
|||||||
{
|
{
|
||||||
public LogicalViewModel(string title, string status, DiagramType diagramType) : base(title, status, diagramType)
|
public LogicalViewModel(string title, string status, DiagramType diagramType) : base(title, status, diagramType)
|
||||||
{
|
{
|
||||||
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.CornerConnectingLine;
|
|
||||||
}
|
}
|
||||||
public LogicalViewModel(string filename, DiagramDocument diagramDocument) : base(filename, diagramDocument)
|
public LogicalViewModel(string filename, DiagramDocument diagramDocument) : base(filename, diagramDocument)
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OpenFile(DiagramDocument diagramDocument)
|
|
||||||
{
|
{
|
||||||
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.CornerConnectingLine;
|
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.CornerConnectingLine;
|
||||||
base.OpenFile(diagramDocument);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void InitDiagramViewModel()
|
protected override void InitDiagramViewModel()
|
||||||
@@ -37,6 +31,7 @@ namespace AIStudio.Wpf.Logical
|
|||||||
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.None;
|
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.None;
|
||||||
|
|
||||||
DiagramViewModel.Items.CollectionChanged += Items_CollectionChanged;
|
DiagramViewModel.Items.CollectionChanged += Items_CollectionChanged;
|
||||||
|
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.CornerConnectingLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Init()
|
protected override void Init()
|
||||||
@@ -79,28 +74,28 @@ namespace AIStudio.Wpf.Logical
|
|||||||
out1.LinkPoint = LogicalService.LinkPoint[4];
|
out1.LinkPoint = LogicalService.LinkPoint[4];
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(out1);
|
DiagramViewModel.DirectAddItemCommand.Execute(out1);
|
||||||
|
|
||||||
ConnectorViewModel connector1 = new ConnectorViewModel(in1.Output[0], item1.Input[0]);
|
ConnectorViewModel connector1 = new ConnectorViewModel(in1.Output[0], item1.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
|
||||||
|
|
||||||
ConnectorViewModel connector2 = new ConnectorViewModel(in2.Output[0], item1.Input[1]);
|
ConnectorViewModel connector2 = new ConnectorViewModel(in2.Output[0], item1.Input[1], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector2);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector2);
|
||||||
|
|
||||||
ConnectorViewModel connector3 = new ConnectorViewModel(item1.Output[0], gTGate.Input[0]);
|
ConnectorViewModel connector3 = new ConnectorViewModel(item1.Output[0], gTGate.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector3);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector3);
|
||||||
|
|
||||||
ConnectorViewModel connector4 = new ConnectorViewModel(constant.Output[0], gTGate.Input[1]);
|
ConnectorViewModel connector4 = new ConnectorViewModel(constant.Output[0], gTGate.Input[1], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector4);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector4);
|
||||||
|
|
||||||
ConnectorViewModel connector5 = new ConnectorViewModel(gTGate.Output[0], sELGate.Input[0]);
|
ConnectorViewModel connector5 = new ConnectorViewModel(gTGate.Output[0], sELGate.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector5);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector5);
|
||||||
|
|
||||||
ConnectorViewModel connector6 = new ConnectorViewModel(in3.Output[0], sELGate.Input[1]);
|
ConnectorViewModel connector6 = new ConnectorViewModel(in3.Output[0], sELGate.Input[1], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector6);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector6);
|
||||||
|
|
||||||
ConnectorViewModel connector7 = new ConnectorViewModel(in4.Output[0], sELGate.Input[2]);
|
ConnectorViewModel connector7 = new ConnectorViewModel(in4.Output[0], sELGate.Input[2], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector7);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector7);
|
||||||
|
|
||||||
ConnectorViewModel connector8 = new ConnectorViewModel(sELGate.Output[0], out1.Input[0]);
|
ConnectorViewModel connector8 = new ConnectorViewModel(sELGate.Output[0], out1.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector8);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace AIStudio.Wpf.Flowchart
|
|||||||
{
|
{
|
||||||
public SFCViewModel(string title, string status, DiagramType diagramType) : base(title, status, diagramType)
|
public SFCViewModel(string title, string status, DiagramType diagramType) : base(title, status, diagramType)
|
||||||
{
|
{
|
||||||
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.BoundaryConnectingLine;
|
|
||||||
}
|
}
|
||||||
public SFCViewModel(string filename, DiagramDocument diagramDocument) : base(filename, diagramDocument)
|
public SFCViewModel(string filename, DiagramDocument diagramDocument) : base(filename, diagramDocument)
|
||||||
{
|
{
|
||||||
@@ -32,12 +32,7 @@ namespace AIStudio.Wpf.Flowchart
|
|||||||
readDataTimer.Interval = 1000;
|
readDataTimer.Interval = 1000;
|
||||||
readDataTimer.AutoReset = false;
|
readDataTimer.AutoReset = false;
|
||||||
readDataTimer.Start();
|
readDataTimer.Start();
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OpenFile(DiagramDocument diagramDocument)
|
|
||||||
{
|
|
||||||
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.BoundaryConnectingLine;
|
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.BoundaryConnectingLine;
|
||||||
base.OpenFile(diagramDocument);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void InitDiagramViewModel()
|
protected override void InitDiagramViewModel()
|
||||||
@@ -48,6 +43,7 @@ namespace AIStudio.Wpf.Flowchart
|
|||||||
DiagramViewModel.GridCellSize = new Size(100, 60);
|
DiagramViewModel.GridCellSize = new Size(100, 60);
|
||||||
DiagramViewModel.CellHorizontalAlignment = CellHorizontalAlignment.Center;
|
DiagramViewModel.CellHorizontalAlignment = CellHorizontalAlignment.Center;
|
||||||
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.Center;
|
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.Center;
|
||||||
|
_service.DrawModeViewModel.VectorLineDrawMode = DrawMode.BoundaryConnectingLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
private System.Timers.Timer readDataTimer = new System.Timers.Timer();
|
private System.Timers.Timer readDataTimer = new System.Timers.Timer();
|
||||||
@@ -124,79 +120,79 @@ namespace AIStudio.Wpf.Flowchart
|
|||||||
SFCCOEndNode coend = new SFCCOEndNode() { Left = 38, Top = 720, Text = "" };
|
SFCCOEndNode coend = new SFCCOEndNode() { Left = 38, Top = 720, Text = "" };
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(coend);
|
DiagramViewModel.DirectAddItemCommand.Execute(coend);
|
||||||
|
|
||||||
ConnectorViewModel connector1_1 = new ConnectorViewModel(start.Output[0], condition1_1.Input[0]);
|
ConnectorViewModel connector1_1 = new ConnectorViewModel(start.Output[0], condition1_1.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector1_1);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector1_1);
|
||||||
|
|
||||||
ConnectorViewModel connector2_1 = new ConnectorViewModel(condition1_1.Output[0], step1.Input[0]);
|
ConnectorViewModel connector2_1 = new ConnectorViewModel(condition1_1.Output[0], step1.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector2_1);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector2_1);
|
||||||
|
|
||||||
ConnectorViewModel connector1_2 = new ConnectorViewModel(start.Output[0], condition1_2.Input[0]);
|
ConnectorViewModel connector1_2 = new ConnectorViewModel(start.Output[0], condition1_2.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector1_2);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector1_2);
|
||||||
|
|
||||||
ConnectorViewModel connector2_2 = new ConnectorViewModel(condition1_2.Output[0], step1.Input[0]);
|
ConnectorViewModel connector2_2 = new ConnectorViewModel(condition1_2.Output[0], step1.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector2_2);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector2_2);
|
||||||
|
|
||||||
ConnectorViewModel connector31 = new ConnectorViewModel(step1.Action[0], action11.Input[0]);
|
ConnectorViewModel connector31 = new ConnectorViewModel(step1.Action[0], action11.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector31);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector31);
|
||||||
|
|
||||||
ConnectorViewModel connector32 = new ConnectorViewModel(step1.Action[0], action12.Input[0]);
|
ConnectorViewModel connector32 = new ConnectorViewModel(step1.Action[0], action12.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector32);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector32);
|
||||||
|
|
||||||
ConnectorViewModel connector33 = new ConnectorViewModel(step1.Action[0], action13.Input[0]);
|
ConnectorViewModel connector33 = new ConnectorViewModel(step1.Action[0], action13.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector33);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector33);
|
||||||
|
|
||||||
ConnectorViewModel connector34 = new ConnectorViewModel(step1.Action[0], action14.Input[0]);
|
ConnectorViewModel connector34 = new ConnectorViewModel(step1.Action[0], action14.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector34);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector34);
|
||||||
|
|
||||||
ConnectorViewModel connector4 = new ConnectorViewModel(step1.Output[0], condition2.Input[0]);
|
ConnectorViewModel connector4 = new ConnectorViewModel(step1.Output[0], condition2.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector4);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector4);
|
||||||
|
|
||||||
ConnectorViewModel connector5 = new ConnectorViewModel(condition2.Output[0], step2.Input[0]);
|
ConnectorViewModel connector5 = new ConnectorViewModel(condition2.Output[0], step2.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector5);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector5);
|
||||||
|
|
||||||
ConnectorViewModel connector6 = new ConnectorViewModel(step2.Action[0], action2.Input[0]);
|
ConnectorViewModel connector6 = new ConnectorViewModel(step2.Action[0], action2.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector6);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector6);
|
||||||
|
|
||||||
ConnectorViewModel connector7 = new ConnectorViewModel(step2.Output[0], condition3.Input[0]);
|
ConnectorViewModel connector7 = new ConnectorViewModel(step2.Output[0], condition3.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector7);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector7);
|
||||||
|
|
||||||
ConnectorViewModel connector8 = new ConnectorViewModel(condition3.Output[0], step3.Input[0]);
|
ConnectorViewModel connector8 = new ConnectorViewModel(condition3.Output[0], step3.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector8);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector8);
|
||||||
|
|
||||||
ConnectorViewModel connector9 = new ConnectorViewModel(step3.Action[0], action3.Input[0]);
|
ConnectorViewModel connector9 = new ConnectorViewModel(step3.Action[0], action3.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector9);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector9);
|
||||||
|
|
||||||
ConnectorViewModel connector10 = new ConnectorViewModel(step3.Output[0], condition4.Input[0]);
|
ConnectorViewModel connector10 = new ConnectorViewModel(step3.Output[0], condition4.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector10);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector10);
|
||||||
|
|
||||||
ConnectorViewModel connector11 = new ConnectorViewModel(condition4.Output[0], cobegin.Input[0]);
|
ConnectorViewModel connector11 = new ConnectorViewModel(condition4.Output[0], cobegin.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector11);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector11);
|
||||||
|
|
||||||
ConnectorViewModel connector12 = new ConnectorViewModel(cobegin.Output[0], step4.Input[0]);
|
ConnectorViewModel connector12 = new ConnectorViewModel(cobegin.Output[0], step4.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector12);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector12);
|
||||||
|
|
||||||
ConnectorViewModel connector13 = new ConnectorViewModel(step4.Action[0], action4.Input[0]);
|
ConnectorViewModel connector13 = new ConnectorViewModel(step4.Action[0], action4.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector13);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector13);
|
||||||
|
|
||||||
ConnectorViewModel connector14 = new ConnectorViewModel(step4.Output[0], condition5.Input[0]);
|
ConnectorViewModel connector14 = new ConnectorViewModel(step4.Output[0], condition5.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector14);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector14);
|
||||||
|
|
||||||
ConnectorViewModel connector15 = new ConnectorViewModel(cobegin.Output[1], step5.Input[0]);
|
ConnectorViewModel connector15 = new ConnectorViewModel(cobegin.Output[1], step5.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector15);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector15);
|
||||||
|
|
||||||
ConnectorViewModel connector16 = new ConnectorViewModel(step5.Action[0], action5.Input[0]);
|
ConnectorViewModel connector16 = new ConnectorViewModel(step5.Action[0], action5.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector16);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector16);
|
||||||
|
|
||||||
ConnectorViewModel connector17 = new ConnectorViewModel(step5.Output[0], condition6.Input[0]);
|
ConnectorViewModel connector17 = new ConnectorViewModel(step5.Output[0], condition6.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector17);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector17);
|
||||||
|
|
||||||
ConnectorViewModel connector18 = new ConnectorViewModel(condition5.Output[0], coend.Input[0]);
|
ConnectorViewModel connector18 = new ConnectorViewModel(condition5.Output[0], coend.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector18);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector18);
|
||||||
|
|
||||||
ConnectorViewModel connector19 = new ConnectorViewModel(condition6.Output[0], coend.Input[1]);
|
ConnectorViewModel connector19 = new ConnectorViewModel(condition6.Output[0], coend.Input[1], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector19);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector19);
|
||||||
|
|
||||||
ConnectorViewModel connector20 = new ConnectorViewModel(coend.Output[0], start.Input[0]);
|
ConnectorViewModel connector20 = new ConnectorViewModel(coend.Output[0], start.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(connector20);
|
DiagramViewModel.DirectAddItemCommand.Execute(connector20);
|
||||||
|
|
||||||
#region 模拟部分
|
#region 模拟部分
|
||||||
@@ -249,28 +245,28 @@ namespace AIStudio.Wpf.Flowchart
|
|||||||
Simulate_TankViewModel tank3 = new Simulate_TankViewModel() { Left = 500, Top = 103, ItemWidth = 48, ItemHeight = 60, Text = "T3", LinkPoint = SFCService.LinkPoint.FirstOrDefault(p => p.Name == "T3") };
|
Simulate_TankViewModel tank3 = new Simulate_TankViewModel() { Left = 500, Top = 103, ItemWidth = 48, ItemHeight = 60, Text = "T3", LinkPoint = SFCService.LinkPoint.FirstOrDefault(p => p.Name == "T3") };
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(tank3);
|
DiagramViewModel.DirectAddItemCommand.Execute(tank3);
|
||||||
|
|
||||||
ConnectorViewModel conn1 = new ConnectorViewModel(tank1.Output[0], k1.Input[0]);
|
ConnectorViewModel conn1 = new ConnectorViewModel(tank1.Output[0], k1.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(conn1);
|
DiagramViewModel.DirectAddItemCommand.Execute(conn1);
|
||||||
|
|
||||||
ConnectorViewModel conn2 = new ConnectorViewModel(tank1.Output[0], k2.Input[0]);
|
ConnectorViewModel conn2 = new ConnectorViewModel(tank1.Output[0], k2.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(conn2);
|
DiagramViewModel.DirectAddItemCommand.Execute(conn2);
|
||||||
|
|
||||||
ConnectorViewModel conn3 = new ConnectorViewModel(tank1.Output[0], k3.Input[0]);
|
ConnectorViewModel conn3 = new ConnectorViewModel(tank1.Output[0], k3.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(conn3);
|
DiagramViewModel.DirectAddItemCommand.Execute(conn3);
|
||||||
|
|
||||||
ConnectorViewModel conn4 = new ConnectorViewModel(k1.Output[0], tank2.Input[0]);
|
ConnectorViewModel conn4 = new ConnectorViewModel(k1.Output[0], tank2.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(conn4);
|
DiagramViewModel.DirectAddItemCommand.Execute(conn4);
|
||||||
|
|
||||||
ConnectorViewModel conn5 = new ConnectorViewModel(k2.Output[0], tank2.Input[0]);
|
ConnectorViewModel conn5 = new ConnectorViewModel(k2.Output[0], tank2.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(conn5);
|
DiagramViewModel.DirectAddItemCommand.Execute(conn5);
|
||||||
|
|
||||||
ConnectorViewModel conn6 = new ConnectorViewModel(k3.Output[0], tank2.Input[0]);
|
ConnectorViewModel conn6 = new ConnectorViewModel(k3.Output[0], tank2.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(conn6);
|
DiagramViewModel.DirectAddItemCommand.Execute(conn6);
|
||||||
|
|
||||||
ConnectorViewModel conn7 = new ConnectorViewModel(tank2.Output[1], k4.Input[0]);
|
ConnectorViewModel conn7 = new ConnectorViewModel(tank2.Output[1], k4.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(conn7);
|
DiagramViewModel.DirectAddItemCommand.Execute(conn7);
|
||||||
|
|
||||||
ConnectorViewModel conn8 = new ConnectorViewModel(k4.Output[0], tank3.Input[0]);
|
ConnectorViewModel conn8 = new ConnectorViewModel(k4.Output[0], tank3.Input[0], _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
DiagramViewModel.DirectAddItemCommand.Execute(conn8);
|
DiagramViewModel.DirectAddItemCommand.Execute(conn8);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -1477,12 +1477,192 @@
|
|||||||
<Fluent:SplitButton.LargeIcon>
|
<Fluent:SplitButton.LargeIcon>
|
||||||
<iconPacks:PackIconMaterial Kind="Grid" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
<iconPacks:PackIconMaterial Kind="Grid" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
</Fluent:SplitButton.LargeIcon>
|
</Fluent:SplitButton.LargeIcon>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="5" Text="宽度" VerticalAlignment="Center"/>
|
||||||
|
<Fluent:Spinner Margin="5" Width="60" Size="Small" Value="{Binding DiagramsViewModel.DiagramViewModel.GridCellWidth,Mode=TwoWay}" Minimum="0" Format="0" />
|
||||||
|
<TextBlock Margin="5" Text="高度" VerticalAlignment="Center"/>
|
||||||
|
<Fluent:Spinner Margin="5" Width="60" Size="Small" Value="{Binding DiagramsViewModel.DiagramViewModel.GridCellHeight,Mode=TwoWay}" Minimum="0" Format="0" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<Fluent:SplitButton.ToolTip>
|
<Fluent:SplitButton.ToolTip>
|
||||||
<Fluent:ScreenTip Title="ShowGrid"
|
<Fluent:ScreenTip Title="ShowGrid"
|
||||||
Text="显示表格"
|
Text="显示网格"
|
||||||
Width="190" />
|
Width="190" />
|
||||||
</Fluent:SplitButton.ToolTip>
|
</Fluent:SplitButton.ToolTip>
|
||||||
</Fluent:SplitButton>
|
</Fluent:SplitButton>
|
||||||
|
<Fluent:SplitButton Header="横对齐" Width="50" VerticalAlignment="Top">
|
||||||
|
<UniformGrid Rows="4">
|
||||||
|
<Fluent:ToggleButton Height="48" Width="48" SizeDefinition="Large" IsChecked="{Binding DiagramsViewModel.DiagramViewModel.CellHorizontalAlignment,Converter={converter:ConverterValueMapToBool Parameter='Left'}, ConverterParameter='Left'}" ToolTip="左对齐">
|
||||||
|
<Fluent:ToggleButton.LargeIcon>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignLeft" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||||
|
</Border>
|
||||||
|
</Fluent:ToggleButton.LargeIcon>
|
||||||
|
</Fluent:ToggleButton>
|
||||||
|
<Fluent:ToggleButton Height="48" Width="48" SizeDefinition="Large" IsChecked="{Binding DiagramsViewModel.DiagramViewModel.CellHorizontalAlignment,Converter={converter:ConverterValueMapToBool Parameter='Center'}, ConverterParameter='Center'}" ToolTip="居中对齐">
|
||||||
|
<Fluent:ToggleButton.LargeIcon>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignCenter" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Fluent:ToggleButton.LargeIcon>
|
||||||
|
</Fluent:ToggleButton>
|
||||||
|
<Fluent:ToggleButton Height="48" Width="48" SizeDefinition="Large" IsChecked="{Binding DiagramsViewModel.DiagramViewModel.CellHorizontalAlignment,Converter={converter:ConverterValueMapToBool Parameter='Right'}, ConverterParameter='Right'}" ToolTip="右对齐">
|
||||||
|
<Fluent:ToggleButton.LargeIcon>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignRight" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||||
|
</Border>
|
||||||
|
</Fluent:ToggleButton.LargeIcon>
|
||||||
|
</Fluent:ToggleButton>
|
||||||
|
<Fluent:ToggleButton Height="48" Width="48" SizeDefinition="Large" IsChecked="{Binding DiagramsViewModel.DiagramViewModel.CellHorizontalAlignment,Converter={converter:ConverterValueMapToBool Parameter='None'}, ConverterParameter='None'}" ToolTip="无对齐">
|
||||||
|
<Fluent:ToggleButton.LargeIcon>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<TextBlock Text="无" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Fluent:ToggleButton.LargeIcon>
|
||||||
|
</Fluent:ToggleButton>
|
||||||
|
</UniformGrid>
|
||||||
|
<Fluent:SplitButton.ToolTip>
|
||||||
|
<Fluent:ScreenTip Title="ShowGrid"
|
||||||
|
Text="横向对齐到网格方式"
|
||||||
|
Width="190" />
|
||||||
|
</Fluent:SplitButton.ToolTip>
|
||||||
|
<Fluent:SplitButton.Style>
|
||||||
|
<Style TargetType="{x:Type Fluent:SplitButton}" BasedOn="{StaticResource RibbonSplitButtonStyle}">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignLeft" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding DiagramsViewModel.DiagramViewModel.CellHorizontalAlignment}" Value="Left">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignLeft" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding DiagramsViewModel.DiagramViewModel.CellHorizontalAlignment}" Value="Center">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignCenter" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding DiagramsViewModel.DiagramViewModel.CellHorizontalAlignment}" Value="Right">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignRight" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding DiagramsViewModel.DiagramViewModel.CellHorizontalAlignment}" Value="None">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<TextBlock Text="无" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Fluent:SplitButton.Style>
|
||||||
|
</Fluent:SplitButton>
|
||||||
|
<Fluent:SplitButton Header="竖对齐" Width="50" VerticalAlignment="Top">
|
||||||
|
<UniformGrid Columns="4">
|
||||||
|
<Fluent:ToggleButton Height="48" Width="48" SizeDefinition="Large" IsChecked="{Binding DiagramsViewModel.DiagramViewModel.CellVerticalAlignment,Converter={converter:ConverterValueMapToBool Parameter='Top'}, ConverterParameter='Top'}" ToolTip="上对齐">
|
||||||
|
<Fluent:ToggleButton.LargeIcon>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignLeft" RotationAngle="90" VerticalAlignment="Top" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Fluent:ToggleButton.LargeIcon>
|
||||||
|
</Fluent:ToggleButton>
|
||||||
|
<Fluent:ToggleButton Height="48" Width="48" SizeDefinition="Large" IsChecked="{Binding DiagramsViewModel.DiagramViewModel.CellVerticalAlignment,Converter={converter:ConverterValueMapToBool Parameter='Center'}, ConverterParameter='Center'}" ToolTip="居中对齐">
|
||||||
|
<Fluent:ToggleButton.LargeIcon>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignCenter" RotationAngle="90" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Fluent:ToggleButton.LargeIcon>
|
||||||
|
</Fluent:ToggleButton>
|
||||||
|
<Fluent:ToggleButton Height="48" Width="48" SizeDefinition="Large" IsChecked="{Binding DiagramsViewModel.DiagramViewModel.CellVerticalAlignment,Converter={converter:ConverterValueMapToBool Parameter='Bottom'}, ConverterParameter='Bottom'}" ToolTip="下对齐">
|
||||||
|
<Fluent:ToggleButton.LargeIcon>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignRight" RotationAngle="90" VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Fluent:ToggleButton.LargeIcon>
|
||||||
|
</Fluent:ToggleButton>
|
||||||
|
<Fluent:ToggleButton Height="48" Width="48" SizeDefinition="Large" IsChecked="{Binding DiagramsViewModel.DiagramViewModel.CellVerticalAlignment,Converter={converter:ConverterValueMapToBool Parameter='None'}, ConverterParameter='None'}" ToolTip="无对齐">
|
||||||
|
<Fluent:ToggleButton.LargeIcon>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<TextBlock Text="无" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Fluent:ToggleButton.LargeIcon>
|
||||||
|
</Fluent:ToggleButton>
|
||||||
|
</UniformGrid>
|
||||||
|
<Fluent:SplitButton.Style>
|
||||||
|
<Style TargetType="{x:Type Fluent:SplitButton}" BasedOn="{StaticResource RibbonSplitButtonStyle}">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignLeft" RotationAngle="90" VerticalAlignment="Top" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding DiagramsViewModel.DiagramViewModel.CellVerticalAlignment}" Value="Top">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignLeft" RotationAngle="90" VerticalAlignment="Top" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding DiagramsViewModel.DiagramViewModel.CellVerticalAlignment}" Value="Center">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignCenter" RotationAngle="90" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding DiagramsViewModel.DiagramViewModel.CellVerticalAlignment}" Value="Bottom">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<iconPacks:PackIconMaterial Foreground="Gray" Kind="FormatAlignRight" RotationAngle="90" VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding DiagramsViewModel.DiagramViewModel.CellVerticalAlignment}" Value="None">
|
||||||
|
<Setter Property="LargeIcon">
|
||||||
|
<Setter.Value>
|
||||||
|
<Border BorderThickness="1" BorderBrush="Gray" Margin="6,6,6,6">
|
||||||
|
<TextBlock Text="无" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Fluent:SplitButton.Style>
|
||||||
|
<Fluent:SplitButton.ToolTip>
|
||||||
|
<Fluent:ScreenTip Title="ShowGrid"
|
||||||
|
Text="竖向对齐到网格方式"
|
||||||
|
Width="190" />
|
||||||
|
</Fluent:SplitButton.ToolTip>
|
||||||
|
</Fluent:SplitButton>
|
||||||
|
|
||||||
</Fluent:RibbonGroupBox>
|
</Fluent:RibbonGroupBox>
|
||||||
<Fluent:RibbonGroupBox Header="背景"
|
<Fluent:RibbonGroupBox Header="背景"
|
||||||
IsLauncherVisible="True" >
|
IsLauncherVisible="True" >
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ namespace Util.DiagramDesigner
|
|||||||
Rect rectangleBounds = sourceConnector.TransformToVisual(this).TransformBounds(new Rect(sourceConnector.RenderSize));
|
Rect rectangleBounds = sourceConnector.TransformToVisual(this).TransformBounds(new Rect(sourceConnector.RenderSize));
|
||||||
Point point = new Point(rectangleBounds.Left + (rectangleBounds.Width / 2),
|
Point point = new Point(rectangleBounds.Left + (rectangleBounds.Width / 2),
|
||||||
rectangleBounds.Bottom + (rectangleBounds.Height / 2));
|
rectangleBounds.Bottom + (rectangleBounds.Height / 2));
|
||||||
partialConnection = new ConnectorViewModel(sourceDataItem, new PartCreatedConnectionInfo(point));
|
partialConnection = new ConnectorViewModel(sourceDataItem, new PartCreatedConnectionInfo(point), _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
_viewModel.DirectAddItemCommand.Execute(partialConnection);
|
_viewModel.DirectAddItemCommand.Execute(partialConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ namespace Util.DiagramDesigner
|
|||||||
Rect rectangleBounds = new Rect(sourceConnectorInfo.DataItem.Left, sourceConnectorInfo.DataItem.Top, 3, 3);
|
Rect rectangleBounds = new Rect(sourceConnectorInfo.DataItem.Left, sourceConnectorInfo.DataItem.Top, 3, 3);
|
||||||
Point point = new Point(rectangleBounds.Left + (rectangleBounds.Width / 2),
|
Point point = new Point(rectangleBounds.Left + (rectangleBounds.Width / 2),
|
||||||
rectangleBounds.Bottom + (rectangleBounds.Height / 2));
|
rectangleBounds.Bottom + (rectangleBounds.Height / 2));
|
||||||
partialConnection = new ConnectorViewModel(sourceConnectorInfo, new PartCreatedConnectionInfo(point));
|
partialConnection = new ConnectorViewModel(sourceConnectorInfo, new PartCreatedConnectionInfo(point), _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
_viewModel.DirectAddItemCommand.Execute(partialConnection);
|
_viewModel.DirectAddItemCommand.Execute(partialConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ namespace Util.DiagramDesigner
|
|||||||
int indexOfLastTempConnection = sinkDataItem.DataItem.Parent.Items.Count - 1;
|
int indexOfLastTempConnection = sinkDataItem.DataItem.Parent.Items.Count - 1;
|
||||||
sinkDataItem.DataItem.Parent.DirectRemoveItemCommand.Execute(
|
sinkDataItem.DataItem.Parent.DirectRemoveItemCommand.Execute(
|
||||||
sinkDataItem.DataItem.Parent.Items[indexOfLastTempConnection]);
|
sinkDataItem.DataItem.Parent.Items[indexOfLastTempConnection]);
|
||||||
sinkDataItem.DataItem.Parent.AddItemCommand.Execute(new ConnectorViewModel(sourceDataItem, sinkDataItem));
|
sinkDataItem.DataItem.Parent.AddItemCommand.Execute(new ConnectorViewModel(sourceDataItem, sinkDataItem, _service.DrawModeViewModel.VectorLineDrawMode));
|
||||||
}
|
}
|
||||||
else if (_service.DrawModeViewModel.GetDrawMode() == DrawMode.ConnectingLine && connectorsHit.Count() == 1)
|
else if (_service.DrawModeViewModel.GetDrawMode() == DrawMode.ConnectingLine && connectorsHit.Count() == 1)
|
||||||
{
|
{
|
||||||
@@ -352,7 +352,7 @@ namespace Util.DiagramDesigner
|
|||||||
_viewModel.DirectRemoveItemCommand.Execute(_viewModel.Items[indexOfLastTempConnection]);
|
_viewModel.DirectRemoveItemCommand.Execute(_viewModel.Items[indexOfLastTempConnection]);
|
||||||
_viewModel.DirectAddItemCommand.Execute(pointItemView);
|
_viewModel.DirectAddItemCommand.Execute(pointItemView);
|
||||||
|
|
||||||
var connector = new ConnectorViewModel(sourceDataItem, sinkDataItem);
|
var connector = new ConnectorViewModel(sourceDataItem, sinkDataItem, _service.DrawModeViewModel.VectorLineDrawMode);
|
||||||
_viewModel.AddItemCommand.Execute(connector);
|
_viewModel.AddItemCommand.Execute(connector);
|
||||||
|
|
||||||
sourceDataItem.DataItem.ZIndex++;
|
sourceDataItem.DataItem.ZIndex++;
|
||||||
|
|||||||
72
Util.DiagramDesigner/Converters/ConnectionDataConverter.cs
Normal file
72
Util.DiagramDesigner/Converters/ConnectionDataConverter.cs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
namespace Util.DiagramDesigner
|
||||||
|
{
|
||||||
|
public class ConnectionDataConverter : IMultiValueConverter
|
||||||
|
{
|
||||||
|
static ConnectionDataConverter()
|
||||||
|
{
|
||||||
|
Instance = new ConnectionDataConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ConnectionDataConverter Instance
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
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())
|
||||||
|
{
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
|
||||||
|
LineSegment arc = new LineSegment(points[i], true);
|
||||||
|
figure.Segments.Add(arc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pathGeometry.Figures.Add(figure);
|
||||||
|
return pathGeometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,6 @@ namespace Util.DiagramDesigner
|
|||||||
public interface IPathFinder
|
public interface IPathFinder
|
||||||
{
|
{
|
||||||
List<Point> GetConnectionLine(ConnectorInfo source, ConnectorInfo sink, bool showLastLine, bool sourceInnerPoint = false);
|
List<Point> GetConnectionLine(ConnectorInfo source, ConnectorInfo sink, bool showLastLine, bool sourceInnerPoint = false);
|
||||||
List<Point> GetConnectionLine(ConnectorInfo source, Point sinkPoint, ConnectorOrientation preferredOrientation, bool isInnerPoint = false);
|
List<Point> GetConnectionLine(ConnectorInfo source, Point sinkPoint, ConnectorOrientation preferredOrientation, bool showLastLine, bool isInnerPoint = false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ namespace Util.DiagramDesigner
|
|||||||
{
|
{
|
||||||
bool flag;
|
bool flag;
|
||||||
Point n = GetNearestNeighborSource(source, endPoint, rectSource, rectSink, out flag, sourceInnerPoint);
|
Point n = GetNearestNeighborSource(source, endPoint, rectSource, rectSink, out flag, sourceInnerPoint);
|
||||||
|
if (linePoints.Contains(n))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
linePoints.Add(n);
|
linePoints.Add(n);
|
||||||
currentPoint = n;
|
currentPoint = n;
|
||||||
|
|
||||||
@@ -209,7 +213,7 @@ namespace Util.DiagramDesigner
|
|||||||
return linePoints;
|
return linePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Point> GetConnectionLine(ConnectorInfo source, Point sinkPoint, ConnectorOrientation preferredOrientation, bool isInnerPoint = false)
|
public List<Point> GetConnectionLine(ConnectorInfo source, Point sinkPoint, ConnectorOrientation preferredOrientation, bool showLastLine, bool isInnerPoint = false)
|
||||||
{
|
{
|
||||||
List<Point> linePoints = new List<Point>();
|
List<Point> linePoints = new List<Point>();
|
||||||
int margin = isInnerPoint ? 0 : const_margin;
|
int margin = isInnerPoint ? 0 : const_margin;
|
||||||
@@ -265,7 +269,7 @@ namespace Util.DiagramDesigner
|
|||||||
else
|
else
|
||||||
linePoints = OptimizeLinePoints(linePoints, new Rect[] { rectSource }, source.Orientation, GetOpositeOrientation(source.Orientation));
|
linePoints = OptimizeLinePoints(linePoints, new Rect[] { rectSource }, source.Orientation, GetOpositeOrientation(source.Orientation));
|
||||||
|
|
||||||
if (!isInnerPoint)
|
if (!showLastLine)
|
||||||
{
|
{
|
||||||
linePoints.Insert(0, source.Position);
|
linePoints.Insert(0, source.Position);
|
||||||
}
|
}
|
||||||
|
|||||||
85
Util.DiagramDesigner/Helpers/SegmentHelper.cs
Normal file
85
Util.DiagramDesigner/Helpers/SegmentHelper.cs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Util.DiagramDesigner
|
||||||
|
{
|
||||||
|
public class SegmentHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获得贝塞尔曲线
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentPt">当前点</param>
|
||||||
|
/// <param name="lastPt">上一个点</param>
|
||||||
|
/// <param name="nextPt1">下一个点1</param>
|
||||||
|
/// <param name="nextPt2">下一个点2</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static BezierSegment GetBezierSegment(Point currentPt, Point lastPt, Point nextPt1, Point nextPt2)
|
||||||
|
{
|
||||||
|
//计算中点
|
||||||
|
var lastC = GetCenterPoint(lastPt, currentPt);
|
||||||
|
var nextC1 = GetCenterPoint(currentPt, nextPt1); //贝塞尔控制点
|
||||||
|
var nextC2 = GetCenterPoint(nextPt1, nextPt2);
|
||||||
|
|
||||||
|
//计算相邻中点连线跟目的点的垂足
|
||||||
|
//效果并不算太好,因为可能点在两个线上或者线的延长线上,计算会有误差
|
||||||
|
//所以就直接使用中点平移方法。
|
||||||
|
//var C1 = GetFootPoint(lastC, nextC1, currentPt);
|
||||||
|
//var C2 = GetFootPoint(nextC1, nextC2, nextPt1);
|
||||||
|
|
||||||
|
|
||||||
|
//计算“相邻中点”的中点
|
||||||
|
var c1 = GetCenterPoint(lastC, nextC1);
|
||||||
|
var c2 = GetCenterPoint(nextC1, nextC2);
|
||||||
|
|
||||||
|
|
||||||
|
//计算【"中点"的中点】需要的点位移
|
||||||
|
var controlPtOffset1 = currentPt - c1;
|
||||||
|
var controlPtOffset2 = nextPt1 - c2;
|
||||||
|
|
||||||
|
//移动控制点
|
||||||
|
var controlPt1 = nextC1 + controlPtOffset1;
|
||||||
|
var controlPt2 = nextC1 + controlPtOffset2;
|
||||||
|
|
||||||
|
//如果觉得曲线幅度太大,可以将控制点向当前点靠近一定的系数。
|
||||||
|
controlPt1 = controlPt1 + 0 * (currentPt - controlPt1);
|
||||||
|
controlPt2 = controlPt2 + 0 * (nextPt1 - controlPt2);
|
||||||
|
|
||||||
|
var bzs = new BezierSegment(controlPt1, controlPt2, nextPt1, true);
|
||||||
|
return bzs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 过c点做A和B连线的垂足
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="aPoint"></param>
|
||||||
|
/// <param name="bPoint"></param>
|
||||||
|
/// <param name="cPoint"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static Point GetFootPoint(Point aPoint, Point bPoint, Point cPoint)
|
||||||
|
{
|
||||||
|
//设三点坐标是A,B,C,AB构成直线,C是线外的点
|
||||||
|
//三点对边距离是a,b,c,垂足为D,
|
||||||
|
//根据距离推导公式得:AD距离是(b平方-a平方+c平方)/2c
|
||||||
|
//本人数学不好,可能没考虑点c在线ab上的情况
|
||||||
|
var offsetADist = (Math.Pow(cPoint.X - aPoint.X, 2) + Math.Pow(cPoint.Y - aPoint.Y, 2) - Math.Pow(bPoint.X - cPoint.X, 2) - Math.Pow(bPoint.Y - cPoint.Y, 2) + Math.Pow(aPoint.X - bPoint.X, 2) + Math.Pow(aPoint.Y - bPoint.Y, 2)) / (2 * GetDistance(aPoint, bPoint));
|
||||||
|
|
||||||
|
var v = bPoint - aPoint;
|
||||||
|
var distab = GetDistance(aPoint, bPoint);
|
||||||
|
var offsetVector = v * offsetADist / distab;
|
||||||
|
return aPoint + offsetVector;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Point GetCenterPoint(Point pt1, Point pt2)
|
||||||
|
{
|
||||||
|
return new Point((pt1.X + pt2.X) / 2, (pt1.Y + pt2.Y) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double GetDistance(Point pt1, Point pt2)
|
||||||
|
{
|
||||||
|
return Math.Sqrt(Math.Pow(pt1.X - pt2.X, 2) + Math.Pow(pt1.Y - pt2.Y, 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,26 +17,27 @@ namespace Util.DiagramDesigner
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public ConnectionItem(Guid id, Guid sourceId, ConnectorOrientation sourceOrientation, Type sourceType, double sourceXRatio, double sourceYRatio, bool sourceInnerPoint,
|
//public ConnectionItem(Guid id, Guid sourceId, ConnectorOrientation sourceOrientation, Type sourceType, double sourceXRatio, double sourceYRatio, bool sourceInnerPoint,
|
||||||
Guid sinkId, ConnectorOrientation sinkOrientation, Type sinkType, double sinkXRatio, double sinkYRatio, bool sinkInnerPoint,
|
// Guid sinkId, ConnectorOrientation sinkOrientation, Type sinkType, double sinkXRatio, double sinkYRatio, bool sinkInnerPoint,
|
||||||
int zIndex, bool isGroup, Guid parentId, ColorViewModel colorViewModel, FontViewModel fontViewModel) : base(id, zIndex, isGroup, parentId, colorViewModel, fontViewModel)
|
// int zIndex, bool isGroup, Guid parentId, DrawMode vectorLineDrawMode, ColorViewModel colorViewModel, FontViewModel fontViewModel) : base(id, zIndex, isGroup, parentId, colorViewModel, fontViewModel)
|
||||||
{
|
//{
|
||||||
this.SourceId = sourceId;
|
// this.SourceId = sourceId;
|
||||||
this.SourceOrientation = sourceOrientation;
|
// this.SourceOrientation = sourceOrientation;
|
||||||
this.SourceType = sourceType;
|
// this.SourceType = sourceType;
|
||||||
this.SourceTypeName = sourceType.FullName;
|
// this.SourceTypeName = sourceType.FullName;
|
||||||
this.SourceXRatio = sourceXRatio;
|
// this.SourceXRatio = sourceXRatio;
|
||||||
this.SourceYRatio = sourceYRatio;
|
// this.SourceYRatio = sourceYRatio;
|
||||||
this.SourceInnerPoint = sourceInnerPoint;
|
// this.SourceInnerPoint = sourceInnerPoint;
|
||||||
|
|
||||||
this.SinkId = sinkId;
|
// this.SinkId = sinkId;
|
||||||
this.SinkOrientation = sinkOrientation;
|
// this.SinkOrientation = sinkOrientation;
|
||||||
this.SinkType = sinkType;
|
// this.SinkType = sinkType;
|
||||||
this.SinkTypeName = sinkType.FullName;
|
// this.SinkTypeName = sinkType.FullName;
|
||||||
this.SinkXRatio = sinkXRatio;
|
// this.SinkXRatio = sinkXRatio;
|
||||||
this.SinkYRatio = sinkYRatio;
|
// this.SinkYRatio = sinkYRatio;
|
||||||
this.SinkInnerPoint = sinkInnerPoint;
|
// this.SinkInnerPoint = sinkInnerPoint;
|
||||||
}
|
// this.VectorLineDrawMode = vectorLineDrawMode;
|
||||||
|
//}
|
||||||
|
|
||||||
public ConnectionItem(Guid sourceId, ConnectorOrientation sourceOrientation, Type sourceType, double sourceXRatio, double sourceYRatio, bool sourceInnerPoint,
|
public ConnectionItem(Guid sourceId, ConnectorOrientation sourceOrientation, Type sourceType, double sourceXRatio, double sourceYRatio, bool sourceInnerPoint,
|
||||||
Guid sinkId, ConnectorOrientation sinkOrientation, Type sinkType, double sinkXRatio, double sinkYRatio, bool sinkInnerPoint, ConnectorViewModel viewmodel) : base(viewmodel)
|
Guid sinkId, ConnectorOrientation sinkOrientation, Type sinkType, double sinkXRatio, double sinkYRatio, bool sinkInnerPoint, ConnectorViewModel viewmodel) : base(viewmodel)
|
||||||
@@ -56,6 +57,7 @@ namespace Util.DiagramDesigner
|
|||||||
this.SinkXRatio = sinkXRatio;
|
this.SinkXRatio = sinkXRatio;
|
||||||
this.SinkYRatio = sinkYRatio;
|
this.SinkYRatio = sinkYRatio;
|
||||||
this.SinkInnerPoint = sinkInnerPoint;
|
this.SinkInnerPoint = sinkInnerPoint;
|
||||||
|
this.VectorLineDrawMode = viewmodel.VectorLineDrawMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlAttribute]
|
[XmlAttribute]
|
||||||
@@ -99,5 +101,8 @@ namespace Util.DiagramDesigner
|
|||||||
|
|
||||||
[XmlAttribute]
|
[XmlAttribute]
|
||||||
public bool SinkInnerPoint { get; set; }
|
public bool SinkInnerPoint { get; set; }
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public DrawMode VectorLineDrawMode { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,17 +21,17 @@ namespace Util.DiagramDesigner
|
|||||||
FontItem = new FontItem();
|
FontItem = new FontItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectableDesignerItemBase(Guid id, int zIndex, bool isGroup, Guid parentId, IColorViewModel colorViewModel, IFontViewModel fontViewModel)
|
//public SelectableDesignerItemBase(Guid id, int zIndex, bool isGroup, Guid parentId, IColorViewModel colorViewModel, IFontViewModel fontViewModel)
|
||||||
{
|
//{
|
||||||
this.Id = id;
|
// this.Id = id;
|
||||||
this.ZIndex = zIndex;
|
// this.ZIndex = zIndex;
|
||||||
this.IsGroup = isGroup;
|
// this.IsGroup = isGroup;
|
||||||
this.ParentId = parentId;
|
// this.ParentId = parentId;
|
||||||
|
|
||||||
|
|
||||||
ColorItem = CopyHelper.Mapper<ColorItem>(colorViewModel);
|
// ColorItem = CopyHelper.Mapper<ColorItem>(colorViewModel);
|
||||||
FontItem = CopyHelper.Mapper<FontItem, IFontViewModel>(fontViewModel);
|
// FontItem = CopyHelper.Mapper<FontItem, IFontViewModel>(fontViewModel);
|
||||||
}
|
//}
|
||||||
|
|
||||||
public SelectableDesignerItemBase(SelectableDesignerItemViewModelBase viewmodel)
|
public SelectableDesignerItemBase(SelectableDesignerItemViewModelBase viewmodel)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -540,12 +540,21 @@
|
|||||||
<Canvas.InputBindings>
|
<Canvas.InputBindings>
|
||||||
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
||||||
</Canvas.InputBindings>
|
</Canvas.InputBindings>
|
||||||
<Polyline x:Name="poly"
|
<!--<Polyline x:Name="poly"
|
||||||
Points="{Binding Path=ConnectionPoints, Converter={x:Static s:ConnectionPathConverter.Instance}}"
|
Points="{Binding Path=ConnectionPoints, Converter={x:Static s:ConnectionPathConverter.Instance}}"
|
||||||
Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
||||||
StrokeThickness="{Binding ColorViewModel.LineWidth}"
|
StrokeThickness="{Binding ColorViewModel.LineWidth}"
|
||||||
StrokeDashArray="{Binding ColorViewModel.LineDashStyle,Converter={StaticResource LineDashConverter}}" />
|
StrokeDashArray="{Binding ColorViewModel.LineDashStyle,Converter={StaticResource LineDashConverter}}" />-->
|
||||||
|
<Path x:Name="poly" Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
||||||
|
StrokeThickness="{Binding ColorViewModel.LineWidth}"
|
||||||
|
StrokeDashArray="{Binding ColorViewModel.LineDashStyle,Converter={StaticResource LineDashConverter}}">
|
||||||
|
<Path.Data>
|
||||||
|
<MultiBinding Converter="{x:Static s:ConnectionDataConverter.Instance}">
|
||||||
|
<Binding Path="ConnectionPoints"/>
|
||||||
|
<Binding Path="VectorLineDrawMode"/>
|
||||||
|
</MultiBinding>
|
||||||
|
</Path.Data>
|
||||||
|
</Path>
|
||||||
<Path x:Name="rightarrow"
|
<Path x:Name="rightarrow"
|
||||||
Data="{Binding ColorViewModel.RightArrowPathStyle,Converter={StaticResource ArrowPathConverter}}"
|
Data="{Binding ColorViewModel.RightArrowPathStyle,Converter={StaticResource ArrowPathConverter}}"
|
||||||
Visibility="{Binding Path=IsFullConnection, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"
|
Visibility="{Binding Path=IsFullConnection, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace Util.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DrawMode _vectorLineDrawMode = DrawMode.RadiusConnectingLine;
|
private DrawMode _vectorLineDrawMode = DrawMode.CornerConnectingLine;
|
||||||
public DrawMode VectorLineDrawMode
|
public DrawMode VectorLineDrawMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -10,16 +10,16 @@ namespace Util.DiagramDesigner
|
|||||||
{
|
{
|
||||||
public class ConnectorViewModel : SelectableDesignerItemViewModelBase
|
public class ConnectorViewModel : SelectableDesignerItemViewModelBase
|
||||||
{
|
{
|
||||||
private IDiagramServiceProvider _service { get { return DiagramServicesProvider.Instance.Provider; } }
|
|
||||||
|
|
||||||
public ConnectorViewModel(IDiagramViewModel parent, FullyCreatedConnectorInfo sourceConnectorInfo, FullyCreatedConnectorInfo sinkConnectorInfo,
|
public ConnectorViewModel(IDiagramViewModel parent, FullyCreatedConnectorInfo sourceConnectorInfo, FullyCreatedConnectorInfo sinkConnectorInfo,
|
||||||
SelectableDesignerItemBase designer) : base(parent, designer)
|
SelectableDesignerItemBase designer, DrawMode vectorLineDrawMode) : base(parent, designer)
|
||||||
{
|
{
|
||||||
|
VectorLineDrawMode = vectorLineDrawMode;
|
||||||
Init(sourceConnectorInfo, sinkConnectorInfo);
|
Init(sourceConnectorInfo, sinkConnectorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConnectorViewModel(FullyCreatedConnectorInfo sourceConnectorInfo, ConnectorInfoBase sinkConnectorInfo)
|
public ConnectorViewModel(FullyCreatedConnectorInfo sourceConnectorInfo, ConnectorInfoBase sinkConnectorInfo, DrawMode vectorLineDrawMode)
|
||||||
{
|
{
|
||||||
|
VectorLineDrawMode = vectorLineDrawMode;
|
||||||
Init(sourceConnectorInfo, sinkConnectorInfo);
|
Init(sourceConnectorInfo, sinkConnectorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,13 +120,15 @@ namespace Util.DiagramDesigner
|
|||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
if (SetProperty(ref _area, value))
|
if (SetProperty(ref _area, value))
|
||||||
{
|
{
|
||||||
UpdateConnectionPoints();
|
UpdateConnectionPoints();
|
||||||
OutTextItemLocation(_area, value);
|
OutTextItemLocation(_area, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DrawMode VectorLineDrawMode { get; set; }
|
||||||
|
|
||||||
public ConnectorInfo ConnectorInfo(ConnectorOrientation orientation, double left, double top, double width, double height, Point position)
|
public ConnectorInfo ConnectorInfo(ConnectorOrientation orientation, double left, double top, double width, double height, Point position)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -189,11 +191,11 @@ namespace Util.DiagramDesigner
|
|||||||
|
|
||||||
private void UpdateConnectionPoints()
|
private void UpdateConnectionPoints()
|
||||||
{
|
{
|
||||||
if (_service.DrawModeViewModel.VectorLineDrawMode == DrawMode.ConnectingLine)
|
if (VectorLineDrawMode == DrawMode.ConnectingLine)
|
||||||
{
|
{
|
||||||
UpdateConnectionPointsByLine();
|
UpdateConnectionPointsByLine();
|
||||||
}
|
}
|
||||||
else if (_service.DrawModeViewModel.VectorLineDrawMode == DrawMode.BoundaryConnectingLine)
|
else if (VectorLineDrawMode == DrawMode.BoundaryConnectingLine)
|
||||||
{
|
{
|
||||||
UpdateConnectionPointsByBoundary();
|
UpdateConnectionPointsByBoundary();
|
||||||
}
|
}
|
||||||
@@ -247,7 +249,7 @@ namespace Util.DiagramDesigner
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConnectionPoints = PointInfoBase.ToList(PathFinder.GetConnectionLine(sourceInfo, points[1], SourceConnectorInfo.Orientation, SourceConnectorInfo.IsInnerPoint));
|
ConnectionPoints = PointInfoBase.ToList(PathFinder.GetConnectionLine(sourceInfo, points[1], SourceConnectorInfo.Orientation, false, SourceConnectorInfo.IsInnerPoint));
|
||||||
EndPoint = new Point();
|
EndPoint = new Point();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Util.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Size _gridCellSize = new Size(50, 50);
|
private Size _gridCellSize = new Size(100, 100);
|
||||||
public Size GridCellSize
|
public Size GridCellSize
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -130,6 +130,32 @@ namespace Util.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double GridCellWidth
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _gridCellSize.Width;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_gridCellSize.Width = value;
|
||||||
|
RaisePropertyChanged(nameof(GridCellSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double GridCellHeight
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _gridCellSize.Height;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_gridCellSize.Height = value;
|
||||||
|
RaisePropertyChanged(nameof(GridCellSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Color _pageBackground = Colors.White;
|
private Color _pageBackground = Colors.White;
|
||||||
public Color PageBackground
|
public Color PageBackground
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user