diff --git a/AIStudio.Wpf.DiagramApp/ViewModels/FlowchartViewModel.cs b/AIStudio.Wpf.DiagramApp/ViewModels/FlowchartViewModel.cs index 17deef4..3294b14 100644 --- a/AIStudio.Wpf.DiagramApp/ViewModels/FlowchartViewModel.cs +++ b/AIStudio.Wpf.DiagramApp/ViewModels/FlowchartViewModel.cs @@ -102,6 +102,26 @@ namespace AIStudio.Wpf.Flowchart ConnectionViewModel connector10 = new ConnectionViewModel(coend.BottomConnector, end.TopConnector, _service.DrawModeViewModel.LineDrawMode, _service.DrawModeViewModel.LineRouterMode); DiagramViewModel.Add(connector10); + TextDesignerItemViewModel despcription = new TextDesignerItemViewModel() + { + Name = nameof(despcription), + Left = 260, + Top = 60, + ItemWidth = 300, + ItemHeight = 150, + Text = @" + 一个简易的OA审批流程 + 1.主管审批为or审批,任意一个审批即可; + 2.分管领导为and审批,需要审批两次; + 3.财务审批为or审批,任意一个审批即可; + 4.人力审批为or审批,任意一个审批即可; +注意:为了模拟审批,双击节点可以进行审批;请双击主管审批、分管领导、财务审批、人力审批、进行效果查看。" + }; + despcription.FontViewModel.HorizontalAlignment = HorizontalAlignment.Left; + despcription.FontViewModel.VerticalAlignment = VerticalAlignment.Top; + despcription.FontViewModel.FontColor = Colors.Blue; + DiagramViewModel.Add(despcription); + FlowchartService.InitData(DiagramViewModel.Items.OfType().ToList(), DiagramViewModel.Items.OfType().ToList(), DiagramViewModel, true); } diff --git a/AIStudio.Wpf.DiagramApp/ViewModels/MindViewModel.cs b/AIStudio.Wpf.DiagramApp/ViewModels/MindViewModel.cs index 00cf960..3660545 100644 --- a/AIStudio.Wpf.DiagramApp/ViewModels/MindViewModel.cs +++ b/AIStudio.Wpf.DiagramApp/ViewModels/MindViewModel.cs @@ -59,7 +59,14 @@ namespace AIStudio.Wpf.Flowchart { get { - return SubType.ToEnum(); + if (SubType == null) + { + return MindType.Mind; + } + else + { + return SubType.ToEnum(); + } } } diff --git a/AIStudio.Wpf.DiagramDesigner/Geometrys/PointBase.cs b/AIStudio.Wpf.DiagramDesigner/Geometrys/PointBase.cs index 8cdfbfc..2ac36aa 100644 --- a/AIStudio.Wpf.DiagramDesigner/Geometrys/PointBase.cs +++ b/AIStudio.Wpf.DiagramDesigner/Geometrys/PointBase.cs @@ -181,8 +181,8 @@ namespace AIStudio.Wpf.DiagramDesigner.Geometrys /// The second PointBase to compare public static bool Equals(PointBase point1, PointBase point2) { - return point1.X.Equals(point2.X) && - point1.Y.Equals(point2.Y); + return Math.Abs(point1.X - point2.X) < 0.01f && + Math.Abs(point1.Y - point2.Y) < 0.01f; } /// diff --git a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Boundary.cs b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Boundary.cs index d01826a..2d226c7 100644 --- a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Boundary.cs +++ b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Boundary.cs @@ -53,12 +53,12 @@ namespace AIStudio.Wpf.DiagramDesigner var p0 = GetFirstSegment(source, sourceOrientation, gridCellSize, gridMargin); var p1 = GetFirstSegment(sink, sinkOrientation, gridCellSize, gridMargin); - if (p0 == p1) + if (p0.Equals(p1)) return points; var p2 = new PointBase(GetNearestCross(p0.X, p1.X, gridCellSize.Width, gridMargin.Width), GetNearestCross(p0.Y, p1.Y, gridCellSize.Height, gridMargin.Height)); var p3 = new PointBase(GetNearestCross(p1.X, p0.X, gridCellSize.Width, gridMargin.Width), GetNearestCross(p1.Y, p0.Y, gridCellSize.Height, gridMargin.Height)); - if (p2 == p3) + if (p2.Equals(p3)) { points.Add(p0); points.Add(p2); @@ -93,12 +93,12 @@ namespace AIStudio.Wpf.DiagramDesigner public static double GetNearestCross(double a, double b, double cellSize, double margin) { - if (Math.Abs(a - b) < 0.0001 && (int)((a - margin)/ cellSize) == ((a - margin) / cellSize)) + if (Math.Abs(a - b) < 0.0001 && (int)(Math.Round((a - margin)/ cellSize, 3)) == (Math.Round((a - margin) / cellSize,3))) return a; else if (a < b) - return Math.Ceiling((a - margin) / cellSize) * cellSize + margin; + return Math.Ceiling(Math.Round((a - margin) / cellSize, 3)) * cellSize + margin; else - return Math.Floor((a - margin) / cellSize) * cellSize + margin; + return Math.Floor(Math.Round((a - margin) / cellSize, 3)) * cellSize + margin; } public static PointBase SegmentMiddlePoint(PointBase p1, PointBase p2) diff --git a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/DesignerItemViewModelBase.cs b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/DesignerItemViewModelBase.cs index 7290705..3014f78 100644 --- a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/DesignerItemViewModelBase.cs +++ b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/DesignerItemViewModelBase.cs @@ -192,6 +192,7 @@ namespace AIStudio.Wpf.DiagramDesigner private double _itemWidth = 65; [CanDo] + [Browsable(true)] public double ItemWidth { get @@ -210,6 +211,7 @@ namespace AIStudio.Wpf.DiagramDesigner private double _itemHeight = 65; [CanDo] + [Browsable(true)] public double ItemHeight { get @@ -361,6 +363,7 @@ namespace AIStudio.Wpf.DiagramDesigner private double _left; [CanDo] + [Browsable(true)] public double Left { get @@ -375,6 +378,7 @@ namespace AIStudio.Wpf.DiagramDesigner private double _top; [CanDo] + [Browsable(true)] public double Top { get diff --git a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/SelectableViewModelBase.cs b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/SelectableViewModelBase.cs index e3ab1bb..336a23e 100644 --- a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/SelectableViewModelBase.cs +++ b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/SelectableViewModelBase.cs @@ -125,6 +125,7 @@ namespace AIStudio.Wpf.DiagramDesigner this.IsGroup = designerbase.IsGroup; this.ZIndex = designerbase.ZIndex; this.Text = designerbase.Text; + this.Name = designerbase.Name; ColorViewModel = CopyHelper.Mapper(designerbase.ColorItem); FontViewModel = CopyHelper.Mapper(designerbase.FontItem);