AbstractGraphicalExpression.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { GraphicalObject } from "./GraphicalObject";
  2. import { GraphicalLabel } from "./GraphicalLabel";
  3. import { StaffLine } from "./StaffLine";
  4. import { BoundingBox } from "./BoundingBox";
  5. import { AbstractExpression, PlacementEnum } from "../VoiceData/Expressions/AbstractExpression";
  6. import { EngravingRules } from "./EngravingRules";
  7. export abstract class AbstractGraphicalExpression extends GraphicalObject {
  8. protected label: GraphicalLabel;
  9. protected parentStaffLine: StaffLine;
  10. /** Internal cache of read expression */
  11. protected expression: AbstractExpression;
  12. /** EngravingRules for positioning */
  13. protected rules: EngravingRules;
  14. constructor(parentStaffline: StaffLine, expression: AbstractExpression) {
  15. super();
  16. this.expression = expression;
  17. this.boundingBox = new BoundingBox(this, parentStaffline.PositionAndShape);
  18. this.parentStaffLine = parentStaffline;
  19. this.parentStaffLine.AbstractExpressions.push(this);
  20. this.rules = parentStaffline.ParentMusicSystem.rules;
  21. }
  22. /** Graphical label of the expression if available */
  23. get Label(): GraphicalLabel { return this.label; }
  24. /** Staffline where the expression is attached to */
  25. public get ParentStaffLine(): StaffLine { return this.parentStaffLine; }
  26. public get SourceExpression(): AbstractExpression { return this.expression; }
  27. public get Placement(): PlacementEnum { return this.expression.Placement; }
  28. //#region abstract methods
  29. public abstract updateSkyBottomLine(): void;
  30. //#endregion
  31. }