This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IR > IRelationalOperator Interface > IRelationalOperator.Contains Method (ArcObjects .NET 10.5 SDK) |
Indicates if this geometry contains the other geometry.
[Visual Basic .NET] Public Function Contains ( _ ByVal other As IGeometry _ ) As Boolean
[C#] public bool Contains ( IGeometry other );
[C++]
HRESULT Contains(
IGeometry* other,
VARIANT_BOOL* Contains
);
[C++]
Parameters other
other is a parameter of type IGeometry Contains [out, retval] Contains is a parameter of type VARIANT_BOOL
The base geometry contains the comparison geometry (other) if the comparison geometry is a subset of the base geometry and the intersection of their interiors is not empty. Therefore a polygon does not contain any part of its 1D boundary. Contains is the opposite operator of Within.
Only geometries that support the IRelationalOperator interface can be used as input geometries.
If geometry1 Contains geometry2, then geometry2 is Within geometry1.
An empty geometry does not contain another geometry. On the other hand, an empty geometry is contained in another geometry, unless the other geometry is empty.
Contains examples. Only "true" relationships are showed in this picture.