/// <summary> /// Get the peak category for a current storm in the current category system. Dano-style api /// </summary> /// <returns></returns> public Category GetPeakCategory(Storm Storm, CategorySystem CatSystem) { // get the first category. Category Category = CatSystem.Categories[0]; // V2: move category to node. Iterate through all of the nodes. foreach (Node XNode in Storm.NodeList) { // Check that we are above the first category if (XNode.Intensity > Category.HigherBound) { // Get the category foreach (Category Cat2 in CatSystem.Categories) { // check it if (XNode.Intensity > Cat2.LowerBound && XNode.Intensity < Cat2.HigherBound) { Category = Cat2; } } } } return(Category); }
/// <summary> /// Adds a Storm. /// </summary> /// <returns></returns> public bool AddStorm(string Name, DateTime DateTime) { try { Storm Storm = new Storm { Id = GetFlatListOfStorms().Count, // this actually makes sense. Name = Name }; Logging.Log($"Adding Storm with id {Storm.Id} and name {Storm.Name}"); if (Storm.Name == "") { Error.Throw("You must add a name!", "Track Maker", ErrorSeverity.Warning, 2); Storm = null; return(false); } // Check the date. [2020-05-13] - convert from nullable datetime to datetime? if (DateTime == null) { Error.Throw("You must add a date and time!", "Error", ErrorSeverity.Warning, 1); return(false); } Storm.FormationDate = DateTime; // WHY IS THIS NULLABLE I MEAN ITS HELPFUL BUT YES // Just starting from what we already had here. List <Storm> FlatList = GetFlatListOfStorms(); if (FlatList.Count != 0) { if (Storm.FormationDate < FlatList[0].FormationDate) { MessageBox.Show("You can't have a Storm start earlier than the season!", "Error I1", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } } Logging.Log("Initializing node list..."); Storm.NodeList = new List <Node>(); // initalize the mode list Logging.Log("Adding Storm to basin Storm list..."); CurrentLayer.AssociatedStorms.Add(Storm); Logging.Log("ApplicationSettings current Storm..."); CurrentLayer.CurrentStorm = Storm; Logging.Log("Done! Closing..."); return(true); } catch (FormatException) { Error.Throw("You must enter a valid date and time!", "Error", ErrorSeverity.Warning, 3); return(false); } }
public void AddStorm(Storm Sto, bool MakeCurrent = false) { AssociatedStorms.Add(Sto); if (MakeCurrent) { CurrentStorm = Sto; } }
public void RemoveStorm(Storm Sto) => AssociatedStorms.Remove(Sto);
/// <summary> /// Remove a Storm from this storm collection. /// </summary> /// <param name="StormObject">The storm object to remove.</param> public void Remove(Storm StormObject) => Storms.Remove(StormObject);
/// <summary> /// Add a Storm to this storm collection. /// </summary> /// <param name="StormObject">The Storm object to add.</param> public void Add(Storm StormObject) => Storms.Add(StormObject);
/// <summary> /// ATCF import helper function overload for AddStorm if you've already created a storm object in advance /// </summary> /// <param name="Sto"></param> public void AddStorm(Storm Sto) => CurrentLayer.AssociatedStorms.Add(Sto);