Beispiel #1
0
        public ArcProcessViewModel(ProcessContainerViewModel container, uint index)
        {
            this.container      = container;
            Index               = index;
            ArcSign             = $"d{FootnotesHelper.Parse(container.Index)}{FootnotesHelper.Parse(Index)}";
            CSign               = $"C{FootnotesHelper.Parse(container.Index)}{FootnotesHelper.Parse(Index)}";
            ActivePredicateSign = $"P{FootnotesHelper.Parse(container.Index)}{FootnotesHelper.Parse(Index)}";

            container.PropertyChanged += ContainerPropertyChanged;
        }
 public ProcessViewModel(uint index)
 {
     Index = index;
     Sign  = $"P{FootnotesHelper.Parse(Index)}";
 }
        private void DrawCompactGraph()
        {
            var host = new DrawingVisual();

            var count = containers.Max(x => x.ProcessStatuses.Length);

            using (var dc = host.RenderOpen())
            {
                for (int index = 0; index < count; index++)
                {
                    var point = new Point(1.5 * radius, 0) + index * vNextNode;

                    //петля
                    var nose = GetNooseEx(index);
                    if (nose.Any())
                    {
                        var _radius = 0.8 * radius;
                        var _vector = new Vector(-Math.Cos(Math.PI / 3), Math.Sin(Math.PI / 3)) * 1.2 * radius;
                        var _v      = new Vector(5.9346588560844, 29.4071390016421);

                        dc.DrawEllipse(null, pen, point + _vector, _radius, _radius);
                        DrawArrow(dc, point + _v, new Vector(0, -1));

                        var _nose = new List <ArcProcessViewModel>(nose);
                        if (count > nose.Length)
                        {
                            _nose.AddRange(new ArcProcessViewModel[count - 1 - nose.Length]);
                        }
                        var start     = point + vRadius;
                        var textNoose = new FormattedText($"{nose.Max(x => x.Priority)}\r\n[{string.Join(";", _nose.Select(x => x?.ActivePredicateSign ?? "0"))}]\r\n[{string.Join(";", _nose.Select(x => x?.CSign ?? "0"))}]",
                                                          CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Verdana"), mFont, pen.Brush, 60);
                        dc.DrawText(textNoose, point + new Vector(-1.5 * radius, 2 * radius));
                    }

                    dc.DrawEllipse(brush, pen, point, radius, radius);
                    var textNode = new FormattedText($"S{FootnotesHelper.Parse((uint)index + 1)}",
                                                     CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Verdana"), lFont, pen.Brush, 60);
                    dc.DrawText(textNode, point + vTextNode);


                    if (index + 1 < count)
                    {
                        var arc = GetArcEx(index, index + 1);
                        if (arc.Any())
                        {
                            var _arc = new List <ArcProcessViewModel>(arc);
                            if (count > arc.Length)
                            {
                                _arc.AddRange(new ArcProcessViewModel[count - 1 - arc.Length]);
                            }
                            var start = point + vRadius;
                            var end   = point + vNextNode - vRadius;
                            dc.DrawLine(pen, start, end);
                            DrawArrow(dc, end, new Vector(vNextNode.X, vNextNode.Y));
                            var textArc = new FormattedText($"{arc.Max(x => x.Priority)}\r\n[{string.Join(";", _arc.Select(x => x?.ActivePredicateSign ?? "0"))}]\r\n[{string.Join(";", _arc.Select(x => x?.CSign ?? "0"))}]",
                                                            CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Verdana"), mFont, pen.Brush, 60);
                            dc.DrawText(textArc, point + new Vector(1.3 * radius, 0.3 * radius));
                        }
                    }
                }
            }
            Drawing = host;
        }
Beispiel #4
0
 public ProcessStatusViewModel(ProcessViewModel process, uint index)
 {
     this.process = process;
     Index        = index;
     Sign         = $"S{FootnotesHelper.Parse(process.Index)}{FootnotesHelper.Parse(Index)}";
 }