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.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static enum 
    The roles of a key in the grid, when assigned to MIDI note on/off event.
  • 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.
    (package private) final SimpleMessage.Sender<eu.bandm.tools.util.xml.XMLDocumentIdentifier>
     
    (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
     
    static final int
     
    (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
    ChartGraphics(int rows, int cols, Tabstaff score, SimpleMessage.Sender<eu.bandm.tools.util.xml.XMLDocumentIdentifier> msg)
     
  • 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
    Write to a sequence of distinct files whiche contain the graphics for different time points.
    abstract void
    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
    • msg

      final SimpleMessage.Sender<eu.bandm.tools.util.xml.XMLDocumentIdentifier> msg
    • maxRow

      public final int maxRow
      Highest index for rows.
    • maxCol

      public final int maxCol
      Highest index for columns.
    • seconds_per_whole

      public static final int seconds_per_whole
      See Also:
    • linewidth_slim

      int linewidth_slim
      Configuration parameter: border of squares representing keys which are not root.
    • linewidth_fat

      int linewidth_fat
      Configuration parameter: border of squares representing keys which are root.
    • size_x

      int size_x
      Configuration parameter: width of the squares which represent the keys.
    • dist_x

      int dist_x
      Configuration parameter: offset between two adjacent squares which represent the keys.
    • size_y

      int size_y
      Configuration parameter: height of the squares which represent the keys.
    • dist_y

      int dist_y
      Configuration parameter: offset between two adjacent squares which represent the keys.
    • round_x

      int round_x
      Configuration parameter: Radius of the rounded corner.
    • round_y

      int round_y
      Configuration parameter: Radius of the rounded corner.
    • offset_x

      int offset_x
      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.)
    • offset_y

      int offset_y
      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.
    • color_keypress

      Color color_keypress
      Configuration parameter: Color of all key-press symbols.
    • color_diatonic

      Color color_diatonic
      Configuration parameter: Color of all diatonic keys.
    • color_numberOnFill

      Color color_numberOnFill
      Configuration parameter: Color of numbers on filled keypress symbols.
    • color_notDiatonic

      Color color_notDiatonic
      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<eu.bandm.tools.util.xml.XMLDocumentIdentifier> msg)
  • Method Details

    • writeSequenceOfSvgs

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

      public abstract void writeToDynamicSVG(File file) throws IOException
      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.)
      Returns:
      null in case of errors in the voice data.