com.tensegrity.composite.coordinate
Class CoordinateSystemMetric

java.lang.Object
  extended bycom.tensegrity.composite.coordinate.CoordinateSystemMetric

public class CoordinateSystemMetric
extends java.lang.Object

The CoordinateSystemMetric relates a CoordinateSystem to a metric system.

The relation is established by using a measure value and a measuring unit. The measure value represents the amount of units of the CoordinateSystem that should represent the measuring unit. The supported measuring units are defined by the following constants:

Constant Description
MetricConstants.CENTIMETER The amount of CoordinateSystem units defined by the measure value are representing a centimeter.
MetricConstants.MILLIMETER The amount of CoordinateSystem units defined by the measure value are representing a millimeter.
MetricConstants.MILLIMETER_10 The amount of CoordinateSystem units defined by the measure value are representing a tenth part of a millimeter.
MetricConstants.MILLIMETER_100 The amount of CoordinateSystem units defined by the measure value are representing a hundredth part of a millimeter.
MetricConstants.INCH The values are given in unit inch.
MetricConstants.INTERN CoordinateSystem values are given in units as they internally used.

Version:
$Id: CoordinateSystemMetric.java,v 1.27 2004/11/11 14:30:52 AndreasEbbert Exp $
Author:
MichaelKegel

Field Summary
static CoordinateSystemMetric SOLE_CSMETRIC
           
 
Method Summary
 double[] computeCoordinateSystemValues(int width, int height)
           
 double computeMeasuringUnitConversionFactor(int measuringUnitConvertTo)
           
static Boundary convertBoundingBox(double left, double top, double right, double bottom, double measureValue, int measuringUnit, int dpi)
           
 Boundary convertBoundingBox(int dpi, Boundary bbox)
           
 Boundary convertBoundingBox(int dpi, CoordinateSystem coordSystem)
          Returns an instance of Boundary with the size of the given CoordinateSystem according the the internal measuring unit, value and the given resolution.
 double convertMeasureValue(int measuringUnitConvertTo)
           
 MetricExpression convertMetricExpression(MetricExpression expression, int measuringUnitConvertTo)
           
 double convertMetricExpressionValue(double value, int measuringUnitConvertFrom, int measuringUnitConvertTo)
           
 double convertMetricExpressionValue(MetricExpression expression, int measuringUnitConvertTo)
           
 CoordinateSystemMetric deepCopy()
          Returns a deep copied instance of a CoordinateSystemMetric.
 double getMeasureValue()
          Returns the current setting for the measure value.
 int getMeasuringUnit()
          Returns a constants that tells about the measuring unit currently chosen.
 int getUnit()
          Returns the set measuring unit.
 java.lang.String getUnitName()
          Returns a textual description / abbreviation of the current selected measuring unit of this metric.
 java.lang.String getUnitNameAbbreviation()
          Returns the abbreviation for the unit name of this system metric.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SOLE_CSMETRIC

public static final CoordinateSystemMetric SOLE_CSMETRIC
Method Detail

getMeasureValue

public final double getMeasureValue()
Returns the current setting for the measure value. The measure value represents the amount of coordinate system units that represent one measuring unit. E.g. measureValue = 500, current coordinate system units = 15000 then you got 30 units of the currently set MeasureUnit.

Returns:
the currently used measure value.

getMeasuringUnit

public final int getMeasuringUnit()
Returns a constants that tells about the measuring unit currently chosen.

Returns:
constant for the current measuring unit

getUnit

public final int getUnit()
Returns the set measuring unit. Possible return values are:

Returns:
the set measuring unit.

getUnitName

public final java.lang.String getUnitName()
Returns a textual description / abbreviation of the current selected measuring unit of this metric.

Returns:
a String describing the current measure unit.

getUnitNameAbbreviation

public final java.lang.String getUnitNameAbbreviation()
Returns the abbreviation for the unit name of this system metric.

Returns:
the abbreviation for this metric or throws an exception if the current measuring unit is not supported.

computeMeasuringUnitConversionFactor

public final double computeMeasuringUnitConversionFactor(int measuringUnitConvertTo)

computeCoordinateSystemValues

public final double[] computeCoordinateSystemValues(int width,
                                                    int height)

convertMeasureValue

public final double convertMeasureValue(int measuringUnitConvertTo)

convertMetricExpression

public final MetricExpression convertMetricExpression(MetricExpression expression,
                                                      int measuringUnitConvertTo)

convertMetricExpressionValue

public final double convertMetricExpressionValue(double value,
                                                 int measuringUnitConvertFrom,
                                                 int measuringUnitConvertTo)

convertMetricExpressionValue

public final double convertMetricExpressionValue(MetricExpression expression,
                                                 int measuringUnitConvertTo)

convertBoundingBox

public final Boundary convertBoundingBox(int dpi,
                                         CoordinateSystem coordSystem)
Returns an instance of Boundary with the size of the given CoordinateSystem according the the internal measuring unit, value and the given resolution.

Parameters:
dpi - the dpi to which the size has to be calculated.
coordSystem - the CoordinateSystem which has to be transformed.
Returns:
an instance of Boundary with the size of the given CoordinateSystem according the the internal measuring unit, value and the given resolution.

convertBoundingBox

public final Boundary convertBoundingBox(int dpi,
                                         Boundary bbox)

deepCopy

public final CoordinateSystemMetric deepCopy()
Returns a deep copied instance of a CoordinateSystemMetric.

Returns:
a deep copied instance.

toString

public java.lang.String toString()
See Also:
Object.toString()

convertBoundingBox

public static final Boundary convertBoundingBox(double left,
                                                double top,
                                                double right,
                                                double bottom,
                                                double measureValue,
                                                int measuringUnit,
                                                int dpi)


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.