Class Print_Plan_3d
The graphics are organized as a vertical stack of horizontal lines, top down.
Each segment of such a line can show either 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 numeric x-positions,
for 3d as pairs (from, to), for 2d as triples (from, to, kind).
This is done by calling addSegment(int,int)
or addSegment(int,int,int)
. The call to nextRow()
starts
a new row.
Afterwards either show_Block_3d(Graphics2D,float,boolean)
or
show_Line_2d(Graphics2D,float,int)
are called which execute the graphic rendering.
For ease of layout, a top-most empty line is provided on construction.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Data item realizing the graphic segments to render. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Color
The color of the visible bottom of the 3d blocksstatic final Color
The color of the front of the 3d blocksstatic final Color
The color of all 2d lines (representing counterpoints/subordinated material).static final Color
The color of the visible right side (visible end) of the 3d blocksstatic final int
The default line width for the 2d lines.List of the java awt defaultPaint
objects for 2d lines, indexed by the "kind" data.static final BufferedImage
Container into which we draw and which will paint the 2ndh line type.static final BufferedImage
Container into which we draw and which will paint the 4th line type.static final BufferedImage
Container into which we draw and which will paint the 0th line type.static final BufferedImage
Container into which we draw and which will paint the 1st line type.static final BufferedImage
Container into which we draw and which will paint the 3rd line type.static TexturePaint
Paint object to draw the lines of type 2static TexturePaint
Paint object to draw the lines of type 4static TexturePaint
Paint object to draw the lines of type 0static TexturePaint
Paint object to draw the lines of type 3static TexturePaint
Paint object to draw the lines of type 1protected Stack<List<Print_Plan_3d.Triple>>
The list of lists, each standing for a horizontal line in the graphics. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSegment
(int from, int to) Add a segment with x and y coordinate, the kind index ==0.void
addSegment
(int from, int to, int kind) Add a segment with x and y coordinate and a kind index (currently 1 to 5)Return the list of java awt defaultPaint
objects for 2d lines,static void
TEST, DISLOC to "example" or to "interactiveTests" FIXMEvoid
nextRow()
Declare the growing row to be finished and a new (=next lower) row to start.void
show_Block_3d
(Graphics2D graphics, float xfactor, boolean suppressLimitLine) Show all 3d-blocks defined in the accumulated data instack
.void
show_Block_3d
(Graphics2D graphics, float xfactor, boolean suppressLimitLine, int yheight, int perspective_x, int perspective_y) Show all 3d-blocks defined in the accumulated data instack
.void
show_Block_3d
(Graphics2D graphics, float xfactor, boolean suppressLimitLine, int yheight, int perspective_x, int perspective_y, Color color_line, int linewidth, Color color_front, Color color_side, Color color_down) Show all 3d-blocks defined in the accumulated data instack
.void
show_Line_2d
(Graphics2D graphics, float xfactor, int yheight) Show all 2d-blocks defined in the accumulated data instack
.void
show_Line_2d
(Graphics2D graphics, float xfactor, int yheight, int yoffset, List<Paint> patterns) Show all 2d-lines defined in the accumulated data instack
.
-
Field Details
-
stack
The list of lists, each standing for a horizontal line in the graphics. -
default_color_line
The color of all 2d lines (representing counterpoints/subordinated material). -
default_linewidth
public static final int default_linewidthThe default line width for the 2d lines.- See Also:
-
default_color_front
The color of the front of the 3d blocks -
default_color_side
The color of the visible right side (visible end) of the 3d blocks -
default_color_down
The color of the visible bottom of the 3d blocks -
image_minus
Container into which we draw and which will paint the 0th line type. -
image_slash
Container into which we draw and which will paint the 1st line type. -
image_cross
Container into which we draw and which will paint the 2ndh line type. -
image_wave
Container into which we draw and which will paint the 3rd line type. -
image_hori
Container into which we draw and which will paint the 4th line type. -
paint_minus
Paint object to draw the lines of type 0 -
paint_wave
Paint object to draw the lines of type 1 -
paint_cross
Paint object to draw the lines of type 2 -
paint_slash
Paint object to draw the lines of type 3 -
paint_hori
Paint object to draw the lines of type 4 -
default_patterns
List of the java awt defaultPaint
objects for 2d lines, indexed by the "kind" data.
-
-
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
-
addSegment
public void addSegment(int from, int to, int kind) Add a segment with x and y coordinate and a kind index (currently 1 to 5)ATTENTION: no further consistency checks are done with the coordinates.
-
addSegment
public void addSegment(int from, int to) Add a segment with x and y coordinate, the kind index ==0. This means a 3d-block symbolizing main theme material.ATTENTION: no further consistency checks are done with the coordinates. The caller is responsible for non-overlapping and increasing order.
-
nextRow
public void nextRow()Declare the growing row to be finished and a new (=next lower) row to start. -
show_Block_3d
Show all 3d-blocks defined in the accumulated data instack
. Sets the next three parameters to 20, 4, 10, the last parameters to their default values defined in the corresponding constants, and callsshow_Block_3d(Graphics2D,float,boolean,int,int,int,Color,int,Color,Color,Color)
-
show_Block_3d
public void show_Block_3d(Graphics2D graphics, float xfactor, boolean suppressLimitLine, int yheight, int perspective_x, int perspective_y) Show all 3d-blocks defined in the accumulated data instack
. Sets the last parameters to their default values defined in the corresponding constants, and callsshow_Block_3d(Graphics2D,float,boolean,int,int,int,Color,int,Color,Color,Color)
-
show_Block_3d
public void show_Block_3d(Graphics2D graphics, float xfactor, boolean suppressLimitLine, int yheight, int perspective_x, int perspective_y, Color color_line, int linewidth, Color color_front, Color color_side, Color color_down) Show all 3d-blocks defined in the accumulated data instack
. The blocks have the form+------------+ | |\ +------------+ | \------------\|
The are drawn completely, without any clipping. The seqenctial order is relevant: first the lines top down, in each line from left to right: So each later block will overprint the earliers, if necessary:+------------+ | |\ +---+-----------------+ \---| |\ +-----------------+ | \-----------------\|
This sequnential order must be adhered to by the user when defining the data byaddSegment(int,int)
and is currently not tested.- Parameters:
graphics
- the target of all draw commandsxfactor
- scaling from input data to Graphic's coordinates.suppressLimitLine
- no line between two parallel, adjacent segmentsyheight
- scaling from segment list (=line) number in input data to graphic's coordinates.perspective_x
- width of perspective side wall, in Graphic's coordinates.perspective_y
- height of perspective bottom wall, in Graphic's coordinates.color_line
- color of all separation lineslinewidth
- width of all separation lines, the Graphics pixel coordinates.color_front
- of the front of the 3d blockscolor_side
- of the visible right side (visible end) of the 3d blockscolor_down
- of the visible bottom of the 3d blocks
-
show_Line_2d
Show all 2d-blocks defined in the accumulated data instack
. Set yoffset to 1/2 yheight and use the list ofdefault_patterns
to callshow_Line_2d(Graphics2D,float,int,int,List)
-
show_Line_2d
public void show_Line_2d(Graphics2D graphics, float xfactor, int yheight, int yoffset, List<Paint> patterns) Show all 2d-lines defined in the accumulated data instack
. Currently there are five line types adressable by index/kind 0 to 4.- Parameters:
graphics
- the target of all draw commandsxfactor
- scaling from input data to Graphic's coordinates.yheight
- scaling from segment list (=line) number in input data to y coordinatesyoffset
- shift of the lines from the box bottom linespatterns
- list ofPaint
objects to draw the lines.
-
get_default_patterns
Return the list of java awt defaultPaint
objects for 2d lines, -
main
TEST, DISLOC to "example" or to "interactiveTests" FIXME
-