Package org.eclipse.birt.chart.computation

# Class Methods

java.lang.Object
org.eclipse.birt.chart.computation.Methods

All Implemented Interfaces:
  `IConstants`

Direct Known Subclasses:
  `AutoScale`, `DataSetAdapter`, `IntersectionValue`, `ScaleContext`

public class Methods extends Object implements IConstants
Methods

## Field Summary

### Fields inherited from interface org.eclipse.birt.chart.computation.IConstants

`ABOVE, ANCILLARY_AXIS, ANCILLARY_BASE, ARRAY, AUTO, AVERAGE, AXIS, BACKWARD, BASE, BASE_AXIS, BELOW, BIG_NUMBER_PRIMITIVE_ARRAY, BOOLEAN, BOTTOM, CENTER, COLLECTION, DATE_TIME, DESIGN_TIME, EMPTY_STRING, EQUAL, FORWARD, HORIZONTAL, INSIDE, LABELS, LEFT, LEGEND_ENTRY, LEGEND_GROUP_NAME, LEGEND_MINSLICE_ENTRY, LEGEND_SEPERATOR, LESS, LINE_EXPAND_DOUBLE_SIZE, LINE_EXPAND_SIZE, LINEAR, LOG_10, LOGARITHMIC, MAJOR, MAX, MIN, MINOR, MORE, NON_PRIMITIVE_ARRAY, NULL_STRING, NUMBER_PRIMITIVE_ARRAY, NUMERICAL, ONE_SPACE, ORTHOGONAL, ORTHOGONAL_AXIS, OTHER, OUTSIDE, PERCENT, POSITION_MASK, POSITION_MOVE_ABOVE, POSITION_MOVE_BELOW, POSITION_MOVE_LEFT, POSITION_MOVE_RIGHT, PRIMITIVE_ARRAY, RIGHT, RUN_TIME, SOME_NULL, TEXT, THREE_D, TICK_ABOVE, TICK_ACROSS, TICK_BELOW, TICK_LEFT, TICK_NONE, TICK_RIGHT, TICK_SIDE1, TICK_SIDE2, TICK_SIZE, TOP, TWO_5_D, TWO_D, UNDEFINED, UNDEFINED_STRING, USER_INTERFACE, VALUE, VERTICAL`

## Constructor Summary

Constructors
Constructor
Description
`Methods()`

## Method Summary

