Interface ITopologyRuleContainer

Namespace
ESRI.ArcGIS.Geodatabase
Assembly
ESRI.Server.Geodatabase.dll

Provides access to members that return and set topology rules.

[Guid("B65D9FEE-6D67-47FD-AC13-06BDE90A1B34")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITopologyRuleContainer

Remarks

The ITopologyRuleContainer interface provides access to members for adding, removing, and returning topology rules from a topology. This interface also provides access to members that control the promotion and demotion of topology errors and exceptions.

[C#]

void AddRuleOnTopologyRuleContainer(ITopology topology)

{

  // Get the topology rule container

  ITopologyRuleContainer topologyRuleContainer = (ITopologyRuleContainer)topology;

  // Create a rule having area with no gaps

  ITopologyRule newTopologyRule = new TopologyRuleClass()

  {

         AllOriginSubtypes = true,

         TopologyRuleType = esriTopologyRuleType.esriTRTAreaNoGaps,

         Name = "Area with no gaps"

  };

  // Add a rule to the container

  bool canAddRule = topologyRuleContainer.get_CanAddRule(newTopologyRule);

  if (canAddRule)

  {

        topologyRuleContainer.AddRule(newTopologyRule);

  }

}

Properties

CanAddRule[ITopologyRule]

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

bool CanAddRule[ITopologyRule Rule] { get; }

Parameters

Rule ITopologyRule

Property Value

bool

Remarks

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

  • An identical rule is already present in the topology. A rule is determined to be identical with an existing rule 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.

  • A topology rule of the same rule type with the same origin and destination feature class is already present in the Topology, but the rule being added is defined at the subtype level.
  • The rule is defined on both the subtype and class levels for a given class-rule combination.
  • The Object Class ID and Subtype value are invalid. For example, if the topology rule has been specified to use subtypes however no subtypes are defined for the relevant feature class, CanAddRule would return false.

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. ITopologyRuleContainer::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.

Rule[int]

The topology rule with the corresponding ID.

IRule Rule[int RuleID] { get; }

Parameters

RuleID int

Property Value

IRule

Remarks

The Rule property returns the rule corresponding to the supplied ID. The RuleID is the internal ID of the topology rule as stored in the geodatabase system tables and is unique within the geodatabase.

To get the ID of the topology rule, QI to the IRule interface and use the IRule::ID property.

RuleByGUID[string]

The rule with the globally unique ID.

IRule RuleByGUID[string GUID] { get; }

Parameters

GUID string

Property Value

IRule

Remarks

Returns the rule identified by the specified GUID. The GUID is generated after the topology is added to the topology using ITopologyRuleContainer::AddRule. The GUID can be returned from the ITopologyRule::GUID property

Rules

An enumeration of all the topology rules.

IEnumRule Rules { get; }

Property Value

IEnumRule

Remarks

Returns an enumerator of the topology rules associated with the topology. The enumerator will contain all rules defined for the topology but not the one rule inherent to each topology, the esriTRTFeatureLargerThanClusterTolerance rule.

RulesByClass[int]

An enumeration of all the rules for a given class.

IEnumRule RulesByClass[int ClassID] { get; }

Parameters

ClassID int

Property Value

IEnumRule

Remarks

The RulesByClass property returns an enumerator of the rules associated with a particular class in the topology using the feature class’ IObjectClass::ObjectClassID. An empty enumerator is returned if an IObjectClass::ObjectClassID corresponding to a feature class is not found in the topology.

RulesByClassAndSubtype[int, int]

An enumeration of all the rules for a given class and subtype.

IEnumRule RulesByClassAndSubtype[int ClassID, int SubType] { get; }

Parameters

ClassID int
SubType int

Property Value

IEnumRule

Remarks

The RulesByClassAndSubtype property returns an enumerator of the rules associated with a particular class/subtype pair in the topology. If the ObjectClassID corresponds to a feature class or the Subtype value does not exist, an empty enumerator is returned.

Methods

AddRule(ITopologyRule)

Adds a topology rule.

void AddRule(ITopologyRule Rule)

Parameters

Rule ITopologyRule

Remarks

Adds the specified rule to the topology. Before adding the topology rule, use ITopologyRuleContainer::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 the AddRule method on a topology that 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.

DeleteRule(ITopologyRule)

Deletes a topology rule.

void DeleteRule(ITopologyRule Rule)

Parameters

Rule ITopologyRule

Remarks

Removes the specified rule from the topology. DeleteRule will remove any associated topology errors and will not result in the creation of a dirty area, nor will the state of the topology change.

DemoteFromRuleException(ITopologyErrorFeature)

Demotes a topology error from an exception to an error.

void DemoteFromRuleException(ITopologyErrorFeature errorException)

Parameters

errorException ITopologyErrorFeature

Remarks

The DemoteFromRuleException method will demote an exception feature from an exception to an error. On a topology in an ArcSDEgeodatabase, DemoteFromRuleException must be called from within an edit session and edit operation. Topology Exceptions arise when a topology rule is purposefully violated. Marking purposeful topology errors as exceptions allows other clients of the topology to handle them in an appropriate or specific manner, e.g., in reporting or symbolization.

Note that it is also possible to promote an error or mark the error as an exception with the ITopologyRuleContainer::PromoteToRuleException method.

PromoteToRuleException(ITopologyErrorFeature)

Promotes a topology error to an exception.

void PromoteToRuleException(ITopologyErrorFeature errorException)

Parameters

errorException ITopologyErrorFeature

Remarks

The PromoteToRuleException method will promote the specified error to an exception feature. On a topology in an ArcSDEgeodatabase, PromoteToRuleException must be called from within an edit session and edit operation. Topologyexceptions arise when a topology rule is purposefully violated. Marking purposeful topology errors as exceptions allows other clients of the topology to handle them in an appropriate or specific manner, e.g., in reporting or symbolization.

Note: It is possible to demote an exception or mark the exception as an error with the ITopologyRuleContainer::DemoteFromRuleException method.