Search in sources :

Example 1 with ContinuedWedge

use of com.xenoage.zong.musiclayout.continued.ContinuedWedge in project Zong by Xenoage.

the class WedgeStamper method stampSystem.

/**
 * Creates all wedge stampings in the given system.
 * @param openWedges  input and output parameter: voltas, which are still open from the
 *                    last system. After the method returns, it contains the voltas which
 *                    are still open after this system
 */
public List<WedgeStamping> stampSystem(SystemSpacing system, Score score, StaffStampings staffStampings, OpenWedges openWedges) {
    List<WedgeStamping> ret = alist();
    // find new wedges beginning in this staff
    for (int iStaff : range(score.getStavesCount())) {
        Staff staff = score.getStaff(iStaff);
        for (int iMeasure : system.getMeasures()) {
            Measure measure = staff.getMeasure(iMeasure);
            for (BeatE<Direction> dir : measure.getDirections()) {
                if (dir.getElement() instanceof Wedge) {
                    Wedge wedge = (Wedge) dir.getElement();
                    // if the position of the end element is known
                    if (wedge.getWedgeEnd().getMP() != null)
                        openWedges.wedges.add(new ContinuedWedge((Wedge) dir.getElement()));
                }
            }
        }
    }
    // draw wedges in the cache, and remove them if closed in this system
    for (Iterator<ContinuedWedge> itW = openWedges.wedges.iterator(); itW.hasNext(); ) {
        ContinuedWedge wedge = itW.next();
        ret.add(stamp(wedge.element, staffStampings.get(system.getSystemIndexInFrame(), wedge.element.getMP().staff)));
        if (MP.getMP(wedge.element.getWedgeEnd()).measure <= system.getEndMeasure()) {
            // wedge is closed
            itW.remove();
        }
    }
    return ret;
}
Also used : ContinuedWedge(com.xenoage.zong.musiclayout.continued.ContinuedWedge) Staff(com.xenoage.zong.core.music.Staff) Measure(com.xenoage.zong.core.music.Measure) WedgeStamping(com.xenoage.zong.musiclayout.stampings.WedgeStamping) Direction(com.xenoage.zong.core.music.direction.Direction) Wedge(com.xenoage.zong.core.music.direction.Wedge) ContinuedWedge(com.xenoage.zong.musiclayout.continued.ContinuedWedge)

Aggregations

Measure (com.xenoage.zong.core.music.Measure)1 Staff (com.xenoage.zong.core.music.Staff)1 Direction (com.xenoage.zong.core.music.direction.Direction)1 Wedge (com.xenoage.zong.core.music.direction.Wedge)1 ContinuedWedge (com.xenoage.zong.musiclayout.continued.ContinuedWedge)1 WedgeStamping (com.xenoage.zong.musiclayout.stampings.WedgeStamping)1