Modifier and Type
Method
Description
`static final CDateTime`
`asDateTime(Object o)`
Converts given object to a DateTime object.
`static final Double`
`asDouble(Object o)`
Converts the given object to a Double object.
`static final int`
`asInteger(Object o)`
Converts the given object to an Integer object.
`static final BoundingBox`
`computeBox(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY)`
`static final BoundingBox`
`computeBox(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY, double dWrapping)`
`static final BoundingBox`
`computeBox(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY, double dWrapping, Double fontHeight)`
`static final BoundingBox`
`computeBox(IDisplayServer xs, ITextMetrics itm, int iLabelLocation, Label la, double dX, double dY, Double fontHeight)`
`static double`
`computeFontHeight(IDisplayServer xs, Label la)`
Convenient method to compute the font's height of a label.
`static final double`
`computeHeight(IDisplayServer xs, Label la)`
`static final double`
`computeHeight(ITextMetrics itm, Label la)`
`static final BoundingBox`
`computeLabelSize(IDisplayServer xs, Label la, double dWrapping, Double fontHeight)`
Compute the size of a label.
`static final RotatedRectangle`
`computePolygon(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY)`
`static final RotatedRectangle`
`computePolygon(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY, Double fontHeight)`
`static final RotatedRectangle`
`computePolygon(ITextMetrics itm, int iLabelLocation, Label la, double dX, double dY, Double fontHeight)`
`static final Location`
`computeRotatedTopPoint(IDisplayServer xs, BoundingBox bbox, Label la, double fullHeight)`
`static final double`
`computeWidth(IDisplayServer xs, Label la)`
`static final double`
`computeWidth(ITextMetrics itm, Label la)`
`static final int`
`getLabelPosition(Position lp)`
Converts to internal (non public-model) data structures
`static final double`
`getLocation(AutoScale sc, double dValue)`
`static final double`
`getLocation(AutoScale sc, Number bdValue)`
Computes and returns the location based on specified value and scale info.
`static final double`
`getLocation(AutoScale sc, Object oValue)`
`static final double`
`getNormalizedLocation(AutoScale sc, double dValue)`
`static final double`
`getNormalizedLocation(AutoScale sc, Object oValue)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Methods

public Methods()

## Method Details

### asDateTime

public static final CDateTime asDateTime(Object o)
Converts given object to a DateTime object.

Parameters:
  `o` -
Returns:
  CDateTime

### asDouble

public static final Double asDouble(Object o)
Converts the given object to a Double object.

Parameters:
  `o` -
Returns:
  Double

### asInteger

public static final int asInteger(Object o)
Converts the given object to an Integer object.

Parameters:
  `o` -
Returns:
  int

### getLocation

public static final double getLocation(AutoScale sc, Object oValue) throws ChartException, IllegalArgumentException

Parameters:
  `sc` -
  `oValue` -
Returns:
  location coordinate
Throws:
  `ChartException`
  `IllegalArgumentException`

### getNormalizedLocation

public static final double getNormalizedLocation(AutoScale sc, double dValue)

Parameters:
  `sc` -
  `dValue` -
Returns:
  location coordinate

### getNormalizedLocation

public static final double getNormalizedLocation(AutoScale sc, Object oValue) throws ChartException, IllegalArgumentException

Parameters:
  `sc` -
  `oValue` -
Returns:
  location coordinate
Throws:
  `ChartException`
  `IllegalArgumentException`

### getLocation

public static final double getLocation(AutoScale sc, Number bdValue)
Computes and returns the location based on specified value and scale info.

Parameters:
  `sc` - scale info instance.
  `bdValue` - specified value.
Returns:

### getLocation

public static final double getLocation(AutoScale sc, double dValue) throws IllegalArgumentException

Parameters:
  `sc` -
  `dValue` -
Returns:
  location coordinate
Throws:
  `IllegalArgumentException`

### computeWidth

public static final double computeWidth(IDisplayServer xs, Label la)

Parameters:
  `g2d` -
  `fm` -
  `sText` -
  `dAngleInDegrees` -
Returns:
  width

### computeWidth

public static final double computeWidth(ITextMetrics itm, Label la)

### computeHeight

public static final double computeHeight(IDisplayServer xs, Label la)

Parameters:
  `g2d` -
  `fm` -
  `sText` -
  `iAngleInDegrees` -
Returns:
  height

### computeHeight

public static final double computeHeight(ITextMetrics itm, Label la)

### computePolygon

public static final RotatedRectangle computePolygon(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY) throws IllegalArgumentException

Parameters:
  `iLabelLocation` -
  `g2d` -
  `fm` -
  `sText` -
  `dAngleInDegrees` -
  `dX` -
  `dY` -
Returns:
  Note: If you find yourself calling this method very frequently while the font of the label is not changed, consider using the version with fontHeight instead. (following)
Throws:
  `IllegalArgumentException`

### computePolygon

public static final RotatedRectangle computePolygon(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY, Double fontHeight) throws IllegalArgumentException

Parameters:
  `xs` -
  `iLabelLocation` -
  `la` -
  `dX` -
  `dY` -
  `fontHeight` - , see also: computeFontHeight
Returns:
  RotatedRectangle
Throws:
  `IllegalArgumentException`

### computePolygon

public static final RotatedRectangle computePolygon(ITextMetrics itm, int iLabelLocation, Label la, double dX, double dY, Double fontHeight) throws IllegalArgumentException

Parameters:
  `xs` -
  `iLabelLocation` -
  `la` -
  `dX` -
  `dY` -
  `fontHeight` - , see also: computeFontHeight
Returns:
  RotatedRectangle
Throws:
  `IllegalArgumentException`

### computeRotatedTopPoint

public static final Location computeRotatedTopPoint(IDisplayServer xs, BoundingBox bbox, Label la, double fullHeight) throws IllegalArgumentException

Parameters:
  `xs` -
  `bbox` -
  `la` -
  `fullHeight` -
Returns:
  Location
Throws:
  `IllegalArgumentException`

### computeBox

public static final BoundingBox computeBox(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY) throws IllegalArgumentException

Parameters:
  `xs` -
  `iLabelLocation` -
  `la` -
  `dX` -
  `dY` -
Returns:
  BoundingBox
Throws:
  `IllegalArgumentException`

### computeLabelSize

public static final BoundingBox computeLabelSize(IDisplayServer xs, Label la, double dWrapping, Double fontHeight) throws ChartException
Compute the size of a label.

Parameters:
  `xs` -
  `la` -
  `dWrapping` -
  `fontHeight` - , pre-computed font height
Returns:
  BoundingBox
Throws:
  `ChartException`

### computeBox

public static final BoundingBox computeBox(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY, double dWrapping) throws IllegalArgumentException

Parameters:
  `xs` -
  `iLabelLocation` -
  `la` -
  `dX` -
  `dY` -
  `dWrapping` - the max size for wrapping by pixels
Returns:
  BoundingBox
Throws:
  `IllegalArgumentException`

### computeBox

public static final BoundingBox computeBox(IDisplayServer xs, ITextMetrics itm, int iLabelLocation, Label la, double dX, double dY, Double fontHeight) throws IllegalArgumentException

Throws:
  `IllegalArgumentException`

### computeBox

public static final BoundingBox computeBox(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY, double dWrapping, Double fontHeight) throws IllegalArgumentException

Throws:
  `IllegalArgumentException`

### getLabelPosition

public static final int getLabelPosition(Position lp)
Converts to internal (non public-model) data structures

Parameters:
  `lp` -
Returns:
  position state

### computeFontHeight

public static double computeFontHeight(IDisplayServer xs, Label la)
Convenient method to compute the font's height of a label. This computation is costly, but in most case we do not change the font of a label, we just change the string value, so the font height will not changed. The purpose of the method is to get the font height overhead for reusing.

Parameters:
  `xs` -
  `la` -
Returns:
  font height