IArea接口(计算多边形面积)

//利用IArea接口计算多边形面积

private
Double MeasurePolygon(IPolygon pPolygon) { IArea pArea = (IArea)pPolygon; Double dArea = Math.Abs(pArea.Area); return dArea; }

 

//面积接口IArea
public double GetMeanArea(List<IFeature> Polygon)
        { 
        //求多边形的平均面积
            double dArea = 0;
            foreach (IFeature polygon in Polygon)
            {
                IArea pArea = polygon.Shape as IArea;
                dArea = dArea + pArea.Area;
            }
            MeanArea = dArea / Polygon.Count;
            return MeanArea;
        }

 

posted @ 2017-10-27 13:09  元宝山小王子  阅读(1540)  评论(1编辑  收藏  举报