a2b7a8b892e6a01966e116618626b34d5d4db4e0
[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     NORTHNORTHEAST("↓↙"),
13     NORTHEAST("↙"),
14     EASTNORTHEAST("↙←"),
15     EAST("←"),
16     EASTSOUTHEAST("←↖"),
17     SOUTHEAST("↖"),
18     SOUTHSOUTHEAST("↖↑"),
19     SOUTH("↑"),
20     SOUTHSOUTHWEST("↑↗"),
21     SOUTHWEST("↗"),
22     WESTSOUTHWEST("↗→"),
23     WEST("→"),
24     WESTNORTHWEST("→↘"),
25     NORTHWEST("↘"),
26     NORTHNORTHWEST("↘↓")
27
28 }
29
30 fun String.toWindDirection(): WindDirection {
31     return when (this) {
32         "N", "Nord" -> WindDirection.NORTH
33         "Nordnordost" -> WindDirection.NORTHNORTHEAST
34         "NO", "Nordost" -> WindDirection.NORTHEAST
35         "Ostnordost" -> WindDirection.EASTNORTHEAST
36         "O", "Ost" -> WindDirection.EAST
37         "Ostsüdost" -> WindDirection.EASTSOUTHEAST
38         "SO", "Südost" -> WindDirection.SOUTHEAST
39         "Südsüdost" -> WindDirection.SOUTHSOUTHEAST
40         "S", "Süd" -> WindDirection.SOUTH
41         "Südsüdwest" -> WindDirection.SOUTHSOUTHWEST
42         "SW", "Südwest" -> WindDirection.SOUTHWEST
43         "Westsüdwest" -> WindDirection.WESTSOUTHWEST
44         "W", "West" -> WindDirection.WEST
45         "Westnordwest" -> WindDirection.WESTNORTHWEST
46         "NW", "Nordwest" -> WindDirection.NORTHWEST
47         "Nordnordwest" -> WindDirection.NORTHNORTHWEST
48         else -> WindDirection.NONE
49     }
50 }