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


ITopology.AddClass Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (GeoDatabase)  

ITopology.AddClass Method

Add an object, feature, or attributed relationship class to the topology.

[Visual Basic .NET]
Public Sub AddClass ( _
    ByVal classToAdd As IClass, _
    ByVal Weight As Double, _
    ByVal XYRank As Integer, _
    ByVal ZRank As Integer, _
    ByVal EventNotificationOnValidate As Boolean _
)
[C#]
public void AddClass (
    IClass classToAdd,
    double Weight,
    int XYRank,
    int ZRank,
    bool EventNotificationOnValidate
);
[C++]
HRESULT AddClass(
  IClass* classToAdd,
  double Weight,
  long XYRank,
  long ZRank,
  VARIANT_BOOL EventNotificationOnValidate
);
[C++]

Parameters classToAdd [in]
classToAdd is a parameter of type IClass Weight [in] Weight is a parameter of type double XYRank [in] XYRank is a parameter of type long ZRank [in] ZRank is a parameter of type long EventNotificationOnValidate [in] EventNotificationOnValidate is a parameter of type VARIANT_BOOL

Product Availability

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

Errors Returned

FDO_E_INVALID_FEATURE_TYPE_FOR_TOPOLOGY

The specified feature class cannot be added to the Topology. Feature classes that cannot participate in a Topology include:


 ~ Dimension feature classes
 ~ Annotation feature classes
 ~ Network feature classes

FDO_E_INVALID_GEOMETRY_TYPE_FOR_TOPOLOGY

The specified feature class cannot be added to the Topology as it has an invalid shape type. Invalid shape types include: esriGeometryMultipoint and esriGeometryMultiPatch

FDO_E_CLASS_ALREADY_MEMBER_OF_TOPOLOGY

Feature classes that already participate in a Topology cannot be added to another Topology.

FDO_E_CANNOT_ADD_REGISTERED_CLASS_TO_TOPOLOGY

Cannot add a registered as versioned class to the topology.

FDO_E_TOPOLOGY_INVALID_RANK

The rank associated with the feature class is less than 0 or greater than 63

Remarks

The AddClass method is used to add a feature class to the topology, with the specified weight and ranks.  The Weight must be an integer between 1 and 10. Although it is not used in ArcGIS, it must still be specified. The XY and Z Rank must each be an integer between 1 and 63 (Ranks higher than 51 are will result in errors when specified in either the New Topology wizard or Topology property page). Even if the feature class being added to the topology is not Z aware, it must have a Z rank specified. The XY and Z ranks represent the accuracies of the feature class, relative to other feature classes participating in the topology. Feature classes with a higher rank, such as 1 are more accurate than feature classes with a lower rank, such as 2. Ranks are a relative measure of accuracy; the difference between two features classes of ranks 1 and 2 is the same as two feature classes with ranks of 1 and 50. Multiple feature classes in topology can have the same rank.

The EventNotificationOnValidate parameter indicates if an event is broadcast when the Topology that the feature class participates in, is validated. The EventNotificationOnValidate property can only be set if the Topology is created programmatically. Feature classes added to a topology using the New Topology wizard in ArcCatalog, will have a value of False for EventNotificationOnValidate.

Non-simple feature classes, such as annotation, dimension, geometric network feature classes and feature classes already in a topology cannot be added to a Topology. Object classes or tables and versioned simple feature classes, cannot be added to a Topology. After a populated feature class is added to a topology that has been validated, in whole or in part, the state of the topology will be changed and a dirty area corresponding to the extent of the feature class will be created. If an unpopulated feature class is added to a topology, the topology's state will not change and no dirty area will be created. The AddClass method cannot be called on versioned topologies in SDE, but can be called on non-versioned topologies in SDE and topologies in a file or personal geodatabase.

See Also

ITopology Interface

.NET Related Topics

Creating a topology in the geodatabase