|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quinncurtis.chart3djava.ChartObj
com.quinncurtis.chart3djava.GraphObj
com.quinncurtis.chart3djava.ChartText
public class ChartText
The ChartText class is used to place text in a chart. ChartText objects can be positioned using any of the coordinate systems, rotated, and justified vertically and horizontally. It also supports multi-line text by inserting a CR (carriage return) character in the string.
Field Summary |
---|
Constructor Summary | |
---|---|
ChartText()
The default ChartText constructor. |
|
ChartText(java.awt.Font tfont,
java.lang.String tstring)
This constructor creates a new ChartText using the specified font, and string. |
|
ChartText(java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
double z,
int npostype)
This constructor creates a new ChartText using the specified scale, font, string, position and justification. |
|
ChartText(java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
double z,
int npostype,
int xjust,
int yjust,
int rotation)
This constructor creates a new ChartText using the specified scale, font, string, position, justification and rotation. |
|
ChartText(java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
int npostype)
This constructor creates a new ChartText using the specified scale, font, string, position and justification. |
|
ChartText(java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
int npostype,
int xjust,
int yjust,
int rotation)
This constructor creates a new ChartText using the specified scale, font, string, position, justification and rotation. |
|
ChartText(PhysicalCoordinates transform)
This constructor creates a new ChartText object using the specified scale. |
|
ChartText(PhysicalCoordinates transform,
java.awt.Font tfont,
java.lang.String tstring)
This constructor creates a new ChartText using the specified scale, font, and string. |
|
ChartText(PhysicalCoordinates transform,
java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
double z,
int npostype)
This constructor creates a new ChartText using the specified scale, font, string, position and justification. |
|
ChartText(PhysicalCoordinates transform,
java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
double z,
int npostype,
int xjust,
int yjust,
int rotation)
This constructor creates a new ChartText using the specified scale, font, string, position, justification and rotation. |
|
ChartText(PhysicalCoordinates transform,
java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
int npostype)
This constructor creates a new ChartText using the specified scale, font, string, position and justification. |
|
ChartText(PhysicalCoordinates transform,
java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
int npostype,
int xjust,
int yjust,
int rotation)
This constructor creates a new ChartText using the specified scale, font, string, position, justification and rotation. |
Method Summary | |
---|---|
void |
addNewLineTextString(java.lang.String thestring)
This method adds a new line of text to the current text object. |
boolean |
checkIntersection(ChartPoint3D testpoint,
NearestPointData np)
The checkIntersection method. |
java.lang.Object |
clone()
Returns an object that is a clone of this ChartText object. |
void |
copy(ChartText source)
Copies the source text object. |
void |
draw(java.awt.Graphics2D g2)
The draw method for this class. |
void |
drawText(java.awt.Graphics2D g2)
The draw method for this class. |
void |
drawTextBox(java.awt.Graphics2D g2)
This method draws the bounding box for the current text object. |
int |
errorCheck(int nerror)
Checks the current chart text object for common errors. |
double |
getLineLeading()
Returns the line leading, the space between lines in multi-line text, in device units. |
java.lang.String |
getMultilineSubstring(java.lang.String s,
int line)
This method returns the substring at a specific line index in a multiline string. |
int |
getNumLines(java.lang.String s)
This method returns number of line break characters, '\n', in a string. |
java.awt.Font |
getResizedTextFont()
Returns a new font based on the current font, taking into account the resize multiplier. |
java.awt.Color |
getTextBgColor()
Returns the color of the background rectangle under the text. |
boolean |
getTextBgMode()
Returns the text background color mode. |
ChartRectangle3D |
getTextBox()
This method returns the bounding box, in window device coordinates, for the current text object. |
java.awt.Color |
getTextBoxColor()
Returns the line color of the text box. |
boolean |
getTextBoxMode()
Returns true if the text bounding box is draw. |
ChartDimension3D |
getTextDimension(java.awt.Graphics2D g2,
java.lang.String s)
Returns the height and width of the text object, taking into account multiline text. |
java.awt.Font |
getTextFont()
Gets the font of the text. |
double |
getTextMaxSizeY(java.awt.Graphics2D g2,
int npostype)
Returns a value that represents the maximum height of a string using the given font. |
ChartPoint3D |
getTextNudge()
Returns the xy values of the textNudge property. |
double |
getTextRotation()
Returns the rotation of the text in the normal viewing plane. |
double |
getTextSizeX(java.awt.Graphics2D g2,
int npostype)
Returns the horizontal size of the text, using the specified coordinate system. |
double |
getTextSizeY(java.awt.Graphics2D g2,
int npostype)
Returns the vertical size of the text, using the specified coordinate system. |
java.lang.String |
getTextString()
Returns the current text string. |
int |
getXJust()
Returns the horizontal justification of the text. |
int |
getYJust()
Returns the vertical justification of the text. |
void |
initChartText(java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
double z,
int npostype,
int xjust,
int yjust,
double rotation)
This method initializes an ChartText using the specified scale, font, string, position, justification and rotation. |
void |
initChartText(java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
int npostype,
int xjust,
int yjust,
double rotation)
This method initializes an ChartText using the specified scale, font, string, position, justification and rotation. |
void |
initChartText(PhysicalCoordinates transform,
java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
double z,
int npostype,
int xjust,
int yjust,
double rotation)
This method initializes an ChartText using the specified scale, font, string, position, justification and rotation. |
void |
initChartText(PhysicalCoordinates transform,
java.awt.Font tfont,
java.lang.String tstring,
double x,
double y,
int npostype,
int xjust,
int yjust,
double rotation)
This method initializes an ChartText using the specified scale, font, string, position, justification and rotation. |
void |
preCalcTextBoundingBox(java.awt.Graphics2D g2)
It is necessary in the axis label routines to pre-calculate the text bounding box the text object before it is actually displayed, so that a test can be made to see if the text object intersects any other text objects. |
void |
setLineLeading(double rlead)
Sets the line leading, the space between lines in multi-line text, in device units. |
void |
setResizedTextFont()
Establishes the resized text font as the current font. |
void |
setTextBgColor(java.awt.Color rgbcolor)
Sets the color of the background rectangle under the text, if the textBgMode is true. |
void |
setTextBgMode(boolean bmode)
Sets the text background color mode. |
void |
setTextBoxColor(java.awt.Color c)
Sets the line color of the text box. |
void |
setTextBoxMode(boolean bmode)
Specifies if the text bounding box is drawn in the text color. |
void |
setTextFont(java.awt.Font tfont)
Sets the font of the text. |
void |
setTextNudge(ChartPoint3D nudge)
Sets the xy values of the textNudge property. |
void |
setTextNudge(double x,
double y)
Sets the xy values of the textNudge property. |
void |
setTextRotation(double rotation)
Sets the rotation of the text in the normal viewing plane. |
void |
setTextString(java.lang.String thestring)
Sets the current text string. |
void |
setXJust(int xjust)
Sets the horizontal justification of the text. |
void |
setYJust(int yjust)
Sets the vertical justification of the text. |
Methods inherited from class com.quinncurtis.chart3djava.ChartObj |
---|
copy, getChartObjIDCntr, getChartObjType, getThisChartObjID |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChartText()
public ChartText(PhysicalCoordinates transform)
transform
- The text object is placed in the coordinate system defined by transform.public ChartText(PhysicalCoordinates transform, java.awt.Font tfont, java.lang.String tstring, double x, double y, int npostype, int xjust, int yjust, int rotation)
transform
- Places the text in the coordinate system defined by transform.tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionnpostype
- Specifies the if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants:DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.xjust
- Specifies the horizontal justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.yjust
- Specifies the vertical justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.rotation
- The rotation (-360 to 360 degrees) of the text in the normal viewing plane.public ChartText(PhysicalCoordinates transform, java.awt.Font tfont, java.lang.String tstring, double x, double y, double z, int npostype, int xjust, int yjust, int rotation)
transform
- Places the text in the coordinate system defined by transform.tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionz
- Specifies the z-value of the text positionnpostype
- Specifies the if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants:DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.xjust
- Specifies the horizontal justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER or JUSTIFY_MAX.yjust
- Specifies the vertical justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.rotation
- The rotation (-360 to 360 degrees) of the text in the normal viewing plane.public ChartText(java.awt.Font tfont, java.lang.String tstring, double x, double y, int npostype, int xjust, int yjust, int rotation)
tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionnpostype
- Specifies the if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants:DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.xjust
- Specifies the horizontal justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.yjust
- Specifies the vertical justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.rotation
- The rotation (-360 to 360 degrees) of the text in the normal viewing plane.public ChartText(java.awt.Font tfont, java.lang.String tstring, double x, double y, double z, int npostype, int xjust, int yjust, int rotation)
tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionz
- Specifies the z-value of the text positionnpostype
- Specifies the if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants:DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.xjust
- Specifies the horizontal justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.yjust
- Specifies the vertical justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.rotation
- The rotation (-360 to 360 degrees) of the text in the normal viewing plane.public ChartText(java.awt.Font tfont, java.lang.String tstring, double x, double y, int npostype)
tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionnpostype
- Specifies the if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants:DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.public ChartText(java.awt.Font tfont, java.lang.String tstring, double x, double y, double z, int npostype)
tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionz
- Specifies the z-value of the text positionnpostype
- Specifies the if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants:DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.public ChartText(PhysicalCoordinates transform, java.awt.Font tfont, java.lang.String tstring, double x, double y, int npostype)
transform
- Places the text in the coordinate system defined by transform.tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionnpostype
- Specifies the if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants:DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.public ChartText(PhysicalCoordinates transform, java.awt.Font tfont, java.lang.String tstring, double x, double y, double z, int npostype)
transform
- Places the text in the coordinate system defined by transform.tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionz
- Specifies the z-value of the text positionnpostype
- Specifies the if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants:DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.public ChartText(PhysicalCoordinates transform, java.awt.Font tfont, java.lang.String tstring)
transform
- Places the text in the coordinate system defined by transform.tfont
- A reference to a Font object.tstring
- A reference to a string object.public ChartText(java.awt.Font tfont, java.lang.String tstring)
tfont
- A reference to a Font object.tstring
- A reference to a string object.Method Detail |
---|
public int errorCheck(int nerror)
errorCheck
in class GraphObj
nerror
- Current error state
public void copy(ChartText source)
source
- The source text object.public java.lang.Object clone()
clone
in class GraphObj
public void initChartText(PhysicalCoordinates transform, java.awt.Font tfont, java.lang.String tstring, double x, double y, int npostype, int xjust, int yjust, double rotation)
transform
- Places the text in the coordinate system defined by transform.tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionnpostype
- Specifies if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants: DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.xjust
- Specifies the horizontal justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.yjust
- Specifies the vertical justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.rotation
- The rotation (-360 to 360 degrees) of the text in the normal viewing plane.public void initChartText(PhysicalCoordinates transform, java.awt.Font tfont, java.lang.String tstring, double x, double y, double z, int npostype, int xjust, int yjust, double rotation)
transform
- Places the text in the coordinate system defined by transform.tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionz
- Specifies the z-value of the text positionnpostype
- Specifies if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants: DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.xjust
- Specifies the horizontal justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.yjust
- Specifies the vertical justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.rotation
- The rotation (-360 to 360 degrees) of the text in the normal viewing plane.public void initChartText(java.awt.Font tfont, java.lang.String tstring, double x, double y, int npostype, int xjust, int yjust, double rotation)
tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionnpostype
- Specifies if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants: DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.xjust
- Specifies the horizontal justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.yjust
- Specifies the vertical justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.rotation
- The rotation (-360 to 360 degrees) of the text in the normal viewing plane.public void initChartText(java.awt.Font tfont, java.lang.String tstring, double x, double y, double z, int npostype, int xjust, int yjust, double rotation)
tfont
- A reference to a Font object.tstring
- A reference to a string object.x
- Specifies the x-value of the text positiony
- Specifies the y-value of the text positionz
- Specifies the z-value of the text positionnpostype
- Specifies if the position of the text is specified in physical coordinates,
normalized coordinates or window device coordinates. Use one of the position constants: DEV_POS,PHYS_POS,
NORM_GRAPH_POS,NORM_PLOT_POS.xjust
- Specifies the horizontal justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.yjust
- Specifies the vertical justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.rotation
- The rotation (-360 to 360 degrees) of the text in the normal viewing plane.public void setTextBgColor(java.awt.Color rgbcolor)
rgbcolor
- Sets the color of the background rectangle under the text.public java.awt.Color getTextBgColor()
public void setTextBgMode(boolean bmode)
bmode
- True and the rectangle under the text is cleared to the textBgColor color.public boolean getTextBgMode()
public void setTextBoxMode(boolean bmode)
bmode
- True and the bounding box rectangle is drawn in the text color.public boolean getTextBoxMode()
public void setTextBoxColor(java.awt.Color c)
c
- Sets the line color of the text box.public java.awt.Color getTextBoxColor()
public void setXJust(int xjust)
xjust
- Specifies the horizontal justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.public int getXJust()
public void setYJust(int yjust)
yjust
- Specifies the vertical justification of the text. Use one of the text
justification constants: JUSTIFY_MIN,JUSTIFY_CENTER orJUSTIFY_MAX.public int getYJust()
public void setLineLeading(double rlead)
rlead
- Sets the line leading, the space between lines in multi-line text, in device units.public double getLineLeading()
public void setTextFont(java.awt.Font tfont)
tfont
- Sets the font of the text.public java.awt.Font getTextFont()
public java.awt.Font getResizedTextFont()
public void addNewLineTextString(java.lang.String thestring)
thestring
- A string containing the new text line.public void setTextString(java.lang.String thestring)
thestring
- Sets the current text string.public java.lang.String getTextString()
public void setTextRotation(double rotation)
rotation
- The rotation (-360 to 360 degrees) of the text in the normal viewing plane.public double getTextRotation()
public void setTextNudge(ChartPoint3D nudge)
nudge
- Sets the xy values of the textNudge property.public void setTextNudge(double x, double y)
x
- Sets the x-value of the textNudge property.y
- Sets the y-value of the textNudge property.public ChartPoint3D getTextNudge()
public double getTextSizeX(java.awt.Graphics2D g2, int npostype)
g2
- The graphics context.npostype
- Specifies the coordinate system used to calculate the return value. Use one of the
coordinate system constants:DEV_POS,PHYS_POS, POLAR_POS, NORM_GRAPH_POS,NORM_PLOT_POS.
public double getTextSizeY(java.awt.Graphics2D g2, int npostype)
g2
- The graphics context.npostype
- Specifies the coordinate system used to calculate the return value. Use one of
the coordinate system constants:DEV_POS,PHYS_POS, POLAR_POS, NORM_GRAPH_POS,NORM_PLOT_POS.
public double getTextMaxSizeY(java.awt.Graphics2D g2, int npostype)
g2
- The graphics context.npostype
- Specifies the coordinate system used to calculate the return value. Use one of the
coordinate system constants:DEV_POS,PHYS_POS, POLAR_POS, NORM_GRAPH_POS,NORM_PLOT_POS.
public int getNumLines(java.lang.String s)
s
- The text object string.
public ChartRectangle3D getTextBox()
public void drawTextBox(java.awt.Graphics2D g2)
g2
- The graphics context.public ChartDimension3D getTextDimension(java.awt.Graphics2D g2, java.lang.String s)
g2
- The graphics context.s
- The text string.
public java.lang.String getMultilineSubstring(java.lang.String s, int line)
s
- The text object string.line
- The line index.
public void setResizedTextFont()
public void preCalcTextBoundingBox(java.awt.Graphics2D g2)
g2
- The graphics context.public void drawText(java.awt.Graphics2D g2)
g2
- The graphics context.public boolean checkIntersection(ChartPoint3D testpoint, NearestPointData np)
checkIntersection
in class GraphObj
testpoint
- The test pointnp
- Nearest point information for data based objects.
public void draw(java.awt.Graphics2D g2)
draw
in class GraphObj
g2
- The graphics context.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |