|
@@ -1,53 +1,78 @@
|
|
-export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
|
|
|
|
+import {MusicSheetCalculator} from "../MusicSheetCalculator";
|
|
|
|
+import {VexFlowGraphicalSymbolFactory} from "./VexFlowGraphicalSymbolFactory";
|
|
|
|
+import {GraphicalMusicSheet} from "../GraphicalMusicSheet";
|
|
|
|
+import {StaffMeasure} from "../StaffMeasure";
|
|
|
|
+import {MusicSystemBuilder} from "../MusicSystemBuilder";
|
|
|
|
+import {StaffLine} from "../StaffLine";
|
|
|
|
+import {VoiceEntry} from "../../VoiceData/VoiceEntry";
|
|
|
|
+import {MusicSystem} from "../MusicSystem";
|
|
|
|
+import {GraphicalNote} from "../GraphicalNote";
|
|
|
|
+import {GraphicalStaffEntry} from "../GraphicalStaffEntry";
|
|
|
|
+import {GraphicalMusicPage} from "../GraphicalMusicPage";
|
|
|
|
+import {GraphicalTie} from "../GraphicalTie";
|
|
|
|
+import {Tie} from "../../VoiceData/Tie";
|
|
|
|
+import {SourceMeasure} from "../../VoiceData/SourceMeasure";
|
|
|
|
+import {MultiExpression} from "../../VoiceData/Expressions/multiExpression";
|
|
|
|
+import {RepetitionInstruction} from "../../VoiceData/Instructions/RepetitionInstruction";
|
|
|
|
+import {Beam} from "../../VoiceData/Beam";
|
|
|
|
+import {ClefInstruction} from "../../VoiceData/Instructions/ClefInstruction";
|
|
|
|
+import {OctaveEnum} from "../../VoiceData/Expressions/ContinuousExpressions/octaveShift";
|
|
|
|
+import {Fraction} from "../../../Common/DataObjects/fraction";
|
|
|
|
+import {LyricsEntry} from "../../VoiceData/Lyrics/LyricsEntry";
|
|
|
|
+import {LyricWord} from "../../VoiceData/Lyrics/LyricsWord";
|
|
|
|
+import {OrnamentContainer} from "../../VoiceData/OrnamentContainer";
|
|
|
|
+import {ArticulationEnum} from "../../VoiceData/VoiceEntry";
|
|
|
|
+import {Tuplet} from "../../VoiceData/Tuplet";
|
|
|
|
+export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
constructor() {
|
|
constructor() {
|
|
super(new VexFlowGraphicalSymbolFactory());
|
|
super(new VexFlowGraphicalSymbolFactory());
|
|
|
|
|
|
}
|
|
}
|
|
public calculate(): void {
|
|
public calculate(): void {
|
|
- clearSystemsAndMeasures();
|
|
|
|
- clearRecreatedObjects();
|
|
|
|
- calculateXLayout(this.graphicalMusicSheet, maxInstrNameLabelLength());
|
|
|
|
- this.graphicalMusicSheet.MusicPages.Clear();
|
|
|
|
|
|
+ this.clearSystemsAndMeasures();
|
|
|
|
+ this.clearRecreatedObjects();
|
|
|
|
+ this.calculateXLayout(this.graphicalMusicSheet, this.maxInstrNameLabelLength());
|
|
|
|
+ this.graphicalMusicSheet.MusicPages.length = 0;
|
|
this.calculateMusicSystems();
|
|
this.calculateMusicSystems();
|
|
this.graphicalMusicSheet.MusicPages[0].PositionAndShape.BorderMarginBottom += 9;
|
|
this.graphicalMusicSheet.MusicPages[0].PositionAndShape.BorderMarginBottom += 9;
|
|
GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet);
|
|
GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet);
|
|
}
|
|
}
|
|
- protected calculateMeasureXLayout(measures: List<StaffMeasure>): number {
|
|
|
|
|
|
+ protected calculateMeasureXLayout(measures: StaffMeasure[]): number {
|
|
throw new NotImplementedException();
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
protected calculateMusicSystems(): void {
|
|
protected calculateMusicSystems(): void {
|
|
- var measureList: List<List<StaffMeasure>> = this.graphicalMusicSheet.MeasureList.Select(ml => ml.Where(m => m.isVisible()).ToList()).ToList();
|
|
|
|
- var numberOfStaffLines: number = 0;
|
|
|
|
- for (var idx: number = 0, len = measureList.Count; idx < len; ++idx) {
|
|
|
|
- var gmlist: List<StaffMeasure> = measureList[idx];
|
|
|
|
- numberOfStaffLines = Math.Max(gmlist.Count, numberOfStaffLines);
|
|
|
|
|
|
+ let measureList: StaffMeasure[][] = this.graphicalMusicSheet.MeasureList.Select(ml => ml.Where(m => m.isVisible()).ToList()).ToList();
|
|
|
|
+ let numberOfStaffLines: number = 0;
|
|
|
|
+ for (let idx: number = 0, len: number = measureList.length; idx < len; ++idx) {
|
|
|
|
+ let gmlist: StaffMeasure[] = measureList[idx];
|
|
|
|
+ numberOfStaffLines = Math.max(gmlist.length, numberOfStaffLines);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- if (numberOfStaffLines == 0)
|
|
|
|
- return
|
|
|
|
- var musicSystemBuilder: MusicSystemBuilder = new MusicSystemBuilder();
|
|
|
|
|
|
+ if (numberOfStaffLines === 0)
|
|
|
|
+ return;
|
|
|
|
+ let musicSystemBuilder: MusicSystemBuilder = new MusicSystemBuilder();
|
|
musicSystemBuilder.initialize(this.graphicalMusicSheet, measureList, numberOfStaffLines, this.symbolFactory);
|
|
musicSystemBuilder.initialize(this.graphicalMusicSheet, measureList, numberOfStaffLines, this.symbolFactory);
|
|
musicSystemBuilder.buildMusicSystems();
|
|
musicSystemBuilder.buildMusicSystems();
|
|
- checkMeasuresForWholeRestNotes();
|
|
|
|
|
|
+ this.checkMeasuresForWholeRestNotes();
|
|
}
|
|
}
|
|
protected updateStaffLineBorders(staffLine: StaffLine): void {
|
|
protected updateStaffLineBorders(staffLine: StaffLine): void {
|
|
- throw new NotImplementedException();
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
protected calculateMeasureNumberPlacement(musicSystem: MusicSystem): void {
|
|
protected calculateMeasureNumberPlacement(musicSystem: MusicSystem): void {
|
|
- throw new NotImplementedException();
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- protected layoutVoiceEntry(voiceEntry: VoiceEntry, graphicalNotes: List<GraphicalNote>, graphicalStaffEntry: GraphicalStaffEntry, hasPitchedNote: boolean, isGraceStaffEntry: boolean): void {
|
|
|
|
|
|
+ protected layoutVoiceEntry(voiceEntry: VoiceEntry, graphicalNotes: GraphicalNote[], graphicalStaffEntry: GraphicalStaffEntry, hasPitchedNote: boolean, isGraceStaffEntry: boolean): void {
|
|
|
|
|
|
}
|
|
}
|
|
protected layoutStaffEntry(graphicalStaffEntry: GraphicalStaffEntry): void {
|
|
protected layoutStaffEntry(graphicalStaffEntry: GraphicalStaffEntry): void {
|
|
|
|
|
|
}
|
|
}
|
|
protected calculateSystemYLayout(): void {
|
|
protected calculateSystemYLayout(): void {
|
|
- for (var idx: number = 0, len = this.graphicalMusicSheet.MusicPages.Count; idx < len; ++idx) {
|
|
|
|
- var graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
|
- if (!leadSheet) {
|
|
|
|
- for (var idx2: number = 0, len2 = graphicalMusicPage.MusicSystems.Count; idx2 < len2; ++idx2) {
|
|
|
|
- var musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
|
|
|
|
|
|
+ for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
|
|
|
|
+ let graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
|
|
|
|
+ if (!this.leadSheet) {
|
|
|
|
+ for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
|
|
|
|
+ let musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -61,36 +86,36 @@
|
|
protected layoutGraphicalTie(tie: GraphicalTie, tieIsAtSystemBreak: boolean): void {
|
|
protected layoutGraphicalTie(tie: GraphicalTie, tieIsAtSystemBreak: boolean): void {
|
|
|
|
|
|
}
|
|
}
|
|
- protected calculateSingleStaffLineLyricsPosition(staffLine: StaffLine, lyricVersesNumber: List<number>): void {
|
|
|
|
- throw new NotImplementedException();
|
|
|
|
|
|
+ protected calculateSingleStaffLineLyricsPosition(staffLine: StaffLine, lyricVersesNumber: number[]): void {
|
|
|
|
+
|
|
}
|
|
}
|
|
protected calculateSingleOctaveShift(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
|
|
protected calculateSingleOctaveShift(sourceMeasure: SourceMeasure, multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
|
|
- throw new NotImplementedException();
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
protected calculateWordRepetitionInstruction(repetitionInstruction: RepetitionInstruction, measureIndex: number): void {
|
|
protected calculateWordRepetitionInstruction(repetitionInstruction: RepetitionInstruction, measureIndex: number): void {
|
|
- throw new NotImplementedException();
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
protected calculateMoodAndUnknownExpression(multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
|
|
protected calculateMoodAndUnknownExpression(multiExpression: MultiExpression, measureIndex: number, staffIndex: number): void {
|
|
- throw new NotImplementedException();
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- protected createGraphicalTieNote(beams: List<Beam>, activeClef: ClefInstruction,
|
|
|
|
|
|
+ protected createGraphicalTieNote(beams: Beam[], activeClef: ClefInstruction,
|
|
octaveShiftValue: OctaveEnum, graphicalStaffEntry: GraphicalStaffEntry, duration: Fraction, numberOfDots: number,
|
|
octaveShiftValue: OctaveEnum, graphicalStaffEntry: GraphicalStaffEntry, duration: Fraction, numberOfDots: number,
|
|
openTie: Tie, isLastTieNote: boolean): void {
|
|
openTie: Tie, isLastTieNote: boolean): void {
|
|
|
|
|
|
}
|
|
}
|
|
- protected handleBeam(graphicalNote: GraphicalNote, beam: Beam, openBeams: List<Beam>): void {
|
|
|
|
|
|
+ protected handleBeam(graphicalNote: GraphicalNote, beam: Beam, openBeams: Beam[]): void {
|
|
|
|
|
|
}
|
|
}
|
|
- protected handleVoiceEntryLyrics(lyricsEntries: Dictionary<number, LyricsEntry>, voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry, openLyricWords: List<LyricWord>): void {
|
|
|
|
|
|
+ protected handleVoiceEntryLyrics(lyricsEntries: Dictionary<number, LyricsEntry>, voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry, openLyricWords: LyricWord[]): void {
|
|
|
|
|
|
}
|
|
}
|
|
protected handleVoiceEntryOrnaments(ornamentContainer: OrnamentContainer, voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry): void {
|
|
protected handleVoiceEntryOrnaments(ornamentContainer: OrnamentContainer, voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry): void {
|
|
|
|
|
|
}
|
|
}
|
|
- protected handleVoiceEntryArticulations(articulations: List<ArticulationEnum>, voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry): void {
|
|
|
|
|
|
+ protected handleVoiceEntryArticulations(articulations: ArticulationEnum[], voiceEntry: VoiceEntry, graphicalStaffEntry: GraphicalStaffEntry): void {
|
|
|
|
|
|
}
|
|
}
|
|
- protected handleTuplet(graphicalNote: GraphicalNote, tuplet: Tuplet, openTuplets: List<Tuplet>): void {
|
|
|
|
|
|
+ protected handleTuplet(graphicalNote: GraphicalNote, tuplet: Tuplet, openTuplets: Tuplet[]): void {
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|