com.approximatrix.charting.coordsystem
Class CoordSystemUtilities

java.lang.Object
  extended by com.approximatrix.charting.coordsystem.CoordSystemUtilities

public class CoordSystemUtilities
extends java.lang.Object

Static class used by Charts for defining and building the default coordinate system throughout Openchart2.

Author:
armstrong

Field Summary
static int CLASSIC_COORD_SYSTEM
          Indicator for using the ClassicCoordSystem by default
private static int DefaultCoordSystem
          The actual indicator for coordinate system defaults
static int MAX
          Internal constant refering to the max value index of a 2-element constraint array
static int MIN
          Internal constant refering to the min value index of a 2-element constraint array
 
Constructor Summary
CoordSystemUtilities()
           
 
Method Summary
static CoordSystem BuildDefaultCoordSystem(ChartDataModel cdm)
          Constructs the default coordinate system
static int GetDefaultCoordSystem()
          Returns the curret default coordinate system
static double[] SafeMaxMin(double max, double min)
          Returns a safe estimate of min and max drawing values for an axis.
static void SetDefaultCoordSystem(int i)
          Sets the default coordinate system to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX

public static final int MAX
Internal constant refering to the max value index of a 2-element constraint array

See Also:
Constant Field Values

MIN

public static final int MIN
Internal constant refering to the min value index of a 2-element constraint array

See Also:
Constant Field Values

CLASSIC_COORD_SYSTEM

public static final int CLASSIC_COORD_SYSTEM
Indicator for using the ClassicCoordSystem by default

See Also:
Constant Field Values

DefaultCoordSystem

private static int DefaultCoordSystem
The actual indicator for coordinate system defaults

Constructor Detail

CoordSystemUtilities

public CoordSystemUtilities()
Method Detail

GetDefaultCoordSystem

public static int GetDefaultCoordSystem()
Returns the curret default coordinate system

Returns:
the integer representing the default coordinate system

SetDefaultCoordSystem

public static void SetDefaultCoordSystem(int i)
Sets the default coordinate system to use. Note that no validity checking is performed.

Parameters:
i - the identifier of the coordinate system style

BuildDefaultCoordSystem

public static CoordSystem BuildDefaultCoordSystem(ChartDataModel cdm)
Constructs the default coordinate system

Parameters:
cdm - the associated chart data model for the system
Returns:
a CoordSystem object

SafeMaxMin

public static double[] SafeMaxMin(double max,
                                  double min)
Returns a safe estimate of min and max drawing values for an axis. Used to defend against special cases where max and min might be equal or reversed.

Parameters:
max - the original max value
min - the originial min value
Returns:
the new max and min values in an array, which can be indexed using the MAX and MIN constants in this class