예제 #1
0
 public static void addYard(yardPolygonData y)
 {
     for (int i = yards.Count - 1; i >= 0; i--)
     {
         if (yards[i].ID == y.ID)
         {
             yards.RemoveAt(i);
         }
     }
     yards.Add(y);
 }
예제 #2
0
        public static void addYard(yardPolygonData y)
        {
            for (int i = yards.Count - 1; i >= 0; i--)
            {
                if (yards[i].ID == y.ID)
                {
                    yards.RemoveAt(i);
                }
            }

            y.maxLat = y.geoFence[0].lat;
            y.maxLon = y.geoFence[0].lon;
            y.minLat = y.geoFence[0].lat;
            y.minLon = y.geoFence[0].lon;
            foreach (latLon ll in y.geoFence)
            {
                if (ll.lat < y.minLat)
                {
                    y.minLat = ll.lat;
                }
                if (ll.lat > y.maxLat)
                {
                    y.maxLat = ll.lat;
                }
                if (ll.lon < y.minLon)
                {
                    y.minLon = ll.lon;
                }
                if (ll.lon > y.maxLon)
                {
                    y.maxLon = ll.lon;
                }
            }

            SQL.SQLCode sql = new SQL.SQLCode();
            sql.updateYardPolygon(y);
            yards.Add(y);
        }