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


IConnectedCells.Locate Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > ArcScan > ESRI.ArcGIS.ArcScan > Interfaces > IC > IConnectedCells Interface > IConnectedCells.Locate Method
ArcGIS Developer Help

IConnectedCells.Locate Method

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
);

Product Availability

Available with ArcGIS Desktop. Requires ArcScan Extension.

Description

This method is called by the Select Connected Cells tool on the ArcScan toolbar.

Remarks

Note that the spatialRelMethod must be entered as a long and only supports the following spatial relationship types:

1 = esriSpatialRelIntersects
7 = esriSpatialRelWithin
8 = esriSpatialRelContains

 

[C#]

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