// ~ Methods ------------------------------------------------------------ // Retrieve the length data @Override protected double getValue(GlyphContext context) { Glyph stick = context.stick; int height = Integer.MAX_VALUE; // Check wrt every staff in the stick getRange for (int i = context.topArea; i <= context.bottomArea; i++) { StaffInfo area = staffManager.getStaff(i); height = Math.min(height, area.getHeight()); } return sheet.getScale().pixelsToFrac(height - stick.getLength(Orientation.VERTICAL)); }
// ~ Methods ------------------------------------------------------------ // Retrieve the stick abscissa @Override protected double getValue(GlyphContext context) { Glyph stick = context.stick; double dist = Double.MAX_VALUE; // Check wrt every staff in the stick range for (int i = context.topArea; i <= context.bottomArea; i++) { StaffInfo staff = staffManager.getStaff(i); Point2D top = staff.getFirstLine().getEndPoint(LEFT); Point2D bot = staff.getLastLine().getEndPoint(LEFT); double y = (top.getY() + bot.getY()) / 2; double x = stick.getPositionAt(y, Orientation.VERTICAL); double dx = x - staff.getAbscissa(LEFT); dist = Math.min(dist, dx); } return sheet.getScale().pixelsToFrac(dist); }