public abstract class

Unit

extends Object
implements Serializable
java.lang.Object
   ↳ com.esri.core.geometry.Unit
Known Direct Subclasses

Class Overview

A base class for units. Use the static method create(int) to create an instance of a particular unit, passing in one of the int codes contained in the subclasses' CODE interfaces.

For example:

 // create a meter unit
 Unit meter = Unit.create(LinearUnit.Code.METER);
 
 // create a radians unit
 Unit degree = Unit.create(AngularUnit.Code.DEGREE);
 
 // create a square kilometer unit
 Unit squareKm = Unit.create(AreaUnit.Code.SQUARE_KILOMETER); 
 
 

Summary

Nested Classes
enum Unit.EsriUnit  
enum Unit.UnitType Unit type (linear, angular, area, unknown). 
Fields
protected String mAbbreviation
protected String mDisplayName
protected int mID
protected String mName
protected String mPluralDisplayName
protected int mWKID
protected double m_factor
Public Constructors
Unit()
Public Methods
static double convertUnits(double valueIn, Unit unitFrom, Unit unitTo)
Converts an input value to new units.
static void convertUnits(double[] valueIn, int countIn, Unit unitFrom, Unit unitTo, double[] valueOut)
Converts an array of values to new units of same Unit.UnitType.
static Unit create(int wkid)
Creates a Unit instance from a unit's well-known ID (wkid).
boolean equals(Object other)
Indicates if this unit is the same type (linear, angular, or area) and the same unit (meter, degree, acre, etc.) as another.
abstract String getAbbreviation()
Returns the abbreviated name of this unit.
abstract double getConversionFactor(Unit destinationUnit)
Returns a conversion factor from this unit to the destination unit.
abstract String getDisplayName()
Returns the display name of this unit.
abstract int getID()
Returns the unit's well-known ID.
abstract String getName()
Returns the canonical name of the unit as defined in Projection Engine.
abstract String getPluralDisplayName()
Returns the display name of this unit.
double getUnitToBaseFactor()
The conversion factor from this unit to the base unit.
abstract Unit.UnitType getUnitType()
Returns the unit type.
int hashCode()
String toString()
Returns string representation of the class for debugging purposes.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected String mAbbreviation

protected String mDisplayName

protected int mID

protected String mName

protected String mPluralDisplayName

protected int mWKID

protected double m_factor

Public Constructors

public Unit ()

Public Methods

public static double convertUnits (double valueIn, Unit unitFrom, Unit unitTo)

Converts an input value to new units. Conversion of input value to new value must be the same Unit.UnitType. We currently do not support conversion from ANGULAR to LINEAR units.

Parameters
valueIn double: The value to be converted from unitFrom to unitTo.
unitFrom Unit: The units to convert from.
unitTo Unit: The units to convert to.
Returns
double A converted value as double.

public static void convertUnits (double[] valueIn, int countIn, Unit unitFrom, Unit unitTo, double[] valueOut)

Converts an array of values to new units of same Unit.UnitType. We currently do not support conversion from ANGULAR to LINEAR units.

Parameters
valueIn double: The value to converted from.
countIn int: The count for the to converted values.
unitFrom Unit: The unit to convert from.
unitTo Unit: The unit to convert to.
valueOut double: the value to convert to.

public static Unit create (int wkid)

Creates a Unit instance from a unit's well-known ID (wkid). Pass in a wkid from the values listed in the AngularUnit.Code interface, the LinearUnit.Code interface, and the AreaUnit.Code interface.

Parameters
wkid int: The well-known ID.
Returns
Unit A unit instance which will be of type angular, area, or linear.

public boolean equals (Object other)

Indicates if this unit is the same type (linear, angular, or area) and the same unit (meter, degree, acre, etc.) as another.

Parameters
other Object: The other object.
Returns
boolean true, if equals

public abstract String getAbbreviation ()

Returns the abbreviated name of this unit.

Returns
String A string value of abbreviation for unit.

public abstract double getConversionFactor (Unit destinationUnit)

Returns a conversion factor from this unit to the destination unit.

Parameters
destinationUnit Unit: The destination unit.
Returns
double A double conversion factor.

public abstract String getDisplayName ()

Returns the display name of this unit.

Returns
String A string value of unit display name.

public abstract int getID ()

Returns the unit's well-known ID. The ID value is a positive number for the units with well-known IDs, and 0 for the custom and area units.

Returns
int Integer value for wkid.

public abstract String getName ()

Returns the canonical name of the unit as defined in Projection Engine. (ex. for German Meter the projection engine canonical string value is METER_GERMAN)

Returns
String A string representation of Projection Engine unit name.

public abstract String getPluralDisplayName ()

Returns the display name of this unit.

Returns
String string value of plural display name

public double getUnitToBaseFactor ()

The conversion factor from this unit to the base unit. For example: to SI meter for linear units, to radian for angular, and to SI square meter for area units.

Returns
double the unit to base factor

public abstract Unit.UnitType getUnitType ()

Returns the unit type.

Returns
Unit.UnitType the unit type

public int hashCode ()

Returns
int

public String toString ()

Returns string representation of the class for debugging purposes. The format and content of the returned string is not part of the contract of the method and is subject to change in any future release or patch without further notice.

Returns
String