ArcGIS Explorer Component Help |
Unit..::.Area Class |
Unit Class Members Example See Also |
Provides type initializers for specific units of area measurement that are used in measurement or measurement
conversion functions.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static class Area |
Visual Basic (Declaration) |
---|
Public NotInheritable Class Area |
Remarks
The properties on this class return Unit objects which represent all of the standard units of area measurement used in ArcGIS Explorer. Area units, unlike linear and angular units, are never used in coordinate systems; they are used in area measurement and area measurement conversion, for example Convert method and also in the Area(Envelope, Unit) and Area(Polygon, Unit) methods.
Examples
The code below uses .NET reflection to find all of the nested type initializers that create new
Unit objects, and then creates an instance of each type of Unit. It then reports on the units by writing to the Debug
window using Name property (and Id property where applicable), listing linear, angular and area units separately.
CopyC#
// Get all the different types of Linear units. System.Reflection.PropertyInfo[] linearProps = typeof(Unit.Linear).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static); // Report linear units. System.Diagnostics.Debug.WriteLine("Linear Units are:"); foreach (System.Reflection.PropertyInfo prop in linearProps) { Unit u = prop.GetValue(null, null) as Unit; System.Diagnostics.Debug.WriteLine(u.Name + "(" + u.Id.ToString() + ")"); } // Get all the different types of angular units. System.Reflection.PropertyInfo[] angularProps = typeof(Unit.Angular).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static); // Report angular units. System.Diagnostics.Debug.WriteLine("Angular Units are:"); foreach (System.Reflection.PropertyInfo prop in angularProps) { Unit u = prop.GetValue(null, null) as Unit; System.Diagnostics.Debug.WriteLine(u.Name + "(" + u.Id.ToString() + ")"); } // Get all the different types of area units. System.Reflection.PropertyInfo[] areaProps = typeof(Unit.Area).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static); // Report area units. System.Diagnostics.Debug.WriteLine("Area Units are:"); foreach (System.Reflection.PropertyInfo prop in areaProps) { Unit u = prop.GetValue(null, null) as Unit; System.Diagnostics.Debug.WriteLine(u.Name); // Area units do not have identifiers. }
CopyVB.NET
' Get all the different types of Linear units. Dim linearProps As System.Reflection.PropertyInfo() = GetType(Unit.Linear).GetProperties(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static) ' Report linear units. System.Diagnostics.Debug.WriteLine("Linear Units are:") Dim prop As System.Reflection.PropertyInfo For Each prop In linearProps Dim u As Unit = CType(prop.GetValue(Nothing, Nothing), Unit) System.Diagnostics.Debug.WriteLine(u.Name & "(" & u.Id.ToString() & ")") Next ' Get all the different types of angular units. Dim angularProps As System.Reflection.PropertyInfo() = GetType(Unit.Angular).GetProperties(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static) ' Report angular units. System.Diagnostics.Debug.WriteLine("Angular Units are:") For Each prop In angularProps Dim u As Unit = CType(prop.GetValue(Nothing, Nothing), Unit) System.Diagnostics.Debug.WriteLine(u.Name & "(" & u.Id.ToString() & ")") Next ' Get all the different types of area units. Dim areaProps As System.Reflection.PropertyInfo() = GetType(Unit.Area).GetProperties(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static) ' Report angular units. System.Diagnostics.Debug.WriteLine("Area Units are:") For Each prop In areaProps Dim u As Unit = CType(prop.GetValue(Nothing, Nothing), Unit) System.Diagnostics.Debug.WriteLine(u.Name) ' Area units do not have Identifiers Next