|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDrawingUtil
Utility class for rendering.
Constructor Summary | |
DrawingUtil()
|
Method Summary | |
static void |
drawCentred(java.awt.Graphics2D g2,
java.lang.String text,
float centerX,
float centerY,
boolean textLayoutBounds)
Draw a text string which is centered in given location. |
static void |
drawCircle(java.awt.Graphics2D g2d,
double[] data,
float[] xData,
float[] yData,
java.awt.Color c,
float xs,
float ys,
float xOff,
float yOff,
float radius)
Draw circles using pass in x and y coordinates. |
static void |
drawDots(java.awt.Graphics2D g2d,
float[] xData,
float[] yData,
float xs,
float ys,
java.awt.Color c,
float xOff,
float yOff)
Draw points centered at (xData[i],yData[i]) and radius is 1. |
void |
drawLegendBox(java.awt.Graphics2D g2,
int width,
int ht)
Draw the legend box. |
static void |
drawLegendTicks(java.awt.Graphics2D g2,
float startX,
float startY,
float endX,
float endY,
java.lang.String[] tickMarks,
int type)
Draw legend's tick marks. |
static void |
drawLineSegments(java.awt.Graphics2D g2d,
float[] xData,
float[] yData,
float xs,
float ys,
java.awt.Color c,
float xOff,
float yOff)
Draw line segments using pass in x and y coordinates. |
static void |
drawLineSegmentsTickMarks(java.awt.Graphics2D g2d,
float[] xData,
float[] yData,
float xs,
float ys,
java.awt.Color c,
float xOff,
float yOff,
java.lang.String[] strs)
Draw line segments using pass in x and y coordinates. |
static void |
drawPolyLine(java.awt.Graphics2D g2d,
float[] xData,
float[] yData,
float xs,
float ys,
java.awt.Color c,
float xOff,
float yOff)
Draw a poly line using pass in x and y coordinates. |
static void |
drawRects(java.awt.Graphics2D g2d,
int[][] data,
java.awt.Color[] c,
float xs,
float ys,
float xOff,
float yOff)
Draw points centered at (xData[i],yData[i]) and radius is 1. |
static void |
drawStringsInBox(java.awt.Graphics2D g2,
int width,
int ht,
java.lang.String[] strs,
java.awt.Font f)
Draw an array of strings in a bounding box with origin in (0,0). |
static void |
printFontNames()
Will print out all available english font names in the system. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DrawingUtil()
Method Detail |
public static void drawCentred(java.awt.Graphics2D g2, java.lang.String text, float centerX, float centerY, boolean textLayoutBounds)
g2
- Graphics2D context in which the string will be drawn.text
- text stringcenterX
- center's x positioncenterY
- center's y positiontextLayoutBounds
- if true, will create a new TextLayout,otherwise use the old onepublic static void printFontNames()
public static void drawLegendTicks(java.awt.Graphics2D g2, float startX, float startY, float endX, float endY, java.lang.String[] tickMarks, int type)
g2
- Graphics2D context which we drawnstartX
- start x positionstartY
- start y positionendX
- x end positionendY
- y end positiontickMarks
- the tick marks' name such 1,2 or 0.2, 0.4, etctype
- =1 draw X ticks, =2 draw Y left ticks, =3 draw Y right ticks ,=4 vertical gray line.public static void drawPolyLine(java.awt.Graphics2D g2d, float[] xData, float[] yData, float xs, float ys, java.awt.Color c, float xOff, float yOff)
xData
- x coordinatesyData
- y coordinatesxs
- scale for x coordinates so the x position fits the legend box.ys
- scale for y coordinates so the y position fits legend box.xOff
- offset for x axis. x axis start with xOffyOff
- offset for y axis. y axis start with yOffpublic static void drawLineSegmentsTickMarks(java.awt.Graphics2D g2d, float[] xData, float[] yData, float xs, float ys, java.awt.Color c, float xOff, float yOff, java.lang.String[] strs)
xData
- x coordinatesyData
- y coordinatesxs
- scale for x coordinates so the x position fits the legend box.ys
- scale for y coordinates so the y position fits legend box.xOff
- offset for x axis. x axis start with xOffyOff
- offset for y axis. y axis start with yOffstrs
- tick mark names.public static void drawLineSegments(java.awt.Graphics2D g2d, float[] xData, float[] yData, float xs, float ys, java.awt.Color c, float xOff, float yOff)
xData
- x coordinatesyData
- y coordinatesxs
- scale for x coordinates so the x position fits the legend box.ys
- scale for y coordinates so the y position fits legend box.xOff
- offset for x axis. x axis start with xOffyOff
- offset for y axis. y axis start with yOffpublic static void drawDots(java.awt.Graphics2D g2d, float[] xData, float[] yData, float xs, float ys, java.awt.Color c, float xOff, float yOff)
xData
- array of x coordinatesyData
- array of y coordinatesxs
- scale for x coordinates so the x position fits the legend box.ys
- scale for y coordinates so the y position fits legend box.xOff
- offset for x axis. x axis start with xOffyOff
- offset for y axis. y axis start with yOffpublic static void drawRects(java.awt.Graphics2D g2d, int[][] data, java.awt.Color[] c, float xs, float ys, float xOff, float yOff)
data
- array of x,y coordinatesxs
- scale for x coordinates so the x position fits the rectangle box.ys
- scale for y coordinates so the y position fits rectangle box.xOff
- offset for x axis. x axis start with xOffyOff
- offset for y axis. y axis start with yOffpublic void drawLegendBox(java.awt.Graphics2D g2, int width, int ht)
g2
- Graphic2D where all drawing happens.width
- width of the legend box.ht
- height of the legend box.public static void drawStringsInBox(java.awt.Graphics2D g2, int width, int ht, java.lang.String[] strs, java.awt.Font f)
g2
- a Graphics2D object to be drawn in.width
- bounding box widthht
- bounding box heightstrs
- the array of stringsf
- default fontpublic static void drawCircle(java.awt.Graphics2D g2d, double[] data, float[] xData, float[] yData, java.awt.Color c, float xs, float ys, float xOff, float yOff, float radius)
g2d
- a Graphics2D object to be drawn in.xData
- x coordinates for the center of the circleyData
- y coordinates for the center of the circledata
- ratios to radius of the circlexs
- scale of x axisys
- scale of y axisxOff
- offset for x axis. x axis start with xOffyOff
- offset for y axis. y axis END with yOffradius
- radius of the circle
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |