Search in sources :

Example 1 with ColumnElementIterator

use of com.xenoage.zong.core.util.ColumnElementIterator in project Zong by Xenoage.

the class Notator method computeAll.

/**
 * Computes the {@link Notation}s of all elements and returns them.
 */
public Notations computeAll(Context context) {
    context.saveMp();
    Score score = context.score;
    Notations notations = new Notations();
    // iterate over all column elements, measure elements and voice elements
    ColumnElementIterator itC = new ColumnElementIterator(score);
    for (ColumnElement e : itC) {
        // column elements: one notation for each staff
        for (int iStaff : range(context.score.getStavesCount())) {
            context.mp = itC.getMp().withStaff(iStaff);
            notations.add(compute(e, context, notations), iStaff);
        }
    }
    MeasureElementIterator itM = new MeasureElementIterator(score);
    for (MeasureElement e : itM) {
        context.mp = itM.getMp();
        notations.add(compute(e, context, notations));
    }
    VoiceElementIterator itV = new VoiceElementIterator(score);
    for (VoiceElement e : itV) {
        context.mp = itV.getMp();
        notations.add(compute(e, context, notations));
    }
    BeamIterator itB = new BeamIterator(score);
    for (Beam e : itB) {
        context.mp = itB.getMp();
        notations.add(compute(e, context, notations));
    }
    context.restoreMp();
    return notations;
}
Also used : Beam(com.xenoage.zong.core.music.beam.Beam) Score(com.xenoage.zong.core.Score) VoiceElementIterator(com.xenoage.zong.core.util.VoiceElementIterator) Notations(com.xenoage.zong.musiclayout.notation.Notations) BeamIterator(com.xenoage.zong.core.util.BeamIterator) ColumnElementIterator(com.xenoage.zong.core.util.ColumnElementIterator) MeasureElementIterator(com.xenoage.zong.core.util.MeasureElementIterator)

Aggregations

Score (com.xenoage.zong.core.Score)1 Beam (com.xenoage.zong.core.music.beam.Beam)1 BeamIterator (com.xenoage.zong.core.util.BeamIterator)1 ColumnElementIterator (com.xenoage.zong.core.util.ColumnElementIterator)1 MeasureElementIterator (com.xenoage.zong.core.util.MeasureElementIterator)1 VoiceElementIterator (com.xenoage.zong.core.util.VoiceElementIterator)1 Notations (com.xenoage.zong.musiclayout.notation.Notations)1