Using ArcObjects as tool input


About using ArcObjects as tool input

ESRI ArcObjects is the development platform for the ArcGIS family of applications, such as ArcMap, ArcCatalog, ArcScene, ArcGIS Engine, and ArcGIS Server. The ArcObjects software components expose the full range of functionality available in ArcInfo, ArcEditor, and ArcView to software developers.
These objects can be used to manage geographic data, for example, the contents of a geodatabase, shapefiles, and coverages. If you are accustomed to working with ArcObjects, you can continue with that object model when working with the geoprocessor. An ArcObject may be used instead of an ArcCatalog path when defining an input parameter. For example, an IFeatureClass object may be used to define the input to the Clip tool in the Analysis toolbox, while an IRasterDataset object may be used as input to the Slope tool.
The CreateFeatureClass tool will not accept an ArcObject as the input location, which could be a folder, geodatabase workspace, or geodatabase feature dataset, since none of these data types may be represented as a layer. An ArcCatalog path must be used to define new output. Tools, such as Append, updates existing data, so its output may be defined using an ArcObject, such as an IFeatureClass.
See the following code example:
[Java]
// Initialize the geoprocessor.
GPUtilities gpUtilities = new GPUtilities();
IFeatureClass inputFeatureClass = gpUtilities.openFeatureClassFromString(inputData +
    "/canada/mjrroads.shp");
IFeatureClass clipFeatureClass = gpUtilities.openFeatureClassFromString(inputData + 
    "/canada/coasts.shp");
Clip clip = new Clip(inputFeatureClass, clipFeatureClass, outputDirectory + 
    "/clipOutput.shp");
gp.execute(clip, null);