Class Print_Plan_3d

java.lang.Object
eu.bandm.music.top.Print_Plan_3d

public class Print_Plan_3d extends Object
Prints a list of segments in a three-dimensional (3d) block diagram style, mostly for visualizing temporal distribution of themes/counterpoints in a multi-voice work of music.

The graphics are organized as a vertical stack of horizontal lines, top down. Each segment of such a line can show ether a 3d-block (for symbolizing main themes) or different kinds of 2d-lines (for counterpoints and subordinated material). The data must be collected in advance, in one instance of this class, which can be used either for 2d or for 3d printing, so that normally two instances cooperate to make one diagram. The data must be entered as lists of triples of numeric x-positions, (from, to) and integer kind. This is done by calling addSegment(int,int,int). The call to nextRow() starts a new row. Afterwards either showBlocks3dModed(Graphics2D,float,Configuration) or

invalid reference
#showLine(Graphics2D,float,Configuration,List)
are called which execute the graphic rendering. For ease of layout, a top-most empty line is provided on construction.
  • Field Details

    • stack

      protected Stack<List<Print_Plan_3d.Triple>> stack
      The list of lists, each standing for a horizontal line in the graphics.
    • image_minus

      @Deprecated public static final BufferedImage image_minus
      Deprecated.
      Container into which we draw and which will paint the 0th line type.
    • image_slash

      public static final BufferedImage image_slash
      Container into which we draw and which will paint the 1st line type.
    • image_cross

      public static final BufferedImage image_cross
      Container into which we draw and which will paint the 2ndh line type.
    • image_wave

      public static final BufferedImage image_wave
      Container into which we draw and which will paint the 3rd line type.
    • image_hori

      public static final BufferedImage image_hori
      Container into which we draw and which will paint the 4th line type.
    • paint_minus

      @Deprecated public static TexturePaint paint_minus
      Deprecated.
      Paint object to draw the lines of type 0
    • paint_wave

      public static TexturePaint paint_wave
      Paint object to draw the lines of type 1
    • paint_cross

      public static TexturePaint paint_cross
      Paint object to draw the lines of type 2
    • paint_slash

      public static TexturePaint paint_slash
      Paint object to draw the lines of type 3
    • paint_hori

      public static TexturePaint paint_hori
      Paint object to draw the lines of type 4
    • DEFAULT_PATTERNS

      protected static final List<Paint> DEFAULT_PATTERNS
      List of the java awt default Paint objects for 2d lines, indexed by the "kind" value (currently from 0 to 4, incl.) (currently: 0 = dashed line, 1=slashes, 2=crossed out, 3=waves, 4=hori lines).
  • Constructor Details

    • Print_Plan_3d

      public Print_Plan_3d()
      Only constructor. Add one empty line to the stack of horizontal lines, and open the next.
  • Method Details

    • dump

      public void dump(PrintStream ps)
      /
    • addSegment

      public void addSegment(int from, int to, int kind)
      Add a segment with x coordinates and a kind index to the currently growing line.

      ATTENTION: no further consistency checks are done with the coordinates. The caller is responsible for non-overlapping and increasing order for all segments in the same row. In the default use case, these corodinates are device coordinates ("pixels") which come from some user-world coordinates. Therefore, for convenience, the case "from == to", resulting form scaling and rounding, is allowed and silently ignored: no segment is generated.

    • addSegmentMerging

      public void addSegmentMerging(int from, int to, int kind)
      Add a segment with x coordinates and a kind index to the currently growing line, or enlarge a preceding adjacent segment of same kind. For details see addSegment(int,int,int)
    • addSegment

      @Deprecated public void addSegment(int from, int to)
      Deprecated.
      Add a segment with x and y coordinate, the kind index ==0. This means a 3d-block symbolizing main theme material.
    • nextRow

      public void nextRow()
      Declare the growing row to be finished and a new (=next lower) row to start. Can also be called after the very last data to add some space to a graphic representation.
    • addFinalFramingEmptyRow

      public void addFinalFramingEmptyRow()
      Add an empty row at the end, iff the last row is not empty. This corresponds to the empty row at the beginning added by the constructor.
    • showBlocks3dModed

      public void showBlocks3dModed(Graphics2D graphics, float xfactor)
      Show all 3d-blocks defined in the accumulated data in stack. Uses the default values as defined with Print_Plan_3d.Configuration.
    • showBlocks3dModed

      public void showBlocks3dModed(Graphics2D graphics, float xfactor, Print_Plan_3d.Configuration config)
      Show all 3d-blocks defined in the accumulated data in stack. The blocks have the form
          +------------+            
          |            |\
          +------------+ |           
           \------------\|
        
      The are drawn completely, without any clipping. Thus the seqential order of drawing is relevant: first the rows top down, then in each row from left to right. So each later block will overprint the earliers, if necessary:
                  +------------+            
                  |            |\
                  +---+-----------------+
                  \---|                 |\
                      +-----------------+ |
                       \-----------------\|
        
      This sequential order must be adhered to by the user when defining the data by addSegment(int,int) and is currently not tested. The "mode" entry in the triple lists determines the form of the block (0..3 or 100..103) and whether it is "incomplete" (>= 100).
      Parameters:
      graphics - the target of all draw commands
      xfactor - scaling from input data to Graphic's coordinates.
      config - all configuration data for rendering.
    • showLine2d

      public void showLine2d(Graphics2D graphics, float xfactor)
      Show all 2d-segments defined in the accumulated data in stack. Use the default configuration and the list of DEFAULT_PATTERNS.
      Parameters:
      graphics - the target of all draw commands
      xfactor - scaling from input data to Graphic's coordinates.
    • showLine2d

      public void showLine2d(Graphics2D graphics, float xfactor, Print_Plan_3d.Configuration config, List<Paint> patterns)
      Show all 2d-lines defined in the accumulated data in stack. Use the given vonfiguration and the list of patterns. Currently there are five line types adressable by index/kind 0 to 4.
      Parameters:
      graphics - the target of all draw commands
      xfactor - scaling from input data to Graphic's coordinates.
      patterns - list of Paint objects to draw the lines.
    • dashStroke

      protected Stroke dashStroke(int width)
    • getDefaultPatterns

      public static List<Paint> getDefaultPatterns()
      Return the list of java awt default Paint objects for 2d lines,
    • getDefaultConfiguration

      public static Print_Plan_3d.Configuration getDefaultConfiguration()
      Returns the default configuration object.