Class ChartGraphics

java.lang.Object
eu.bandm.music.applications.tabstaff.ChartGraphics
Direct Known Subclasses:
ChartGraphics_byStrings, ChartGraphics_svg

public abstract class ChartGraphics extends Object
Subroutines and configuration data for the "grid" view of tabstaff, for static and animated SVG renderings. This is the superclass of two implementations, with explicit String construction and one with the JSVG library, resp.

Usage as a one-shot instance: (1) Create one instance of a sub-class for one particular score and grid geometry, (2) overwrite the graphic parameters by {{a=b;}}, (3) call writeSequenceOfSvgs(String) or and/or writeToDynamicSVG(File) to generate the graphic output.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static enum 
    The roles of a key in a particular interpretation of the grid, when this assigns MIDI note on/off events.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) int
    Configuration parameter: Size of the circle which stands for events by arbitrary hands.
    (package private) Color
    Configuration parameter: Color of all diatonic keys.
    (package private) Color
    Configuration parameter: Color of all key-press symbols.
    (package private) Color
    Configuration parameter: Color of all keys between the diatonic keys.
    (package private) Color
    Configuration parameter: Color of numbers on filled keypress symbols.
    (package private) int
    Configuration parameter: offset between two adjacent squares which represent the keys.
    (package private) int
    Configuration parameter: offset between two adjacent squares which represent the keys.
    (package private) int
    Configuration parameter: border of squares representing keys which are root.
    (package private) int
    Configuration parameter: border of squares representing keys which are not root.
    (package private) final int[]
    Distances (in chromatic steps) for each scale position to its upper neighbour in a major scale.
    final int
    Highest index for columns.
    final int
    Highest index for rows.
    (package private) final int[]
    Distances (in chromatic steps) for each scale position to its upper neighbour in a natural minor scale.
    Target of all messages.
    (package private) int
    Configuration parameter: Offset from the left margin of the graphic area to the very first square which represents a key.
    (package private) int
    Configuration parameter: Offset from the top margin of the graphic area to the very first square which represents a key.
    (package private) int
    Configuration parameter: Size of the rotated square which stands for left-hand events.
    (package private) int
    Configuration parameter: Radius of the rounded corner.
    (package private) int
    Configuration parameter: Radius of the rounded corner.
    final Tabstaff
    The score data which will be rendered.
    (package private) int
    Configuration parameters: Duration of one 1/1 note in seconds.
    (package private) int
    Configuration parameter: width of the squares which represent the keys.
    (package private) int
    Configuration parameter: height of the squares which represent the keys.
    (package private) int
    Configuration parameter: Size of the upright square which stands for right-hand events.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Basic constructor which defines fundamental input and output data.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) int
    col2coord(int column)
    Get the x coord of a given column number (from 1 to 8).
    static int
    coord2index(int r, int c)
    Translate a coordinate pair of the complete 8*8 area into a linear index.
    (package private) @Opt ChartGraphics.rank[]
    Calculate the form and color of the grid background.
    (package private) int
    row2coord(int row)
    Get the y coord of a given row number (from 1 to 8).
    scaleToButtons(Tabstaff.distance distance, int[] scaleDistances)
    Calculate the ranks of all squares to display (root, own, or foreign).
    abstract void
    Service Access Point: Write to a sequence of distinct files whiche contain the graphics for different time points.
    abstract void
    Service Access Point: Write to one single file which contains the animated graphics stepping through the time points.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • score

      public final Tabstaff score
      The score data which will be rendered.
    • msg

      Target of all messages.
    • maxRow

      public final int maxRow
      Highest index for rows.
    • maxCol

      public final int maxCol
      Highest index for columns.
    • secondsPerWhole

      int secondsPerWhole
      Configuration parameters: Duration of one 1/1 note in seconds. Determins the tempo of the animated rendering.
    • linewidthSlim

      int linewidthSlim
      Configuration parameter: border of squares representing keys which are not root.
    • linewidthFat

      int linewidthFat
      Configuration parameter: border of squares representing keys which are root.
    • sizeX

      int sizeX
      Configuration parameter: width of the squares which represent the keys.
    • distX

      int distX
      Configuration parameter: offset between two adjacent squares which represent the keys.
    • sizeY

      int sizeY
      Configuration parameter: height of the squares which represent the keys.
    • distY

      int distY
      Configuration parameter: offset between two adjacent squares which represent the keys.
    • roundX

      int roundX
      Configuration parameter: Radius of the rounded corner.
    • roundY

      int roundY
      Configuration parameter: Radius of the rounded corner.
    • offsetX

      int offsetX
      Configuration parameter: Offset from the left margin of the graphic area to the very first square which represents a key. (The offset from the last key to the right margin is fixed to half a button width.)
    • offsetY

      int offsetY
      Configuration parameter: Offset from the top margin of the graphic area to the very first square which represents a key. (The offset from the last key to the bottom margin is fixed to half a button height.)
    • squareSize

      int squareSize
      Configuration parameter: Size of the upright square which stands for right-hand events.
    • rotSquareSize

      int rotSquareSize
      Configuration parameter: Size of the rotated square which stands for left-hand events.
    • circleRadius

      int circleRadius
      Configuration parameter: Size of the circle which stands for events by arbitrary hands.
    • colorKeypress

      Color colorKeypress
      Configuration parameter: Color of all key-press symbols.
    • colorDiatonic

      Color colorDiatonic
      Configuration parameter: Color of all diatonic keys.
    • colorNumberOnFill

      Color colorNumberOnFill
      Configuration parameter: Color of numbers on filled keypress symbols.
    • colorNotDiatonic

      Color colorNotDiatonic
      Configuration parameter: Color of all keys between the diatonic keys.
    • majorMode

      final int[] majorMode
      Distances (in chromatic steps) for each scale position to its upper neighbour in a major scale.

      ATTENTION scale support currently only provisionary.

    • minorMode

      final int[] minorMode
      Distances (in chromatic steps) for each scale position to its upper neighbour in a natural minor scale.

      ATTENTION scale support currently only provisionary.

  • Constructor Details

    • ChartGraphics

      protected ChartGraphics(int rows, int cols, Tabstaff score, SimpleMessage.Sender<XMLDocumentIdentifier> msg)
      Basic constructor which defines fundamental input and output data. Not called by the user, but the constructors of the subclasses.
      Parameters:
      rows - number of rows = highest index of rows (because row numbers are 1-based!)
      cols - number of cols = highest index of cols (because col numbers are 1-based!)
  • Method Details

    • writeSequenceOfSvgs

      public abstract void writeSequenceOfSvgs(String fileStem)
      Service Access Point: Write to a sequence of distinct files whiche contain the graphics for different time points.
    • writeToDynamicSVG

      public abstract void writeToDynamicSVG(File file) throws IOException
      Service Access Point: Write to one single file which contains the animated graphics stepping through the time points.
      Throws:
      IOException
    • coord2index

      public static int coord2index(int r, int c)
      Translate a coordinate pair of the complete 8*8 area into a linear index. This corresponds to a numbering of the keys from left to right, starting with the lowest row and ascending.
    • scaleToButtons

      public static ChartGraphics.rank[] scaleToButtons(Tabstaff.distance distance, int[] scaleDistances)
      Calculate the ranks of all squares to display (root, own, or foreign).
      (ATTENTION button(1,1) is currently fixed to root, since dynamic layout change with "mode=nearest" is not yet implemented.)
      Parameters:
      distance - how the leftmost key in each row is related to the leftmost key one row higher/lower.
      scaleDistances - gives for every diatonic step the distance to its successor in chromatic steps. CURRENTLY seven positions must cover twelve chromatic steps.
    • col2coord

      int col2coord(int column)
      Get the x coord of a given column number (from 1 to 8). This coordinate is used as the left edge of the painted button.
    • row2coord

      int row2coord(int row)
      Get the y coord of a given row number (from 1 to 8). This coordinate is used as the top edge of the painted button (= numerically lower and optically higher).
    • initialGridPattern

      @Opt @Opt ChartGraphics.rank[] initialGridPattern()
      Calculate the form and color of the grid background. (Currently restricted to the situation defined by the very first event.) (Currently restricted to evaluate distance and functionalKey-mode. Subset, orientation, fixed, and pitch base are ignored.)
      Returns:
      null in case of errors in the voice data.