Example #1
0
 public static List<GeoXYPoint> CoverageDistributePoint(GeoPolygon polygonPeak, double r)
 {
     List<GeoXYPoint> list = new List<GeoXYPoint>();
     GeoXYPoint centerPoint = new GeoXYPoint((polygonPeak.Right + polygonPeak.Left) / 2.0, (polygonPeak.Top + polygonPeak.Bottom) / 2.0);
     GeoXYPoint southwest = GetSouthWestPoint(polygonPeak.Left, polygonPeak.Right, polygonPeak.Top, polygonPeak.Bottom, centerPoint, r);
     GeoXYPoint northeast = GetNorthEastClutterPoint(polygonPeak.Left, polygonPeak.Right, polygonPeak.Top, polygonPeak.Bottom, centerPoint, r);
     list = InitialDistribute(southwest, northeast, r);
     int index = 0;
     while (index < list.Count)
     {
         if (!polygonPeak.IsPointInPolygon(list[index]))
         {
             list.RemoveAt(index);
             index--;
         }
         index++;
     }
     for (int i = 0; list.Count == 0; i++)
     {
         if (i >= polygonPeak.Points.Count)
         {
             return list;
         }
         list = InitialDistribute(polygonPeak.Points[i], northeast, r);
         for (index = 0; index < list.Count; index++)
         {
             if (!polygonPeak.IsPointInPolygon(list[index]))
             {
                 list.RemoveAt(index);
                 index--;
             }
         }
     }
     return list;
 }