public void DrawCallLine(Color color, int lineWidth, PointF start, PointF end, bool dashed, NodeModel source, NodeModel destination) { var lineRect = new RectangleF(Math.Min(start.X, end.X), Math.Min(start.Y, end.Y), Math.Abs(end.X - start.X), Math.Abs(end.Y - start.Y)); if (!ClientRect.IntersectsWith(lineRect)) { return; } var a = new Vector3(start.X, start.Y, 0); var b = new Vector3(end.X, end.Y, 0); VertexBuffer vbo = null; if (!dashed) { vbo = GetLineVbo(CallLines, lineWidth); } else { vbo = GetLineVbo(DashedCallLines, lineWidth); } vbo.AddVerticies(color, Normal, a, b); }
public void DrawTextBackground(Color color, float x, float y, float width, float height) { var rect = new RectangleF(x, y, width, height); if (!ClientRect.IntersectsWith(rect)) { return; } Overlays.AddVerticies(color, Normal, GetRectVerticies(rect)); }
public void DrawNode(Color color, RectangleF area, bool outside, NodeModel node, int depth) { if (!ClientRect.IntersectsWith(area)) { return; } var verticies = outside ? GetTriangleVerticies(area) : GetRectVerticies(area); Nodes.AddVerticies(color, Normal, verticies); }
public void DrawNodeLabel(string text, Font font, Color color, RectangleF rect, NodeModel node, int depth) { QFont qfont = GetQFont(font); float height = LabelHeight; if (Model.ViewLayout == LayoutType.TreeMap) { height = depth * LevelSize + GetNodeHeight(node); // put over call lines } if (SelectionMode != SelectionModes.None) { SelectionMap[node.ID] = node; color = Color.FromArgb((255 << 24) | node.ID); var textArea = qfont.Measure(text, rect.Size, QFontAlignment.Left); var normal = new Vector3(0, 1, 0); var v1 = new Vector3(rect.X, height, rect.Y); var v2 = new Vector3(rect.X, height, rect.Y + textArea.Height); var v3 = new Vector3(rect.X + textArea.Width, height, rect.Y + textArea.Height); var v4 = new Vector3(rect.X + textArea.Width, height, rect.Y); Nodes.AddVerticies(color, normal, v1, v2, v3, v1, v3, v4); } else { qfont.PrintToVBO(text, QFontAlignment.Left, new Vector3(rect.X, rect.Y, -height), color, rect.Size); } }
public static void DrawCube(VertexBuffer vbo, Color color, float x, float z, float width, float length, float bottom, float height) { var v1 = new Vector3(x, bottom, z); var v2 = new Vector3(x + width, bottom, z); var v3 = new Vector3(x + width, bottom, z + length); var v4 = new Vector3(x, bottom, z + length); var v5 = new Vector3(x, bottom + height, z); var v6 = new Vector3(x + width, bottom + height, z); var v7 = new Vector3(x + width, bottom + height, z + length); var v8 = new Vector3(x, bottom + height, z + length); // bottom vertices var normal = new Vector3(0, -1, 0); vbo.AddVerticies(color, normal, v1, v2, v3, v1, v3, v4); // top vertices normal = new Vector3(0, 1, 0); vbo.AddVerticies(color, normal, v8, v7, v6, v8, v6, v5); // -z facing vertices normal = new Vector3(0, 0, -1); vbo.AddVerticies(color, normal, v5, v6, v2, v5, v2, v1); // x facing vertices normal = new Vector3(1, 0, 0); vbo.AddVerticies(color, normal, v6, v7, v3, v6, v3, v2); // z facing vertices normal = new Vector3(0, 0, 1); vbo.AddVerticies(color, normal, v4, v3, v7, v4, v7, v8); // -x facing vertices normal = new Vector3(-1, 0, 0); vbo.AddVerticies(color, normal, v1, v4, v8, v1, v8, v5); }