ab8b0301f43f7914f92223b6f7921decea2c8eee
[rhynodge.git] / src / main / kotlin / net / pterodactylus / rhynodge / webpages / weather / WindDirection.kt
1 package net.pterodactylus.rhynodge.webpages.weather
2
3 /**
4  * The direction the wind comes from.
5  *
6  * @author [David ‘Bombe’ Roden](mailto:bombe@pterodactylus.net)
7  */
8 enum class WindDirection(val arrow: String) {
9
10     NONE("↺"),
11     NORTH("↓"),
12     NORTHEAST("↙"),
13     EAST("←"),
14     SOUTHEAST("↖"),
15     SOUTH("↑"),
16     SOUTHWEST("↗"),
17     WEST("→"),
18     NORTHWEST("↘")
19
20 }
21
22 fun String.toWindDirection(): WindDirection {
23     return when (this) {
24         "N" -> WindDirection.NORTH
25         "NO" -> WindDirection.NORTHEAST
26         "O" -> WindDirection.EAST
27         "SO" -> WindDirection.SOUTHEAST
28         "S" -> WindDirection.SOUTH
29         "SW" -> WindDirection.SOUTHWEST
30         "W" -> WindDirection.WEST
31         "NW" -> WindDirection.NORTHWEST
32         else -> WindDirection.NONE
33     }
34 }