IFeatureConstruction的用法
发布时间:2020-12-16 22:34:35 所属栏目:大数据 来源:网络整理
导读:IFeatureConstruction的用法 如何构建从游标使用IFeatureConstruction的新功能 本文档发布与适用于ArcGIS 9.3中, 9.2 版本也存在。 总结 本文介绍了如何使现有生产线的功能游标在IFeatureConstruction接口的使用方法,新的多边形要素。 发展许可 部署牌 Arc
IFeatureConstruction的用法 如何构建从游标使用IFeatureConstruction的新功能 本文档发布与适用于ArcGIS 9.3中, 9.2 版本也存在。 总结 本文介绍了如何使现有生产线的功能游标在IFeatureConstruction接口的使用方法,新的多边形要素。 发展许可 部署牌 ArcEditor中 ArcEditor中 ArcInfo的 ArcInfo的 Engine开发工具包 发动机运行时:更新地理数据库 在这篇文章中使用代码,必须通过使用(C#)或进口(VB.NET)语句引用下??面的命名空间。还需要添加相应的引用到项目中,为了获得这些API。 ESRI.ArcGIS.Geodatabase ESRI.ArcGIS.Geometry ESRI.ArcGIS.esriSystem ESRI.ArcGIS.Carto 构建从游标使用IFeatureConstruction的新功能 构建IFeatureConstruction使用游标功能,先设置以下参数: IFeatureCursor,这将是构建多边形的线源 处理边界,将用于为现有的多边形搜索目标功能 无效区域对象,这是可选的,可以用来重绘受影响的地区处理,在某些情况下可能需要有相关的功能(注释,路线符号等)无效的面积在正确重绘 集群的宽容,它必须至少像大集群与目标多边形要素类的空间参考性。可以通过此参数值-1,表示要使用集群目标要素类的空间参考性 结构功能的方法也应该在一个编辑会话,并进行编辑操作,以便撤消和重做功能是否可用。 可以用下面的方法构造多边形的特点,从一个游标: ConstructPolygonsFromFeaturesFromCursors可以用来建构多边形要素源使用光标到指定的功能类。 AutoCompleteFromFeaturesFromCursors可用于指定的行源相结合,与现有的多边形的新功能。 SplitPolygonsWithLinesFromCursor 可以用于在指定的功能,使用类折线光标的功能源分裂多边形。 下面的代码显示了如何建造多边形使用ConstructPolygonsFromFeaturesFromCursors方法,和使用其他两种方法的代码是在评论会议: [C#] public void CreatePolygonFeaturesFromCursors(IFeatureClass polygonFC,IFeatureClass lineFC) { if (polygonFC.ShapeType != esriGeometryType.esriGeometryPolygon) { System.Console.WriteLine("The target layer is not a polygon layer."); return ; } //Set IFeatureCursor object,which will be the line source to construct polygons. IFeatureCursor lineFeatureCursor = lineFC.Search(null,false); //Set the processing bounds to be the extent of the polygon feature class,//which will be used to search for existing polygons in the target feature. IGeoDataset geoDS = polygonFC as IGeoDataset; IEnvelope processingBounds = geoDS.Extent; //Define an IInValidArea object. IInvalidArea invalidArea = new InvalidAreaClass(); //Define a construct feature object. IFeatureConstruction featureConstruction = new FeatureConstructionClass(); //Start an edit session. IDataset dataset = polygonFC as IDataset; IWorkspace workspace = dataset.Workspace; IWorkspaceEdit workspaceEdit = workspace as IWorkspaceEdit; if (workspaceEdit.IsBeingEdited() != true) { workspaceEdit.StartEditing(true); workspaceEdit.StartEditOperation(); } try { //**********Construct polygons using the line feature cursor.************// featureConstruction.ConstructPolygonsFromFeaturesFromCursor(null,polygonFC,processingBounds,true,false,lineFeatureCursor,invalidArea,- 1,null) ; //**********AutoComplete the polygons.*************// //IWorkspace selWorkspace = polygonFC.FeatureDataset.Workspace; //ISelectionSet selectionSet; //featureConstruction.AutoCompleteFromFeaturesFromCursor(polygonFC,// invalidArea,-1,selWorkspace,out selectionSet); //**********Split the polygons.***************// //featureConstruction.SplitPolygonsWithLinesFromCursor(null,// lineFeatureCursor,-1); //Complete the edit operation and stop the edit session. workspaceEdit.StopEditOperation(); workspaceEdit.StopEditing(true); } catch (Exception e) { //Abort the edit operation if errors are detected. System.Console.WriteLine("Construct polygons failed. " + e.Message); workspaceEdit.AbortEditOperation(); } } See Also:How to construct new features using IFeatureConstruction in ArcMap(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |