public class Print_Plan_3d extends Object
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.
Modifier and Type | Class and Description |
---|---|
protected class |
Print_Plan_3d.Triple
Data item realizing the graphic segments to render.
|
Modifier and Type | Field and Description |
---|---|
static Color |
default_color_down
The color of the visible bottom of the 3d blocks
|
static Color |
default_color_front
The color of the front of the 3d blocks
|
static Color |
default_color_line
The color of all 2d lines (representing counterpoints/subordinated material).
|
static Color |
default_color_side
The color of the visible right side (visible end) of the 3d blocks
|
static int |
default_linewidth
The default line width for the 2d lines.
|
protected static List<Paint> |
default_patterns
List of the java awt default
Paint objects for 2d lines,
indexed by the "kind" data. |
static BufferedImage |
image_cross
Container into which we draw and which will paint the 2ndh line type.
|
static BufferedImage |
image_hori
Container into which we draw and which will paint the 4th line type.
|
static BufferedImage |
image_minus
Container into which we draw and which will paint the 0th line type.
|
static BufferedImage |
image_slash
Container into which we draw and which will paint the 1st line type.
|
static BufferedImage |
image_wave
Container into which we draw and which will paint the 3rd line type.
|
static TexturePaint |
paint_cross
Paint object to draw the lines of type 2
|
static TexturePaint |
paint_hori
Paint object to draw the lines of type 4
|
static TexturePaint |
paint_minus
Paint object to draw the lines of type 0
|
static TexturePaint |
paint_slash
Paint object to draw the lines of type 3
|
static TexturePaint |
paint_wave
Paint object to draw the lines of type 1
|
protected Stack<List<Print_Plan_3d.Triple>> |
stack
The list of lists, each standing for a horizontal line in the graphics.
|
Constructor and Description |
---|
Print_Plan_3d()
Only constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
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)
|
static List<Paint> |
get_default_patterns()
Return the list of java awt default
Paint objects for 2d lines, |
static void |
main(String[] args)
TEST, DISLOC to "example" or to "interactiveTests" FIXME
|
void |
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 in
stack . |
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 in
stack . |
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 in
stack . |
void |
show_Line_2d(Graphics2D graphics,
float xfactor,
int yheight)
Show all 2d-blocks defined in the accumulated data in
stack . |
void |
show_Line_2d(Graphics2D graphics,
float xfactor,
int yheight,
int yoffset,
List<Paint> patterns)
Show all 2d-lines defined in the accumulated data in
stack . |
protected Stack<List<Print_Plan_3d.Triple>> stack
public static final Color default_color_line
public static final int default_linewidth
public static final Color default_color_front
public static final Color default_color_side
public static final Color default_color_down
public static final BufferedImage image_minus
public static final BufferedImage image_slash
public static final BufferedImage image_cross
public static final BufferedImage image_wave
public static final BufferedImage image_hori
public static TexturePaint paint_minus
public static TexturePaint paint_wave
public static TexturePaint paint_cross
public static TexturePaint paint_slash
public static TexturePaint paint_hori
public Print_Plan_3d()
public void addSegment(int from, int to, int kind)
ATTENTION: no further consistency checks are done with the coordinates.
public void addSegment(int from, int to)
ATTENTION: no further consistency checks are done with the coordinates. The caller is responsible for non-overlapping and increasing order.
public void nextRow()
public void show_Block_3d(Graphics2D graphics, float xfactor, boolean suppressLimitLine)
stack
.
Sets the next three parameters to 20, 4, 10, the last parameters to their
default values defined in the
corresponding constants, and calls
show_Block_3d(Graphics2D,float,boolean,int,int,int,Color,int,Color,Color,Color)
public void show_Block_3d(Graphics2D graphics, float xfactor, boolean suppressLimitLine, int yheight, int perspective_x, int perspective_y)
stack
.
Sets the last parameters to their default values defined in the
corresponding constants, and calls
show_Block_3d(Graphics2D,float,boolean,int,int,int,Color,int,Color,Color,Color)
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)
stack
.
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 by
addSegment(int,int)
and is currently not tested.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_dwon
- of the visible bottom of the 3d blockspublic void show_Line_2d(Graphics2D graphics, float xfactor, int yheight)
stack
.
Set yoffset to 1/2 yheight and use the list of default_patterns
to call show_Line_2d(Graphics2D,float,int,int,List)
public void show_Line_2d(Graphics2D graphics, float xfactor, int yheight, int yoffset, List<Paint> patterns)
stack
.
Currently there are five line types adressable by index/kind 0 to 4.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 of Paint
objects to draw the lines.public static List<Paint> get_default_patterns()
Paint
objects for 2d lines,public static void main(String[] args)