uavsim.graphics.instruments
Class NumberDescriptor<_UNIT_ extends I_Unitable<_UNIT_>>

java.lang.Object
  extended by uavsim.graphics.instruments.NumberDescriptor<_UNIT_>
Type Parameters:
_UNIT_ - - the unit that the numbers are based on

public class NumberDescriptor<_UNIT_ extends I_Unitable<_UNIT_>>
extends java.lang.Object

Defines a number descriptor.

Author:
Dan Tappan [29.06.11]

Field Summary
private  int _divider
          the divider to scale the order of magnitude of the numbers
private  Interval<_UNIT_> _interval
          the interval over which the numbers range
private  boolean _isRotated
          whether to rotate the numbers to align their base to the origin
private  Scaler _radius
          the radius scaler from the origin around which the numbers are arrayed
private  AngleMathematical _rotationOffset
          the offset for starting the number series
private  java.util.Map<java.lang.Integer,java.lang.String> _substitutions
          any substitutions to replace numbers with text
private  TextProperties _textProperties
          the text properties
 
Constructor Summary
NumberDescriptor(Interval<_UNIT_> interval, double radiusScaler, TextProperties textProperties, AngleMathematical rotationOffset, int divider)
          Creates a number descriptor.
NumberDescriptor(Interval<_UNIT_> interval, double radiusScaler, TextProperties textProperties, boolean isRotated, AngleMathematical rotationOffset, int divider)
          Creates a number descriptor.
NumberDescriptor(Interval<_UNIT_> interval, double radiusScaler, TextProperties textProperties, int divider)
          Creates a number descriptor.
NumberDescriptor(Interval<_UNIT_> interval, Scaler radius, TextProperties textProperties, boolean isRotated, AngleMathematical rotationOffset, int divider)
          Creates a number descriptor.
 
Method Summary
 void addSubstitution(int number, java.lang.String substitution)
          Adds a substitution to replace a number with text.
 int getDivider()
          Gets the divider to scale the order of magnitude of the numbers.
 Interval<_UNIT_> getInterval()
          Gets the interval over which the numbers range.
 Scaler getRadiusScaler()
          Gets the radius scaler from the origin around which the numbers are arrayed.
 AngleMathematical getRotationOffset()
          Gets the offset for starting the number series.
 java.lang.String getSubstitution(int number)
          Gets the substitution that replaces a number with text.
 TextProperties getTextProperties()
          Gets the text properties.
 boolean hasSubstitution(int number)
          Gets whether there is a text substitution for a number.
 boolean hasSubstitutions()
          Returns whether there are any substitutions that replace numbers with text.
 boolean isRotated()
          Gets whether to rotate the numbers to align their base to the origin.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_divider

private final int _divider
the divider to scale the order of magnitude of the numbers


_interval

private final Interval<_UNIT_ extends I_Unitable<_UNIT_>> _interval
the interval over which the numbers range


_isRotated

private final boolean _isRotated
whether to rotate the numbers to align their base to the origin


_radius

private final Scaler _radius
the radius scaler from the origin around which the numbers are arrayed


_rotationOffset

private final AngleMathematical _rotationOffset
the offset for starting the number series


_substitutions

private final java.util.Map<java.lang.Integer,java.lang.String> _substitutions
any substitutions to replace numbers with text


_textProperties

private final TextProperties _textProperties
the text properties

Constructor Detail

NumberDescriptor

public NumberDescriptor(Interval<_UNIT_> interval,
                        double radiusScaler,
                        TextProperties textProperties,
                        AngleMathematical rotationOffset,
                        int divider)
Creates a number descriptor. [xxx Law of Demeter helper to keep configuration constants smaller; note difference between scale/scaler]

Parameters:
interval - - the interval over which the numbers range
radiusScaler - - the radius scaler from the origin around which the numbers are arrayed
textProperties - - the text properties
rotationOffset - - the offset for starting the number series
divider - - the divider to scale the order of magnitude of the numbers

NumberDescriptor

public NumberDescriptor(Interval<_UNIT_> interval,
                        double radiusScaler,
                        TextProperties textProperties,
                        boolean isRotated,
                        AngleMathematical rotationOffset,
                        int divider)
Creates a number descriptor. [xxx Law of Demeter helper to keep configuration constants smaller; note difference between scale/scaler]

Parameters:
interval - - the interval over which the numbers range
radiusScaler - - the radius scaler from the origin around which the numbers are arrayed
textProperties - - the text properties
isRotated - - whether to rotate the numbers to align their base to the origin
rotationOffset - - the offset for starting the number series
divider - - the divider to scale the order of magnitude of the numbers

NumberDescriptor

public NumberDescriptor(Interval<_UNIT_> interval,
                        double radiusScaler,
                        TextProperties textProperties,
                        int divider)
Creates a number descriptor. [xxx Law of Demeter helper to keep configuration constants smaller; note difference between scale/scaler]

Parameters:
interval - - the interval over which the numbers range
radiusScaler - - the radius scaler from the origin around which the numbers are arrayed
textProperties - - the text properties
divider - - the divider to scale the order of magnitude of the numbers

NumberDescriptor

public NumberDescriptor(Interval<_UNIT_> interval,
                        Scaler radius,
                        TextProperties textProperties,
                        boolean isRotated,
                        AngleMathematical rotationOffset,
                        int divider)
Creates a number descriptor.

Parameters:
interval - - the interval over which the numbers range
radius - - the radius scaler from the origin around which the numbers are arrayed
textProperties - - the text properties
isRotated - - whether to rotate the numbers to align their base to the origin
rotationOffset - - the offset for starting the number series
divider - - the divider to scale the order of magnitude of the numbers
Method Detail

addSubstitution

public void addSubstitution(int number,
                            java.lang.String substitution)
Adds a substitution to replace a number with text. Duplicates are ignored.

Parameters:
number - - the number
substitution - - the text

getDivider

public int getDivider()
Gets the divider to scale the order of magnitude of the numbers.

Returns:
the divider

getInterval

public Interval<_UNIT_> getInterval()
Gets the interval over which the numbers range.

Returns:
the interval

getRadiusScaler

public Scaler getRadiusScaler()
Gets the radius scaler from the origin around which the numbers are arrayed.

Returns:
the scaler

getRotationOffset

public AngleMathematical getRotationOffset()
Gets the offset for starting the number series.

Returns:
the offset

getSubstitution

public java.lang.String getSubstitution(int number)
Gets the substitution that replaces a number with text. This is valid only if a substitution exists.

Parameters:
number - - the number
Returns:
the text

getTextProperties

public TextProperties getTextProperties()
Gets the text properties.

Returns:
the properties

hasSubstitution

public boolean hasSubstitution(int number)
Gets whether there is a text substitution for a number.

Parameters:
number - - the number
Returns:
the result

hasSubstitutions

public boolean hasSubstitutions()
Returns whether there are any substitutions that replace numbers with text.

Returns:
the state

isRotated

public boolean isRotated()
Gets whether to rotate the numbers to align their base to the origin.

Returns:
the state

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object