示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ProcessFile(object sender, RoutedEventArgs e)
        {
            List <Storm> fullList = StormHelper.ParseFile(textBox.Text);

            BoundedBox florida = new BoundedBox("Florida", 24.45, 31, -87.65, -80);

            List <Storm> filtered = StormHelper.Get_FilteredStormList_Status_Identifier_Boundingbox_AfterYear(fullList, "HU", "L", florida, 1900);

            foreach (Storm storm in filtered)
            {
                Console.WriteLine("Storm Name: " + storm.Name);
                Console.WriteLine("Max windspeed of storm: " + storm.Get_Max_Windspeed());
                List <HurrLine> relevantLines = storm.GetLines_Status_Identifier_Boundingbox_AfterYear("HU", "L", florida, 1900);
                foreach (HurrLine h in relevantLines)
                {
                    Console.WriteLine("Date of landfall: " + h.PrintDate());
                }
            }
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="bounding"></param>
 /// <returns></returns>
 public bool IsWithinBox(BoundedBox bounding)
 {
     return(bounding.CheckCoord(Latitude, Longitude));
 }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="list"></param>
        /// <param name="status"></param>
        /// <param name="ident"></param>
        /// <param name="box"></param>
        /// <param name="year"></param>
        /// <returns></returns>
        public static List <Storm> Get_FilteredStormList_Status_Identifier_Boundingbox_AfterYear(List <Storm> list, string status, string ident, BoundedBox box, int year)
        {
            List <Storm> newList = new List <Storm>();

            foreach (Storm s in list)
            {
                for (int x = 0; x < s.NumLines; x++)
                {
                    if (s.Data[x].StatusEquals(status) &&
                        s.Data[x].IdentifierEquals(ident) &&
                        s.Data[x].IsWithinBox(box) &&
                        s.Year > year)
                    {
                        newList.Add(s);
                        //Once one line of the storm meets the criteria, there is no reason to keep checking the storm.
                        break;
                    }
                }
            }
            return(newList);
        }
示例#4
0
文件: Storm.cs 项目: josh4662/WpfApp1
        public List <HurrLine> GetLines_Status_Identifier_Boundingbox_AfterYear(string status, string ident, BoundedBox box, int year)
        {
            List <HurrLine> newList = new List <HurrLine>();

            foreach (HurrLine h in Data)
            {
                if (h.StatusEquals(status) &&
                    h.IdentifierEquals(ident) &&
                    h.IsWithinBox(box) &&
                    Year > year)
                {
                    newList.Add(h);
                }
            }
            return(newList);
        }