- Direct Known Subclasses:
AngularUnit
,AreaUnit
,LinearUnit
Unit is a base class for measurement classes such as LinearUnit
, AngularUnit
, and AreaUnit
. Many
method parameters only accept specific types of measurement to reduce the chance of accidental use of
inappropriate values, but some generic methods accept all unit types, such as for translation from ID to text
description.
LinearUnit
- Projected coordinate systems define coordinates using linear measurements,
for example using meters or miles. They are also used to return distance measurements, for
example by some members of GeometryEngine
.
AngularUnit
- Geographic coordinate systems define coordinates using angular
measurements, for example using degrees or radians.
AreaUnit
- Projected coordinate systems define area units for two dimensional
measurements such as the area enclosed by a ring, for example in acres or square kilometers.
Linear, angular, and area units can be defined by using enumerations of the most common units
of measurement. They can also be defined by well-known ID (WKID) or well-known text (WKText).
Create the unit instances using the Unit
base class or the subtype, passing in the
enumeration for a specific unit of measurement.
Construction of related units are also supported so that if, for instance, the LinearUnit
(e.g. METERS) is known, then the corresponding AreaUnit
(e.g. SQUARE_METERS) can be created
based on the LinearUnit
.
Custom unit implementations are not supported.
Each instance of the various units types has properties for the unit name (singular, plural, and abbreviated) and provides methods for unit conversion between different units of measurement in the same category of measurement.
All unit names and abbreviations are returned in the English language. Instances of unit are immutable.
- Since:
- 100.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Unit
fromWkid
(int wkid) Creates a unit given its well-known ID.Gets the common abbreviation of the English name of this unit of measurement, for example 'm' for meters.Gets the English display name of the unit, suitable for displaying in a user interface.getName()
Gets the name of this unit of measurement, which may include underscores, for example Nautical_Mile or Minute_Centesimal.Gets the English display name for the plural of this unit of measurement, suitable for displaying in a user interface when the number of units is greater than one.Deprecated, for removal: This API element is subject to removal in a future version.since 200.1.0, use instanceof to determine the unit typeint
getWkid()
Gets the well-known ID for the unit, or 0 for a custom unit.
-
Method Details
-
getName
Gets the name of this unit of measurement, which may include underscores, for example Nautical_Mile or Minute_Centesimal. To display the name of the unit in a user interface, usegetDisplayName()
,getPluralDisplayName()
, orgetAbbreviation()
instead.- Returns:
- the name of this Unit
- Since:
- 100.0.0
- See Also:
-
getWkid
public int getWkid()Gets the well-known ID for the unit, or 0 for a custom unit.- Returns:
- the well-known ID for the unit, or 0 for a custom unit
- Since:
- 100.14.0
-
getAbbreviation
Gets the common abbreviation of the English name of this unit of measurement, for example 'm' for meters.- Returns:
- the abbreviation of the name of this Unit
- Since:
- 100.0.0
- See Also:
-
getDisplayName
Gets the English display name of the unit, suitable for displaying in a user interface. Alternatively, use thegetPluralDisplayName()
method to return the correct display name for the plural of the unit. Use thegetAbbreviation()
method to return the standard abbreviated form of this name.- Returns:
- the display name of this Unit
- Since:
- 100.0.0
-
getUnitType
Deprecated, for removal: This API element is subject to removal in a future version.since 200.1.0, use instanceof to determine the unit typeGets the type of this unit of measurement, linear, area, or angular. Different types of Unit are used in different measurement functions.- Returns:
- the type of this Unit
- Since:
- 100.0.0
-
getPluralDisplayName
Gets the English display name for the plural of this unit of measurement, suitable for displaying in a user interface when the number of units is greater than one. Alternatively, use thegetDisplayName()
method to return the correct display name for the singular of this unit.- Returns:
- the plural display name of this Unit
- Since:
- 100.0.0
-
fromWkid
Creates a unit given its well-known ID.- Parameters:
wkid
- the well-known ID of the unit- Returns:
- a unit. Depending on the well-known ID given, this may be a
LinearUnit
,AngularUnit
, orAreaUnit
. - Since:
- 100.14.0
-