소스 검색

Made some adaptions

Removed unnecessary code, made some little corrections
Oliver 9 년 전
부모
커밋
70055a9a68

+ 2 - 2
src/MusicalScore/Graphical/MusicSheetCalculator.ts

@@ -154,7 +154,7 @@ export abstract class MusicSheetCalculator {
         this.createGraphicalTies();
         this.calculateSheetLabelBoundingBoxes();
         this.calculateXLayout(this.graphicalMusicSheet, this.maxInstrNameLabelLength());
-        this.graphicalMusicSheet.MusicPages = [];
+        this.graphicalMusicSheet.MusicPages.length = 0;
         this.calculateMusicSystems();
         this.graphicalMusicSheet.MusicPages[0].PositionAndShape.BorderMarginBottom += 9;
         GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet);
@@ -1144,7 +1144,7 @@ export abstract class MusicSheetCalculator {
         }
     }
 
-    private createGraphicalTies(): void {
+    protected createGraphicalTies(): void {
         for (let measureIndex: number = 0; measureIndex < this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length; measureIndex++) {
             let sourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[measureIndex];
             for (let staffIndex: number = 0; staffIndex < sourceMeasure.CompleteNumberOfStaves; staffIndex++) {

+ 3 - 2
src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalSymbolFactory.ts

@@ -120,9 +120,10 @@ export class VexFlowGraphicalSymbolFactory implements IGraphicalSymbolFactory {
     }
 
     /**
-     * Adds an accidental to a graphical note.
+     * Sets a pitch which will be used for rendering the given graphical note (not changing the original pitch of the note!!!).
+     * Will be only called if the displayed accidental is different from the original (e.g. a C# with C# as key instruction)
      * @param graphicalNote
-     * @param pitch
+     * @param pitch The pitch which will be rendered.
      * @param grace
      * @param graceScalingFactor
      */

+ 0 - 77
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -38,20 +38,6 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
     }
 
     /**
-     * The main method for the Calculator.
-     */
-    public calculate(): void {
-        this.clearSystemsAndMeasures();
-        this.clearRecreatedObjects();
-        this.calculateSheetLabelBoundingBoxes();
-        this.calculateXLayout(this.graphicalMusicSheet, this.maxInstrNameLabelLength());
-        this.graphicalMusicSheet.MusicPages.length = 0;
-        this.calculateMusicSystems();
-        this.graphicalMusicSheet.MusicPages[0].PositionAndShape.BorderMarginBottom += 9;
-        GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet);
-    }
-
-    /**
      * Calculates the x layout of the staff entries within the staff measures belonging to one source measure.
      * All staff entries are x-aligned throughout all vertically aligned staff measures.
      * This method is called within calculateXLayout.
@@ -95,69 +81,6 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
         return width;
     }
 
-    /**
-     * Creates the music systems and calculates their layout.
-     */
-    protected calculateMusicSystems(): void {
-        let measureList: StaffMeasure[][] = [];
-        for (let mlist of this.graphicalMusicSheet.MeasureList) {
-            let list: StaffMeasure[] = [];
-            for (let m of mlist) {
-                if (m.isVisible()) {
-                    list.push(m);
-                }
-            }
-            measureList.push(list);
-        }
-        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);
-        }
-        if (numberOfStaffLines === 0) { return; }
-        let musicSystemBuilder: MusicSystemBuilder = new MusicSystemBuilder();
-        musicSystemBuilder.initialize(this.graphicalMusicSheet, measureList, numberOfStaffLines, this.symbolFactory);
-        musicSystemBuilder.buildMusicSystems();
-        this.checkMeasuresForWholeRestNotes();
-        this.calculateSystemYLayout();
-        for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
-            let graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
-            for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
-                let musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
-                musicSystem.setMusicSystemLabelsYPosition();
-                if (!this.leadSheet) {
-                    musicSystem.setYPositionsToVerticalLineObjectsAndCreateLines(this.rules);
-                    musicSystem.createSystemLeftLine(this.rules.SystemThinLineWidth, this.rules.SystemLabelsRightMargin);
-                    musicSystem.createInstrumentBrackets(this.graphicalMusicSheet.ParentMusicSheet.Instruments, this.rules.StaffHeight);
-                    musicSystem.createGroupBrackets(this.graphicalMusicSheet.ParentMusicSheet.InstrumentalGroups, this.rules.StaffHeight, 0);
-                    musicSystem.alignBeginInstructions();
-                } else if (musicSystem === musicSystem.Parent.MusicSystems[0]) {
-                    musicSystem.createSystemLeftLine(this.rules.SystemThinLineWidth, this.rules.SystemLabelsRightMargin);
-                }
-                musicSystem.calculateBorders(this.rules);
-            }
-            let distance: number = graphicalMusicPage.MusicSystems[0].PositionAndShape.BorderTop;
-            for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
-                let musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
-                // let newPosition: PointF2D = new PointF2D(musicSystem.PositionAndShape.RelativePosition.x,
-                // musicSystem.PositionAndShape.RelativePosition.y - distance);
-                musicSystem.PositionAndShape.RelativePosition =
-                    new PointF2D(musicSystem.PositionAndShape.RelativePosition.x, musicSystem.PositionAndShape.RelativePosition.y - distance);
-            }
-            for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
-                let musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
-                for (let idx3: number = 0, len3: number = musicSystem.StaffLines.length; idx3 < len3; ++idx3) {
-                    let staffLine: StaffLine = musicSystem.StaffLines[idx3];
-                    staffLine.addActivitySymbolClickArea();
-                }
-            }
-            if (graphicalMusicPage === this.graphicalMusicSheet.MusicPages[0]) {
-                this.calculatePageLabels(graphicalMusicPage);
-            }
-            graphicalMusicPage.PositionAndShape.calculateTopBottomBorders();
-        }
-    }
-
     protected updateStaffLineBorders(staffLine: StaffLine): void {
         return;
     }