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


ITopologyRuleContainer.CanAddRule Property (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (GeoDatabase)  

ITopologyRuleContainer.CanAddRule Property

Indicates if the topology rule can be added to the topology.

[Visual Basic .NET]
Public Function get_CanAddRule ( _
    ByVal Rule As ITopologyRule _
) As Boolean
[C#]
public bool get_CanAddRule (
    ITopologyRule Rule
);
[C++]
HRESULT get_CanAddRule(
  ITopologyRule* Rule,
  VARIANT_BOOL* CanAddRule
);
[C++]

Parameters Rule [in]
Rule is a parameter of type ITopologyRule CanAddRule [out, retval] CanAddRule is a parameter of type VARIANT_BOOL

Product Availability

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

Remarks

The CanAddRule property returns a Boolean value indicating if the topology rule is valid and consistent with respect to the existing rules. This property will return false if:

        - For a given rule type, the origin class and subtype and if applicable, destination class and subtype are equal to an existing rule.

        - For single feature class rules, such as esriTRTAreaNoGaps in the origin feature class is defined at the class and subtype level.

        - The destination feature class is specified at both the class and subtype level if the origin is specified at the class level.

        - the origin subtype is defined twice, except for rules esriTRTAreaNoOverlapArea and esriTRTLineNoOverlapLine.

For example, for feature class FC1 with subtypes; SubT1 and SubT2, and a Topology with the rule; FC1 AreaNoOverlap, the following rules, specified at the subtype level, are invalid and CanAddRule would return false:

FC1: SubT1 AreNoOverlap

FC1: SubT2 AreNoOverlap

After calling CanAddRule, it is not guaranteed that the topology rule will be added to the Topology. AddRule may still fail if the geometry types of the Origin and Destination feature classes are incorrect.  In this case, an FDO_E_INVALID_GEOMETRY_TYPE_FOR_TOPOLOGY_RULE error would be raised.

See Also

ITopologyRuleContainer Interface

.NET Related Topics

Creating a topology in the geodatabase