ArcObjects Library Reference  (GeoDatabase)    

ISubtypes Interface

Provides access to members that return and modify subtype information.

Product Availability

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

Description

ISubtypes interface is a member of the ObjectClass coclass and is used to maintain information about subtypes for the object class. Subtypes can be removed, added, and retrieved using this interface. Also default subtypes and subtypecodes can be set for the object class here.

When To Use

The ISubtypes interface is the main interface for managing the subtypes, default values and attribute domains of an object class. For example, use the ISubtypes interface to create new subtypes, delete subtypes and assign an attribute domain for a particular field of a subtype. ISubtypes is an interface on the ObjectClass coclass.

Members

Description
Method AddSubtype Adds the subtype to the set of associated subtypes.
Read/write property DefaultSubtypeCode The default subtype associated with the class.
Read/write property DefaultValue The default value for the associated attribute.
Method DeleteSubtype Deletes the subtype from the set of associated subtypes.
Read/write property Domain The domain given the subtype and field.
Read-only property HasSubtype Indicates if the table has subtypes.
Read-only property SubtypeFieldIndex The subtype field index.
Read/write property SubtypeFieldName The subtype field name.
Read-only property SubtypeName The subtype name.
Read-only property Subtypes The subtypes associated with the class.

CoClasses that implement ISubtypes

CoClasses and Classes Description
FeatureClass FeatureClass Object.
NetCDFFeatureClass (esriDataSourcesNetCDF) An in-memory representation of a NetCDF feature class.
ObjectClass ObjectClass Object.
RouteEventSource (esriLocation) Route event source object.
SchematicDiagramClass (esriSchematic) Schematic diagram class object.
SchematicElementClass (esriSchematic) Schematic element class object.
XYEventSource XY event source object.
[C#]

    //e.g., nameOfFeatureClass = "land_use";
    //on ArcSDE use ISqlSyntax::QualifyTableName for fully qualified table names.
    public ISubtypes getISubtypes(IWorkspace workspace, string nameOfFeatureClass)
    {
        IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
        IFeatureClass featureClass = featureWorkspace.OpenFeatureClass(nameOfFeatureClass);

        ISubtypes subtypes = (ISubtypes)featureClass;
        return subtypes;
    }

[Visual Basic 6.0]

The following two examples are code excerpts that show how to get to an ISubtypes interface with Visual Basic for Applications and Visual Basic respecitvly.

When using VBA, you can get the ISubtypes interface from a layer in ArcMap's table of contents

Dim pFeatcls As IFeatureClass
Dim pFeatLayer As IFeatureLayer
Dim pDoc As IMxDocument
Dim pMap As IMap
Dim pSubtypes As ISubtypes
  
Set pDoc = ThisDocument
Set pMap = pDoc.Maps.Item(0)
Set pFeatLayer = pMap.Layer(0)
Set pFeatcls = pFeatLayer.FeatureClass
Set pSubtypes = pFeatcls

With Visual Basic, you are working outside of the application, so you need to use code to get the workspace object that contains the feature class, then get the ISubtypes interface from the feature class. This example has the location of the connection file for the workspace hard-coded, but you could use the mini-browser to browse to the workspace, or the feature class.

Dim pFact As IWorkspaceFactory
 Set pFact = New SdeWorkspaceFactory
   
 Dim pWorkspace As IWorkspace
 Set pWorkspace = pFact.OpenFromFile("C:\MyConnections\redarrow_gdb.sde",0)
   
 Dim pFeatws As IFeatureWorkspace
 Set pFeatws = pWorkspace
   
 Dim pFeatcls As IFeatureClass
 Set pFeatcls = pFeatws.OpenFeatureClass("gdb.Buildings_net")
   
 Dim pSubtypes As ISubtypes
 Set pSubtypes = pFeatcls

You can get the ISubtypes interface from the following objects:
FeatureClass
ObjectClass
Table

Example

ISubtypes Example

 


Feedback Send feedback on this page