private void clip()
{
Geoprocessor gp = new Geoprocessor();
gp.OverwriteOutput = true;
IFeatureLayer inputfeaturelayer = ArcGISPub.ArcGISClassPub.GetShapeByFileName(@"D:\11\test\JFBCopy.shp");
IFeatureLayer cliplayer = ArcGISPub.ArcGISClassPub.GetShapeByFileName(@"D:\11\test\XZQ.shp");
IFeatureClass inputfeatureclass = inputfeaturelayer.FeatureClass;
IFeatureClass clipfeatureclass = cliplayer.FeatureClass;
IDataset dataset = inputfeatureclass as IDataset;
IWorkspace workspace = dataset.Workspace;
IFeatureWorkspace fworkspace = workspace as IFeatureWorkspace;
IFields outfields = inputfeatureclass.Fields;
IFeatureClass outfeatureclass = fworkspace.CreateFeatureClass("Clip_result", outfields, null, null, esriFeatureType.esriFTSimple, "Shape", "");
ESRI.ArcGIS.AnalysisTools.Clip clipTool =
new ESRI.ArcGIS.AnalysisTools.Clip(inputfeatureclass, clipfeatureclass, outfeatureclass);
gp.Execute(clipTool, null);
IFeatureLayer outlayer = new FeatureLayerClass();
outlayer.FeatureClass = outfeatureclass;
outlayer.Name = outfeatureclass.AliasName;
MessageBox.Show("转换完成!");
}