• my merge(留作纪念)


     private void button11_Click(object sender, EventArgs e)
            {
                IWorkspaceEdit pWorkspaceEdit = (IWorkspaceEdit)pCommonFeaureWorkspace;
                pWorkspaceEdit.StartEditing(true);
                pWorkspaceEdit.StartEditOperation();

                IFeatureCursor pFeatureCursor = pCommonFeatureClass.Search(null, false);
                IFeature pFeatureFirst = pFeatureCursor.NextFeature();
                //int count = 0;
                //while (pFeatureFirst != null)
                //{
                    Console.WriteLine(pFeatureFirst.get_Value(0).ToString());

                    IGeometry pGeometryFirst = pFeatureFirst.Shape;
                    ITopologicalOperator2 pTopOperatorFirst = (ITopologicalOperator2)pGeometryFirst;
                    IRelationalOperator pRelOperatorFirst = (IRelationalOperator)pGeometryFirst;
                    pTopOperatorFirst.IsKnownSimple_2 = false;
                    pTopOperatorFirst.Simplify();
                    pGeometryFirst.SnapToSpatialReference();

                    IGeometry pGeometrySecond;
                    IFeature pFeatureSecond = pFeatureCursor.NextFeature();

                    while (pFeatureSecond != null)
                    {
                        pGeometrySecond = pFeatureSecond.ShapeCopy;
                        ITopologicalOperator2 pTopOperatorSecond = (ITopologicalOperator2)pGeometrySecond;
                        pTopOperatorSecond.IsKnownSimple_2 = false;
                        pTopOperatorSecond.Simplify();
                        pGeometrySecond.SnapToSpatialReference();
                        Console.WriteLine(pFeatureSecond.get_Value(0).ToString());

                        if (pRelOperatorFirst.Overlaps(pGeometrySecond) == true)
                        {
                            pGeometryFirst = pTopOperatorFirst.Union(pGeometrySecond);
                            pFeatureSecond.Delete();
                        }

                        pFeatureSecond = pFeatureCursor.NextFeature();
                    }

                    pTopOperatorFirst.IsKnownSimple_2 = false;
                    pTopOperatorFirst.Simplify();
                    pFeatureFirst.Shape = pGeometryFirst;
                    pFeatureFirst.Store();
                    //axMapControl1.Refresh();
                    //count++;

                //    pFeatureCursor = pCommonFeatureClass.Search(null, false);
                //    for (int i = 0; i <= count; i++)
                //    {
                //        pFeatureFirst = pFeatureCursor.NextFeature();
                //    }
                
                //}
                pWorkspaceEdit.StopEditOperation();
                pWorkspaceEdit.StopEditing(true);
                axMapControl1.Refresh();
            }
  • 相关阅读:
    ios手机和Android手机测试点区别
    业务下的测试总结
    Mac下web自动化环境部署
    Mac下查找python的安装位置以及第三方库
    简易计算器
    递归
    可变参数
    方法的重载
    方法
    三角形
  • 原文地址:https://www.cnblogs.com/zhangjun1130/p/1428433.html
Copyright © 2020-2023  润新知