예제 #1
0
    // ~ Methods ------------------------------------------------------------
    // Retrieve the distance with proper staff border
    @Override
    protected double getValue(GlyphContext context) {
      Glyph stick = context.stick;
      Point2D stop = stick.getStopPoint(VERTICAL);

      // Which staff area contains the bottom of the stick?
      StaffInfo staff = staffManager.getStaffAt(stop);

      // How far are we from the stop of the staff?
      double staffBottom = staff.getLastLine().yAt(stop.getX());
      double dy = sheet.getScale().pixelsToFrac(Math.abs(staffBottom - stop.getY()));

      // Change limits according to rough & partDefining
      if (rough && context.isPartDefining) {
        setLowHigh(constants.maxStaffShiftDyLowRough, constants.maxStaffShiftDyHighRough);
      } else {
        setLowHigh(constants.maxStaffShiftDyLow, constants.maxStaffShiftDyHigh);
      }

      // Side-effect
      if (dy <= getLow()) {
        context.botStaff = context.bottomArea;
      }

      return dy;
    }
예제 #2
0
    // ~ Methods ------------------------------------------------------------
    // Retrieve the difference between stick slope and global slope
    @Override
    protected double getValue(GlyphContext context) {
      Glyph stick = context.stick;
      Point2D start = stick.getStartPoint(VERTICAL);
      Point2D stop = stick.getStopPoint(VERTICAL);

      // Beware of sign of stickSlope (it is opposite of globalSlope)
      double stickSlope = -(stop.getX() - start.getX()) / (stop.getY() - start.getY());

      return Math.abs(stickSlope - sheet.getSkew().getSlope());
    }
예제 #3
0
    // ~ Methods ------------------------------------------------------------
    @Override
    protected Rectangle getBox(Glyph stick) {
      Point2D bottom = stick.getStopPoint(VERTICAL);
      Rectangle box =
          new Rectangle(
              (int) Math.rint(bottom.getX()),
              (int) Math.rint(bottom.getY() - (1.5 * nHeight)),
              nWidth,
              2 * nHeight);
      stick.addAttachment("br", box);

      return box;
    }
예제 #4
0
    // ~ Methods ------------------------------------------------------------
    // Retrieve the distance with proper staff border
    @Override
    protected double getValue(GlyphContext context) {
      Glyph stick = context.stick;
      Point2D stop = stick.getStopPoint(VERTICAL);

      // Which staff area contains the bottom of the stick?
      StaffInfo staff = staffManager.getStaffAt(stop);

      // How far are we from the stop of the staff?
      double staffBottom = staff.getLastLine().yAt(stop.getX());
      double dy = sheet.getScale().pixelsToFrac(Math.abs(staffBottom - stop.getY()));

      return dy;
    }
예제 #5
0
  // -------------------//
  // initializeContext //
  // -------------------//
  private void initializeContext(GlyphContext context) {
    Glyph stick = context.stick;
    StaffInfo startStaff = staffManager.getStaffAt(stick.getStartPoint(VERTICAL));
    StaffInfo stopStaff = staffManager.getStaffAt(stick.getStopPoint(VERTICAL));

    // Remember top & bottom areas
    context.topArea = staffManager.getIndexOf(startStaff);
    context.bottomArea = staffManager.getIndexOf(stopStaff);

    // Check whether this stick embraces more than one staff
    context.isPartDefining = context.topArea != context.bottomArea;

    // Remember if this is a thick stick
    context.isThick = isThickBar(stick);
  }