From: David ‘Bombe’ Roden Date: Sat, 28 May 2016 07:22:24 +0000 (+0200) Subject: Use arrows to display wind direction X-Git-Tag: v2~129 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c01b97296bda0955018f14aa00f783b57f7f2c63;p=rhynodge.git Use arrows to display wind direction --- diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComTrigger.kt b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComTrigger.kt index 7409357..8a2f62b 100644 --- a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComTrigger.kt +++ b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComTrigger.kt @@ -65,7 +65,12 @@ class WetterComTrigger : Trigger { div("temperature") { +"%d °C".format(it.temperature.toInt()) } div("rain-probability") { +"%d%%".format((it.rainProbability * 100).toInt()) } div("rain-amount") { +"%d l/m²".format(it.rainAmount.toInt()) } - div("wind-direction") { +it.windDirection.name } + div("wind-direction") { + div { + attributes += "style" to "padding: none; transform: rotate(%ddeg)".format(180 - it.windDirection.degrees) + +"➠" + } + } div("wind-speed") { +"%d km/h".format(it.windSpeed.toInt()) } div("description") { +it.description } div("image") { img(src = it.image) } diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt index 6e43934..047bbd9 100644 --- a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt +++ b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt @@ -5,17 +5,17 @@ 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) }