com.esri.core.geometry
Class Unit

java.lang.Object
  extended by com.esri.core.geometry.Unit
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AngularUnit, AreaUnit, LinearUnit

public abstract class Unit
extends Object
implements Serializable

A base class for units.

Since:
1.0
See Also:
Serialized Form

Nested Class Summary
static class Unit.EsriUnit
           
static class Unit.UnitType
          Unit type (linear, angular, or area)
 
Field Summary
protected  double m_factor
           
protected  String mAbbreviation
           
protected  String mDisplayName
           
protected  int mID
           
protected  String mName
           
protected  String mPluralDisplayName
           
protected  int mWKID
           
 
Constructor Summary
Unit()
           
 
Method Summary
static void convertUnits(double[] valueIn, int countIn, Unit unitFrom, Unit unitTo, double[] valueOut)
          Converts an array of values to new units of same UnitType.
static double convertUnits(double valueIn, Unit unitFrom, Unit unitTo)
          Converts an input value to new units.
static Unit create(int wkid)
          Create a unit class from the 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 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. for example: to SI meter for linear units, to radian for angular, and to SI square meter for area units.
abstract  Unit.UnitType getUnitType()
          Returns the unit type.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_factor

protected double m_factor

mWKID

protected int mWKID

mName

protected String mName

mID

protected int mID

mDisplayName

protected String mDisplayName

mPluralDisplayName

protected String mPluralDisplayName

mAbbreviation

protected String mAbbreviation
Constructor Detail

Unit

public Unit()
Method Detail

getUnitType

public abstract Unit.UnitType getUnitType()
Returns the unit type.

Returns:
the unit type
Since:
1.0

create

public static Unit create(int wkid)
Create a unit class from the well-known id(wkid). The list of codes for common wkids can be found in the

Parameters:
wkid - The well known ID.
Returns:
The unit object of type angular, area, or linear. AngularUnit.Code interface, the LinearUnit.Code interface, and the AreaUnit.Code interface.
Since:
1.0

getName

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:
A string representation of Projection Engine unit name.
Since:
1.0

getID

public abstract int getID()
Returns the unit 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:
Integer value for wkid.
Since:
1.0

getDisplayName

public abstract String getDisplayName()
Returns the display name of this unit.

Returns:
A string value of unit display name.
Since:
1.0

getPluralDisplayName

public abstract String getPluralDisplayName()
Returns the display name of this unit.

Returns:
string value of plural display name
Since:
1.0

getAbbreviation

public abstract String getAbbreviation()
Returns the abbreviated name of this unit.

Returns:
A string value of abbreviation for unit.
Since:
1.0

getConversionFactor

public abstract double getConversionFactor(Unit destinationUnit)
Returns a conversion factor from this unit to the destination unit. To convert a value V from this units to the dst units.

Parameters:
destinationUnit - The destination unit.
Returns:
A double conversion factor.
Since:
1.0

convertUnits

public static double convertUnits(double valueIn,
                                  Unit unitFrom,
                                  Unit unitTo)
Converts an input value to new units.

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

convertUnits

public static void convertUnits(double[] valueIn,
                                int countIn,
                                Unit unitFrom,
                                Unit unitTo,
                                double[] valueOut)
Converts an array of values to new units of same UnitType.

Parameters:
valueIn - The value to converted from.
countIn - The count for the to converted values.
unitFrom - The unit to convert from.
unitTo - The unit to convert to.
valueOut - the value to convert to.
Since:
1.0

getUnitToBaseFactor

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:
the unit to base factor
Since:
1.0

equals

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.

Overrides:
equals in class Object
Parameters:
other - The other object.
Returns:
true, if equals
Since:
1.0

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Since:
1.0


Copyright © 2012. All Rights Reserved.