Advertisement
Cosmo224

drawing

Apr 10th, 2020
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.02 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Media;
  9. using System.Windows.Shapes;
  10.  
  11. namespace Track_Maker
  12. {
  13.     public partial class MainWindow : Window
  14.     {
  15.         public void RenderContent()
  16.         {
  17.             HurricaneBasin.Children.Clear();
  18.             // render loop
  19.             foreach (Storm XStorm in CurrentBasin.Storms)
  20.             {
  21.                 foreach (Node XNode in XStorm.NodeList)
  22.                 {
  23.                     switch (XNode.NodeType)
  24.                     {
  25.                         // tropical systems
  26.                         case StormType.Tropical:
  27.                             Ellipse Ellipse = new Ellipse();
  28.                             Ellipse.Width = 5;
  29.                             Ellipse.Height = 5;
  30.  
  31.                             // get the colour
  32.                             Ellipse.Fill = new SolidColorBrush(RenderBasedOnNodeIntensity(XNode));
  33.  
  34.                             // set the position
  35.                             Canvas.SetTop(Ellipse, XNode.Position.X);
  36.                             Canvas.SetTop(Ellipse, XNode.Position.Y);
  37.  
  38.                             HurricaneBasin.Children.Add(Ellipse);
  39.                             continue;
  40.                     }
  41.  
  42.                    
  43.                 }
  44.             }
  45.             UpdateLayout();
  46.         }
  47.  
  48.         public Color RenderBasedOnNodeIntensity(Node XNode)
  49.         {
  50.             // check the node intensity
  51.             // category system
  52.  
  53.             foreach (Category Category in Catman.CurrentCategorySystem.Categories)
  54.             {
  55.                 // get the colour by checking it
  56.                 if (XNode.Intensity > Category.LowerBound && XNode.Intensity < Category.HigherBound)
  57.                 {
  58.                     return Category.Color;
  59.                 }
  60.             }
  61.  
  62.             return new Color { A = 0, R = 0, G = 0, B = 0 };
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement