ArcGIS中线分割面

1、在ArcMAP中操作。

        在编辑状态下,选中所有的线,然后使用高级编辑工具条上的Split Polygons即可,参见下图。

2、IFeatureConstruction接口

该接口发布与适用于ArcGIS 9.3中,9.2 版本也存在。以下是IFeatureConstruction接口参数:
      IEnumFeature:它将是构造多边形的线源。
      Processing bounds:处理范围,目标面范围。
      invalidArea:无效的区域对象,它是可选的,可用于重绘受处理影响的区域-在某些情况下,可能需要使无效的区域有效,以便相关特征(注释,路径符号等)正确重绘。
      ClusterTolerance:该值必须至少与与目标面要素类关联的空间参考的聚类容差一样大。可以为该参数传递值–1,表示将使用目标要素类的空间参考。

/// <summary>
/// 地图控件中选中线分割面
/// </summary>
public static void SplitPolygonsWithLines()
{
    IFeatureLayer polygonLayer = axMapControl1.get_Layer(1) as IFeatureLayer;
    IFeatureClass polygonFeatureClass = polygonLayer.FeatureClass;
    IEnvelope envelope = (polygonFeatureClass as IGeoDataset).Extent;
    IEnumFeature enumLineFeature = axMapControl1.Map.FeatureSelection as IEnumFeature;
    IFeatureConstruction featureCon = new FeatureConstructionClass();
    featureCon.SplitPolygonsWithLines(null, polygonFeatureClass, envelope, enumLineFeature, null, -1);
}
/// <summary>
/// 线图层切割面图层
/// </summary>
/// <param name="polygonFC">面图层</param>
/// <param name="lineFC">线图层</param>
public static void SplitPolygonsWithLinesFromCursor(IFeatureClass polygonFC, IFeatureClass lineFC)
{
    //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
    {
        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();
    }
}

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值