diff --git a/lib/xmet/hodograph.py b/lib/xmet/hodograph.py index 2a1d8e0..cb6a42f 100644 --- a/lib/xmet/hodograph.py +++ b/lib/xmet/hodograph.py @@ -118,6 +118,37 @@ class Hodograph(): cr.restore() + def draw_direction_legends(self, cr: cairo.Context, x, y): + cr.save() + + cr.select_font_face('Sans', + cairo.FONT_SLANT_NORMAL, + cairo.FONT_WEIGHT_BOLD) + + cx, cy = self.sample_to_screen(0, 0) + + cr.set_font_size(14) + + text = "%d°" % 180 + extents = cr.text_extents(text) + + cr.move_to(x + cx - extents.width / 2, + y + 4 * extents.height) + + cr.show_text(text) + cr.stroke() + + text = "%d°" % 0 + extents = cr.text_extents(text) + + cr.move_to(x + cx - extents.width / 2, + y + self.height - 4 * extents.height) + + cr.show_text(text) + cr.stroke() + + cr.restore() + COLORS = { 500: (1.0, 0.4, 1.0), 3000: (1.0, 0.4, 0.4), @@ -279,6 +310,7 @@ class Hodograph(): self.draw_sounding(cr, x, y, sounding) self.draw_speed_legends(cr, x, y) + self.draw_direction_legends(cr, x, y) self.draw_height_legends(cr, x, y) cr.reset_clip()