VexFlowMusicSystem.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import {MusicSystem} from "../MusicSystem";
  2. import {GraphicalMusicPage} from "../GraphicalMusicPage";
  3. import {SystemLinesEnum} from "../SystemLinesEnum";
  4. import {PointF2D} from "../../../Common/DataObjects/PointF2D";
  5. import {SystemLinePosition} from "../SystemLinePosition";
  6. import {StaffMeasure} from "../StaffMeasure";
  7. import {SystemLine} from "../SystemLine";
  8. import {VexFlowMeasure} from "./VexFlowMeasure";
  9. import {VexFlowConverter} from "./VexFlowConverter";
  10. export class VexFlowMusicSystem extends MusicSystem {
  11. constructor(parent: GraphicalMusicPage, id: number) {
  12. super(parent, id);
  13. }
  14. /**
  15. * This method creates all the graphical lines and dots needed to render a system line (e.g. bold-thin-dots..).
  16. * @param xPosition
  17. * @param lineWidth
  18. * @param lineType
  19. * @param linePosition indicates if the line belongs to start or end of measure
  20. * @param musicSystem
  21. * @param topMeasure
  22. * @param bottomMeasure
  23. */
  24. protected createSystemLine(xPosition: number, lineWidth: number, lineType: SystemLinesEnum, linePosition: SystemLinePosition,
  25. musicSystem: MusicSystem, topMeasure: StaffMeasure, bottomMeasure: StaffMeasure = undefined): SystemLine {
  26. // ToDo: create line in Vexflow
  27. if (bottomMeasure) {
  28. (bottomMeasure as VexFlowMeasure).lineTo(topMeasure as VexFlowMeasure, VexFlowConverter.line(lineType));
  29. }
  30. return new SystemLine(lineType, linePosition, this, topMeasure, bottomMeasure);
  31. }
  32. /**
  33. * Calculates the summed x-width of a possibly given Instrument Brace and/or Group Bracket(s).
  34. * @returns {number} the x-width
  35. */
  36. protected calcInstrumentsBracketsWidth(): number {
  37. return 0;
  38. }
  39. /**
  40. * creates an instrument brace for the given dimension.
  41. * The height and positioning can be inferred from the given points.
  42. * @param rightUpper the upper right corner point of the bracket to create
  43. * @param rightLower the lower right corner point of the bracket to create
  44. */
  45. protected createInstrumentBracket(rightUpper: PointF2D, rightLower: PointF2D): void {
  46. return;
  47. }
  48. /**
  49. * creates an instrument group bracket for the given dimension.
  50. * There can be cascaded bracket (e.g. a group of 2 in a group of 4) -
  51. * The recursion depth informs about the current depth level (needed for positioning)
  52. * @param rightUpper rightUpper the upper right corner point of the bracket to create
  53. * @param rightLower rightLower the lower right corner point of the bracket to create
  54. * @param staffHeight
  55. * @param recursionDepth
  56. */
  57. protected createGroupBracket(rightUpper: PointF2D, rightLower: PointF2D, staffHeight: number, recursionDepth: number): void {
  58. return;
  59. }
  60. }