List<IPoint> to IPointCollection to IPolygon

           IPointCollection 到 IPolygon的转换

            IPoint pPoint = new PointClass();
            //IPolygon pPolygon1 = new PolygonClass();
            IPointCollection pPointCollection1 = new PolygonClass();

            object _missing = Type.Missing;
            double x, y;
            for (int i = 0; i < pAllPnts.Count; i++)
            {
                x = pAllPnts[i].X;
                y = pAllPnts[i].Y;
                pPoint = new PointClass();
                pPoint.PutCoords(x, y);
                pPointCollection1.AddPoint(pPoint, ref _missing, ref _missing);
            }
            IPolygon pPolygon = new PolygonClass();
            pPolygon = (IPolygon)pPointCollection1;

            IArea pArea;

            IFeature pFeature = pFC.CreateFeature();
            pFeature.Shape = pPolygon;
            //Abs(pArea.Area());
            pArea = (IArea)pPolygon;
            System.Windows.Forms.MessageBox.Show(pArea.Area.ToString());
            pFeature.Store();

原文地址:https://www.cnblogs.com/yuxuetaoxp/p/3259701.html