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


IRelationalOperator.Relation Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IR > IRelationalOperator Interface > IRelationalOperator.Relation Method
ArcGIS Developer Help

IRelationalOperator.Relation Method

Indicates if the defined relationship exists.

[Visual Basic .NET]
Public Function Relation ( _
    ByVal other As IGeometry, _
    ByVal relationDescription As String _
) As Boolean
[C#]
public bool Relation (
    IGeometry other,
    string relationDescription
);
[C++]
HRESULT Relation(
  IGeometry* other,
  BSTR relationDescription
);
[C++]
Parameters
other 

other is a parameter of type IGeometry* relationDescription
relationDescription is a parameter of type BSTR

Product Availability

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

Description

Relation allows a general relation defined using the Shape Comparison Language to be determined between two input geometries. The Shape Comparison Language is based on the Calculus-Based Method (CBM), as described and defined by Clementini and Felice, but has some extensions specific to working with vertex-based geometries and is fully described in the Technical Documents section of the ArcObjects Developer Help. Please refer to the Shape Comparison Language documentation for proper syntax and available functionality.

Note that at the current release, Relation only operates with straight lines.

Remarks

Here is a VBA example of using the "RELATE" function to detect overlapping polylines. It assumes two polyline features are selected. G1 and G2 are placeholders for, in this example, the VBA variables r1 and r2.

Option Explicit

Public Sub overlapstest()
Dim ef As IEnumFeature
Dim d As IMxDocument
Set d = ThisDocument
Set ef = d.FocusMap.FeatureSelection
Dim r1 As IRelationalOperator, r2 As IRelationalOperator
Set r1 = ef.Next.Shape
Set r2 = ef.Next.Shape

Debug.Print "relation:", r1.Relation(r2, "RELATE(G1, G2, ""1********"")")

End Sub

See Also

IRelationalOperator Interface