private void DrawBlock()

in src/Structure/StructureVisualizer/StructureMarginElement.cs [260:302]


        private void DrawBlock(DrawingContext drawingContext, IMappingTagSpan<IBlockTag> tag, bool methodHighlights)
        {
            if (methodHighlights
                ? (tag.Tag.Type == BlockType.Method)
                : ((tag.Tag.Type != BlockType.Namespace) && (tag.Tag.Type != BlockType.Root)))
            {
                int level = 0;
                for (var p = tag.Tag.Parent; (p != null); p = p.Parent)
                {
                    if ((p.Type != BlockType.Namespace) && (p.Type != BlockType.Root))
                        ++level;
                }

                NormalizedSnapshotSpanCollection spans = tag.Span.GetSpans(_textView.TextSnapshot);
                foreach (var span in spans)
                {
                    double x = (double)(level) * (lineWidth + gapWidth) + 3.0;

                    if (x < this.ActualWidth)
                    {
                        double yTop = _scrollBar.GetYCoordinateOfBufferPosition(span.Start);
                        double yBottom = _scrollBar.GetYCoordinateOfBufferPosition(span.End);

                        if (yBottom > yTop + 2.0)
                        {
                            if (methodHighlights)
                            {
                                drawingContext.PushClip(new RectangleGeometry(new Rect(x - 1.0, 0.0, (this.ActualWidth - x), this.ActualHeight)));
                                drawingContext.DrawEllipse(_coloring.MethodSeparatorAndHighlightColoring.ToolTipBrush, null, new Point(x - 1.0, (yTop + yBottom) * 0.5),
                                                           (this.ActualWidth + 1.0 - x), (yBottom - yTop) * 0.5);
                                drawingContext.Pop();
                            }
                            else
                            {
                                drawingContext.DrawLine(_coloring.GetLinePen(tag.Tag),
                                                        new Point(x, yTop),
                                                        new Point(x, yBottom));
                            }
                        }
                    }
                }
            }
        }