private IGeometry GetGeo(IFeatureLayer pFlyr)
        {
            IEnumGeometry pGeos = new EnumFeatureGeometryClass();
            IEnumGeometryBind pGeosBind = pGeos as IEnumGeometryBind;
            IFeatureSelection pflyrSelection = pFlyr as IFeatureSelection;
            pflyrSelection.SelectFeatures(null, esriSelectionResultEnum.esriSelectionResultNew, false);            pGeosBind.BindGeometrySource(null, pflyrSelection.SelectionSet);
            pGeos.Reset();
            IPolygon sPoly = new PolygonClass();
            ITopologicalOperator pTopo = sPoly as ITopologicalOperator;
            pTopo.ConstructUnion(pGeos);
            pTopo.Simplify();
            sPoly = pTopo as IPolygon;
            pflyrSelection.Clear();
            return sPoly;
        }

     执行上面的代码段可以把图层上的所有实体合并。注意红色部分的那行代码,不写此行代码,pGeos 里的图形个数为0,最后得到的spoly是空。

相关文章:

  • 2021-05-19
  • 2022-01-05
  • 2021-10-03
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
猜你喜欢
  • 2021-09-02
  • 2021-05-01
  • 2022-12-23
  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
相关资源
相似解决方案