Exemple #1
0
        /// <summary>
        /// Задать цвета вершины.
        /// </summary>
        /// <param name="args">Аргументы события отрисовки вершины.</param>
        /// <param name="dadVertices">Перечисление всех вершин с УСПД в топологии.</param>
        /// <param name="mcdVertices">Перечисление всех вергин с КУ в топологии.</param>
        protected void SetVertexColors(FormatVertexEventArgs <TopologyVertex> args, IEnumerable <TopologyVertex> dadVertices, IEnumerable <TopologyVertex> mcdVertices)
        {
            try
            {
                args.VertexFormatter.Style = GraphvizVertexStyle.Filled;

                if (args.Vertex.MCZs != null && args.Vertex.MCZs.Any()) // Вершины с ТУУ окрашиваем в зелёный цвет
                {
                    args.VertexFormatter.FillColor = Color.LightGreen;
                }

                else if (!args.Vertex.IsInside())                       // Граничные вершины окрашиваем в жёлтый цвет
                {
                    args.VertexFormatter.FillColor = Color.Yellow;
                }

                else
                {
                    args.VertexFormatter.FillColor = Color.WhiteSmoke;  // Все остальные вершины - почти белые
                }
                HighlightVertex(args, dadVertices, mcdVertices);
            }
            catch (Exception ex)
            {
                Console.WriteLine("SetVertexColor failed! {0}", ex.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// Выделить цветом на графе вершины топологии.
        /// </summary>
        /// <param name="args">Аргументы события отрисовки вершины.</param>
        /// <param name="dadVertices">Перечисление всех вершин с УСПД в топологии.</param>
        /// <param name="mcdVertices">Перечисление всех вергин с КУ в топологии.</param>
        protected void HighlightVertex(FormatVertexEventArgs <TopologyVertex> args, IEnumerable <TopologyVertex> dadVertices, IEnumerable <TopologyVertex> mcdVertices)
        {
            try
            {
                var dadFound = dadVertices.Contains(args.Vertex);
                var mcdFound = mcdVertices.Contains(args.Vertex);

                // Окрашиваем контуры вершинам в соответствии с устройствами на них
                if (dadFound)
                {
                    args.VertexFormatter.Shape       = GraphvizVertexShape.Box;
                    args.VertexFormatter.StrokeColor = Color.Red;
                    args.VertexFormatter.FontColor   = Color.Red;
                }

                if (mcdFound)
                {
                    args.VertexFormatter.Shape       = dadFound ? GraphvizVertexShape.Hexagon : GraphvizVertexShape.Box; // Если в вершине и счётчик, и УСПД, то форма особенная
                    args.VertexFormatter.StrokeColor = Color.Blue;
                    args.VertexFormatter.FontColor   = Color.Blue;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("HighlightVertex failed! {0}", ex.Message);
            }
        }
Exemple #3
0
        void VertexStyler(object sender, FormatVertexEventArgs <Vertex> e)
        {
            e.VertexFormatter.Label = e.Vertex.Title;

            if (e.Vertex.VertexType == typeof(Event))
            {
                e.VertexFormatter.FontColor = GraphvizColor.Black;
                e.VertexFormatter.Shape     = GraphvizVertexShape.Plaintext;

                if (e.Vertex.TargetType != typeof(Event) && e.Vertex.TargetType != typeof(Exception))
                {
                    e.VertexFormatter.Label += "<" + e.Vertex.TargetType.Name + ">";
                }
            }
            else
            {
                switch (e.Vertex.Title)
                {
                case "Initial":
                    e.VertexFormatter.FillColor = GraphvizColor.White;
                    break;

                case "Final":
                    e.VertexFormatter.FillColor = GraphvizColor.White;
                    break;

                default:
                    e.VertexFormatter.FillColor = GraphvizColor.White;
                    e.VertexFormatter.FontColor = GraphvizColor.Black;
                    break;
                }

                e.VertexFormatter.Shape = GraphvizVertexShape.Ellipse;
            }
        }
        private void graphviz_FormatVertex(object sender, FormatVertexEventArgs <int> e)
        {
            //(If nothing is included here, having this here allows default behaviour for serializer (add labels))

            //Use formattor explicitally
            var vertexFormattor = e.VertexFormatter;
            int vertexNo        = e.Vertex;

            string vertexLabel = vertexNo.ToString();

            if (vertexMapping.ContainsKey(vertexNo))
            {
                vertexLabel = vertexMapping[vertexNo];
            }

            //If there is a clue here, append clue
            var clues = model.DoorAndClueManager.GetObjectiveAndClueIdsAtVertex(vertexNo);

            foreach (var clue in clues)
            {
                vertexLabel += "\\n";
                vertexLabel += clue;
            }

            vertexFormattor.Label = vertexLabel;
        }
Exemple #5
0
        void graphviz_FormatVertex(object sender, FormatVertexEventArgs e)
        {
            TypeVertex v = (TypeVertex)e.Vertex;

            e.VertexFormatter.Label = v.Name;
            e.VertexFormatter.Font  = new Font(FontFamily.GenericSerif, 8);
        }
        void VertexStyler(object sender, FormatVertexEventArgs<Vertex> e)
        {
            e.VertexFormatter.Label = e.Vertex.Title;

            if (e.Vertex.VertexType == typeof(Event))
            {
                e.VertexFormatter.FontColor = GraphvizColor.Black;
                e.VertexFormatter.Shape = GraphvizVertexShape.Rectangle;

                if (e.Vertex.TargetType != typeof(Event) && e.Vertex.TargetType != typeof(Exception))
                    e.VertexFormatter.Label += "<" + e.Vertex.TargetType.Name + ">";
            }
            else
            {
                switch (e.Vertex.Title)
                {
                    case "Initial":
                        e.VertexFormatter.FillColor = GraphvizColor.White;
                        break;
                    case "Final":
                        e.VertexFormatter.FillColor = GraphvizColor.White;
                        break;
                    default:
                        e.VertexFormatter.FillColor = GraphvizColor.White;
                        e.VertexFormatter.FontColor = GraphvizColor.Black;
                        break;
                }

                e.VertexFormatter.Shape = GraphvizVertexShape.Ellipse;
            }
        }
Exemple #7
0
        private static void VertexStyler(object sender, FormatVertexEventArgs <Vertex> args)
        {
            args.VertexFormat.Label = args.Vertex.Title;

            if (args.Vertex.VertexType == typeof(Event))
            {
                args.VertexFormat.FontColor = GraphvizColor.Black;
                args.VertexFormat.Shape     = GraphvizVertexShape.Rectangle;

                if (args.Vertex.TargetType != typeof(Event) && args.Vertex.TargetType != typeof(Exception))
                {
                    args.VertexFormat.Label += "<" + args.Vertex.TargetType.Name + ">";
                }
            }
            else
            {
                switch (args.Vertex.Title)
                {
                case "Initial":
                    args.VertexFormat.FillColor = GraphvizColor.White;
                    break;

                case "Final":
                    args.VertexFormat.FillColor = GraphvizColor.White;
                    break;

                default:
                    args.VertexFormat.FillColor = GraphvizColor.White;
                    args.VertexFormat.FontColor = GraphvizColor.Black;
                    break;
                }

                args.VertexFormat.Shape = GraphvizVertexShape.Ellipse;
            }
        }
Exemple #8
0
        public void FormatGraph(object sender, FormatVertexEventArgs args)
        {
            MyVertex o = (MyVertex)args.Vertex;

            args.VertexFormatter.Label = o.Name;
            args.VertexFormatter.Shape = NGraphviz.Helpers.GraphvizVertexShape.Ellipse;
        }
Exemple #9
0
        private void VertexFormatter(object sender, FormatVertexEventArgs <int> e)
        {
            Contract.Requires(e != null);

            e.VertexFormat.Label = e.Vertex.ToString();
            e.VertexFormat.Shape = _VertexShape;
            e.VertexFormat.Style = _VertexStyle;
        }
        /*
         * задаёт стиль вершин графа
         */
        private static void FormatVertex(object sender, FormatVertexEventArgs <string> e)

        {
            e.VertexFormatter.Label       = e.Vertex.Split()[0];
            e.VertexFormatter.Shape       = GraphvizVertexShape.Circle;
            e.VertexFormatter.StrokeColor = GraphvizColor.Black;
            e.VertexFormatter.Font        = new GraphvizFont("Calibri", 11);
        }
Exemple #11
0
        ////////////////////////////////////////////////////////////////
        private void FormatVertexHandler(object sender, FormatVertexEventArgs <string> e)
        {
            Contract.Requires(e != null);

            e.VertexFormat.Label = e.Vertex;
            e.VertexFormat.Shape = _VertexShape;
            e.VertexFormat.Style = _VertexStyle;
        }
Exemple #12
0
        private static void VizFormastring <TVertex>(object sender, FormatVertexEventArgs <TVertex> e)
            where TVertex : ExpansionTreeNode
        {
            var graph = e.Vertex.QueryGraph;

            e.VertexFormatter.Shape  = QuickGraph.Graphviz.Dot.GraphvizVertexShape.Box;
            e.VertexFormatter.Label  = e.Vertex.NodeName;
            e.VertexFormatter.Label += graph == null ? "\n\n(Root)" : $"\n\n(Level {e.Vertex.Level}. #Edges: {graph.EdgeCount})";
        }
 private static void FormatVertex(object sender, FormatVertexEventArgs <string> e)
 {
     e.VertexFormatter.Label = e.Vertex;
     //Форма узла
     e.VertexFormatter.Shape = GraphvizVertexShape.Circle;
     //Цвет узора
     e.VertexFormatter.StrokeColor = GraphvizColor.Black;
     //Настройки шрифта
     e.VertexFormatter.Font = new GraphvizFont("Calibri", 11);
 }
Exemple #14
0
        private static void graphviz_FormatVertex(object sender, FormatVertexEventArgs <int> e)
        {
            //(If nothing is included here, having this here allows default behaviour for serializer (add labels))

            //Use formattor explicitally
            var vertexFormattor = e.VertexFormatter;
            int vertexNo        = e.Vertex;

            vertexFormattor.Label = String.Format("{0}", vertexNo);
        }
        private static void graphviz_FormatVertex(object sender, FormatVertexEventArgs<int> e)
        {
            //(If nothing is included here, having this here allows default behaviour for serializer (add labels))

            //Use formattor explicitally
            var vertexFormattor = e.VertexFormatter;
            int vertexNo = e.Vertex;

            vertexFormattor.Label = String.Format("{0}", vertexNo);
        }
        private void graphviz_FormatDoorVertex(object sender, FormatVertexEventArgs <int> e)
        {
            //Output door id
            var vertexFormattor = e.VertexFormatter;
            int vertexNo        = e.Vertex;

            var door = model.DoorAndClueManager.GetLockIdByIndex(vertexNo);

            vertexFormattor.Label = door;
        }
Exemple #17
0
		private void FormatVertex(Object sender, FormatVertexEventArgs e)
		{
			e.VertexFormatter.Label = ((NamedVertex)e.Vertex).Name;
			e.VertexFormatter.Shape = GraphvizVertexShape.Box;

			if (e.Vertex==this.root)
				e.VertexFormatter.StrokeColor = Color.Blue;
			else
				e.VertexFormatter.StrokeColor = Color.Black;
		}
Exemple #18
0
        private static void FormatVertex(object sender, FormatVertexEventArgs <string> e)
        {
            e.VertexFormatter.Label = e.Vertex;
            e.VertexFormatter.Shape = GraphvizVertexShape.Circle;

            e.VertexFormatter.StrokeColor = GraphvizColor.Black;
            e.VertexFormatter.Font        = new GraphvizFont(System.Drawing.FontFamily.GenericMonospace.Name, 12);

            e.VertexFormatter.Style = GraphvizVertexStyle.Filled;
        }
Exemple #19
0
        private static void FormatVertex(object sender, FormatVertexEventArgs <int> e)
        {
            if (e.Vertex == 0 || e.Vertex == 1)
            {
                e.VertexFormatter.StrokeColor = Color.Brown;
                e.VertexFormatter.Shape       = GraphvizVertexShape.Box;
            }
            var    item = idNum[e.Vertex].Item2;
            string lb   = item == LBDDNode.Labeling.Double ? "& " : item == LBDDNode.Labeling.Negate ? "$ " : " ";

            e.VertexFormatter.Label = lb + idNum[e.Vertex].Item1.ToString();
        }
Exemple #20
0
        private static void OnFormatVertex(object sender, FormatVertexEventArgs <Node> e)
        {
            var formatter = e.VertexFormatter;

            formatter.Shape       = VERTEX_SHAPE;
            formatter.Style       = GraphvizVertexStyle.Filled;
            formatter.Font        = new GraphvizFont(FONT_NAME, VERTEX_FONT_SIZE);
            formatter.FontColor   = new GraphvizColor(255, FONT_COLOR, FONT_COLOR, FONT_COLOR);
            formatter.Label       = e.Vertex.ShowLabel ? e.Vertex.IdNum.ToString() : string.Empty;
            formatter.StrokeColor = new GraphvizColor(255, STROKE_COLOR, STROKE_COLOR, STROKE_COLOR);
            formatter.FillColor   = e.Vertex.Color;
        }
Exemple #21
0
 private static void FormatVertex(object sender, FormatVertexEventArgs <TVertex> e)
 {
     e.VertexFormatter.Label = e.Vertex.ToString();
     if (e.Vertex.IsFinish)
     {
         e.VertexFormatter.Style = GraphvizVertexStyle.Filled;
     }
     if (e.Vertex.IsStart)
     {
         e.VertexFormatter.Style = GraphvizVertexStyle.Dashed;
     }
 }
 private void algo_FormatVertex(object sender, FormatVertexEventArgs e)
 {
     e.VertexFormatter.Label=e.Vertex.ToString();
     if (e.Vertex is IPlace)
     {
         e.VertexFormatter.Shape = GraphvizVertexShape.Circle;
     }
     else if (e.Vertex is Transition)
     {
         e.VertexFormatter.Shape = GraphvizVertexShape.Box;
     }
 }
        private void graphviz_FormatVertex_NoAnnotation(object sender, FormatVertexEventArgs <int> e)
        {
            //(If nothing is included here, having this here allows default behaviour for serializer (add labels))

            //Use formattor explicitally
            var vertexFormattor = e.VertexFormatter;
            int vertexNo        = e.Vertex;

            string vertexLabel = vertexNo.ToString();

            vertexFormattor.Label = vertexLabel;
        }
        private void graphviz_FormatVertex(object sender, FormatVertexEventArgs <int> e)
        {
            Project project = _solution.Projects[e.Vertex];

            e.VertexFormatter.Label = project.Name;
            e.VertexFormatter.Shape = GraphvizVertexShape.Ellipse;

            foreach (var proc in GraphProcessors)
            {
                proc.ProcessVertex(e.VertexFormatter, project);
            }
        }
Exemple #25
0
 private void algo_FormatVertex(object sender, FormatVertexEventArgs e)
 {
     e.VertexFormatter.Label = e.Vertex.ToString();
     if (e.Vertex is IPlace)
     {
         e.VertexFormatter.Shape = GraphvizVertexShape.Circle;
     }
     else if (e.Vertex is Transition)
     {
         e.VertexFormatter.Shape = GraphvizVertexShape.Box;
     }
 }
Exemple #26
0
        private static void OnFormatInfoVertex(object sender, FormatVertexEventArgs <Vertex> e)
        {
            if (!(e.Vertex.Node is IInformationTreeNode))
            {
                return;
            }
            var treeNode   = (IInformationTreeNode)e.Vertex.Node;
            var relCount   = (double)treeNode.Value / treeNode.RootNode?.Value ?? 1d;
            var isArgument = treeNode is IArgInfoTreeNode;

            FormatVertex(
                e.VertexFormatter, relCount, $"{treeNode}:{treeNode.Value}", treeNode.RootNode == null, isArgument);
        }
        public void FormatVertex(object sender, FormatVertexEventArgs<IContent> e)
        {
            // .Has<> doesn't work here
            if (e.Vertex.As<ITitleAspect>() != null) e.VertexFormatter.Label = e.Vertex.As<ITitleAspect>().Title;

            if (e.Vertex.As<IAliasAspect>() != null)
            {
                e.VertexFormatter.Url = new UrlHelper(_orchardServices.WorkContext.HttpContext.Request.RequestContext)
                                    .RouteUrl(_orchardServices.ContentManager.GetItemMetadata(e.Vertex).DisplayRouteValues);
            }

            e.VertexFormatter.Shape = GraphvizVertexShape.Diamond;
        }
Exemple #28
0
        /// <summary>
        /// Formats a <see cref="DataTable"/> (a table).
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected virtual void FormatTable([NotNull] object sender, [NotNull] FormatVertexEventArgs <DataTable> args)
        {
            Debug.Assert(sender != null);
            Debug.Assert(args != null);

            DataTable      vertex = args.Vertex;
            GraphvizVertex format = args.VertexFormat;

            format.Shape = GraphvizVertexShape.Record;

            // Create a record with a title and a list of columns
            var title = new GraphvizRecordCell
            {
                Text = vertex.TableName
            };

            var  builder = new StringBuilder();
            bool flag    = true;

            foreach (DataColumn column in vertex.Columns)
            {
                if (flag)
                {
                    flag = false;
                }
                else
                {
                    builder.AppendLine();
                }

                builder.Append($"+ {column.ColumnName} : {column.DataType.Name}");
                if (column.Unique)
                {
                    builder.Append(" unique");
                }
            }
            var columns = new GraphvizRecordCell
            {
                Text = builder.ToString().TrimEnd()
            };

            format.Record.Cells.Add(title);
            format.Record.Cells.Add(columns);
        }
Exemple #29
0
        private void FormatVertex(object sender, FormatVertexEventArgs <ExpandingNode> e)
        {
            ExpandingNode ent = e.Vertex;

            //e.VertexFormatter.Label = ent.GetName();
            e.VertexFormatter.Shape = GraphvizVertexShape.Record;
            e.VertexFormatter.Style = GraphvizVertexStyle.Filled;

            switch (ent.state)
            {
            case ExpandingNode.STATE.NEW:
                e.VertexFormatter.FillColor = Color.Orange;
                break;

            case ExpandingNode.STATE.EXPANDED:
                e.VertexFormatter.FillColor = Color.Red;
                break;

            case ExpandingNode.STATE.FREEZED:
                e.VertexFormatter.FillColor = Color.LightBlue;
                break;
            }

            GraphvizRecord rec = new GraphvizRecord();

            GraphvizRecordCell name = new GraphvizRecordCell();

            name.Text = ent.GetName();

            GraphvizRecordCell maxScore = new GraphvizRecordCell();

            maxScore.Text = ent.maxVal.ToString();

            GraphvizRecordCell minScore = new GraphvizRecordCell();

            minScore.Text = ent.minVal.ToString();

            rec.Cells.Add(name);
            rec.Cells.Add(maxScore);
            rec.Cells.Add(minScore);

            e.VertexFormatter.Record = rec;
        }
        protected virtual void FormatTable(object sender, FormatVertexEventArgs <DataTable> e)
        {
            Contract.Requires(sender != null);
            Contract.Requires(e != null);

            var v      = e.Vertex;
            var format = e.VertexFormatter;

            format.Shape = GraphvizVertexShape.Record;

            // creating a record with a title and a list of columns.
            var title = new GraphvizRecordCell()
            {
                Text = v.TableName
            };
            var  sb    = new StringBuilder();
            bool first = true;

            foreach (DataColumn column in v.Columns)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    sb.AppendLine();
                }
                sb.AppendFormat("+ {0} : {1}", column.ColumnName, column.DataType.Name);
                if (column.Unique)
                {
                    sb.Append(" unique");
                }
            }
            var columns = new GraphvizRecordCell()
            {
                Text = sb.ToString().TrimEnd()
            };

            format.Record.Cells.Add(title);
            format.Record.Cells.Add(columns);
        }
Exemple #31
0
        public void FormatCCCVertex(object sender, FormatVertexEventArgs args)
        {
            CondensedVertex o = (CondensedVertex)args.Vertex;

            args.VertexFormatter.Label = o.Name;

            if (o.IsSCC)
            {
                args.VertexFormatter.Group     = "sdfsdf";
                args.VertexFormatter.FillColor = Color.AliceBlue;
                args.VertexFormatter.Style     = GraphvizVertexStyle.Filled;
                args.VertexFormatter.Shape     = NGraphviz.Helpers.GraphvizVertexShape.Box;
            }
            if (o.ImutableExternalType)
            {
                args.VertexFormatter.FillColor = Color.LightSalmon;
                args.VertexFormatter.Style     = GraphvizVertexStyle.Filled;
                args.VertexFormatter.Shape     = NGraphviz.Helpers.GraphvizVertexShape.MSquare;
            }
        }
Exemple #32
0
        public void FormatCCCVertex(object sender, FormatVertexEventArgs args)
        {
            CondensedVertex o = (CondensedVertex)args.Vertex;
            args.VertexFormatter.Label = o.Name;

            if (o.IsSCC)
            {
                args.VertexFormatter.Group = "sdfsdf";
                args.VertexFormatter.FillColor = Color.AliceBlue;
                args.VertexFormatter.Style = GraphvizVertexStyle.Filled;
                args.VertexFormatter.Shape = NGraphviz.Helpers.GraphvizVertexShape.Box;
            }
            if (o.ImutableExternalType)
            {
                args.VertexFormatter.FillColor = Color.LightSalmon;
                args.VertexFormatter.Style = GraphvizVertexStyle.Filled;
                args.VertexFormatter.Shape = NGraphviz.Helpers.GraphvizVertexShape.MSquare;

            }
        }
Exemple #33
0
        //Возвращает ноль, если все цвета уже присвоены
        //static bool NoFullColor(int versh, AdjacencyGraph<uzel, Edge<uzel>> g)
        //{
        //    int flag = 0;
        //    foreach (uzel col in g.Vertices)    //Цикл проверяет - все ли цвета посещены
        //    {
        //        if (col.color <= versh)
        //            flag++;
        //    }
        //    if (flag == versh)
        //    {
        //        return false;
        //    }
        //    else
        //    {
        //        return true;
        //    }

        //}

        private static void FormatVertex(object sender, FormatVertexEventArgs <uzel> e)
        {
            string para;

            if (e.Vertex.leacture)
            {
                para = "Лекция";
            }
            else
            {
                para = "Практика";
            }
            e.VertexFormatter.Label = e.Vertex.group + "\n" + e.Vertex.subject + "\n" + e.Vertex.teacher + "\n" + para + "\n\n" + e.Vertex.color.ToString();
            e.VertexFormatter.Shape = GraphvizVertexShape.Circle;
            //e.VertexFormatter.BottomLabel = e.Vertex.subject;



            e.VertexFormatter.StrokeColor = GraphvizColor.Black;
            e.VertexFormatter.Font        = new GraphvizFont("Calibri", 16);
        }
        private void graphviz_FormatVertex(object sender,
                                           FormatVertexEventArgs <Leaf> e)
        {
            // decision
            if (e.Vertex.DecisionClass != null)
            {
                e.VertexFormatter.Label = e.Vertex.DecisionClass.Name;

                return;
            }

            e.VertexFormatter.Shape = GraphvizVertexShape.Diamond;

            if (e.Vertex.ParentLink.Negatives == 0)
            {
                e.VertexFormatter.Label = "Yes";
            }
            else
            {
                e.VertexFormatter.Label = "No";
            }
        }
Exemple #35
0
        private void graphviz_FormatVertex(object sender,
                                           FormatVertexEventArgs <Leaf> e)
        {
            // decision
            if (e.Vertex.Classifier != null
                //&& e.Vertex.Classifier.Entropy == 0
                )
            {
                e.VertexFormatter.Label = e.Vertex.Classifier.AttributeName;

                return;
            }

            e.VertexFormatter.Shape = GraphvizVertexShape.Diamond;

            if (e.Vertex.Parent.Negatives == 0)
            {
                e.VertexFormatter.Label = "Yes";
            }
            else
            {
                e.VertexFormatter.Label = "No";
            }
        }
Exemple #36
0
        void algorithm_FormatVertex(object sender, FormatVertexEventArgs e)
        {
            CFGNode node = (CFGNode)e.Vertex;
            e.VertexFormatter.Label = node.ToString();
            if (node == Graph.Root)
            {
                e.VertexFormatter.FillColor = System.Drawing.Color.Blue;
                e.VertexFormatter.FontColor = System.Drawing.Color.White;
            }
            else if (Graph.OutDegree(node) == 0)
            {
                e.VertexFormatter.FillColor = System.Drawing.Color.Red;
                e.VertexFormatter.FontColor = System.Drawing.Color.White;
            }
            else if (MethodCompileInfo.DeadCode.Contains(node))
            {
                e.VertexFormatter.FillColor = System.Drawing.Color.LightGray;
                e.VertexFormatter.FontColor = System.Drawing.Color.Black;
            }
            else if (node.FlowControl == FlowControl.Call)
            {
                e.VertexFormatter.FillColor = System.Drawing.Color.Green;
                e.VertexFormatter.FontColor = System.Drawing.Color.White;
            }
            else
            {
                e.VertexFormatter.FillColor = System.Drawing.Color.Black;
                e.VertexFormatter.FontColor = System.Drawing.Color.White;
            }
            StringBuilder sb = new StringBuilder();
            if (node.DebugInfo != null)
            {
                sb.AppendFormat("\nDebugInfo: {0}", node.DebugInfo);
            }
            sb.AppendFormat("\nFlow control: {0}", node.FlowControl);
            if (DebugSettings.DetailedGraphs)
            {
                sb.Append("\nDefined: ");
                foreach (string var in MethodCompileInfo.Defined[node])
                {
                    sb.AppendFormat("{0} ", var);
                }
                sb.Append("\nUsed: ");
                foreach (string var in MethodCompileInfo.Used[node])
                {
                    sb.AppendFormat("{0} ", var);
                }
                sb.Append("\nIn: ");
                foreach (string var in MethodCompileInfo.LiveVariablesIn[node])
                {
                    sb.AppendFormat("{0} ", var);
                }
                sb.Append("\nOut: ");
                foreach (string var in MethodCompileInfo.LiveVariablesOut[node])
                {
                    sb.AppendFormat("{0} ", var);
                }
            #if GRAPH2
            sb.Append("\nDominators: ");
            foreach (CFGNode dom in MethodCompileInfo.Dominators[node])
            {
                sb.AppendFormat("{0} ", dom.ID);
            }
            sb.Append("\nGen: ");
            for (int i = 0; i < MethodCompileInfo.GeneratedDefinitions[node].Count;i++ )
            {
                sb.Append(MethodCompileInfo.GeneratedDefinitions[node][i].ToString().Replace("\", "\\").Replace("\n", "\n").Replace("\r", "").Replace("\"", "\\""));
                if (i < MethodCompileInfo.GeneratedDefinitions[node].Count - 1)
                {
                    sb.Append(" \n");
                }
            }
            sb.Append("\nKill: ");
            for (int i = 0; i < MethodCompileInfo.KilledDefinitions[node].Count; i++)
            {
                sb.Append(MethodCompileInfo.KilledDefinitions[node][i].ToString().Replace("\", "\\").Replace("\n", "\n").Replace("\r", "").Replace("\"", "\\""));
                if (i < MethodCompileInfo.KilledDefinitions[node].Count - 1)
                {
                    sb.Append(" \n");
                }
            }
            sb.Append("\nExps in: ");
            for (int i = 0; i < MethodCompileInfo.LiveExpressionsIn[node].Count; i++)
            {
                sb.Append(MethodCompileInfo.LiveExpressionsIn[node][i].ToString().Replace("\", "\\").Replace("\n", "\n").Replace("\r", "").Replace("\"", "\\""));
                if (i < MethodCompileInfo.LiveExpressionsIn[node].Count - 1)
                {
                    sb.Append(" \n");
                }
            }
            sb.Append("\nExps out: ");
            for (int i = 0; i < MethodCompileInfo.LiveExpressionsOut[node].Count; i++)
            {
                sb.Append(MethodCompileInfo.LiveExpressionsOut[node][i].ToString().Replace("\", "\\").Replace("\n", "\n").Replace("\r", "").Replace("\"", "\\""));
                if (i < MethodCompileInfo.LiveExpressionsOut[node].Count - 1)
                {
                    sb.Append(" \n");
                }
            }
            #endif
            }

            if (DebugSettings.GraphReachingDefinitions)
            {
                sb.Append("\nReaching Defs: ");
                for (int i = 0; i < MethodCompileInfo.ReachingDefinitions[node].Count; i++)
                {
                    sb.Append(MethodCompileInfo.ReachingDefinitions[node][i].ToString());
                    if (i < MethodCompileInfo.ReachingDefinitions[node].Count - 1)
                    {
                        sb.Append(" \n");
                    }
                }
            }
            if (DebugSettings.GraphDominators)
            {
                sb.Append("\n Dominators: ");
                for (int i = 0; i < MethodCompileInfo.Dominators[node].Count; i++)
                {
                    sb.Append(MethodCompileInfo.Dominators[node][i].ID);
                    if (i < MethodCompileInfo.Dominators[node].Count - 1)
                    {
                        sb.Append(",");
                    }
                }
                sb.Append("\n Dominator Frontier: ");
                for (int i = 0; i < MethodCompileInfo.DominatorFrontier[node].Count; i++)
                {
                    sb.Append(MethodCompileInfo.DominatorFrontier[node][i].ID);
                    if (i < MethodCompileInfo.DominatorFrontier[node].Count - 1)
                    {
                        sb.Append(",");
                    }
                }
            }

            e.VertexFormatter.Label += sb.ToString();
            e.VertexFormatter.Label = Escape(e.VertexFormatter.Label);
        }
Exemple #37
0
        void algorithm_FormatVertex(object sender, FormatVertexEventArgs e)
        {
            InterferenceGraphNode node = (InterferenceGraphNode)e.Vertex;
            e.VertexFormatter.Label = node.ToString();

            if (node.Color != 0)
            {
                e.VertexFormatter.FillColor = ColorMapping[node.Color];
            }
            int registerNum;
            if (MethodCompileInfo.RegisterMap.TryGetValue(node.Variable, out registerNum))
            {
                e.VertexFormatter.Label += " => $r" + registerNum;
            }
        }
        private void graphviz_FormatVertex_NoAnnotation(object sender, FormatVertexEventArgs<int> e)
        {
            //(If nothing is included here, having this here allows default behaviour for serializer (add labels))

            //Use formattor explicitally
            var vertexFormattor = e.VertexFormatter;
            int vertexNo = e.Vertex;

            string vertexLabel = vertexNo.ToString();

            vertexFormattor.Label = vertexLabel;
        }
        private void graphviz_FormatVertex(object sender, FormatVertexEventArgs<int> e)
        {
            //(If nothing is included here, having this here allows default behaviour for serializer (add labels))

            //Use formattor explicitally
            var vertexFormattor = e.VertexFormatter;
            int vertexNo = e.Vertex;

            string vertexLabel = vertexNo.ToString();

            if (vertexMapping.ContainsKey(vertexNo))
                vertexLabel = vertexMapping[vertexNo];

            //If there is a clue here, append clue
            var clues = model.DoorAndClueManager.GetObjectiveAndClueIdsAtVertex(vertexNo);

            foreach (var clue in clues)
            {
                vertexLabel += "\\n";
                vertexLabel += clue;
            }

            vertexFormattor.Label = vertexLabel;
        }
 private void gw_FormatVertex(object sender, FormatVertexEventArgs e)
 {
     // setting the vertex name
     e.VertexFormatter.Label = Names[e.Vertex];
 }
 void graphviz_FormatVertex(object sender, FormatVertexEventArgs<PackageDto> e)
 {
     e.VertexFormatter.Label = e.Vertex.ToString();
 }
 private void FormatVertex(Object sender, FormatVertexEventArgs args)
 {
     args.VertexFormatter.Label = (args.Vertex as NamedVertex).Name;
 }
        private void graphviz_FormatDoorVertex(object sender, FormatVertexEventArgs<int> e)
        {
            //Output door id
            var vertexFormattor = e.VertexFormatter;
            int vertexNo = e.Vertex;

            var door = model.DoorAndClueManager.GetLockIdByIndex(vertexNo);

            vertexFormattor.Label = door;
        }
        private void FormatVertex(Object sender, FormatVertexEventArgs e)
        {
            e.VertexFormatter.Label = ((NamedVertex)e.Vertex).Name;
            e.VertexFormatter.Shape = GraphvizVertexShape.Box;

            if (e.Vertex==this.root)
                e.VertexFormatter.StrokeColor = Color.Blue;
            else
                e.VertexFormatter.StrokeColor = Color.Black;
        }
        private void graphviz_FormatVertex(object sender, 
                                           FormatVertexEventArgs<Leaf> e)
        {
            // decision
            if (e.Vertex.DecisionClass != null)
            {
                e.VertexFormatter.Label = e.Vertex.DecisionClass.Name;

                return;
            }

            e.VertexFormatter.Shape = GraphvizVertexShape.Diamond;

            if (e.Vertex.ParentLink.Negatives == 0)
                e.VertexFormatter.Label = "Yes";
            else
                e.VertexFormatter.Label = "No";
        }
        private void graphviz_FormatVertex(object sender, FormatVertexEventArgs<int> e)
        {
            Project project = _solution.Projects[e.Vertex];

            e.VertexFormatter.Label = project.Name;
            e.VertexFormatter.Shape = GraphvizVertexShape.Ellipse;

            foreach (var proc in GraphProcessors)
            {
                proc.ProcessVertex(e.VertexFormatter, project);
            }
        }
 void graphviz_FormatVertex(object sender, FormatVertexEventArgs e)
 {
     CustomVertex vertex = (CustomVertex)e.Vertex;
     e.VertexFormatter.Label = String.Format("{0}", vertex.Value);
 }
 public void FormatGraph(object sender, FormatVertexEventArgs args)
 {
     MyVertex o = (MyVertex) args.Vertex;
     args.VertexFormatter.Label = o.Name;
     args.VertexFormatter.Shape = NGraphviz.Helpers.GraphvizVertexShape.Ellipse;
 }
Exemple #49
0
 void graphviz_FormatVertex(object sender, FormatVertexEventArgs e)
 {
     TypeVertex v = (TypeVertex)e.Vertex;
     e.VertexFormatter.Label = v.Name;
     e.VertexFormatter.Font = new Font(FontFamily.GenericSerif, 8);
 }
 private static void FormatVertexHandler(object sender, FormatVertexEventArgs<string> e)
 {
     e.VertexFormatter.Label = e.Vertex;
     e.VertexFormatter.Shape = GraphvizVertexShape.MSquare;
     e.VertexFormatter.Style = GraphvizVertexStyle.Rounded;
 }
 /// <summary>
 /// Format vertex event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void FormatVertex(Object sender, FormatVertexEventArgs args)
 {
     args.VertexFormatter.Label = ((NamedVertex)args.Vertex).Name;
 }
 void gv_FormatVertex(object sender, FormatVertexEventArgs e)
 {
     NamedVertex v = (NamedVertex)e.Vertex;
     e.VertexFormatter.Label = v.Name;
 }