ArcGIS Explorer Component Help |
GeometryOperations..::.Contains Method |
GeometryOperations Class Example See Also |
Indicates if a geometry spatially contains a second geometry.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static bool Contains( Geometry containerGeometry, Geometry containedGeometry ) |
Visual Basic (Declaration) |
---|
Public Shared Function Contains ( _ containerGeometry As Geometry, _ containedGeometry As Geometry _ ) As Boolean |
Parameters
- containerGeometry
- Type: ESRI.ArcGISExplorer.Geometry..::.Geometry
A geometry to check for a contains relationship with containedGeometry.
- containedGeometry
- Type: ESRI.ArcGISExplorer.Geometry..::.Geometry
A geometry to check for a is-contained-by relationship with containerGeometry.
Return Value
trueTruetruetrue (True in Visual Basic) if containerGeometry contains containedGeometry; otherwise, falseFalsefalsefalse (False in Visual Basic).Remarks
Any type of geometry can be passed to this method. containerGeometry is considered to contain containedGeometry if containedGeometry is a subset of containerGeometry and the intersection of their interiors is not empty.
This method ignores any Z values on the input geometries, and so operates in 2D only. If a Multipatch geometry is passed in, the 2D footprint of the Multipatch is used for the contains operation, instead of the 3D shape.
Version Information: This method is supported from version 2.0.0.1500.
Examples
The code below demonstrates how you can use the GeometryOperations Contains method to find out if a specific
Point is contained in the current extent shown in the Map, by creating a new Point at latitude 0 and longitude 0
using the default WGS 1984 coordinate system, and using the Extent property of the MapDisplay.
CopyC#
// Get a reference to the current Display and its Extent. Envelope ext = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Extent; bool pointInExtent = GeometryOperations.Contains(ext, new ESRI.ArcGISExplorer.Geometry.Point (0, 0));
CopyVB.NET
' Get a reference to the current Display and its Extent. Dim ext As Envelope = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Extent Dim pointInExtent As Boolean = GeometryOperations.Contains(ext, New ESRI.ArcGISExplorer.Geometry.Point(0, 0))
Exceptions
Exception | Condition |
---|---|
System..::.ArgumentNullException | containerGeometry and containedGeometry must not be nullNothingnullptra null reference (Nothing in Visual Basic). |
System..::.ArgumentException | Both geometries must have the same coordinate system. |