internal DependencyGraphView(IndexedGraph dg, IEnumerable <EdgeStylePredicate> edgeStyles = null, Func <NodeIndex, string> nodeName = null, Func <EdgeIndex, string> edgeName = null) { this.dg = dg; this.edgeStyles = edgeStyles; this.nodeName = nodeName; this.edgeName = edgeName; nodeOf = dg.CreateNodeData <Node>(null); OnGraphChanged(); //make the graph.Legend if (edgeStyles != null) { graph.Legend = new Legend(edgeStyles.Count()); graph.Legend.BackColor = Color.LightGray; foreach (EdgeStylePredicate esp in edgeStyles) { LegendItem item = new LegendItem(); item.Label = esp.Name; item.LineColor = Color.Black; if ((esp.Style & GVEdgeStyle.Dimmed) > 0) { item.LineColor = Color.LightGray; } else if ((esp.Style & GVEdgeStyle.Back) > 0) { item.LineColor = Color.Red; } else if ((esp.Style & GVEdgeStyle.Blue) > 0) { item.LineColor = Color.Blue; } item.LineWidth = 1; if ((esp.Style & GVEdgeStyle.Bold) > 0) { item.LineWidth = 2; } if ((esp.Style & GVEdgeStyle.Dashed) > 0) { item.Style = EdgeStyle.Dashed; } graph.Legend.Items.Add(item); } } }
internal DependencyGraphView(IndexedGraph dg, IEnumerable <EdgeStylePredicate> edgeStyles = null, Func <NodeIndex, string> nodeName = null, Func <EdgeIndex, string> edgeName = null) { this.dg = dg; this.edgeStyles = edgeStyles; this.nodeName = nodeName; this.edgeName = edgeName; nodeOf = dg.CreateNodeData <Node>(null); OnGraphChanged(); panel.Dock = DockStyle.Fill; gviewer.Dock = DockStyle.Fill; panel.Controls.Add(gviewer); if (edgeStyles != null) { // draw the legend TableLayoutPanel legend = new TableLayoutPanel(); legend.AutoSize = true; legend.ColumnCount = 2 * edgeStyles.Count(); foreach (EdgeStylePredicate esp in edgeStyles) { PictureBox pic = new PictureBox(); pic.SizeMode = PictureBoxSizeMode.AutoSize; legend.Controls.Add(pic); int size = 8; var bitmap = new System.Drawing.Bitmap(size, size); var graphics = System.Drawing.Graphics.FromImage(bitmap); var color = System.Drawing.Color.Black; if ((esp.Style & EdgeStyle.Dimmed) > 0) { color = System.Drawing.Color.LightGray; } else if ((esp.Style & EdgeStyle.Back) > 0) { color = System.Drawing.Color.Red; } else if ((esp.Style & EdgeStyle.Blue) > 0) { color = System.Drawing.Color.Blue; } int width = 1; if ((esp.Style & EdgeStyle.Bold) > 0) { width = 2; } var pen = new System.Drawing.Pen(color, width); if ((esp.Style & EdgeStyle.Dashed) > 0) { pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; } int y = bitmap.Height / 2; graphics.DrawLine(pen, 0, y, bitmap.Width - 1, y); pic.Image = bitmap; ToolLabel label = new ToolLabel(); label.Text = esp.Name; label.AutoSize = true; legend.Controls.Add(label); } legend.Anchor = AnchorStyles.None; // centers the legend in its parent TableLayoutPanel legendPanel = new TableLayoutPanel(); legendPanel.AutoSize = true; legendPanel.BackColor = System.Drawing.Color.LightGray; legendPanel.Controls.Add(legend); legendPanel.Dock = DockStyle.Bottom; panel.Controls.Add(legendPanel); } }
internal EqualityAnalysisTransform() { newExpression = graph.CreateNodeData <IExpression>(); }