uavsim.graphics.text
Class TextProperties

java.lang.Object
  extended by uavsim.graphics.text.TextProperties
All Implemented Interfaces:
java.lang.Cloneable

public class TextProperties
extends java.lang.Object
implements java.lang.Cloneable

Defines simple text properties that define how VectorText will render a string.

Author:
Dan Tappan [10.04.11]

Nested Class Summary
static class TextProperties.E_Origin
          Defines the origin of a text string, which is the point at which it will be anchored.
 
Field Summary
 double _angleDegrees
          the rotation angle in degrees
private  boolean _areDescendersIgnored
          whether to ignore descenders in calculating the bounding box.
private  double _borderScale
          the ratio of the border to the text size, if a border is rendered
private  java.awt.Color _colorBackground
          the default background color
private  java.awt.Color _colorForeground
          the default foreground color
private  boolean _hasColorBackground
          whether the background color is rendered
private  boolean _isItalic
          whether the text is rendered as italic
private  double _magnification
          the magnification of the text in percent
private  TextProperties.E_Origin _origin
          the origin for anchoring and rotating the text
private  double _weight
          the weight of the text in percent
private  double MAGNIFICATION_MAX
          the maximum magnification
 
Constructor Summary
TextProperties()
          Creates a text descriptor with the following default values: black foreground color, no background color no bold, no italics, no border magnification 1.0 weight 1.0 left-to-right rotation bottom-left origin
TextProperties(double magnification, double weight)
          Creates a text descriptor with the following default values: black foreground color, no background color no bold, no italics, no border left-to-right rotation bottom-left origin
 
Method Summary
 boolean areDescendersIgnored()
          Returns whether to ignore descenders in calculating the bounding box.
 void areDescendersIgnored(boolean areDescendersIgnored)
          Sets whether to ignore descenders in calculating the bounding box.
 TextProperties clone()
          
 double getBorderScale()
          Gets the ratio of the border to the text size, if a border is rendered.
 java.awt.Color getColorBackground()
          Gets the background color, if it is enabled.
 java.awt.Color getColorForeground()
          Gets the foreground color.
 double getMagnification()
          Gets the magnification of the text in percent.
 TextProperties.E_Origin getOrigin()
          Gets the origin for anchoring and rotating the text.
 double getRotation()
          Gets the rotation angle about the origin.
 double getWeight()
          Gets the weight of the text in percent.
 boolean hasColorBackground()
          Gets whether the text has a background color.
 void hasColorBackground(boolean state)
          Sets whether the text has a background color.
 boolean isItalic()
          Returns whether text will be rendered in italics.
 void isItalic(boolean isItalic)
          Sets whether text will be rendered in italics.
 void setBorderScale(double scale)
          the ratio of the border to the text size, if a border is rendered
 void setColorBackground(java.awt.Color color)
          Sets the background color, if it is enabled.
 void setColorForeground(java.awt.Color color)
          Sets the foreground color.
 void setMagnification(double magnification)
          Sets the magnification.
 void setOrigin(TextProperties.E_Origin origin)
          Sets the origin for anchoring and rotating the text.
 void setRotation(double angleDegrees)
          Sets the rotation angle about the origin
 void setWeight(double weight)
          Sets the weight of the text.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_angleDegrees

public double _angleDegrees
the rotation angle in degrees


_areDescendersIgnored

private boolean _areDescendersIgnored
whether to ignore descenders in calculating the bounding box. For bordered and backgrounded uppercase text, disabling this produces better padding


_borderScale

private double _borderScale
the ratio of the border to the text size, if a border is rendered


_colorBackground

private java.awt.Color _colorBackground
the default background color


_colorForeground

private java.awt.Color _colorForeground
the default foreground color


_hasColorBackground

private boolean _hasColorBackground
whether the background color is rendered


_isItalic

private boolean _isItalic
whether the text is rendered as italic


_magnification

private double _magnification
the magnification of the text in percent


_origin

private TextProperties.E_Origin _origin
the origin for anchoring and rotating the text


_weight

private double _weight
the weight of the text in percent


MAGNIFICATION_MAX

private final double MAGNIFICATION_MAX
the maximum magnification

See Also:
Constant Field Values
Constructor Detail

TextProperties

public TextProperties()
Creates a text descriptor with the following default values:


TextProperties

public TextProperties(double magnification,
                      double weight)
Creates a text descriptor with the following default values:

Parameters:
magnification - - the magnification of the text in percent
weight - - the weight of the text in percent
Method Detail

areDescendersIgnored

public boolean areDescendersIgnored()
Returns whether to ignore descenders in calculating the bounding box.

Returns:
the state

areDescendersIgnored

public void areDescendersIgnored(boolean areDescendersIgnored)
Sets whether to ignore descenders in calculating the bounding box. For bordered and backgrounded uppercase text, disabling this produces better padding.

Parameters:
areDescendersIgnored - - the state

clone

public TextProperties clone()

Overrides:
clone in class java.lang.Object

getBorderScale

public double getBorderScale()
Gets the ratio of the border to the text size, if a border is rendered.

Returns:
the scale

getColorBackground

public java.awt.Color getColorBackground()
Gets the background color, if it is enabled.

Returns:
the color

getColorForeground

public java.awt.Color getColorForeground()
Gets the foreground color.

Returns:
the color

getMagnification

public double getMagnification()
Gets the magnification of the text in percent.

Returns:
the magnification

getOrigin

public TextProperties.E_Origin getOrigin()
Gets the origin for anchoring and rotating the text.

Returns:
the origin

getRotation

public double getRotation()
Gets the rotation angle about the origin.

Returns:
the angle in degrees

getWeight

public double getWeight()
Gets the weight of the text in percent.

Returns:
the weight

hasColorBackground

public boolean hasColorBackground()
Gets whether the text has a background color.

Returns:
the state

hasColorBackground

public void hasColorBackground(boolean state)
Sets whether the text has a background color.

Parameters:
state - - the state

isItalic

public boolean isItalic()
Returns whether text will be rendered in italics.

Returns:
the state

isItalic

public void isItalic(boolean isItalic)
Sets whether text will be rendered in italics.

Parameters:
isItalic - - the state

setBorderScale

public void setBorderScale(double scale)
the ratio of the border to the text size, if a border is rendered

Parameters:
scale - - the scale as a percent >= 1.0

setColorBackground

public void setColorBackground(java.awt.Color color)
Sets the background color, if it is enabled.

Parameters:
color - - the color

setColorForeground

public void setColorForeground(java.awt.Color color)
Sets the foreground color.

Parameters:
color - - the color

setMagnification

public void setMagnification(double magnification)
Sets the magnification.

Parameters:
magnification - - the magnification in percent

setOrigin

public void setOrigin(TextProperties.E_Origin origin)
Sets the origin for anchoring and rotating the text.

Parameters:
origin - - the origin

setRotation

public void setRotation(double angleDegrees)
Sets the rotation angle about the origin

Parameters:
angleDegrees - - the angle in degrees

setWeight

public void setWeight(double weight)
Sets the weight of the text.

Parameters:
weight - - the weight as a percent

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object