import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Polygon;
import javafx.scene.text.Text;
import java.lang.Math;
public class Wind extends CustomNode {
public-init var angle: String;
public-init var speed: String;
public-init var unit: String;
override function create() {
def a = java.lang.Integer.parseInt(angle);
def r = 3.5 * Config.SMALL_FONT.size;
def x = r * Math.cos(Math.PI / 5);
def y = r * Math.sin(Math.PI / 5);
def text = Text {
content: "{speed} {unit}"
fill: Config.FONT_COLOR
font: Config.SMALL_FONT
}
Group {
translateX: bind scene.width - r - Config.SPACE
translateY: r + Config.SPACE_DOUBLE
rotate: a
content: [
Circle {
radius: r
strokeWidth: 2
stroke: Config.LIGHT_COLOR
fill: null
}
Polygon {
points: [
-x, -y
0, r
x, -y
]
stroke: Config.DARK_COLOR
fill: LinearGradient {
endX: 0
stops: [
Stop { offset: 0 color: Config.DARK_COLOR }
Stop { offset: 1 color: Config.LIGHT_COLOR }
]
}
}
Group {
rotate: if ((90 <= a) and (a < 270)) then 180 else 0
translateX: bind - text.boundsInLocal.width / 2
translateY: bind - text.boundsInLocal.minY - y
content: text
}
]
}
}
}