Compare commits
No commits in common. "6a00aad2a1098c85cd5c209e7ef0f74a6c3781eb" and "df0b885447dee79ed14e616b88c588b831da0041" have entirely different histories.
6a00aad2a1
...
df0b885447
1 changed files with 2 additions and 44 deletions
|
@ -113,50 +113,8 @@ class Hodograph():
|
|||
|
||||
cr.move_to(x + sx + extents.width * 0.25,
|
||||
y + sy - extents.height * 1.5)
|
||||
|
||||
cr.show_text(text)
|
||||
|
||||
cr.restore()
|
||||
|
||||
def draw_direction_legends(self, cr: cairo.Context, x, y):
|
||||
cx, cy = self.sample_to_screen(0, 0)
|
||||
|
||||
legends = {
|
||||
'0°': (
|
||||
lambda e: x + cx - e.width / 2,
|
||||
lambda e: y + self.height - 2 * e.height
|
||||
),
|
||||
|
||||
'90°': (
|
||||
lambda e: x + cx - e.width * 2,
|
||||
lambda e: y + cy + e.height / 2
|
||||
),
|
||||
|
||||
'180°': (
|
||||
lambda e: x + cx - e.width / 2,
|
||||
lambda e: y + 2 * e.height
|
||||
),
|
||||
|
||||
'270°': (
|
||||
lambda e: x + self.width - e.width * 2,
|
||||
lambda e: y + cy + e.height / 2
|
||||
)
|
||||
}
|
||||
|
||||
cr.save()
|
||||
|
||||
cr.select_font_face('Sans',
|
||||
cairo.FONT_SLANT_NORMAL,
|
||||
cairo.FONT_WEIGHT_BOLD)
|
||||
|
||||
cr.set_font_size(14)
|
||||
|
||||
for text in legends:
|
||||
extents = cr.text_extents(text)
|
||||
fx, fy = legends[text]
|
||||
|
||||
cr.move_to(fx(extents), fy(extents))
|
||||
cr.show_text(text)
|
||||
cr.stroke()
|
||||
|
||||
cr.restore()
|
||||
|
||||
|
@ -305,6 +263,7 @@ class Hodograph():
|
|||
|
||||
cr.move_to(offset + x - extents.width / 4, y + 3.5*width)
|
||||
cr.show_text(text)
|
||||
cr.stroke()
|
||||
|
||||
offset += interval
|
||||
|
||||
|
@ -320,7 +279,6 @@ 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()
|
||||
|
|
Loading…
Add table
Reference in a new issue