IFeatureConstruction的用法

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, processingBounds, lineFeatureCursor, // invalidArea, -1, selWorkspace, out selectionSet); //**********Split the polygons.***************// //featureConstruction.SplitPolygonsWithLinesFromCursor(null, polygonFC, processingBounds, // lineFeatureCursor, invalidArea, -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


转载于:https://www.cnblogs.com/sqlite3/archive/2012/03/06/2566739.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值