Use arrows to display wind direction
[rhynodge.git] / src / main / kotlin / net / pterodactylus / rhynodge / webpages / weather / wettercom / WindDirection.kt
index 6335fe2..047bbd9 100644 (file)
@@ -5,26 +5,26 @@ package net.pterodactylus.rhynodge.webpages.weather.wettercom
  *
  * @author [David ‘Bombe’ Roden](mailto:bombe@pterodactylus.net)
  */
-enum class WindDirection {
+enum class WindDirection(val degrees: Int) {
 
-    NONE,
-    NORTH,
-    NORTHEAST,
-    EAST,
-    SOUTHEAST,
-    SOUTH,
-    SOUTHWEST,
-    WEST,
-    NORTHWEST
+    NONE(0),
+    NORTH(90),
+    NORTHEAST(45),
+    EAST(0),
+    SOUTHEAST(315),
+    SOUTH(270),
+    SOUTHWEST(225),
+    WEST(180),
+    NORTHWEST(135)
 
 }
 
 fun String.toWindDirection(): WindDirection {
     return when (this) {
         "N" -> WindDirection.NORTH
-        "NE" -> WindDirection.NORTHEAST
-        "E" -> WindDirection.EAST
-        "SE" -> WindDirection.SOUTHEAST
+        "NO" -> WindDirection.NORTHEAST
+        "O" -> WindDirection.EAST
+        "SO" -> WindDirection.SOUTHEAST
         "S" -> WindDirection.SOUTH
         "SW" -> WindDirection.SOUTHWEST
         "W" -> WindDirection.WEST