AlphaTab.Rendering.Glyphs.ScoreBeatGlyph.DoLayout C# (CSharp) Method

DoLayout() public method

public DoLayout ( ) : void
return void
        public override void DoLayout()
        {
            // create glyphs
            var sr = (ScoreBarRenderer)Renderer;
            if (!Container.Beat.IsEmpty)
            {
                if (!Container.Beat.IsRest)
                {
                    //
                    // Note heads
                    //
                    NoteHeads = new ScoreNoteChordGlyph();
                    NoteHeads.Beat = Container.Beat;
                    NoteHeads.BeamingHelper = BeamingHelper;
                    foreach (var note in Container.Beat.Notes)
                    {
                        CreateNoteGlyph(note);
                    }
                    AddGlyph(NoteHeads);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            foreach (var note in Container.Beat.Notes)
                            {
                                CreateBeatDot(sr.GetNoteLine(note), group);
                            }
                            AddGlyph(group);
                        }
                    }
                }
                else
                {
                    var dotLine = 0;
                    var line = 0;
                    var offset = 0;

                    switch (Container.Beat.Duration)
                    {
                        case Duration.QuadrupleWhole:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.DoubleWhole:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.Whole:
                            line = 4;
                            dotLine = 5;
                            break;
                        case Duration.Half:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.Quarter:
                            line = 6;
                            offset = -2;
                            dotLine = 5;
                            break;
                        case Duration.Eighth:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.Sixteenth:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.ThirtySecond:
                            line = 6;
                            dotLine = 3;
                            break;
                        case Duration.SixtyFourth:
                            line = 6;
                            dotLine = 3;
                            break;
                        case Duration.OneHundredTwentyEighth:
                            line = 6;
                            dotLine = 3;
                            break;
                        case Duration.TwoHundredFiftySixth:
                            line = 6;
                            dotLine = 3;
                            break;
                    }

                    var y = sr.GetScoreY(line, offset);

                    RestGlyph = new ScoreRestGlyph(0, y, Container.Beat.Duration);
                    RestGlyph.Beat = Container.Beat;
                    RestGlyph.BeamingHelper = BeamingHelper;
                    AddGlyph(RestGlyph);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            CreateBeatDot(dotLine, group);
                            AddGlyph(group);
                        }
                    }
                }
            }

            base.DoLayout();
        }