Esempio n. 1
0
        private void SetStemAndFlags(ChordSymbol chord, List<HeadMetrics> topDownHeadsMetrics, float stemThickness)
        {
            DurationClass durationClass = chord.DurationClass;
            _flagsBlockMetrics = null;
            if(chord.BeamBlock == null
            && (durationClass == DurationClass.quaver
                || durationClass == DurationClass.semiquaver
                || durationClass == DurationClass.threeFlags
                || durationClass == DurationClass.fourFlags
                || durationClass == DurationClass.fiveFlags))
            {
                _flagsBlockMetrics = GetFlagsBlockMetrics(topDownHeadsMetrics,
                                                                durationClass,
                                                                chord.FontHeight,
                                                                chord.Stem.Direction,
                                                                stemThickness);
            }

            if(durationClass == DurationClass.minim
            || durationClass == DurationClass.crotchet
            || durationClass == DurationClass.quaver
            || durationClass == DurationClass.semiquaver
            || durationClass == DurationClass.threeFlags
            || durationClass == DurationClass.fourFlags
            || durationClass == DurationClass.fiveFlags)
            {
                _stemMetrics = NewStemMetrics(topDownHeadsMetrics, chord, _flagsBlockMetrics, stemThickness);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Returns null if the durationClass does not have a flagsBlock,
        /// otherwise returns the metrics for the flagsBlock attached to this chord, correctly positioned wrt the noteheads.
        /// </summary>
        private FlagsBlockMetrics GetFlagsBlockMetrics(List<HeadMetrics> topDownHeadsMetrics, DurationClass durationClass, float fontSize, VerticalDir stemDirection, float stemThickness)
        {
            Debug.Assert(durationClass == DurationClass.quaver
                || durationClass == DurationClass.semiquaver
                || durationClass == DurationClass.threeFlags
                || durationClass == DurationClass.fourFlags
                || durationClass == DurationClass.fiveFlags);

            FlagsBlockMetrics flagsBlockMetrics = new FlagsBlockMetrics(durationClass, fontSize, stemDirection);

            if(flagsBlockMetrics != null)
            {
                // flagsMetrics contains a metrics for the flags block with the outermost point at OriginX=0, BaselineY=0
                // Now move the flagblock so that is positioned correctly wrt the noteheads.
                SetFlagsPositionReNoteheads(topDownHeadsMetrics, flagsBlockMetrics, stemDirection, stemThickness);
            }
            return flagsBlockMetrics;
        }