ArcGIS Explorer Component Help |
Unit..::.GetDisplayName Method |
Unit Class Example See Also |
Returns the name of the Unit in a format suitable for display in a user interface,
in a simplified or more detailed form.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public string GetDisplayName( UnitNameOptions nameOptions ) |
Visual Basic (Declaration) |
---|
Public Function GetDisplayName ( _ nameOptions As UnitNameOptions _ ) As String |
Parameters
- nameOptions
- Type: ESRI.ArcGISExplorer.Geometry..::.UnitNameOptions
Indicates the form of name to return, for example a simplified form of the Unit name.
Return Value
A string containing the name of the Unit.Remarks
You can use this method to return the name of a unit suitable for display in a user interface. Using UnitNameOptions.Simple returns the name of the basic unit of measurement, for example for MilesSurvey, the simple name would be 'Mile', and the detailed name would be 'Survey Mile'. Alternatively to find out the plural name of the unit, use GetPluralName(UnitNameOptions).
Note that for some units, the simple and detailed names are the same, for example Kilometers and Meters.
The value returned by this method may differ slightly from the value of the Name property, and is more suitable for display in a user interface.
Examples
The code below creates new Unit objects representing linear and angular units using a nested type initializer.
It builds a string to report the conversion Factor indicating how many Meters (for linear units)
and Radians (for angular units) are in the specified units, using the GetDisplayName property to format
the name of the Unit.
CopyC#
// Create new Units with a specific unit of measurement. Unit feet = Unit.Linear.Feet; Unit degrees = Unit.Angular.Degrees; // Find out the conversion factors. double factorFeet = Unit.Convert(1, feet, Unit.Linear.Meters); string feetInfo = "1 " + feet.GetDisplayName(UnitNameOptions.Detailed) + " = " + factorFeet + " Meters"; double factorDegrees = Unit.Convert(1, degrees, Unit.Angular.Radians); string degreesInfo = "1 " + degrees.GetDisplayName(UnitNameOptions.Detailed) + " = " + factorDegrees + " Radians";
CopyVB.NET
' Create new Units with a specific unit of measurement. Dim feet As Unit = Unit.Linear.Feet Dim degrees As Unit = Unit.Angular.Degrees ' Find out the conversion factors. Dim factorFeet As Double = Unit.Convert(1, feet, Unit.Linear.Meters) Dim feetInfo As String = "1 " & feet.GetDisplayName(UnitNameOptions.Detailed) & " = " & factorFeet & " Meters" Dim factorDegrees As Double = Unit.Convert(1, degrees, Unit.Angular.Radians) Dim degreesInfo As String = "1 " & degrees.GetDisplayName(UnitNameOptions.Detailed) & " = " & factorDegrees & " Radians"