This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IS > ISpatialReferenceFactory Interface > ISpatialReferenceFactory.CreateUnit Method (ArcObjects .NET 10.5 SDK) |
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,
IUnit** Unit
);
[C++]
Parameters unitType unitType is a parameter of type long Unit [out, retval]
Unit is a parameter of type IUnit
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