Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using System.Windows.Shapes;
- namespace Track_Maker
- {
- public partial class MainWindow : Window
- {
- public void RenderContent()
- {
- HurricaneBasin.Children.Clear();
- // render loop
- foreach (Storm XStorm in CurrentBasin.Storms)
- {
- foreach (Node XNode in XStorm.NodeList)
- {
- switch (XNode.NodeType)
- {
- // tropical systems
- case StormType.Tropical:
- Ellipse Ellipse = new Ellipse();
- Ellipse.Width = 5;
- Ellipse.Height = 5;
- // get the colour
- Ellipse.Fill = new SolidColorBrush(RenderBasedOnNodeIntensity(XNode));
- // set the position
- Canvas.SetTop(Ellipse, XNode.Position.X);
- Canvas.SetTop(Ellipse, XNode.Position.Y);
- HurricaneBasin.Children.Add(Ellipse);
- continue;
- }
- }
- }
- UpdateLayout();
- }
- public Color RenderBasedOnNodeIntensity(Node XNode)
- {
- // check the node intensity
- // category system
- foreach (Category Category in Catman.CurrentCategorySystem.Categories)
- {
- // get the colour by checking it
- if (XNode.Intensity > Category.LowerBound && XNode.Intensity < Category.HigherBound)
- {
- return Category.Color;
- }
- }
- return new Color { A = 0, R = 0, G = 0, B = 0 };
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement