This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > ArcScan > ESRI.ArcGIS.ArcScan > Interfaces > IC > IConnectedCells Interface > IConnectedCells.Locate Method (ArcObjects .NET 10.4 SDK) |
Generates the envelopes that represent all connected cells that are at the search shape (see esriSpatialRelEnum for spatialRelMethod.
[Visual Basic .NET] Public Sub Locate ( _ ByVal searchShape As IGeometry, _ ByVal Foreground As Boolean, _ ByVal spatialRelMethod As Integer, _ ByVal callbackSel As INotifySelectionBlock, _ ByVal trackCancel As ITrackCancel, _ ByVal stepProgressor As IStepProgressor _ )
[C#] public void Locate ( IGeometry searchShape, bool Foreground, int spatialRelMethod, INotifySelectionBlock callbackSel, ITrackCancel trackCancel, IStepProgressor stepProgressor );
This method is called by the Select Connected Cells tool on the ArcScan toolbar.
Note that the spatialRelMethod must be entered as a long and only supports the following spatial relationship types:
1=esriSpatialRelIntersects
7=esriSpatialRelWithin
8=esriSpatialRelContains
The following code shows an example of this method in C#.
//You can get app from ICommand :: OnCreate() hook parameter
public void Locate()
{
IConnectedCells connectedCells=app.FindExtensionByName("ESRI ArcScan Tools") as IConnectedCells;
IMxDocument mxDoc=app.Document as IMxDocument;
INotifySelectionBlock foundBlock=new FoundBlock();
ESRI.ArcGIS.Geometry.IPoint currentPoint=new ESRI.ArcGIS.Geometry.Point();
currentPoint.PutCoords(39.2, 37.4);
connectedCells.Locate(currentPoint.Envelope, true, 1, foundBlock, null, null);
}
Also create a new class (FoundBlock) with the following code.
public class FoundBlock : ESRI.ArcGIS.ArcScan.INotifySelectionBlock
{
public FoundBlock()
{
}
#region INotifySelectionBlock Members
void ESRI.ArcGIS.ArcScan.INotifySelectionBlock.SelectionBlock(ref ESRI.ArcGIS.Display.tagRECT rectangle, object block, ESRI.ArcGIS.esriSystem.ITrackCancel cancel)
{
System.Diagnostics.Debug.Print("Found block");
}
#endregion
}
See Also
IConnectedCells Interface