import Vex = require("vexflow");
import { GraphicalMeasure } from "../GraphicalMeasure";
import { SourceMeasure } from "../../VoiceData/SourceMeasure";
import { Staff } from "../../VoiceData/Staff";
import { StaffLine } from "../StaffLine";
import { SystemLinesEnum } from "../SystemLinesEnum";
import { ClefInstruction } from "../../VoiceData/Instructions/ClefInstruction";
import { KeyInstruction } from "../../VoiceData/Instructions/KeyInstruction";
import { RhythmInstruction } from "../../VoiceData/Instructions/RhythmInstruction";
import { Beam } from "../../VoiceData/Beam";
import { GraphicalNote } from "../GraphicalNote";
import { GraphicalStaffEntry } from "../GraphicalStaffEntry";
import { Tuplet } from "../../VoiceData/Tuplet";
import { RepetitionInstruction } from "../../VoiceData/Instructions/RepetitionInstruction";
import { SystemLinePosition } from "../SystemLinePosition";
import { GraphicalVoiceEntry } from "../GraphicalVoiceEntry";
import { Voice } from "../../VoiceData/Voice";
export declare class VexFlowMeasure extends GraphicalMeasure {
    constructor(staff: Staff, staffLine?: StaffLine, sourceMeasure?: SourceMeasure);
    /** octaveOffset according to active clef */
    octaveOffset: number;
    /** The VexFlow Voices in the measure */
    vfVoices: {
        [voiceID: number]: Vex.Flow.Voice;
    };
    /** Call this function (if present) to x-format all the voices in the measure */
    formatVoices: (width: number) => void;
    /** The VexFlow Ties in the measure */
    vfTies: Vex.Flow.StaveTie[];
    /** The repetition instructions given as words or symbols (coda, dal segno..) */
    vfRepetitionWords: Vex.Flow.Repetition[];
    /** The VexFlow Stave (= one measure in a staffline) */
    private stave;
    /** VexFlow StaveConnectors (vertical lines) */
    private connectors;
    /** Intermediate object to construct beams */
    private beams;
    /** Beams created by (optional) autoBeam function. */
    private autoVfBeams;
    /** Beams of tuplet notes created by (optional) autoBeam function. */
    private autoTupletVfBeams;
    /** VexFlow Beams */
    private vfbeams;
    /** Intermediate object to construct tuplets */
    private tuplets;
    /** VexFlow Tuplets */
    private vftuplets;
    setAbsoluteCoordinates(x: number, y: number): void;
    /**
     * Reset all the geometric values and parameters of this measure and put it in an initialized state.
     * This is needed to evaluate a measure a second time by system builder.
     */
    resetLayout(): void;
    clean(): void;
    /**
     * returns the x-width (in units) of a given measure line {SystemLinesEnum}.
     * @param line
     * @returns the x-width in osmd units
     */
    getLineWidth(line: SystemLinesEnum): number;
    /**
     * adds the given clef to the begin of the measure.
     * This has to update/increase BeginInstructionsWidth.
     * @param clef
     */
    addClefAtBegin(clef: ClefInstruction): void;
    /**
     * adds the given key to the begin of the measure.
     * This has to update/increase BeginInstructionsWidth.
     * @param currentKey the new valid key.
     * @param previousKey the old cancelled key. Needed to show which accidentals are not valid any more.
     * @param currentClef the valid clef. Needed to put the accidentals on the right y-positions.
     */
    addKeyAtBegin(currentKey: KeyInstruction, previousKey: KeyInstruction, currentClef: ClefInstruction): void;
    /**
     * adds the given rhythm to the begin of the measure.
     * This has to update/increase BeginInstructionsWidth.
     * @param rhythm
     */
    addRhythmAtBegin(rhythm: RhythmInstruction): void;
    /**
     * adds the given clef to the end of the measure.
     * This has to update/increase EndInstructionsWidth.
     * @param clef
     */
    addClefAtEnd(clef: ClefInstruction): void;
    addMeasureLine(lineType: SystemLinesEnum, linePosition: SystemLinePosition): void;
    /**
     * Adds a measure number to the top left corner of the measure
     * This method is not used currently in favor of the calculateMeasureNumberPlacement
     * method in the MusicSheetCalculator.ts
     */
    addMeasureNumber(): void;
    addWordRepetition(repetitionInstruction: RepetitionInstruction): void;
    private addVolta;
    /**
     * Sets the overall x-width of the measure.
     * @param width
     */
    setWidth(width: number): void;
    /**
     * This method is called after the StaffEntriesScaleFactor has been set.
     * Here the final x-positions of the staff entries have to be set.
     * (multiply the minimal positions with the scaling factor, considering the BeginInstructionsWidth)
     */
    layoutSymbols(): void;
    /**
     * Draw this measure on a VexFlow CanvasContext
     * @param ctx
     */
    draw(ctx: Vex.IRenderContext): void;
    format(): void;
    /**
     * Returns all the voices that are present in this measure
     */
    getVoicesWithinMeasure(): Voice[];
    /**
     * Returns all the graphicalVoiceEntries of a given Voice.
     * @param voice the voice for which the graphicalVoiceEntries shall be returned.
     */
    getGraphicalVoiceEntriesPerVoice(voice: Voice): GraphicalVoiceEntry[];
    /**
     * Finds the gaps between the existing notes within a measure.
     * Problem here is, that the graphicalVoiceEntry does not exist yet and
     * that Tied notes are not present in the normal voiceEntries.
     * To handle this, calculation with absolute timestamps is needed.
     * And the graphical notes have to be analysed directly (and not the voiceEntries, as it actually should be -> needs refactoring)
     * @param voice the voice for which the ghost notes shall be searched.
     */
    private getRestFilledVexFlowStaveNotesPerVoice;
    /**
     * Add a note to a beam
     * @param graphicalNote
     * @param beam
     */
    handleBeam(graphicalNote: GraphicalNote, beam: Beam): void;
    handleTuplet(graphicalNote: GraphicalNote, tuplet: Tuplet): void;
    /**
     * Complete the creation of VexFlow Beams in this measure
     */
    finalizeBeams(): void;
    /** Automatically creates beams for notes except beamedNotes, using Vexflow's Beam.generateBeams().
     *  Takes options from EngravingRules.Rules.AutoBeamOptions.
     * @param beamedNotes notes that will not be autobeamed (usually because they are already beamed)
     */
    private autoBeamNotes;
    /**
     * Complete the creation of VexFlow Tuplets in this measure
     */
    finalizeTuplets(): void;
    layoutStaffEntry(graphicalStaffEntry: GraphicalStaffEntry): void;
    graphicalMeasureCreatedCalculations(): void;
    /**
     * Copy the stem directions chosen by VexFlow to the StemDirection variable of the graphical notes
     */
    private setStemDirectionFromVexFlow;
    /**
     * Create the articulations for all notes of the current staff entry
     */
    private createArticulations;
    /**
     * Create the ornaments for all notes of the current staff entry
     */
    private createOrnaments;
    private createFingerings;
    /**
     * Creates a line from 'top' to this measure, of type 'lineType'
     * @param top
     * @param lineType
     */
    lineTo(top: VexFlowMeasure, lineType: any): void;
    /**
     * Return the VexFlow Stave corresponding to this graphicalMeasure
     * @returns {Vex.Flow.Stave}
     */
    getVFStave(): Vex.Flow.Stave;
    /**
     * After re-running the formatting on the VexFlow Stave, update the
     * space needed by Instructions (in VexFlow: StaveModifiers)
     */
    private updateInstructionWidth;
}
export declare enum StavePositionEnum {
    LEFT = 1,
    RIGHT = 2,
    ABOVE = 3,
    BELOW = 4,
    BEGIN = 5,
    END = 6
}
