Skip To Content ArcGIS for Developers Sign In Dashboard

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)
Unit()
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.

Different units of measurement can be used throughout ArcGIS Runtime. Projected coordinate systems define coordinates using linear measurements, for example using meters or miles, which are represented by LinearUnit. Linear units are also used to return distance measurements, for example by some members of GeometryEngine. Geographic coordinate systems define coordinates using angular measurements, for example using degrees or radians, which are represented by AngularUnit. Methods that calculate the size of areas, for example in acres or square kilometers, use area units. These are represented by AreaUnit. 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).

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.

Unit::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()

Destructor

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?