This document is archived and information here might be outdated. Recommended version. |
Creates a predefined unit of measure.
[Visual Basic .NET] Public Function CreateUnit ( _ ByVal unitType As Integer _ ) As IUnit
[C#] public IUnit CreateUnit ( int unitType );
[C++]
HRESULT CreateUnit(
long unitType
);
[C++] Parameters unitType
unitType is a parameter of type long
Use an element from the esriSRUnitType or esriSRUnit2Type enumerations as the unitType to create a particular predefined unit of measure.
ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
//Create the unit using the available units. These can be
//found in the esriGeometry esriSRUnitType enumeration.
ILinearUnit linearUnit = spatialReferenceFactory.CreateUnit((int)esriSRUnitType.esriSRUnit_Foot) as ILinearUnit;
Dim pSpatRefFact As ESRI.ArcGIS.Geometry.ISpatialReferenceFactory
'Set the spatial reference factory to a new spatial reference environment
pSpatRefFact = New ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment
Dim pUnit As ESRI.ArcGIS.Geometry.ILinearUnit
'Create the unit using the available units. These can be
'found in the esriGeometry esriSRUnitType enumeration.
pUnit = pSpatRefFact.CreateUnit(ESRI.ArcGIS.Geometry.esriSRUnitType.esriSRUnit_Foot)
ISpatialReferenceFactory Interface | esriSRUnitType Constants | esriSRUnit2Type Constants