This document is archived and information here might be outdated.  Recommended version.


IGeometryDefEdit Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IG > IGeometryDefEdit Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (GeoDatabase)  

IGeometryDefEdit Interface

Provides access to members that modify the geometry definition.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Members

Name Description
Write-only property AvgNumPoints The estimated average number of points per feature.
Read-only property AvgNumPoints The estimated average number of points per feature.
Write-only property GeometryType The geometry type.
Read-only property GeometryType The enumerated geometry type.
Write-only property GridCount The number of spatial index grids.
Read-only property GridCount The number of spatial index grids.
Write-only property GridSize The size of a spatial index grid.
Read-only property GridSize The size of a spatial index grid.
Write-only property HasM Indicates if the feature class will support M values.
Read-only property HasM Indicates if the feature class has measure (M) values.
Write-only property HasZ Indicates if the feature class will support Z values.
Read-only property HasZ Indicates if the featureClass has Z values.
Write-only property SpatialReference The spatial reference of the dataset.
Read-only property SpatialReference The spatial reference for the dataset.

Inherited Interfaces

Interfaces Description
IGeometryDef Provides access to members that return information about the geometry definition.

CoClasses that implement IGeometryDefEdit

CoClasses and Classes Description
GeometryDef Esri Geometry Definition object.

Remarks

The IGeometryDefEdit interface is used when creating a GeometryDef object. You would normally use this interface when defining a new feature class. You cannot use IGeometryDefEdit to modify an existing GeometryDef which is attached to a feature class; the same restrictions apply when using the standard ArcGIS user interface. For example, you cannot change the spatial reference of an existing feature class.

The following are valid Geometry types for a new feature class (from esriGeometryType):

esriGeometryPoint

esriGeometryMultipoint

esriGeometryPolyline

esriGeometryPolygon

esriGeometryMultiPatch

 

The SpatialReference property should always be set when creating a new GeometryDef.  If a GeometryDef without a spatial reference is used to create a stand-alone feature class, an error will occur.

 

If a feature class is created in a feature dataset, and the SpatialReference property does not match the spatial reference of the feature dataset, the property will be modified to match that of the feature dataset.

[C#]

The code below shows how to create a geometry field, assuming a spatial reference has already been created:

// Create the GeometryDef and set its spatial reference and geometry type.
IGeometryDef geometryDef=new GeometryDefClass();
IGeometryDefEdit geometryDefEdit=(IGeometryDefEdit)geometryDef;
geometryDefEdit.SpatialReference_2=spatialReference;
geometryDefEdit.GeometryType_2=esriGeometryType.esriGeometryPolyline;

// Set the grid count to 1 and the grid size to 0 to allow ArcGIS to
// determine a valid grid size.
geometryDefEdit.GridCount_2=1;
geometryDefEdit.set_GridSize(0, 0);

// Create a geometry field and assign the GeometryDef to it.
IField field=new FieldClass();
IFieldEdit fieldEdit=(IFieldEdit)field;
fieldEdit.Name_2="SHAPE";
fieldEdit.Type_2=esriFieldType.esriFieldTypeGeometry;
fieldEdit.GeometryDef_2=geometryDef;

[Visual Basic .NET]

The code below shows how to create a geometry field, assuming a spatial reference has already been created:

' Create the GeometryDef and set its spatial reference and geometry type.
Dim geometryDef As IGeometryDef=New GeometryDefClass()
Dim geometryDefEdit As IGeometryDefEdit=CType(geometryDef, IGeometryDefEdit)
geometryDefEdit.SpatialReference_2=spatialReference
geometryDefEdit.GeometryType_2=esriGeometryType.esriGeometryPolyline

' Set the grid count to 1 and the grid size to 0 to allow ArcGIS to
' determine a valid grid size.
geometryDefEdit.GridCount_2=1
geometryDefEdit.GridSize_2(0)=0

' Create a geometry field and assign the GeometryDef to it.
Dim field As IField=New FieldClass()
Dim fieldEdit As IFieldEdit=CType(field, IFieldEdit)
fieldEdit.Name_2="SHAPE"
fieldEdit.Type_2=esriFieldType.esriFieldTypeGeometry
fieldEdit.GeometryDef_2=geometryDef

.NET Related Topics

Converting simple data | Creating a plug-in data source | Creating annotation and dimension feature classes | Creating feature classes | Creating fields | Creating indexes | How to work with geoprocessing services