ArcObjects Library Reference (Geometry)  

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,
  VARIANT_BOOL* RelationResult
);
[C++]

Parameters

other

  other is a parameter of type IGeometry

relationDescription   relationDescription is a parameter of type BSTR RelationResult [out, retval]   RelationResult is a parameter of type VARIANT_BOOL

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