ArcObjects Library Reference (GeoDatabase)  

ITopologyRuleContainer.AddRule Method

Adds a topology rule.

[Visual Basic .NET]
Public Sub AddRule ( _
    ByVal Rule As ITopologyRule _
)
[C#]
public void AddRule (
    ITopologyRule Rule
);
[C++]
HRESULT AddRule(
  ITopologyRule* Rule
);
[C++]

Parameters

Rule [in]

  Rule is a parameter of type ITopologyRule

Product Availability

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

Errors Returned

FDO_E_INVALID_TOPOLOGY_RULE_TYPE

The TopologyRuleType property has been specified as a non-existant rule type. See esriTopologyRuleType for a listing of the supported Topology rules.

FDO_E_INVALID_GEOMETRY_TYPE_FOR_TOPOLOGY_RULE

The geometry type of the origin and/or destination feature class is invalid for the topology rule.

FDO_E_INVALID_TOPOLOGY_RULE

The topology rule is invalid. This error can be raised if an invalid OriginSubtype or DestinationSubtype has been specified.

FDO_E_INVALID_TOPOLOGY_RULE_CLASS_ASSIGNMENT

The origin and destination feature class for the topology rule have been specified as the same class. This error can also be raised when the origin and destination feature class are the same class, but one has been specified at the feature class level and the other at the subtype level.

FDO_E_INCONSISTENT_TOPOLOGY_RULE

The topology rule is inconsistent and cannot be added to the Topology, it conflicts with an existing rule. Examples include: adding a rule specified at the feature class level to a Topology that already contains a rule of the same type for the same feature class, but specified at the subytpe level.

For example, for feature class FC1 with subtypes SubT1 and SubT2 and a Topology with the rule, FC1 Must Not Overlap, the following rules, specified at the subtype level, are invalid and would result in a value of false from CanAddRule:

FC1: SubT1 Must Not Overlap

FC1: SubT2 Must Not Overlap

Remarks

Adds the specified rule to the topology. Before adding the topology rule use CanAddRule to determine if the rule is inconsistent with any existing topology rules. Topology rules of the same type cannot be specified at the class level and subtype level for the same feature class.

Using AddRule on a topology which has already been validated, in whole or in part, will result in a dirty area created for the extent of the feature classes participating in the rule and a change to the state of the topology to esriTSUnanalyzed.

See Also

ITopologyRuleContainer Interface

.NET Related Topics

Creating a topology in the geodatabase