public static IEnumerable <List <CPoint> > GetIpgInteriorCptLtEb(IPolygon4 ipg) { //ipg.Close(); if (ipg.ExteriorRingCount != 1) { throw new ArgumentException( "I have not considered such a complicated case! A hole contains other holes! "); } IRing2 pExteriorRing = (ipg.ExteriorRingBag as IGeometryCollection).get_Geometry(0) as IRing2; IGeometryCollection pGeoColInteriorRing = (IGeometryCollection)ipg.get_InteriorRingBag(pExteriorRing); for (int i = 0; i < pGeoColInteriorRing.GeometryCount; i++) { yield return(GetCptEbByICol(pGeoColInteriorRing.get_Geometry(i) as IPointCollection4).ToList()); } }
//static int intCount = 0; /// <summary> /// 通过面要素(IPolygon4)获取点数组 /// </summary> /// <param name="ipg">面要素</param> /// <returns>点数组</returns> /// <remarks>currently, we assume that there is only one exterior ring for ipg</remarks> public static IEnumerable <CPoint> GetIpgExteriorCptLt(IPolygon4 ipg) { //ipg.Close(); IRing2 pExteriorRing = (ipg.ExteriorRingBag as IGeometryCollection).get_Geometry(0) as IRing2; var cptlt = GetCptEbByICol(pExteriorRing as IPointCollection4).ToList(); if (ipg.ExteriorRingCount != 1) { var x1 = cptlt[0].X; var y1 = cptlt[0].Y; //var x = pCol.Point[0].X; //var y = pCol.Point[0].Y; throw new ArgumentException( "I have not considered such a complicated case! A hole contains other holes! "); } return(cptlt); }