Exemplo n.º 1
0
  /**
   * Used by SystemTranslator to allocate the dynamics marks
   *
   * @param glyph underlying glyph
   * @param measure measure where the mark is located
   * @param point location for the mark
   */
  public static void populate(Glyph glyph, Measure measure, SystemPoint point) {
    // Can we gather with another dynamics letter? (e.g. m + p -> mp)
    for (TreeNode node : measure.getChildren()) {
      if (node instanceof Dynamics) {
        Dynamics d = (Dynamics) node;

        if (d.isCompatibleWith(point)) {
          d.addGlyph(glyph);
          glyph.setTranslation(d);

          return;
        }
      }
    }

    // Otherwise, create a brand new instance
    glyph.setTranslation(new Dynamics(measure, point, findChord(measure, point), glyph));
  }