ArcGIS Developers

Unit Class

class Esri::ArcGISRuntime::Unit

Base class for classes that represent a unit of measurement. More...

Header: #include <Unit>
Since: Esri::ArcGISRuntime 100.0
Inherited By:

Esri::ArcGISRuntime::AngularUnit, Esri::ArcGISRuntime::AreaUnit, and Esri::ArcGISRuntime::LinearUnit

This class was introduced in Esri::ArcGISRuntime 100.0.

Public Functions

Unit(Esri::ArcGISRuntime::Unit &&other)
Unit(const Esri::ArcGISRuntime::Unit &other)
Esri::ArcGISRuntime::Unit &operator=(Esri::ArcGISRuntime::Unit &&other)
Esri::ArcGISRuntime::Unit &operator=(const Esri::ArcGISRuntime::Unit &other)
virtual ~Unit()
QString abbreviation() const
QString displayName() const
bool isEmpty() const
QString name() const
QString pluralDisplayName() const
int unitId() const
Esri::ArcGISRuntime::UnitType unitType() const

Static Public Members

Esri::ArcGISRuntime::Unit fromUnitId(int unitId)

Detailed Description

Unit is a base class inherited by subtypes representing different categories of measurement: LinearUnit, AngularUnit, and AreaUnit. The subtypes are used in measurement functions and spatial references. Many function parameters only accept specific types of measurement to reduce the chance of accidental use of inappropriate values, but some generic functions accept all unit types e.g. 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.

Each instance 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.

Create Unit instances using the subtypes, passing in the enumeration for a specific unit of measurement. Custom unit implementations are not supported.

Instances of Unit are immutable.

Member Function Documentation

Unit::Unit(Esri::ArcGISRuntime::Unit &&other)

Move constructor from other Unit.

Unit::Unit(const Esri::ArcGISRuntime::Unit &other)

Copy constructor from other Unit.


Default constructor.

Esri::ArcGISRuntime::Unit &Unit::operator=(Esri::ArcGISRuntime::Unit &&other)

Move operator from other Unit.

Esri::ArcGISRuntime::Unit &Unit::operator=(const Esri::ArcGISRuntime::Unit &other)

Assignment operator from other Unit.

[virtual] Unit::~Unit()


QString Unit::abbreviation() const

Gets the abbreviated unit name.

QString Unit::displayName() const

Gets the singular display name (for example, FOOT).

[static] Esri::ArcGISRuntime::Unit Unit::fromUnitId(int unitId)

Constructs a new %Unit based on the unitId corresponding to desired %Unit. Returns A new %Unit instance which will be one of AreaUnit, AngularUnit, LinearUnit or null if it could not be created.

bool Unit::isEmpty() const

Gets whether this Unit is empty.

A default constructed Unit is empty.

Returns true if empty.

QString Unit::name() const

Gets the unit name.

QString Unit::pluralDisplayName() const

Gets the plural display name (for example, FEET).

int Unit::unitId() const

Gets the unit ID which is unique across all types of units.

Esri::ArcGISRuntime::UnitType Unit::unitType() const

Gets the unit type.

Feedback on this topic?